2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
2005-06-27 08:16:51 +00:00
|
|
|
*
|
2000-12-28 22:12:02 +00:00
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
2005-03-07 18:27:42 +00:00
|
|
|
* 2004 Wim Taymans <wim@fluendo.com>
|
2000-12-28 22:12:02 +00:00
|
|
|
*
|
|
|
|
* gstbin.c: GstBin container object and support code
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2005-10-15 16:01:57 +00:00
|
|
|
|
2005-08-23 11:53:58 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstbin
|
2005-11-02 15:34:23 +00:00
|
|
|
* @short_description: Base class and element that can contain other elements
|
2005-08-23 11:53:58 +00:00
|
|
|
*
|
2005-11-24 09:44:07 +00:00
|
|
|
* #GstBin is an element that can contain other #GstElement, allowing them to be
|
2005-11-01 19:16:58 +00:00
|
|
|
* managed as a group.
|
2005-11-24 09:44:07 +00:00
|
|
|
* Pads from the child elements can be ghosted to the bin, see #GstGhostPad.
|
2005-11-01 19:16:58 +00:00
|
|
|
* This makes the bin look like any other elements and enables creation of
|
|
|
|
* higher-level abstraction elements.
|
2005-08-23 11:53:58 +00:00
|
|
|
*
|
2005-11-24 09:44:07 +00:00
|
|
|
* A new #GstBin is created with gst_bin_new(). Use a #GstPipeline instead if you
|
2005-09-24 14:14:03 +00:00
|
|
|
* want to create a toplevel bin because a normal bin doesn't have a bus or
|
|
|
|
* handle clock distribution of its own.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-08-23 11:53:58 +00:00
|
|
|
* After the bin has been created you will typically add elements to it with
|
|
|
|
* gst_bin_add(). You can remove elements with gst_bin_remove().
|
|
|
|
*
|
|
|
|
* An element can be retrieved from a bin with gst_bin_get_by_name(), using the
|
|
|
|
* elements name. gst_bin_get_by_name_recurse_up() is mainly used for internal
|
|
|
|
* purposes and will query the parent bins when the element is not found in the
|
|
|
|
* current bin.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
|
|
|
* An iterator of elements in a bin can be retrieved with
|
2005-09-24 14:14:03 +00:00
|
|
|
* gst_bin_iterate_elements(). Various other iterators exist to retrieve the
|
|
|
|
* elements in a bin.
|
2005-10-15 15:30:24 +00:00
|
|
|
*
|
2005-11-02 15:34:23 +00:00
|
|
|
* gst_object_unref() is used to drop your reference to the bin.
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
*
|
2005-11-02 15:34:23 +00:00
|
|
|
* The <link linkend="GstBin-element-added">element-added</link> signal is
|
|
|
|
* fired whenever a new element is added to the bin. Likewise the <link
|
|
|
|
* linkend="GstBin-element-removed">element-removed</link> signal is fired
|
|
|
|
* whenever an element is removed from the bin.
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
*
|
2005-11-02 15:34:23 +00:00
|
|
|
* <refsect2><title>Notes</title>
|
|
|
|
* <para>
|
2005-11-24 09:44:07 +00:00
|
|
|
* A #GstBin internally intercepts every #GstMessage posted by its children and
|
2005-11-02 15:34:23 +00:00
|
|
|
* implements the following default behaviour for each of them:
|
|
|
|
* <variablelist>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>GST_MESSAGE_EOS</term>
|
|
|
|
* <listitem><para>This message is only posted by sinks in the PLAYING
|
|
|
|
* state. If all sinks posted the EOS message, this bin will post and EOS
|
|
|
|
* message upwards.</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>GST_MESSAGE_SEGMENT_START</term>
|
|
|
|
* <listitem><para>just collected and never forwarded upwards.
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
* The messages are used to decide when all elements have completed playback
|
2005-11-02 15:34:23 +00:00
|
|
|
* of their segment.</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>GST_MESSAGE_SEGMENT_DONE</term>
|
2005-11-24 09:44:07 +00:00
|
|
|
* <listitem><para> Is posted by #GstBin when all elements that posted
|
2005-11-02 15:34:23 +00:00
|
|
|
* a SEGMENT_START have posted a SEGMENT_DONE.</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
* <term>GST_MESSAGE_DURATION</term>
|
|
|
|
* <listitem><para> Is posted by an element that detected a change
|
|
|
|
* in the stream duration. The default bin behaviour is to clear any
|
|
|
|
* cached duration values so that the next duration query will perform
|
|
|
|
* a full duration recalculation. The duration change is posted to the
|
|
|
|
* application so that it can refetch the new duration with a duration
|
|
|
|
* query.
|
|
|
|
* </para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>GST_MESSAGE_CLOCK_LOST</term>
|
|
|
|
* <listitem><para> This message is posted by an element when it
|
|
|
|
* can no longer provide a clock. The default bin behaviour is to
|
|
|
|
* check if the lost clock was the one provided by the bin. If so and
|
|
|
|
* the bin is currently in the PLAYING state, the message is forwarded to
|
|
|
|
* the bin parent.
|
|
|
|
* This message is also generated when a clock provider is removed from
|
|
|
|
* the bin. If this message is received by the application, it should
|
|
|
|
* PAUSE the pipeline and set it back to PLAYING to force a new clock
|
|
|
|
* distribution.
|
|
|
|
* </para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>GST_MESSAGE_CLOCK_PROVIDE</term>
|
|
|
|
* <listitem><para> This message is generated when an element
|
2007-04-23 07:30:38 +00:00
|
|
|
* can provide a clock. This mostly happens when a new clock
|
|
|
|
* provider is added to the bin. The default behaviour of the bin is to
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
* mark the currently selected clock as dirty, which will perform a clock
|
|
|
|
* recalculation the next time the bin is asked to provide a clock.
|
|
|
|
* This message is never sent tot the application but is forwarded to
|
|
|
|
* the parent of the bin.
|
|
|
|
* </para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
2005-11-02 15:34:23 +00:00
|
|
|
* <term>OTHERS</term>
|
|
|
|
* <listitem><para> posted upwards.</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* </variablelist>
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
*
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
*
|
2005-11-24 09:44:07 +00:00
|
|
|
* A #GstBin implements the following default behaviour for answering to a
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
* #GstQuery:
|
2005-11-02 15:34:23 +00:00
|
|
|
* <variablelist>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term>GST_QUERY_DURATION</term>
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
* <listitem><para>If the query has been asked before with the same format
|
|
|
|
* and the bin is a toplevel bin (ie. has no parent),
|
2005-11-02 15:34:23 +00:00
|
|
|
* use the cached previous value. If no previous value was cached, the
|
|
|
|
* query is sent to all sink elements in the bin and the MAXIMUM of all
|
2007-04-23 07:30:38 +00:00
|
|
|
* values is returned. If the bin is a toplevel bin the value is cached.
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
* If no sinks are available in the bin, the query fails.
|
|
|
|
* </para></listitem>
|
2005-11-02 15:34:23 +00:00
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
2006-12-07 10:02:19 +00:00
|
|
|
* <term>GST_QUERY_POSITION</term>
|
|
|
|
* <listitem><para>The query is sent to all sink elements in the bin and the
|
|
|
|
* MAXIMUM of all values is returned. If no sinks are available in the bin,
|
|
|
|
* the query fails.
|
|
|
|
* </para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
2005-11-02 15:34:23 +00:00
|
|
|
* <term>OTHERS</term>
|
|
|
|
* <listitem><para>the query is forwarded to all sink elements, the result
|
|
|
|
* of the first sink that answers the query successfully is returned. If no
|
|
|
|
* sink is in the bin, the query fails.</para></listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* </variablelist>
|
2005-12-16 18:20:58 +00:00
|
|
|
*
|
|
|
|
* A #GstBin will by default forward any event sent to it to all sink elements.
|
2006-04-28 13:04:07 +00:00
|
|
|
* If all the sinks return TRUE, the bin will also return TRUE, else FALSE is
|
|
|
|
* returned. If no sinks are in the bin, the event handler will return TRUE.
|
2005-12-16 18:20:58 +00:00
|
|
|
*
|
2005-11-02 15:34:23 +00:00
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
2005-10-28 17:35:43 +00:00
|
|
|
*
|
2006-04-28 13:04:07 +00:00
|
|
|
* Last reviewed on 2006-04-28 (0.10.6)
|
2005-08-23 11:53:58 +00:00
|
|
|
*/
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-12-28 22:12:02 +00:00
|
|
|
#include "gst_private.h"
|
2000-12-08 18:24:16 +00:00
|
|
|
|
2001-12-18 19:03:07 +00:00
|
|
|
#include "gstevent.h"
|
2000-12-15 01:57:34 +00:00
|
|
|
#include "gstbin.h"
|
2004-02-03 03:31:26 +00:00
|
|
|
#include "gstmarshal.h"
|
2002-02-03 20:07:09 +00:00
|
|
|
#include "gstxml.h"
|
2003-06-29 14:05:49 +00:00
|
|
|
#include "gstinfo.h"
|
2004-02-24 12:41:19 +00:00
|
|
|
#include "gsterror.h"
|
2000-08-21 21:20:38 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
#include "gstindex.h"
|
more docs inlined, splitted gstindex.{c,h}
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/.cvsignore:
* gst/Makefile.am:
* gst/gst.h:
* gst/gstbin.c:
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_class_init):
* gst/gstindex.h:
* gst/gstindexfactory.c: (gst_index_factory_get_type),
(gst_index_factory_class_init), (gst_index_factory_init),
(gst_index_factory_finalize), (gst_index_factory_new),
(gst_index_factory_destroy), (gst_index_factory_find),
(gst_index_factory_create), (gst_index_factory_make):
* gst/gstindexfactory.h:
* gst/gstpluginfeature.c:
* gst/gstpluginfeature.h:
* libs/gst/controller/gstcontroller.c: (gst_controller_new_valist):
more docs inlined, splitted gstindex.{c,h}
2005-09-20 20:40:00 +00:00
|
|
|
#include "gstindexfactory.h"
|
2004-07-12 21:27:11 +00:00
|
|
|
#include "gstutils.h"
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
#include "gstchildproxy.h"
|
2000-12-26 23:51:04 +00:00
|
|
|
|
2007-04-23 07:30:38 +00:00
|
|
|
/* enable for DURATION caching.
|
2006-06-14 10:34:14 +00:00
|
|
|
* FIXME currently too many elements don't update
|
2007-02-20 10:45:13 +00:00
|
|
|
* their duration when it changes so we return inaccurate values. */
|
|
|
|
#undef DURATION_CACHING
|
2006-06-14 10:34:14 +00:00
|
|
|
|
2007-05-24 08:35:04 +00:00
|
|
|
/* latency is by default enabled now.
|
2007-03-21 11:52:04 +00:00
|
|
|
* live-preroll and no-live-preroll in the environment var GST_COMPAT
|
|
|
|
* to enables or disable it respectively.
|
|
|
|
*/
|
|
|
|
static gboolean enable_latency = TRUE;
|
|
|
|
|
2004-08-03 09:51:37 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (bin_debug);
|
|
|
|
#define GST_CAT_DEFAULT bin_debug
|
|
|
|
|
2006-04-28 18:55:17 +00:00
|
|
|
static const GstElementDetails gst_bin_details =
|
|
|
|
GST_ELEMENT_DETAILS ("Generic bin",
|
2004-03-13 15:27:01 +00:00
|
|
|
"Generic/Bin",
|
|
|
|
"Simple container object",
|
2005-03-07 18:27:42 +00:00
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>," "Wim Taymans <wim@fluendo.com>");
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2007-08-02 11:15:46 +00:00
|
|
|
/* a bin is toplevel if it has no parent or when it is configured to behave like
|
|
|
|
* a toplevel bin */
|
|
|
|
#define BIN_IS_TOPLEVEL(bin) ((GST_OBJECT_PARENT (bin) == NULL) || bin->priv->asynchandling)
|
|
|
|
|
2007-05-22 11:09:45 +00:00
|
|
|
struct _GstBinPrivate
|
|
|
|
{
|
|
|
|
gboolean asynchandling;
|
|
|
|
};
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstBin *bin;
|
|
|
|
guint32 cookie;
|
|
|
|
GstState pending;
|
|
|
|
} BinContinueData;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_bin_dispose (GObject * object);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2007-05-22 11:09:45 +00:00
|
|
|
static void gst_bin_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_bin_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2005-10-10 11:52:58 +00:00
|
|
|
static GstStateChangeReturn gst_bin_change_state_func (GstElement * element,
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChange transition);
|
2005-10-10 11:52:58 +00:00
|
|
|
static GstStateChangeReturn gst_bin_get_state_func (GstElement * element,
|
Use GstClockTime in _get_state() instead of GTimeVal.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstelement.c: (GST_START_TEST):
* check/gst/gstevent.c: (GST_START_TEST), (test_event):
* check/gst/gstghostpad.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST):
* check/pipelines/simple_launch_lines.c: (run_pipeline):
* check/states/sinks.c: (GST_START_TEST):
* gst/elements/gsttypefindelement.c: (stop_typefinding):
* gst/gstbin.c: (gst_bin_provide_clock_func), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_get_state), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_set_state),
(gst_element_change_state), (gst_element_change_state_func):
* gst/gstelement.h:
* gst/gstpipeline.c: (gst_pipeline_class_init), (do_pipeline_seek),
(gst_pipeline_provide_clock_func):
* gst/gstutils.c: (gst_element_link_pads_filtered):
* tools/gst-launch.c: (main):
* tools/gst-typefind.c: (main):
Use GstClockTime in _get_state() instead of GTimeVal.
Remove old code in gstutils.c
2005-10-12 12:18:48 +00:00
|
|
|
GstState * state, GstState * pending, GstClockTime timeout);
|
2007-06-19 10:41:33 +00:00
|
|
|
static void bin_handle_async_done (GstBin * bin, GstStateChangeReturn ret);
|
2007-08-14 14:10:36 +00:00
|
|
|
static void bin_handle_async_start (GstBin * bin, gboolean new_base_time);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
static void bin_push_state_continue (BinContinueData * data);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
static gboolean gst_bin_add_func (GstBin * bin, GstElement * element);
|
|
|
|
static gboolean gst_bin_remove_func (GstBin * bin, GstElement * element);
|
|
|
|
|
2003-02-10 20:32:32 +00:00
|
|
|
#ifndef GST_DISABLE_INDEX
|
2005-03-09 16:10:59 +00:00
|
|
|
static void gst_bin_set_index_func (GstElement * element, GstIndex * index);
|
2003-02-10 20:32:32 +00:00
|
|
|
#endif
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
static GstClock *gst_bin_provide_clock_func (GstElement * element);
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
static gboolean gst_bin_set_clock_func (GstElement * element, GstClock * clock);
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2005-11-19 18:28:40 +00:00
|
|
|
static void gst_bin_handle_message_func (GstBin * bin, GstMessage * message);
|
2005-03-28 14:54:33 +00:00
|
|
|
static gboolean gst_bin_send_event (GstElement * element, GstEvent * event);
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
static GstBusSyncReply bin_bus_handler (GstBus * bus,
|
|
|
|
GstMessage * message, GstBin * bin);
|
2005-05-12 15:09:17 +00:00
|
|
|
static gboolean gst_bin_query (GstElement * element, GstQuery * query);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-06-25 06:45:56 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2004-03-13 15:27:01 +00:00
|
|
|
static xmlNodePtr gst_bin_save_thyself (GstObject * object, xmlNodePtr parent);
|
|
|
|
static void gst_bin_restore_thyself (GstObject * object, xmlNodePtr self);
|
2001-06-24 21:18:28 +00:00
|
|
|
#endif
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
static void bin_remove_messages (GstBin * bin, GstObject * src,
|
|
|
|
GstMessageType types);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
static void gst_bin_continue_func (BinContinueData * data);
|
2005-05-12 19:45:44 +00:00
|
|
|
static gint bin_element_is_sink (GstElement * child, GstBin * bin);
|
2006-01-26 06:57:14 +00:00
|
|
|
static gint bin_element_is_src (GstElement * child, GstBin * bin);
|
2005-05-12 19:45:44 +00:00
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
static GstIterator *gst_bin_sort_iterator_new (GstBin * bin);
|
|
|
|
|
2005-10-08 09:24:25 +00:00
|
|
|
/* Bin signals and properties */
|
2001-12-15 22:37:35 +00:00
|
|
|
enum
|
|
|
|
{
|
2002-12-19 21:31:03 +00:00
|
|
|
ELEMENT_ADDED,
|
|
|
|
ELEMENT_REMOVED,
|
2000-01-30 09:03:00 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2001-12-15 22:37:35 +00:00
|
|
|
enum
|
|
|
|
{
|
2007-05-22 11:09:45 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_ASYNC_HANDLING
|
2004-03-13 15:27:01 +00:00
|
|
|
/* FILL ME */
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_bin_base_init (gpointer g_class);
|
|
|
|
static void gst_bin_class_init (GstBinClass * klass);
|
|
|
|
static void gst_bin_init (GstBin * bin);
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
static void gst_bin_child_proxy_init (gpointer g_iface, gpointer iface_data);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
static guint gst_bin_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2004-03-26 03:46:16 +00:00
|
|
|
/**
|
|
|
|
* gst_bin_get_type:
|
|
|
|
*
|
|
|
|
* Returns: the type of #GstBin
|
|
|
|
*/
|
2001-06-25 01:20:11 +00:00
|
|
|
GType
|
2001-01-20 03:10:44 +00:00
|
|
|
gst_bin_get_type (void)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2005-10-15 16:33:09 +00:00
|
|
|
static GType gst_bin_type = 0;
|
2007-03-21 11:52:04 +00:00
|
|
|
const gchar *compat;
|
2005-10-15 16:33:09 +00:00
|
|
|
|
2006-02-28 10:52:02 +00:00
|
|
|
if (G_UNLIKELY (gst_bin_type == 0)) {
|
2001-06-25 01:20:11 +00:00
|
|
|
static const GTypeInfo bin_info = {
|
2001-12-15 22:37:35 +00:00
|
|
|
sizeof (GstBinClass),
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_bin_base_init,
|
2001-06-25 01:20:11 +00:00
|
|
|
NULL,
|
2001-12-15 22:37:35 +00:00
|
|
|
(GClassInitFunc) gst_bin_class_init,
|
2001-06-25 01:20:11 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2001-12-15 22:37:35 +00:00
|
|
|
sizeof (GstBin),
|
2004-04-09 19:05:03 +00:00
|
|
|
0,
|
2001-12-15 22:37:35 +00:00
|
|
|
(GInstanceInitFunc) gst_bin_init,
|
2001-09-14 22:16:47 +00:00
|
|
|
NULL
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
static const GInterfaceInfo child_proxy_info = {
|
|
|
|
gst_bin_child_proxy_init,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
2001-12-15 22:37:35 +00:00
|
|
|
|
2005-10-15 16:33:09 +00:00
|
|
|
gst_bin_type =
|
2004-03-15 19:27:17 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstBin", &bin_info, 0);
|
2004-08-03 09:51:37 +00:00
|
|
|
|
2005-10-15 16:33:09 +00:00
|
|
|
g_type_add_interface_static (gst_bin_type, GST_TYPE_CHILD_PROXY,
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
&child_proxy_info);
|
|
|
|
|
2004-08-03 09:51:37 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (bin_debug, "bin", GST_DEBUG_BOLD,
|
|
|
|
"debugging info for the 'bin' container element");
|
2007-03-21 11:52:04 +00:00
|
|
|
|
|
|
|
/* compatibility stuff */
|
|
|
|
compat = g_getenv ("GST_COMPAT");
|
|
|
|
if (compat != NULL) {
|
|
|
|
if (strstr (compat, "no-live-preroll"))
|
|
|
|
enable_latency = FALSE;
|
|
|
|
else if (strstr (compat, "live-preroll"))
|
|
|
|
enable_latency = TRUE;
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2005-10-15 16:33:09 +00:00
|
|
|
return gst_bin_type;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
static void
|
|
|
|
gst_bin_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_element_class_set_details (gstelement_class, &gst_bin_details);
|
|
|
|
}
|
|
|
|
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
static GstObject *
|
|
|
|
gst_bin_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
|
|
|
|
guint index)
|
|
|
|
{
|
2005-10-08 09:24:25 +00:00
|
|
|
GstObject *res;
|
|
|
|
GstBin *bin;
|
|
|
|
|
|
|
|
bin = GST_BIN_CAST (child_proxy);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-10-08 09:24:25 +00:00
|
|
|
if ((res = g_list_nth_data (bin->children, index)))
|
|
|
|
gst_object_ref (res);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-10-08 09:24:25 +00:00
|
|
|
|
|
|
|
return res;
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
guint
|
|
|
|
gst_bin_child_proxy_get_children_count (GstChildProxy * child_proxy)
|
|
|
|
{
|
2005-10-08 09:24:25 +00:00
|
|
|
guint num;
|
|
|
|
GstBin *bin;
|
|
|
|
|
|
|
|
bin = GST_BIN_CAST (child_proxy);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-10-08 09:24:25 +00:00
|
|
|
num = bin->numchildren;
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-10-08 09:24:25 +00:00
|
|
|
|
|
|
|
return num;
|
ported gstchildproxy over from 0.8 ported gst-inspect fixes and enhancements over from 0.8
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gstbin.c: (gst_bin_get_type),
(gst_bin_child_proxy_get_child_by_index),
(gst_bin_child_proxy_get_children_count),
(gst_bin_child_proxy_init):
* gst/gstchildproxy.c: (gst_child_proxy_get_child_by_name),
(gst_child_proxy_get_child_by_index),
(gst_child_proxy_get_children_count), (gst_child_proxy_lookup),
(gst_child_proxy_get_property), (gst_child_proxy_get_valist),
(gst_child_proxy_get), (gst_child_proxy_set_property),
(gst_child_proxy_set_valist), (gst_child_proxy_set),
(gst_child_proxy_child_added), (gst_child_proxy_child_removed),
(gst_child_proxy_base_init), (gst_child_proxy_get_type):
* gst/gstchildproxy.h:
* gst/parse/grammar.y:
* tools/gst-inspect.c: (print_interfaces),
(print_element_properties_info), (print_element_info):
ported gstchildproxy over from 0.8
ported gst-inspect fixes and enhancements over from 0.8
2005-08-22 21:03:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_bin_child_proxy_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstChildProxyInterface *iface = g_iface;
|
|
|
|
|
|
|
|
iface->get_children_count = gst_bin_child_proxy_get_children_count;
|
|
|
|
iface->get_child_by_index = gst_bin_child_proxy_get_child_by_index;
|
|
|
|
}
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
static void
|
2001-12-15 22:37:35 +00:00
|
|
|
gst_bin_class_init (GstBinClass * klass)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2001-06-25 01:20:11 +00:00
|
|
|
GObjectClass *gobject_class;
|
2001-01-29 00:06:02 +00:00
|
|
|
GstObjectClass *gstobject_class;
|
2000-01-30 09:03:00 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2005-10-18 15:15:11 +00:00
|
|
|
GError *err;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2001-12-15 22:37:35 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstobject_class = (GstObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-09-23 17:17:42 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2007-05-22 11:09:45 +00:00
|
|
|
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_bin_set_property);
|
|
|
|
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_bin_get_property);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstBin:async-handling
|
|
|
|
*
|
|
|
|
* If set to #TRUE, the bin will handle asynchronous state changes.
|
|
|
|
* This should be used only if the bin subclass is modifying the state
|
2007-09-13 21:27:33 +00:00
|
|
|
* of its children on its own.
|
2007-05-22 11:09:45 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.13
|
2007-05-24 08:35:04 +00:00
|
|
|
*/
|
2007-05-22 11:09:45 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_ASYNC_HANDLING,
|
|
|
|
g_param_spec_boolean ("async-handling", "Async Handling",
|
|
|
|
"The bin will handle Asynchronous state changes",
|
|
|
|
FALSE, G_PARAM_READWRITE));
|
|
|
|
|
2005-08-23 11:53:58 +00:00
|
|
|
/**
|
|
|
|
* GstBin::element-added:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: the #GstBin
|
|
|
|
* @element: the #GstElement that was added to the bin
|
2005-08-23 11:53:58 +00:00
|
|
|
*
|
2005-11-01 19:16:58 +00:00
|
|
|
* Will be emitted after the element was added to the bin.
|
2005-08-23 11:53:58 +00:00
|
|
|
*/
|
2002-12-19 21:31:03 +00:00
|
|
|
gst_bin_signals[ELEMENT_ADDED] =
|
2004-03-13 15:27:01 +00:00
|
|
|
g_signal_new ("element-added", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GstBinClass, element_added), NULL,
|
|
|
|
NULL, gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT);
|
2005-08-23 11:53:58 +00:00
|
|
|
/**
|
|
|
|
* GstBin::element-removed:
|
2005-11-01 19:16:58 +00:00
|
|
|
* @bin: the #GstBin
|
2005-10-28 17:35:43 +00:00
|
|
|
* @element: the #GstElement that was removed from the bin
|
2005-08-23 11:53:58 +00:00
|
|
|
*
|
2005-11-01 19:16:58 +00:00
|
|
|
* Will be emitted after the element was removed from the bin.
|
2005-08-23 11:53:58 +00:00
|
|
|
*/
|
2002-12-19 21:31:03 +00:00
|
|
|
gst_bin_signals[ELEMENT_REMOVED] =
|
2004-03-13 15:27:01 +00:00
|
|
|
g_signal_new ("element-removed", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GstBinClass, element_removed), NULL,
|
|
|
|
NULL, gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT);
|
2001-12-18 19:03:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_bin_dispose);
|
2002-01-18 22:44:19 +00:00
|
|
|
|
2001-06-25 06:45:56 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2004-03-13 15:27:01 +00:00
|
|
|
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_bin_save_thyself);
|
|
|
|
gstobject_class->restore_thyself =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_bin_restore_thyself);
|
2001-06-24 21:18:28 +00:00
|
|
|
#endif
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2005-10-10 11:52:58 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_bin_change_state_func);
|
|
|
|
gstelement_class->get_state = GST_DEBUG_FUNCPTR (gst_bin_get_state_func);
|
2003-02-10 20:32:32 +00:00
|
|
|
#ifndef GST_DISABLE_INDEX
|
2005-03-09 16:10:59 +00:00
|
|
|
gstelement_class->set_index = GST_DEBUG_FUNCPTR (gst_bin_set_index_func);
|
2003-02-10 20:32:32 +00:00
|
|
|
#endif
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
gstelement_class->provide_clock =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_bin_provide_clock_func);
|
2005-03-09 16:10:59 +00:00
|
|
|
gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_bin_set_clock_func);
|
2001-10-17 10:21:27 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_bin_send_event);
|
2005-05-12 15:09:17 +00:00
|
|
|
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_bin_query);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
klass->add_element = GST_DEBUG_FUNCPTR (gst_bin_add_func);
|
|
|
|
klass->remove_element = GST_DEBUG_FUNCPTR (gst_bin_remove_func);
|
2005-11-19 18:28:40 +00:00
|
|
|
klass->handle_message = GST_DEBUG_FUNCPTR (gst_bin_handle_message_func);
|
2005-10-18 15:15:11 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("creating bin thread pool");
|
|
|
|
err = NULL;
|
|
|
|
klass->pool =
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
g_thread_pool_new ((GFunc) gst_bin_continue_func, NULL, -1, FALSE, &err);
|
2005-10-18 15:15:11 +00:00
|
|
|
if (err != NULL) {
|
|
|
|
g_critical ("could alloc threadpool %s", err->message);
|
|
|
|
}
|
2003-10-14 00:00:37 +00:00
|
|
|
}
|
|
|
|
|
2001-01-20 03:10:44 +00:00
|
|
|
static void
|
2001-12-15 22:37:35 +00:00
|
|
|
gst_bin_init (GstBin * bin)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
GstBus *bus;
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
bin->numchildren = 0;
|
|
|
|
bin->children = NULL;
|
2005-03-07 18:27:42 +00:00
|
|
|
bin->children_cookie = 0;
|
2005-10-11 15:05:55 +00:00
|
|
|
bin->messages = NULL;
|
2005-10-11 12:58:44 +00:00
|
|
|
bin->provided_clock = NULL;
|
|
|
|
bin->clock_dirty = FALSE;
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
|
check/gst/gstbin.c: Add bus to bin.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Add bus to bin.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
A bin does not have a bus, it gets the bus from the parent.
* gst/gstelement.c: (gst_element_requires_clock),
(gst_element_provides_clock), (gst_element_is_indexable),
(gst_element_is_locked_state), (gst_element_change_state),
(gst_element_set_bus_func):
Small cleanups.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_provide_clock_func):
The pipeline provides a bus.
2005-09-29 09:39:36 +00:00
|
|
|
/* Set up a bus for listening to child elements */
|
2006-01-20 19:01:59 +00:00
|
|
|
bus = gst_bus_new ();
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
bin->child_bus = bus;
|
2006-01-20 19:01:59 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "using bus %" GST_PTR_FORMAT " to listen to children",
|
|
|
|
bus);
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bin_bus_handler, bin);
|
2007-05-22 11:09:45 +00:00
|
|
|
|
2007-05-22 17:10:04 +00:00
|
|
|
bin->priv = g_new0 (GstBinPrivate, 1);
|
|
|
|
bin->priv->asynchandling = FALSE;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
static void
|
|
|
|
gst_bin_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstBin *bin = GST_BIN (object);
|
2006-03-21 14:14:49 +00:00
|
|
|
GstBus **child_bus_p = &bin->child_bus;
|
|
|
|
GstClock **provided_clock_p = &bin->provided_clock;
|
|
|
|
GstElement **clock_provider_p = &bin->clock_provider;
|
2005-11-17 14:51:11 +00:00
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
|
|
|
|
|
|
|
|
bin_remove_messages (bin, NULL, GST_MESSAGE_ANY);
|
2006-01-18 18:56:44 +00:00
|
|
|
|
2006-03-21 14:14:49 +00:00
|
|
|
gst_object_replace ((GstObject **) child_bus_p, NULL);
|
|
|
|
gst_object_replace ((GstObject **) provided_clock_p, NULL);
|
|
|
|
gst_object_replace ((GstObject **) clock_provider_p, NULL);
|
2005-11-17 14:51:11 +00:00
|
|
|
|
|
|
|
while (bin->children) {
|
|
|
|
gst_bin_remove (bin, GST_ELEMENT_CAST (bin->children->data));
|
|
|
|
}
|
|
|
|
if (G_UNLIKELY (bin->children != NULL)) {
|
|
|
|
g_critical ("could not remove elements from bin %s",
|
|
|
|
GST_STR_NULL (GST_OBJECT_NAME (object)));
|
|
|
|
}
|
|
|
|
|
2007-05-22 17:10:04 +00:00
|
|
|
if (bin->priv) {
|
|
|
|
g_free (bin->priv);
|
|
|
|
bin->priv = NULL;
|
2007-05-22 11:09:45 +00:00
|
|
|
}
|
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/**
|
|
|
|
* gst_bin_new:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @name: the name of the new bin
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Creates a new bin with the given name.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns: a new #GstBin
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2001-12-15 22:37:35 +00:00
|
|
|
GstElement *
|
|
|
|
gst_bin_new (const gchar * name)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2002-04-11 20:35:18 +00:00
|
|
|
return gst_element_factory_make ("bin", name);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 11:09:45 +00:00
|
|
|
static void
|
|
|
|
gst_bin_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstBin *gstbin;
|
|
|
|
|
|
|
|
gstbin = GST_BIN (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_ASYNC_HANDLING:
|
|
|
|
GST_OBJECT_LOCK (gstbin);
|
2007-05-22 17:10:04 +00:00
|
|
|
gstbin->priv->asynchandling = g_value_get_boolean (value);
|
2007-05-22 11:09:45 +00:00
|
|
|
GST_OBJECT_UNLOCK (gstbin);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_bin_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstBin *gstbin;
|
|
|
|
|
|
|
|
gstbin = GST_BIN (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_ASYNC_HANDLING:
|
|
|
|
GST_OBJECT_LOCK (gstbin);
|
2007-05-22 17:10:04 +00:00
|
|
|
g_value_set_boolean (value, gstbin->priv->asynchandling);
|
2007-05-22 11:09:45 +00:00
|
|
|
GST_OBJECT_UNLOCK (gstbin);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
/* set the index on all elements in this bin
|
|
|
|
*
|
2005-06-27 08:16:51 +00:00
|
|
|
* MT safe
|
2005-03-09 16:10:59 +00:00
|
|
|
*/
|
|
|
|
#ifndef GST_DISABLE_INDEX
|
|
|
|
static void
|
|
|
|
gst_bin_set_index_func (GstElement * element, GstIndex * index)
|
2003-02-10 20:32:32 +00:00
|
|
|
{
|
2005-03-09 16:10:59 +00:00
|
|
|
GstBin *bin;
|
|
|
|
GList *children;
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
bin = GST_BIN (element);
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-03-09 16:10:59 +00:00
|
|
|
for (children = bin->children; children; children = g_list_next (children)) {
|
|
|
|
GstElement *child = GST_ELEMENT (children->data);
|
|
|
|
|
|
|
|
gst_element_set_index (child, index);
|
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2003-02-10 20:32:32 +00:00
|
|
|
}
|
2005-03-09 16:10:59 +00:00
|
|
|
#endif
|
2003-02-10 20:32:32 +00:00
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
/* set the clock on all elements in this bin
|
2002-03-31 14:04:50 +00:00
|
|
|
*
|
2005-06-27 08:16:51 +00:00
|
|
|
* MT safe
|
2002-03-31 14:04:50 +00:00
|
|
|
*/
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
static gboolean
|
2005-03-09 16:10:59 +00:00
|
|
|
gst_bin_set_clock_func (GstElement * element, GstClock * clock)
|
2002-02-03 20:07:09 +00:00
|
|
|
{
|
2005-03-09 16:10:59 +00:00
|
|
|
GList *children;
|
|
|
|
GstBin *bin;
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
gboolean res = TRUE;
|
2002-02-03 20:07:09 +00:00
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
bin = GST_BIN (element);
|
2002-02-03 20:07:09 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
if (element->clock != clock) {
|
|
|
|
for (children = bin->children; children; children = g_list_next (children)) {
|
|
|
|
GstElement *child = GST_ELEMENT (children->data);
|
2002-02-03 20:07:09 +00:00
|
|
|
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
res &= gst_element_set_clock (child, clock);
|
docs/design/part-states.txt: Some more docs.
Original commit message from CVS:
* docs/design/part-states.txt:
Some more docs.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_recalc_state),
(gst_bin_change_state_func), (bin_bus_handler):
Doc updates. Don't distribute the same clock over and over again.
* gst/gstclock.c:
* gst/gstclock.h:
Doc updates.
* gst/gstpad.c: (gst_flow_get_name), (gst_flow_to_quark),
(gst_pad_get_type), (gst_pad_push), (gst_pad_push_event),
(gst_pad_send_event):
* gst/gstpad.h:
Make probe emission threadsafe again.
Register quarks and move _get_name() from utils.
Doc updates.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
Only redistribute the clock of it changed.
* gst/gstsystemclock.h:
Doc updates.
* gst/gstutils.c:
* gst/gstutils.h:
Moved the _flow_get_name() to GstPad.
2005-10-11 11:08:52 +00:00
|
|
|
}
|
2005-03-09 16:10:59 +00:00
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
gst/base/gstbasesink.*: No need to store the clock, the parent element class already has it.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_class_init),
(gst_base_sink_wait), (gst_base_sink_do_sync),
(gst_base_sink_handle_event):
* gst/base/gstbasesink.h:
No need to store the clock, the parent element class already
has it.
* gst/gstbin.c: (gst_bin_set_clock_func), (gst_bin_add_func):
Updates for clock_set returning a gboolean
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_class_init),
(gst_clock_init), (gst_clock_finalize),
(gst_clock_get_internal_time), (gst_clock_get_time),
(gst_clock_slave_callback), (gst_clock_set_master),
(gst_clock_get_master), (do_linear_regression),
(gst_clock_add_observation), (gst_clock_set_property),
(gst_clock_get_property):
* gst/gstclock.h:
Implement master/slave. When setting a clock as a slave, a
periodic timeout is scheduled to sample master and slave times.
Then the slave clock is recalibrated to match offset and rate
of the master clock.
Update logging a bit.
Add flag so that a clock can state that is cannot be slaved to
another clock.
* gst/gstelement.c: (gst_element_set_clock):
* gst/gstelement.h:
The set_clock returns a gboolean for when an element cannot
deal with the selected clock in the pipeline.
* gst/gstpipeline.c: (gst_pipeline_change_state),
(gst_pipeline_set_clock):
* gst/gstpipeline.h:
Handle the case where the selected clock cannot be set on
the pipeline.
* gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init),
(gst_net_client_clock_init), (gst_net_client_clock_finalize),
(gst_net_client_clock_set_property),
(gst_net_client_clock_get_property),
(gst_net_client_clock_observe_times):
* gst/net/gstnetclientclock.h:
Use regression code in GstClock parent, remove duplicated
functionality.
2005-11-22 18:28:44 +00:00
|
|
|
|
|
|
|
return res;
|
2002-02-03 20:07:09 +00:00
|
|
|
}
|
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
/* get the clock for this bin by asking all of the children in this bin
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
*
|
|
|
|
* The ref of the returned clock in increased so unref after usage.
|
2002-03-31 14:04:50 +00:00
|
|
|
*
|
2007-04-23 07:30:38 +00:00
|
|
|
* We loop the elements in state order and pick the last clock we can
|
2005-11-17 14:51:11 +00:00
|
|
|
* get. This makes sure we get a clock from the source.
|
|
|
|
*
|
2005-06-27 08:16:51 +00:00
|
|
|
* MT safe
|
2005-10-11 12:58:44 +00:00
|
|
|
*/
|
2005-03-09 16:10:59 +00:00
|
|
|
static GstClock *
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
gst_bin_provide_clock_func (GstElement * element)
|
2001-05-25 21:00:07 +00:00
|
|
|
{
|
2005-03-09 16:10:59 +00:00
|
|
|
GstClock *result = NULL;
|
2005-11-18 11:03:10 +00:00
|
|
|
GstElement *provider = NULL;
|
2005-03-07 18:27:42 +00:00
|
|
|
GstBin *bin;
|
2005-11-17 14:51:11 +00:00
|
|
|
GstIterator *it;
|
|
|
|
gpointer val;
|
2006-03-21 14:14:49 +00:00
|
|
|
GstClock **provided_clock_p;
|
|
|
|
GstElement **clock_provider_p;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
bin = GST_BIN (element);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-10-11 12:58:44 +00:00
|
|
|
if (!bin->clock_dirty)
|
|
|
|
goto not_dirty;
|
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "finding new clock");
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
it = gst_bin_sort_iterator_new (bin);
|
|
|
|
|
|
|
|
while (it->next (it, &val) == GST_ITERATOR_OK) {
|
|
|
|
GstElement *child = GST_ELEMENT_CAST (val);
|
|
|
|
GstClock *clock;
|
|
|
|
|
|
|
|
clock = gst_element_provide_clock (child);
|
2005-11-18 11:03:10 +00:00
|
|
|
if (clock) {
|
|
|
|
GST_DEBUG_OBJECT (bin, "found candidate clock %p by element %s",
|
|
|
|
clock, GST_ELEMENT_NAME (child));
|
|
|
|
if (result) {
|
2005-11-17 14:51:11 +00:00
|
|
|
gst_object_unref (result);
|
2005-11-18 11:03:10 +00:00
|
|
|
gst_object_unref (provider);
|
|
|
|
}
|
2005-11-17 14:51:11 +00:00
|
|
|
result = clock;
|
2005-11-18 11:03:10 +00:00
|
|
|
provider = child;
|
|
|
|
} else {
|
|
|
|
gst_object_unref (child);
|
2005-11-17 14:51:11 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
2006-03-21 14:14:49 +00:00
|
|
|
|
|
|
|
provided_clock_p = &bin->provided_clock;
|
|
|
|
clock_provider_p = &bin->clock_provider;
|
|
|
|
gst_object_replace ((GstObject **) provided_clock_p, (GstObject *) result);
|
|
|
|
gst_object_replace ((GstObject **) clock_provider_p, (GstObject *) provider);
|
2005-10-11 12:58:44 +00:00
|
|
|
bin->clock_dirty = FALSE;
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
GST_DEBUG_OBJECT (bin,
|
|
|
|
"provided new clock %" GST_PTR_FORMAT " by provider %" GST_PTR_FORMAT,
|
|
|
|
result, provider);
|
|
|
|
/* Provider is not being returned to caller, just the result */
|
|
|
|
if (provider)
|
|
|
|
gst_object_unref (provider);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-03-09 16:10:59 +00:00
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
gst_iterator_free (it);
|
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
return result;
|
2005-10-11 12:58:44 +00:00
|
|
|
|
|
|
|
not_dirty:
|
|
|
|
{
|
|
|
|
if ((result = bin->provided_clock))
|
|
|
|
gst_object_ref (result);
|
|
|
|
GST_DEBUG_OBJECT (bin, "returning old clock %p", result);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-10-11 12:58:44 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2002-12-19 21:31:03 +00:00
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
/*
|
|
|
|
* functions for manipulating cached messages
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstObject *src;
|
|
|
|
GstMessageType types;
|
|
|
|
} MessageFind;
|
|
|
|
|
|
|
|
/* check if a message is of given src and type */
|
|
|
|
static gint
|
|
|
|
message_check (GstMessage * message, MessageFind * target)
|
|
|
|
{
|
|
|
|
gboolean eq = TRUE;
|
|
|
|
|
|
|
|
if (target->src)
|
|
|
|
eq &= GST_MESSAGE_SRC (message) == target->src;
|
|
|
|
if (target->types)
|
|
|
|
eq &= (GST_MESSAGE_TYPE (message) & target->types) != 0;
|
|
|
|
|
|
|
|
return (eq ? 0 : 1);
|
|
|
|
}
|
|
|
|
|
2007-06-07 10:11:47 +00:00
|
|
|
static GList *
|
|
|
|
find_message (GstBin * bin, GstObject * src, GstMessageType types)
|
|
|
|
{
|
|
|
|
GList *result;
|
|
|
|
MessageFind find;
|
|
|
|
|
|
|
|
find.src = src;
|
|
|
|
find.types = types;
|
|
|
|
|
|
|
|
result = g_list_find_custom (bin->messages, &find,
|
|
|
|
(GCompareFunc) message_check);
|
|
|
|
|
2007-08-07 09:56:08 +00:00
|
|
|
if (result) {
|
|
|
|
GST_DEBUG_OBJECT (bin, "we found a message %p from %s mathing types %08x",
|
|
|
|
result->data, GST_OBJECT_NAME (GST_MESSAGE_CAST (result->data)->src),
|
|
|
|
types);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (bin, "no message found matching types %08x", types);
|
|
|
|
}
|
|
|
|
|
2007-06-07 10:11:47 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
/* with LOCK, returns TRUE if message had a valid SRC, takes ref on
|
2007-04-23 07:30:38 +00:00
|
|
|
* the message.
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
*
|
|
|
|
* A message that is cached and has the same SRC and type is replaced
|
|
|
|
* by the given message.
|
|
|
|
*/
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
static gboolean
|
|
|
|
bin_replace_message (GstBin * bin, GstMessage * message, GstMessageType types)
|
|
|
|
{
|
|
|
|
GList *previous;
|
|
|
|
GstObject *src;
|
|
|
|
gboolean res = TRUE;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
const gchar *name;
|
|
|
|
|
2006-02-13 11:52:43 +00:00
|
|
|
name = GST_MESSAGE_TYPE_NAME (message);
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
|
|
|
|
if ((src = GST_MESSAGE_SRC (message))) {
|
|
|
|
/* first find the previous message posted by this element */
|
2007-06-07 10:11:47 +00:00
|
|
|
if ((previous = find_message (bin, src, types))) {
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
/* if we found a previous message, replace it */
|
|
|
|
gst_message_unref (previous->data);
|
|
|
|
previous->data = message;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "replace old message %s from %s",
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
name, GST_ELEMENT_NAME (src));
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
} else {
|
|
|
|
/* keep new message */
|
|
|
|
bin->messages = g_list_prepend (bin->messages, message);
|
|
|
|
|
2007-02-20 10:45:13 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "got new message %p, %s from %s",
|
|
|
|
message, name, GST_ELEMENT_NAME (src));
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "got message %s from (NULL), not processing", name);
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
res = FALSE;
|
|
|
|
gst_message_unref (message);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* with LOCK. Remove all messages of given types */
|
|
|
|
static void
|
|
|
|
bin_remove_messages (GstBin * bin, GstObject * src, GstMessageType types)
|
|
|
|
{
|
|
|
|
MessageFind find;
|
|
|
|
GList *walk, *next;
|
|
|
|
|
|
|
|
find.src = src;
|
|
|
|
find.types = types;
|
|
|
|
|
|
|
|
for (walk = bin->messages; walk; walk = next) {
|
|
|
|
GstMessage *message = (GstMessage *) walk->data;
|
|
|
|
|
|
|
|
next = g_list_next (walk);
|
|
|
|
|
|
|
|
if (message_check (message, &find) == 0) {
|
|
|
|
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message),
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
"deleting message %p of types 0x%08x", message, types);
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
bin->messages = g_list_delete_link (bin->messages, walk);
|
|
|
|
gst_message_unref (message);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message),
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
"not deleting message %p of type 0x%08x", message,
|
|
|
|
GST_MESSAGE_TYPE (message));
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-08 17:30:29 +00:00
|
|
|
/* Check if the bin is EOS. We do this by scanning all sinks and
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
* checking if they posted an EOS message.
|
2005-10-08 17:30:29 +00:00
|
|
|
*
|
|
|
|
* call with bin LOCK */
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
static gboolean
|
|
|
|
is_eos (GstBin * bin)
|
|
|
|
{
|
2005-10-08 17:30:29 +00:00
|
|
|
gboolean result;
|
|
|
|
GList *walk;
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
|
2005-10-08 17:30:29 +00:00
|
|
|
result = TRUE;
|
|
|
|
for (walk = bin->children; walk; walk = g_list_next (walk)) {
|
|
|
|
GstElement *element;
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
|
2005-10-08 17:30:29 +00:00
|
|
|
element = GST_ELEMENT_CAST (walk->data);
|
|
|
|
if (bin_element_is_sink (element, bin) == 0) {
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
/* check if element posted EOS */
|
2007-06-07 10:11:47 +00:00
|
|
|
if (find_message (bin, GST_OBJECT_CAST (element), GST_MESSAGE_EOS)) {
|
2007-08-16 11:04:40 +00:00
|
|
|
GST_DEBUG ("sink '%s' posted EOS", GST_ELEMENT_NAME (element));
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
} else {
|
2007-08-16 11:04:40 +00:00
|
|
|
GST_DEBUG ("sink '%s' did not post EOS yet",
|
|
|
|
GST_ELEMENT_NAME (element));
|
2005-10-08 17:30:29 +00:00
|
|
|
result = FALSE;
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-07-28 15:38:46 +00:00
|
|
|
static void
|
|
|
|
unlink_pads (GstPad * pad)
|
|
|
|
{
|
|
|
|
GstPad *peer;
|
|
|
|
|
|
|
|
if ((peer = gst_pad_get_peer (pad))) {
|
|
|
|
if (gst_pad_get_direction (pad) == GST_PAD_SRC)
|
|
|
|
gst_pad_unlink (pad, peer);
|
|
|
|
else
|
|
|
|
gst_pad_unlink (peer, pad);
|
|
|
|
gst_object_unref (peer);
|
|
|
|
}
|
|
|
|
gst_object_unref (pad);
|
|
|
|
}
|
|
|
|
|
2005-11-01 19:16:58 +00:00
|
|
|
/* vmethod that adds an element to a bin
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-06-27 08:16:51 +00:00
|
|
|
* MT safe
|
2002-03-31 14:04:50 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_bin_add_func (GstBin * bin, GstElement * element)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gchar *elem_name;
|
2005-07-28 15:38:46 +00:00
|
|
|
GstIterator *it;
|
2005-10-12 19:38:44 +00:00
|
|
|
gboolean is_sink;
|
2007-08-16 11:04:40 +00:00
|
|
|
GstMessage *clock_message = NULL, *async_message = NULL;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "element :%s", GST_ELEMENT_NAME (element));
|
2001-12-10 18:08:35 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* we obviously can't add ourself to ourself */
|
|
|
|
if (G_UNLIKELY (GST_ELEMENT_CAST (element) == GST_ELEMENT_CAST (bin)))
|
|
|
|
goto adding_itself;
|
2003-03-25 19:39:18 +00:00
|
|
|
|
2005-07-28 15:38:46 +00:00
|
|
|
/* get the element name to make sure it is unique in this bin. */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
elem_name = g_strdup (GST_ELEMENT_NAME (element));
|
2005-10-12 19:38:44 +00:00
|
|
|
is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_IS_SINK);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
2000-07-17 17:14:15 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-05-12 12:17:23 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* then check to see if the element's name is already taken in the bin,
|
|
|
|
* we can safely take the lock here. This check is probably bogus because
|
2005-07-28 15:38:46 +00:00
|
|
|
* you can safely change the element name after this check and before setting
|
|
|
|
* the object parent. The window is very small though... */
|
|
|
|
if (G_UNLIKELY (!gst_object_check_uniqueness (bin->children, elem_name)))
|
2005-03-07 18:27:42 +00:00
|
|
|
goto duplicate_name;
|
2004-07-11 12:16:29 +00:00
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* set the element's parent and add the element to the bin's list of children */
|
2005-03-10 12:51:45 +00:00
|
|
|
if (G_UNLIKELY (!gst_object_set_parent (GST_OBJECT_CAST (element),
|
|
|
|
GST_OBJECT_CAST (bin))))
|
2005-03-07 18:27:42 +00:00
|
|
|
goto had_parent;
|
2001-12-04 22:12:50 +00:00
|
|
|
|
2005-07-28 15:38:46 +00:00
|
|
|
/* if we add a sink we become a sink */
|
2005-10-12 19:38:44 +00:00
|
|
|
if (is_sink) {
|
2005-09-22 16:51:27 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, bin, "element \"%s\" was sink",
|
|
|
|
elem_name);
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
GST_OBJECT_FLAG_SET (bin, GST_ELEMENT_IS_SINK);
|
2005-09-22 16:51:27 +00:00
|
|
|
}
|
2005-10-11 12:58:44 +00:00
|
|
|
if (gst_element_provides_clock (element)) {
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "element \"%s\" can provide a clock", elem_name);
|
2005-11-18 11:03:10 +00:00
|
|
|
clock_message =
|
2007-08-16 11:04:40 +00:00
|
|
|
gst_message_new_clock_provide (GST_OBJECT_CAST (element), NULL, TRUE);
|
2005-10-11 12:58:44 +00:00
|
|
|
}
|
2005-05-12 19:45:44 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
bin->children = g_list_prepend (bin->children, element);
|
2000-01-30 09:03:00 +00:00
|
|
|
bin->numchildren++;
|
2005-03-07 18:27:42 +00:00
|
|
|
bin->children_cookie++;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
ret = GST_STATE_RETURN (bin);
|
|
|
|
|
|
|
|
/* no need to update the state if we are in error */
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
goto no_state_recalc;
|
|
|
|
|
2007-08-16 11:04:40 +00:00
|
|
|
/* distribute the bus */
|
|
|
|
gst_element_set_bus (element, bin->child_bus);
|
|
|
|
|
|
|
|
/* propagate the current base_time and clock */
|
|
|
|
gst_element_set_base_time (element, GST_ELEMENT (bin)->base_time);
|
|
|
|
/* it's possible that the element did not accept the clock but
|
|
|
|
* that is not important right now. When the pipeline goes to PLAYING,
|
|
|
|
* a new clock will be selected */
|
|
|
|
gst_element_set_clock (element, GST_ELEMENT_CLOCK (bin));
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* update the bin state, the new element could have been an ASYNC or
|
|
|
|
* NO_PREROLL element */
|
|
|
|
ret = GST_STATE_RETURN (element);
|
|
|
|
GST_DEBUG_OBJECT (bin, "added %s element",
|
|
|
|
gst_element_state_change_return_get_name (ret));
|
|
|
|
|
|
|
|
switch (ret) {
|
|
|
|
case GST_STATE_CHANGE_ASYNC:
|
2007-08-16 11:04:40 +00:00
|
|
|
{
|
|
|
|
/* create message to track this aync element when it posts an async-done
|
|
|
|
* message */
|
|
|
|
async_message =
|
|
|
|
gst_message_new_async_start (GST_OBJECT_CAST (element), FALSE);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
break;
|
2007-08-16 11:04:40 +00:00
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
case GST_STATE_CHANGE_NO_PREROLL:
|
2007-08-16 11:04:40 +00:00
|
|
|
/* ignore all async elements we might have and commit our state */
|
2007-06-19 10:41:33 +00:00
|
|
|
bin_handle_async_done (bin, ret);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_FAILURE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
no_state_recalc:
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2000-12-30 02:41:15 +00:00
|
|
|
|
2007-08-16 11:04:40 +00:00
|
|
|
/* post the messages on the bus of the element so that the bin can handle
|
|
|
|
* them */
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
if (clock_message)
|
2007-08-16 11:04:40 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (element), clock_message);
|
|
|
|
|
|
|
|
if (async_message)
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (element), async_message);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
|
2005-07-29 19:19:29 +00:00
|
|
|
/* unlink all linked pads */
|
|
|
|
it = gst_element_iterate_pads (element);
|
|
|
|
gst_iterator_foreach (it, (GFunc) unlink_pads, element);
|
|
|
|
gst_iterator_free (it);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, bin, "added element \"%s\"",
|
2005-03-07 18:27:42 +00:00
|
|
|
elem_name);
|
|
|
|
g_free (elem_name);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_ADDED], 0, element);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERROR handling here */
|
|
|
|
adding_itself:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
{
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
g_warning ("Cannot add bin %s to itself", GST_ELEMENT_NAME (bin));
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
duplicate_name:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
{
|
|
|
|
g_warning ("Name %s is not unique in bin %s, not adding",
|
|
|
|
elem_name, GST_ELEMENT_NAME (bin));
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
g_free (elem_name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
had_parent:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
{
|
|
|
|
g_warning ("Element %s already has parent", elem_name);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
g_free (elem_name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2003-01-11 20:08:03 +00:00
|
|
|
* gst_bin_add:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2005-11-01 19:16:58 +00:00
|
|
|
* @element: the #GstElement to add
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Adds the given element to the bin. Sets the element's parent, and thus
|
2004-10-13 13:03:25 +00:00
|
|
|
* takes ownership of the element. An element can only be added to one bin.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-07-28 15:38:46 +00:00
|
|
|
* If the element's pads are linked to other pads, the pads will be unlinked
|
|
|
|
* before the element is added to the bin.
|
|
|
|
*
|
2005-06-27 08:16:51 +00:00
|
|
|
* MT safe.
|
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns: TRUE if the element could be added, FALSE if
|
2005-03-07 18:27:42 +00:00
|
|
|
* the bin does not want to accept the element.
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_bin_add (GstBin * bin, GstElement * element)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2003-01-11 20:08:03 +00:00
|
|
|
GstBinClass *bclass;
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
2003-01-11 20:08:03 +00:00
|
|
|
|
|
|
|
bclass = GST_BIN_GET_CLASS (bin);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (G_UNLIKELY (bclass->add_element == NULL))
|
|
|
|
goto no_function;
|
|
|
|
|
|
|
|
GST_CAT_DEBUG (GST_CAT_PARENTAGE, "adding element %s to bin %s",
|
2007-03-10 15:44:44 +00:00
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (element)),
|
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (bin)));
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
result = bclass->add_element (bin, element);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
/* ERROR handling */
|
2005-03-07 18:27:42 +00:00
|
|
|
no_function:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
{
|
|
|
|
g_warning ("adding elements to bin %s is not supported",
|
|
|
|
GST_ELEMENT_NAME (bin));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-01-11 20:08:03 +00:00
|
|
|
}
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* remove an element from the bin
|
|
|
|
*
|
|
|
|
* MT safe
|
|
|
|
*/
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_bin_remove_func (GstBin * bin, GstElement * element)
|
2003-01-11 20:08:03 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gchar *elem_name;
|
2005-07-28 15:38:46 +00:00
|
|
|
GstIterator *it;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
gboolean is_sink, othersink, found;
|
2007-06-19 10:41:33 +00:00
|
|
|
GstMessage *clock_message = NULL;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GList *walk, *next;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
gboolean other_async, this_async, have_no_preroll;
|
|
|
|
GstStateChangeReturn ret;
|
2003-01-11 20:08:03 +00:00
|
|
|
|
2007-05-22 11:09:45 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "element :%s", GST_ELEMENT_NAME (element));
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
2005-08-24 15:10:41 +00:00
|
|
|
/* Check if the element is already being removed and immediately
|
|
|
|
* return */
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
if (G_UNLIKELY (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_UNPARENTING)))
|
2005-08-24 15:10:41 +00:00
|
|
|
goto already_removing;
|
|
|
|
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
GST_OBJECT_FLAG_SET (element, GST_ELEMENT_UNPARENTING);
|
2005-08-24 15:10:41 +00:00
|
|
|
/* grab element name so we can print it */
|
2005-03-07 18:27:42 +00:00
|
|
|
elem_name = g_strdup (GST_ELEMENT_NAME (element));
|
2005-10-12 19:38:44 +00:00
|
|
|
is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_IS_SINK);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-08-24 15:10:41 +00:00
|
|
|
/* unlink all linked pads */
|
|
|
|
it = gst_element_iterate_pads (element);
|
|
|
|
gst_iterator_foreach (it, (GFunc) unlink_pads, element);
|
|
|
|
gst_iterator_free (it);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
found = FALSE;
|
|
|
|
othersink = FALSE;
|
|
|
|
have_no_preroll = FALSE;
|
|
|
|
/* iterate the elements, we collect which ones are async and no_preroll. We
|
|
|
|
* also remove the element when we find it. */
|
|
|
|
for (walk = bin->children; walk; walk = next) {
|
|
|
|
GstElement *child = GST_ELEMENT_CAST (walk->data);
|
|
|
|
|
|
|
|
next = g_list_next (walk);
|
|
|
|
|
|
|
|
if (child == element) {
|
|
|
|
found = TRUE;
|
|
|
|
/* remove the element */
|
|
|
|
bin->children = g_list_delete_link (bin->children, walk);
|
|
|
|
} else {
|
|
|
|
gboolean child_sink;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (child);
|
|
|
|
child_sink = GST_OBJECT_FLAG_IS_SET (child, GST_ELEMENT_IS_SINK);
|
|
|
|
/* when we remove a sink, check if there are other sinks. */
|
|
|
|
if (is_sink && !othersink && child_sink)
|
|
|
|
othersink = TRUE;
|
|
|
|
/* check if we have NO_PREROLL children */
|
|
|
|
if (GST_STATE_RETURN (child) == GST_STATE_CHANGE_NO_PREROLL)
|
|
|
|
have_no_preroll = TRUE;
|
|
|
|
GST_OBJECT_UNLOCK (child);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the element must have been in the bin's list of children */
|
|
|
|
if (G_UNLIKELY (!found))
|
2005-03-07 18:27:42 +00:00
|
|
|
goto not_in_bin;
|
2005-01-31 23:21:52 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* we now removed the element from the list of elements, increment the cookie
|
|
|
|
* so that others can detect a change in the children list. */
|
2000-01-30 09:03:00 +00:00
|
|
|
bin->numchildren--;
|
2005-03-07 18:27:42 +00:00
|
|
|
bin->children_cookie++;
|
2005-05-12 19:45:44 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
if (is_sink && !othersink) {
|
|
|
|
/* we're not a sink anymore */
|
|
|
|
GST_DEBUG_OBJECT (bin, "we removed the last sink");
|
|
|
|
GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_IS_SINK);
|
2005-05-12 19:45:44 +00:00
|
|
|
}
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
|
2005-11-18 11:03:10 +00:00
|
|
|
/* if the clock provider for this element is removed, we lost
|
|
|
|
* the clock as well, we need to inform the parent of this
|
|
|
|
* so that it can select a new clock */
|
2005-11-19 18:28:40 +00:00
|
|
|
if (bin->clock_provider == element) {
|
2005-11-18 11:03:10 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "element \"%s\" provided the clock", elem_name);
|
2005-10-11 12:58:44 +00:00
|
|
|
bin->clock_dirty = TRUE;
|
2005-11-18 11:03:10 +00:00
|
|
|
clock_message =
|
|
|
|
gst_message_new_clock_lost (GST_OBJECT_CAST (bin), bin->provided_clock);
|
2005-10-11 12:58:44 +00:00
|
|
|
}
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
/* remove messages for the element, if there was a pending ASYNC_START
|
|
|
|
* message we must see if removing the element caused the bin to lose its
|
|
|
|
* async state. */
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
this_async = FALSE;
|
|
|
|
other_async = FALSE;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
for (walk = bin->messages; walk; walk = next) {
|
|
|
|
GstMessage *message = (GstMessage *) walk->data;
|
|
|
|
GstElement *src = GST_ELEMENT_CAST (GST_MESSAGE_SRC (message));
|
|
|
|
|
|
|
|
next = g_list_next (walk);
|
|
|
|
|
|
|
|
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_START) {
|
|
|
|
if (src == element)
|
|
|
|
this_async = TRUE;
|
|
|
|
else
|
|
|
|
other_async = TRUE;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message),
|
|
|
|
"looking at message %p", message);
|
|
|
|
}
|
|
|
|
if (src == element) {
|
|
|
|
/* delete all message types */
|
|
|
|
GST_DEBUG_OBJECT (GST_MESSAGE_SRC (message),
|
|
|
|
"deleting message %p of element \"%s\"", message, elem_name);
|
|
|
|
bin->messages = g_list_delete_link (bin->messages, walk);
|
|
|
|
gst_message_unref (message);
|
|
|
|
}
|
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
|
|
|
|
/* get last return */
|
|
|
|
ret = GST_STATE_RETURN (bin);
|
|
|
|
|
|
|
|
/* no need to update the state if we are in error */
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
goto no_state_recalc;
|
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
if (!other_async && this_async) {
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* all other elements were not async and we removed the async one,
|
|
|
|
* handle the async-done case because we are not async anymore now. */
|
|
|
|
GST_DEBUG_OBJECT (bin,
|
|
|
|
"we removed the last async element, have no_preroll %d",
|
|
|
|
have_no_preroll);
|
|
|
|
|
|
|
|
/* the current state return of the bin depends on if there are no_preroll
|
|
|
|
* elements in the pipeline or not */
|
|
|
|
if (have_no_preroll)
|
|
|
|
ret = GST_STATE_CHANGE_NO_PREROLL;
|
|
|
|
else
|
|
|
|
ret = GST_STATE_CHANGE_SUCCESS;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
bin_handle_async_done (bin, ret);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (bin,
|
|
|
|
"recalc state preroll: %d, other async: %d, this async %d",
|
|
|
|
have_no_preroll, other_async, this_async);
|
|
|
|
|
|
|
|
if (have_no_preroll) {
|
|
|
|
ret = GST_STATE_CHANGE_NO_PREROLL;
|
|
|
|
} else if (other_async) {
|
|
|
|
/* there are other async elements and we were not doing an async state
|
|
|
|
* change, change our pending state and go async */
|
|
|
|
if (GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING) {
|
|
|
|
GST_STATE_NEXT (bin) = GST_STATE (bin);
|
|
|
|
GST_STATE_PENDING (bin) = GST_STATE (bin);
|
|
|
|
}
|
|
|
|
ret = GST_STATE_CHANGE_ASYNC;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
GST_STATE_RETURN (bin) = ret;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
no_state_recalc:
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2001-12-10 18:08:35 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
if (clock_message)
|
2005-11-18 11:03:10 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin), clock_message);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
2004-07-29 20:33:49 +00:00
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_PARENTAGE, bin, "removed child \"%s\"",
|
2005-03-07 18:27:42 +00:00
|
|
|
elem_name);
|
|
|
|
g_free (elem_name);
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_element_set_bus (element, NULL);
|
2000-12-30 02:41:15 +00:00
|
|
|
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
/* Clear the clock we provided to the element */
|
|
|
|
gst_element_set_clock (element, NULL);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* we ref here because after the _unparent() the element can be disposed
|
2005-08-24 15:10:41 +00:00
|
|
|
* and we still need it to reset the UNPARENTING flag and fire a signal. */
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (element);
|
2005-03-10 12:51:45 +00:00
|
|
|
gst_object_unparent (GST_OBJECT_CAST (element));
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
GST_OBJECT_FLAG_UNSET (element, GST_ELEMENT_UNPARENTING);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
2005-08-24 15:10:41 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_REMOVED], 0, element);
|
2005-08-24 15:10:41 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
/* element is really out of our control now */
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
/* ERROR handling */
|
2005-03-07 18:27:42 +00:00
|
|
|
not_in_bin:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
{
|
|
|
|
g_warning ("Element %s is not in bin %s", elem_name,
|
|
|
|
GST_ELEMENT_NAME (bin));
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
g_free (elem_name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-08-24 15:10:41 +00:00
|
|
|
already_removing:
|
|
|
|
{
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
2005-08-24 15:10:41 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2003-01-11 20:08:03 +00:00
|
|
|
/**
|
|
|
|
* gst_bin_remove:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
|
|
|
* @element: the #GstElement to remove
|
2003-01-11 20:08:03 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Removes the element from the bin, unparenting it as well.
|
2004-03-26 03:46:16 +00:00
|
|
|
* Unparenting the element means that the element will be dereferenced,
|
|
|
|
* so if the bin holds the only reference to the element, the element
|
|
|
|
* will be freed in the process of removing it from the bin. If you
|
|
|
|
* want the element to still exist after removing, you need to call
|
2005-08-24 21:35:43 +00:00
|
|
|
* gst_object_ref() before removing it from the bin.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-07-28 15:38:46 +00:00
|
|
|
* If the element's pads are linked to other pads, the pads will be unlinked
|
|
|
|
* before the element is removed from the bin.
|
|
|
|
*
|
2005-06-27 08:16:51 +00:00
|
|
|
* MT safe.
|
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns: TRUE if the element could be removed, FALSE if
|
2005-03-07 18:27:42 +00:00
|
|
|
* the bin does not want to remove the element.
|
2003-01-11 20:08:03 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_bin_remove (GstBin * bin, GstElement * element)
|
2003-01-11 20:08:03 +00:00
|
|
|
{
|
|
|
|
GstBinClass *bclass;
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result;
|
2003-01-11 20:08:03 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), FALSE);
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
2003-01-11 20:08:03 +00:00
|
|
|
|
|
|
|
bclass = GST_BIN_GET_CLASS (bin);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (G_UNLIKELY (bclass->remove_element == NULL))
|
|
|
|
goto no_function;
|
|
|
|
|
|
|
|
GST_CAT_DEBUG (GST_CAT_PARENTAGE, "removing element %s from bin %s",
|
|
|
|
GST_ELEMENT_NAME (element), GST_ELEMENT_NAME (bin));
|
|
|
|
|
|
|
|
result = bclass->remove_element (bin, element);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
/* ERROR handling */
|
2005-03-07 18:27:42 +00:00
|
|
|
no_function:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
{
|
|
|
|
g_warning ("removing elements from bin %s is not supported",
|
|
|
|
GST_ELEMENT_NAME (bin));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstIteratorItem
|
|
|
|
iterate_child (GstIterator * it, GstElement * child)
|
|
|
|
{
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (child);
|
2005-03-07 18:27:42 +00:00
|
|
|
return GST_ITERATOR_ITEM_PASS;
|
2003-01-11 20:08:03 +00:00
|
|
|
}
|
|
|
|
|
2003-02-11 20:15:50 +00:00
|
|
|
/**
|
2005-03-07 18:27:42 +00:00
|
|
|
* gst_bin_iterate_elements:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Gets an iterator for the elements in this bin.
|
2005-06-27 08:16:51 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Each element yielded by the iterator will have its refcount increased, so
|
|
|
|
* unref after use.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* MT safe. Caller owns returned value.
|
|
|
|
*
|
|
|
|
* Returns: a #GstIterator of #GstElement, or NULL
|
2003-02-11 20:15:50 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *
|
|
|
|
gst_bin_iterate_elements (GstBin * bin)
|
2003-02-11 20:15:50 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *result;
|
2003-02-11 20:15:50 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-03-07 18:27:42 +00:00
|
|
|
/* add ref because the iterator refs the bin. When the iterator
|
2005-06-27 08:16:51 +00:00
|
|
|
* is freed it will unref the bin again using the provided dispose
|
2005-03-07 18:27:42 +00:00
|
|
|
* function. */
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (bin);
|
2005-10-07 00:14:45 +00:00
|
|
|
result = gst_iterator_new_list (GST_TYPE_ELEMENT,
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_GET_LOCK (bin),
|
2005-03-07 18:27:42 +00:00
|
|
|
&bin->children_cookie,
|
|
|
|
&bin->children,
|
|
|
|
bin,
|
|
|
|
(GstIteratorItemFunction) iterate_child,
|
|
|
|
(GstIteratorDisposeFunction) gst_object_unref);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2003-02-11 20:15:50 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return result;
|
|
|
|
}
|
2003-02-11 20:15:50 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
static GstIteratorItem
|
|
|
|
iterate_child_recurse (GstIterator * it, GstElement * child)
|
|
|
|
{
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (child);
|
2005-03-07 18:27:42 +00:00
|
|
|
if (GST_IS_BIN (child)) {
|
|
|
|
GstIterator *other = gst_bin_iterate_recurse (GST_BIN (child));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
gst_iterator_push (it, other);
|
2003-02-11 20:15:50 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
return GST_ITERATOR_ITEM_PASS;
|
|
|
|
}
|
2003-02-11 20:15:50 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/**
|
|
|
|
* gst_bin_iterate_recurse:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Gets an iterator for the elements in this bin.
|
|
|
|
* This iterator recurses into GstBin children.
|
2005-06-27 08:16:51 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Each element yielded by the iterator will have its refcount increased, so
|
|
|
|
* unref after use.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* MT safe. Caller owns returned value.
|
|
|
|
*
|
|
|
|
* Returns: a #GstIterator of #GstElement, or NULL
|
2005-03-07 18:27:42 +00:00
|
|
|
*/
|
|
|
|
GstIterator *
|
|
|
|
gst_bin_iterate_recurse (GstBin * bin)
|
|
|
|
{
|
|
|
|
GstIterator *result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-03-07 18:27:42 +00:00
|
|
|
/* add ref because the iterator refs the bin. When the iterator
|
2005-06-27 08:16:51 +00:00
|
|
|
* is freed it will unref the bin again using the provided dispose
|
2005-03-07 18:27:42 +00:00
|
|
|
* function. */
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (bin);
|
2005-10-07 00:14:45 +00:00
|
|
|
result = gst_iterator_new_list (GST_TYPE_ELEMENT,
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_GET_LOCK (bin),
|
2005-03-07 18:27:42 +00:00
|
|
|
&bin->children_cookie,
|
|
|
|
&bin->children,
|
|
|
|
bin,
|
|
|
|
(GstIteratorItemFunction) iterate_child_recurse,
|
|
|
|
(GstIteratorDisposeFunction) gst_object_unref);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
return result;
|
2003-02-11 20:15:50 +00:00
|
|
|
}
|
|
|
|
|
gst/: Fix state changes for non sinks. We now change sinks, then elements with unconnected srcpads, then the rest.
Original commit message from CVS:
* gst/gstbin.c: (bin_element_is_sink), (has_ancestor),
(bin_element_is_semi_sink), (append_child), (gst_bin_change_state):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_prepare),
(gst_pad_link), (gst_pad_accept_caps), (gst_pad_query),
(gst_pad_send_event), (gst_pad_start_task):
* gst/gstqueue.c: (gst_queue_init), (gst_queue_locked_flush),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_sink_activate), (gst_queue_src_activate),
(gst_queue_change_state):
* gst/gstqueue.h:
Fix state changes for non sinks. We now change sinks, then elements
with unconnected srcpads, then the rest.
More efficient queue unlocking in flush and state changes.
Set the pad activate mode even if it does not have an activate
function.
2005-05-25 19:33:39 +00:00
|
|
|
/* returns 0 when TRUE because this is a GCompareFunc */
|
2005-05-14 18:01:12 +00:00
|
|
|
/* MT safe */
|
2005-03-09 16:10:59 +00:00
|
|
|
static gint
|
|
|
|
bin_element_is_sink (GstElement * child, GstBin * bin)
|
|
|
|
{
|
gst/: Fix state changes for non sinks. We now change sinks, then elements with unconnected srcpads, then the rest.
Original commit message from CVS:
* gst/gstbin.c: (bin_element_is_sink), (has_ancestor),
(bin_element_is_semi_sink), (append_child), (gst_bin_change_state):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_prepare),
(gst_pad_link), (gst_pad_accept_caps), (gst_pad_query),
(gst_pad_send_event), (gst_pad_start_task):
* gst/gstqueue.c: (gst_queue_init), (gst_queue_locked_flush),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_sink_activate), (gst_queue_src_activate),
(gst_queue_change_state):
* gst/gstqueue.h:
Fix state changes for non sinks. We now change sinks, then elements
with unconnected srcpads, then the rest.
More efficient queue unlocking in flush and state changes.
Set the pad activate mode even if it does not have an activate
function.
2005-05-25 19:33:39 +00:00
|
|
|
gboolean is_sink;
|
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
/* we lock the child here for the remainder of the function to
|
2005-10-10 11:52:58 +00:00
|
|
|
* get its name and flag safely. */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (child);
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
is_sink = GST_OBJECT_FLAG_IS_SET (child, GST_ELEMENT_IS_SINK);
|
gst/: Fix state changes for non sinks. We now change sinks, then elements with unconnected srcpads, then the rest.
Original commit message from CVS:
* gst/gstbin.c: (bin_element_is_sink), (has_ancestor),
(bin_element_is_semi_sink), (append_child), (gst_bin_change_state):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_prepare),
(gst_pad_link), (gst_pad_accept_caps), (gst_pad_query),
(gst_pad_send_event), (gst_pad_start_task):
* gst/gstqueue.c: (gst_queue_init), (gst_queue_locked_flush),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_sink_activate), (gst_queue_src_activate),
(gst_queue_change_state):
* gst/gstqueue.h:
Fix state changes for non sinks. We now change sinks, then elements
with unconnected srcpads, then the rest.
More efficient queue unlocking in flush and state changes.
Set the pad activate mode even if it does not have an activate
function.
2005-05-25 19:33:39 +00:00
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin,
|
|
|
|
"child %s %s sink", GST_OBJECT_NAME (child), is_sink ? "is" : "is not");
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (child);
|
gst/: Fix state changes for non sinks. We now change sinks, then elements with unconnected srcpads, then the rest.
Original commit message from CVS:
* gst/gstbin.c: (bin_element_is_sink), (has_ancestor),
(bin_element_is_semi_sink), (append_child), (gst_bin_change_state):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_prepare),
(gst_pad_link), (gst_pad_accept_caps), (gst_pad_query),
(gst_pad_send_event), (gst_pad_start_task):
* gst/gstqueue.c: (gst_queue_init), (gst_queue_locked_flush),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_sink_activate), (gst_queue_src_activate),
(gst_queue_change_state):
* gst/gstqueue.h:
Fix state changes for non sinks. We now change sinks, then elements
with unconnected srcpads, then the rest.
More efficient queue unlocking in flush and state changes.
Set the pad activate mode even if it does not have an activate
function.
2005-05-25 19:33:39 +00:00
|
|
|
return is_sink ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
2005-05-14 18:01:12 +00:00
|
|
|
static gint
|
|
|
|
sink_iterator_filter (GstElement * child, GstBin * bin)
|
|
|
|
{
|
2005-05-16 21:17:14 +00:00
|
|
|
if (bin_element_is_sink (child, bin) == 0) {
|
2005-05-14 18:01:12 +00:00
|
|
|
/* returns 0 because this is a GCompareFunc */
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
/* child carries a ref from gst_bin_iterate_elements -- drop if not passing
|
|
|
|
through */
|
2005-10-10 11:52:58 +00:00
|
|
|
gst_object_unref (child);
|
2005-05-14 18:01:12 +00:00
|
|
|
return 1;
|
2005-03-09 16:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_bin_iterate_sinks:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2005-03-09 16:10:59 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Gets an iterator for all elements in the bin that have the
|
|
|
|
* #GST_ELEMENT_IS_SINK flag set.
|
2005-03-09 16:10:59 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Each element yielded by the iterator will have its refcount increased, so
|
|
|
|
* unref after use.
|
2005-03-10 12:51:45 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* MT safe. Caller owns returned value.
|
2005-06-27 08:16:51 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns: a #GstIterator of #GstElement, or NULL
|
2005-03-09 16:10:59 +00:00
|
|
|
*/
|
|
|
|
GstIterator *
|
|
|
|
gst_bin_iterate_sinks (GstBin * bin)
|
|
|
|
{
|
|
|
|
GstIterator *children;
|
|
|
|
GstIterator *result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
|
|
|
|
|
|
|
children = gst_bin_iterate_elements (bin);
|
|
|
|
result = gst_iterator_filter (children,
|
2005-05-14 18:01:12 +00:00
|
|
|
(GCompareFunc) sink_iterator_filter, bin);
|
2005-03-09 16:10:59 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2006-01-26 06:57:14 +00:00
|
|
|
/* returns 0 when TRUE because this is a GCompareFunc */
|
|
|
|
/* MT safe */
|
|
|
|
static gint
|
|
|
|
bin_element_is_src (GstElement * child, GstBin * bin)
|
|
|
|
{
|
|
|
|
gboolean is_src = FALSE;
|
|
|
|
|
|
|
|
/* we lock the child here for the remainder of the function to
|
|
|
|
* get its name and flag safely. */
|
|
|
|
GST_OBJECT_LOCK (child);
|
|
|
|
if (!GST_OBJECT_FLAG_IS_SET (child, GST_ELEMENT_IS_SINK) &&
|
|
|
|
!child->numsinkpads) {
|
|
|
|
is_src = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin,
|
|
|
|
"child %s %s src", GST_OBJECT_NAME (child), is_src ? "is" : "is not");
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (child);
|
|
|
|
return is_src ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
src_iterator_filter (GstElement * child, GstBin * bin)
|
|
|
|
{
|
|
|
|
if (bin_element_is_src (child, bin) == 0) {
|
|
|
|
/* returns 0 because this is a GCompareFunc */
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
/* child carries a ref from gst_bin_iterate_elements -- drop if not passing
|
|
|
|
through */
|
|
|
|
gst_object_unref (child);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_bin_iterate_sources:
|
|
|
|
* @bin: a #GstBin
|
|
|
|
*
|
2007-04-23 07:30:38 +00:00
|
|
|
* Gets an iterator for all elements in the bin that have no sinkpads and have
|
2006-08-16 08:54:56 +00:00
|
|
|
* the #GST_ELEMENT_IS_SINK flag unset.
|
2006-01-26 06:57:14 +00:00
|
|
|
*
|
|
|
|
* Each element yielded by the iterator will have its refcount increased, so
|
|
|
|
* unref after use.
|
|
|
|
*
|
|
|
|
* MT safe. Caller owns returned value.
|
|
|
|
*
|
|
|
|
* Returns: a #GstIterator of #GstElement, or NULL
|
|
|
|
*/
|
|
|
|
GstIterator *
|
|
|
|
gst_bin_iterate_sources (GstBin * bin)
|
|
|
|
{
|
|
|
|
GstIterator *children;
|
|
|
|
GstIterator *result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
|
|
|
|
|
|
|
children = gst_bin_iterate_elements (bin);
|
|
|
|
result = gst_iterator_filter (children,
|
|
|
|
(GCompareFunc) src_iterator_filter, bin);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
/*
|
|
|
|
* MT safe
|
|
|
|
*/
|
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_bin_get_state_func (GstElement * element, GstState * state,
|
|
|
|
GstState * pending, GstClockTime timeout)
|
|
|
|
{
|
|
|
|
GstBin *bin = GST_BIN (element);
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin, "getting state");
|
|
|
|
|
|
|
|
ret = parent_class->get_state (element, state, pending, timeout);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/***********************************************
|
2005-10-15 15:30:24 +00:00
|
|
|
* Topologically sorted iterator
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
* see http://en.wikipedia.org/wiki/Topological_sorting
|
gst/gstbin.c: Some documentation updates.
Original commit message from CVS:
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Some documentation updates.
Clean up dispose handlers.
* gst/gstobject.c: (gst_object_ref), (gst_object_unref):
* gst/gstpad.c: (gst_pad_dispose):
Clean up dispose handler.
* gst/gstpipeline.c: (gst_pipeline_change_state):
Removed spurious UNLOCK.
2005-09-28 11:03:58 +00:00
|
|
|
*
|
|
|
|
* For each element in the graph, an entry is kept in a HashTable
|
2005-10-15 15:30:24 +00:00
|
|
|
* with its number of srcpad connections (degree).
|
|
|
|
* We then change state of all elements without dependencies
|
gst/gstbin.c: Some documentation updates.
Original commit message from CVS:
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Some documentation updates.
Clean up dispose handlers.
* gst/gstobject.c: (gst_object_ref), (gst_object_unref):
* gst/gstpad.c: (gst_pad_dispose):
Clean up dispose handler.
* gst/gstpipeline.c: (gst_pipeline_change_state):
Removed spurious UNLOCK.
2005-09-28 11:03:58 +00:00
|
|
|
* (degree 0) and decrement the degree of all elements connected
|
|
|
|
* on the sinkpads. When an element reaches degree 0, its state is
|
|
|
|
* changed next.
|
|
|
|
* When all elements are handled the algorithm stops.
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
*/
|
|
|
|
typedef struct _GstBinSortIterator
|
|
|
|
{
|
|
|
|
GstIterator it;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
GQueue *queue; /* elements queued for state change */
|
|
|
|
GstBin *bin; /* bin we iterate */
|
|
|
|
gint mode; /* adding or removing dependency */
|
|
|
|
GstElement *best; /* next element with least dependencies */
|
|
|
|
gint best_deg; /* best degree */
|
2005-11-02 18:44:20 +00:00
|
|
|
GHashTable *hash; /* hashtable with element dependencies */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
} GstBinSortIterator;
|
|
|
|
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
/* we add and subtract 1 to make sure we don't confuse NULL and 0 */
|
|
|
|
#define HASH_SET_DEGREE(bit, elem, deg) \
|
|
|
|
g_hash_table_replace (bit->hash, elem, GINT_TO_POINTER(deg+1))
|
|
|
|
#define HASH_GET_DEGREE(bit, elem) \
|
|
|
|
(GPOINTER_TO_INT(g_hash_table_lookup (bit->hash, elem))-1)
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* add element to queue of next elements in the iterator.
|
|
|
|
* We push at the tail to give higher priority elements a
|
|
|
|
* chance first */
|
|
|
|
static void
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
add_to_queue (GstBinSortIterator * bit, GstElement * element)
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
{
|
2007-08-16 10:27:16 +00:00
|
|
|
GST_DEBUG_OBJECT (bit->bin, "adding '%s' to queue",
|
|
|
|
GST_ELEMENT_NAME (element));
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
gst_object_ref (element);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
g_queue_push_tail (bit->queue, element);
|
|
|
|
HASH_SET_DEGREE (bit, element, -1);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
|
|
|
|
2007-08-16 10:27:16 +00:00
|
|
|
static void
|
|
|
|
remove_from_queue (GstBinSortIterator * bit, GstElement * element)
|
|
|
|
{
|
2007-10-09 16:20:59 +00:00
|
|
|
GList *find;
|
|
|
|
|
|
|
|
if ((find = g_queue_find (bit->queue, element))) {
|
|
|
|
GST_DEBUG_OBJECT (bit->bin, "removing '%s' from queue",
|
|
|
|
GST_ELEMENT_NAME (element));
|
|
|
|
|
|
|
|
g_queue_delete_link (bit->queue, find);
|
|
|
|
gst_object_unref (element);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (bit->bin, "unable to remove '%s' from queue",
|
|
|
|
GST_ELEMENT_NAME (element));
|
|
|
|
}
|
2007-08-16 10:27:16 +00:00
|
|
|
}
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* clear the queue, unref all objects as we took a ref when
|
|
|
|
* we added them to the queue */
|
|
|
|
static void
|
|
|
|
clear_queue (GQueue * queue)
|
|
|
|
{
|
|
|
|
gpointer p;
|
|
|
|
|
|
|
|
while ((p = g_queue_pop_head (queue)))
|
|
|
|
gst_object_unref (p);
|
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* set all degrees to 0. Elements marked as a sink are
|
2007-08-16 10:27:16 +00:00
|
|
|
* added to the queue immediatly. Since we only look at the SINK flag of the
|
|
|
|
* element, it is possible that we add non-sinks to the queue. These will be
|
|
|
|
* removed from the queue again when we can prove that it provides data for some
|
|
|
|
* other element. */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
static void
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
reset_degree (GstElement * element, GstBinSortIterator * bit)
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
{
|
2005-10-12 19:38:44 +00:00
|
|
|
gboolean is_sink;
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* sinks are added right away */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
2005-10-12 19:38:44 +00:00
|
|
|
is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_IS_SINK);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
2005-10-12 19:38:44 +00:00
|
|
|
|
|
|
|
if (is_sink) {
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
add_to_queue (bit, element);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
} else {
|
|
|
|
/* others are marked with 0 and handled when sinks are done */
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
HASH_SET_DEGREE (bit, element, 0);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* adjust the degree of all elements connected to the given
|
2007-06-07 10:11:47 +00:00
|
|
|
* element. If a degree of an element drops to 0, it is
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
* added to the queue of elements to schedule next.
|
|
|
|
*
|
|
|
|
* We have to make sure not to cross the bin boundary this element
|
|
|
|
* belongs to.
|
|
|
|
*/
|
|
|
|
static void
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
update_degree (GstElement * element, GstBinSortIterator * bit)
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
{
|
|
|
|
gboolean linked = FALSE;
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
2005-10-08 18:01:04 +00:00
|
|
|
/* don't touch degree if element has no sourcepads */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
if (element->numsinkpads != 0) {
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* loop over all sinkpads, decrement degree for all connected
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
* elements in this bin */
|
|
|
|
GList *pads;
|
|
|
|
|
|
|
|
for (pads = element->sinkpads; pads; pads = g_list_next (pads)) {
|
|
|
|
GstPad *peer;
|
|
|
|
|
|
|
|
if ((peer = gst_pad_get_peer (GST_PAD_CAST (pads->data)))) {
|
|
|
|
GstElement *peer_element;
|
|
|
|
|
|
|
|
if ((peer_element = gst_pad_get_parent_element (peer))) {
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (peer_element);
|
2005-10-08 18:01:04 +00:00
|
|
|
/* check that we don't go outside of this bin */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
if (GST_OBJECT_CAST (peer_element)->parent ==
|
|
|
|
GST_OBJECT_CAST (bit->bin)) {
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
gint old_deg, new_deg;
|
|
|
|
|
|
|
|
old_deg = HASH_GET_DEGREE (bit, peer_element);
|
2007-08-16 10:27:16 +00:00
|
|
|
|
|
|
|
/* check to see if we added an element as sink that was not really a
|
|
|
|
* sink because it was connected to some other element. */
|
|
|
|
if (old_deg == -1) {
|
|
|
|
remove_from_queue (bit, peer_element);
|
|
|
|
old_deg = 0;
|
|
|
|
}
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
new_deg = old_deg + bit->mode;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GST_DEBUG_OBJECT (bit->bin,
|
|
|
|
"change element %s, degree %d->%d, linked to %s",
|
|
|
|
GST_ELEMENT_NAME (peer_element), old_deg, new_deg,
|
|
|
|
GST_ELEMENT_NAME (element));
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* update degree */
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
if (new_deg == 0) {
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* degree hit 0, add to queue */
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
add_to_queue (bit, peer_element);
|
|
|
|
} else {
|
|
|
|
HASH_SET_DEGREE (bit, peer_element, new_deg);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
|
|
|
linked = TRUE;
|
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (peer_element);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
gst_object_unref (peer_element);
|
|
|
|
}
|
|
|
|
gst_object_unref (peer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!linked) {
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GST_DEBUG_OBJECT (bit->bin, "element %s not linked on any sinkpads",
|
2005-10-08 18:01:04 +00:00
|
|
|
GST_ELEMENT_NAME (element));
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* find the next best element not handled yet. This is the one
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
* with the lowest non-negative degree */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
static void
|
|
|
|
find_element (GstElement * element, GstBinSortIterator * bit)
|
|
|
|
{
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
gint degree;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
|
|
|
/* element is already handled */
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
if ((degree = HASH_GET_DEGREE (bit, element)) < 0)
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
return;
|
|
|
|
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* first element or element with smaller degree */
|
|
|
|
if (bit->best == NULL || bit->best_deg > degree) {
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
bit->best = element;
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
bit->best_deg = degree;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get next element in iterator. the returned element has the
|
|
|
|
* refcount increased */
|
|
|
|
static GstIteratorResult
|
|
|
|
gst_bin_sort_iterator_next (GstBinSortIterator * bit, gpointer * result)
|
|
|
|
{
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GstBin *bin = bit->bin;
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* empty queue, we have to find a next best element */
|
|
|
|
if (g_queue_is_empty (bit->queue)) {
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GstElement *best;
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
bit->best = NULL;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
bit->best_deg = G_MAXINT;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
g_list_foreach (bin->children, (GFunc) find_element, bit);
|
|
|
|
if ((best = bit->best)) {
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
if (bit->best_deg != 0) {
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* we don't fail on this one yet */
|
2007-08-16 10:27:16 +00:00
|
|
|
GST_WARNING_OBJECT (bin, "loop dected in graph");
|
|
|
|
g_warning ("loop detected in the graph of bin %s!!",
|
|
|
|
GST_ELEMENT_NAME (bin));
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
gst/gstbin.c: Some documentation updates.
Original commit message from CVS:
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Some documentation updates.
Clean up dispose handlers.
* gst/gstobject.c: (gst_object_ref), (gst_object_unref):
* gst/gstpad.c: (gst_pad_dispose):
Clean up dispose handler.
* gst/gstpipeline.c: (gst_pipeline_change_state):
Removed spurious UNLOCK.
2005-09-28 11:03:58 +00:00
|
|
|
/* best unhandled element, schedule as next element */
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "queue empty, next best: %s",
|
|
|
|
GST_ELEMENT_NAME (best));
|
|
|
|
gst_object_ref (best);
|
|
|
|
HASH_SET_DEGREE (bit, best, -1);
|
|
|
|
*result = best;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
} else {
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "queue empty, elements exhausted");
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* no more unhandled elements, we are done */
|
|
|
|
return GST_ITERATOR_DONE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* everything added to the queue got reffed */
|
|
|
|
*result = g_queue_pop_head (bit->queue);
|
|
|
|
}
|
|
|
|
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "queue head gives %s", GST_ELEMENT_NAME (*result));
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* update degrees of linked elements */
|
|
|
|
update_degree (GST_ELEMENT_CAST (*result), bit);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
|
|
|
return GST_ITERATOR_OK;
|
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* clear queues, recalculate the degrees and restart. */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
static void
|
|
|
|
gst_bin_sort_iterator_resync (GstBinSortIterator * bit)
|
|
|
|
{
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GstBin *bin = bit->bin;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "resync");
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
clear_queue (bit->queue);
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* reset degrees */
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
g_list_foreach (bin->children, (GFunc) reset_degree, bit);
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* calc degrees, incrementing */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
bit->mode = 1;
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
g_list_foreach (bin->children, (GFunc) update_degree, bit);
|
gst/gstbin.c: Small doc fixes. get_clock -> provide_clock.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
(add_to_queue), (clear_queue), (reset_degree), (update_degree),
(find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state), (gst_bin_dispose):
Small doc fixes. get_clock -> provide_clock.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_provides_clock), (gst_element_provide_clock),
(gst_element_get_clock), (gst_element_commit_state),
(gst_element_lost_state):
* gst/gstelement.h:
Make get/set_clock() symetric. Add provide_clock vmethod since
that is actually what this function does.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func),
(gst_pipeline_get_clock):
get_clock -> provide_clock.
2005-09-28 13:41:27 +00:00
|
|
|
/* for the rest of the function we decrement the degrees */
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
bit->mode = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear queues, unref bin and free iterator. */
|
|
|
|
static void
|
|
|
|
gst_bin_sort_iterator_free (GstBinSortIterator * bit)
|
|
|
|
{
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
GstBin *bin = bit->bin;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "free");
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
clear_queue (bit->queue);
|
|
|
|
g_queue_free (bit->queue);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstelement.h:
Remove element variable, we keep element info in the iterator now.
2005-09-27 17:00:13 +00:00
|
|
|
g_hash_table_destroy (bit->hash);
|
gst/base/gstbasesink.c: Speed up current position calculation.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_get_position),
(gst_base_sink_query):
Speed up current position calculation.
* gst/base/gstbasesrc.c: (gst_base_src_query),
(gst_base_src_default_newsegment):
Correctly set stream position in newsegment.
* gst/gstbin.c: (gst_bin_add_func), (add_to_queue),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free):
* gst/gstmessage.c: (gst_message_new_custom):
Clean up debugging info
* gst/gstqueue.c: (gst_queue_link_src), (gst_queue_chain),
(gst_queue_loop), (gst_queue_handle_src_query):
Pause task faster.
2005-10-20 11:48:53 +00:00
|
|
|
gst_object_unref (bin);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
g_free (bit);
|
|
|
|
}
|
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
/* should be called with the bin LOCK held */
|
|
|
|
static GstIterator *
|
|
|
|
gst_bin_sort_iterator_new (GstBin * bin)
|
|
|
|
{
|
|
|
|
GstBinSortIterator *result;
|
|
|
|
|
|
|
|
/* we don't need an ItemFunction because we ref the items in the _next
|
|
|
|
* method already */
|
|
|
|
result = (GstBinSortIterator *)
|
|
|
|
gst_iterator_new (sizeof (GstBinSortIterator),
|
|
|
|
GST_TYPE_ELEMENT,
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_GET_LOCK (bin),
|
2005-11-17 14:51:11 +00:00
|
|
|
&bin->children_cookie,
|
|
|
|
(GstIteratorNextFunction) gst_bin_sort_iterator_next,
|
|
|
|
(GstIteratorItemFunction) NULL,
|
|
|
|
(GstIteratorResyncFunction) gst_bin_sort_iterator_resync,
|
|
|
|
(GstIteratorFreeFunction) gst_bin_sort_iterator_free);
|
|
|
|
result->queue = g_queue_new ();
|
|
|
|
result->hash = g_hash_table_new (NULL, NULL);
|
|
|
|
gst_object_ref (bin);
|
|
|
|
result->bin = bin;
|
|
|
|
gst_bin_sort_iterator_resync (result);
|
|
|
|
|
|
|
|
return (GstIterator *) result;
|
|
|
|
}
|
|
|
|
|
2005-06-27 18:11:24 +00:00
|
|
|
/**
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
* gst_bin_iterate_sorted:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2005-06-27 18:11:24 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Gets an iterator for the elements in this bin in topologically
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
* sorted order. This means that the elements are returned from
|
|
|
|
* the most downstream elements (sinks) to the sources.
|
|
|
|
*
|
2005-10-15 15:30:24 +00:00
|
|
|
* This function is used internally to perform the state changes
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
* of the bin elements.
|
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Each element yielded by the iterator will have its refcount increased, so
|
|
|
|
* unref after use.
|
2005-06-27 18:11:24 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* MT safe. Caller owns returned value.
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns: a #GstIterator of #GstElement, or NULL
|
2005-06-27 18:11:24 +00:00
|
|
|
*/
|
|
|
|
GstIterator *
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
gst_bin_iterate_sorted (GstBin * bin)
|
2005-06-27 18:11:24 +00:00
|
|
|
{
|
2005-11-17 14:51:11 +00:00
|
|
|
GstIterator *result;
|
2005-06-27 18:11:24 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-11-17 14:51:11 +00:00
|
|
|
result = gst_bin_sort_iterator_new (bin);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-06-27 18:11:24 +00:00
|
|
|
|
2005-11-17 14:51:11 +00:00
|
|
|
return result;
|
2005-06-27 18:11:24 +00:00
|
|
|
}
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
static GstStateChangeReturn
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
gst_bin_element_set_state (GstBin * bin, GstElement * element,
|
|
|
|
GstClockTime base_time, GstState current, GstState next)
|
2005-06-30 09:41:15 +00:00
|
|
|
{
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
gboolean locked;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GList *found;
|
2005-08-17 16:33:27 +00:00
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* peel off the locked flag */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
renamed GST_FLAGS macros to GST_OBJECT_FLAGS moved bitshift from macro to enum definition
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
* docs/gst/gstreamer-sections.txt:
* gst/base/gstbasesink.c: (gst_base_sink_init):
* gst/base/gstbasesrc.c: (gst_base_src_init),
(gst_base_src_get_range), (gst_base_src_check_get_range),
(gst_base_src_start), (gst_base_src_stop):
* gst/base/gstbasesrc.h:
* gst/elements/gstfakesrc.c: (gst_fake_src_set_property):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(bin_element_is_sink), (reset_degree), (gst_bin_element_set_state),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstbuffer.h:
* gst/gstbus.c: (gst_bus_post), (gst_bus_set_flushing):
* gst/gstbus.h:
* gst/gstelement.c: (gst_element_is_locked_state),
(gst_element_set_locked_state), (gst_element_commit_state),
(gst_element_set_state):
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_init):
* gst/gstindex.h:
* gst/gstminiobject.h:
* gst/gstobject.c: (gst_object_init), (gst_object_sink),
(gst_object_set_parent):
* gst/gstobject.h:
* gst/gstpad.c: (gst_pad_set_blocked_async), (gst_pad_is_blocked),
(gst_pad_get_caps_unlocked), (gst_pad_set_caps):
* gst/gstpad.h:
* gst/gstpadtemplate.h:
* gst/gstpipeline.c: (gst_pipeline_provide_clock_func),
(gst_pipeline_use_clock), (gst_pipeline_auto_clock):
* gst/gstpipeline.h:
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(gst_file_index_commit):
* testsuite/bytestream/filepadsink.c: (gst_fp_sink_init):
* testsuite/pad/link.c: (gst_test_src_init),
(gst_test_filter_init), (gst_test_sink_init):
* testsuite/states/locked.c: (main):
renamed GST_FLAGS macros to GST_OBJECT_FLAGS
moved bitshift from macro to enum definition
2005-10-12 14:28:39 +00:00
|
|
|
locked = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_LOCKED_STATE);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* get previous state return */
|
|
|
|
ret = GST_STATE_RETURN (element);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
2005-06-30 09:41:15 +00:00
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* skip locked elements */
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
if (G_UNLIKELY (locked))
|
|
|
|
goto locked;
|
|
|
|
|
2007-08-14 13:37:16 +00:00
|
|
|
/* if the element was no preroll, just start changing the state regardless
|
|
|
|
* if it had async elements (in the case of a bin) because they won't preroll
|
|
|
|
* anyway. */
|
|
|
|
if (G_UNLIKELY (ret == GST_STATE_CHANGE_NO_PREROLL)) {
|
|
|
|
GST_DEBUG_OBJECT (element, "element is NO_PREROLL, ignore async elements");
|
|
|
|
goto no_preroll;
|
|
|
|
}
|
|
|
|
|
2007-06-07 10:11:47 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
/* the element was busy with an upwards async state change, we must wait for
|
|
|
|
* an ASYNC_DONE message before we attemp to change the state. */
|
2007-06-07 10:11:47 +00:00
|
|
|
if ((found =
|
|
|
|
find_message (bin, GST_OBJECT_CAST (element),
|
|
|
|
GST_MESSAGE_ASYNC_START))) {
|
2007-04-23 07:30:38 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GstMessage *message = GST_MESSAGE_CAST (found->data);
|
2007-03-21 11:52:04 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "element message %p, %s async busy",
|
2007-04-23 07:30:38 +00:00
|
|
|
message, GST_ELEMENT_NAME (GST_MESSAGE_SRC (message)));
|
2007-06-07 10:11:47 +00:00
|
|
|
#endif
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
/* only wait for upward state changes */
|
2007-03-21 11:52:04 +00:00
|
|
|
if (next > current) {
|
|
|
|
/* We found an async element check if we can force its state to change or
|
|
|
|
* if we have to wait for it to preroll. */
|
|
|
|
if (G_UNLIKELY (!enable_latency)) {
|
|
|
|
g_warning ("Future versions of GStreamer will wait for element \"%s\"\n"
|
|
|
|
"\tto preroll in order to perform correct latency calculations.\n"
|
|
|
|
"\tPlease verify that the application continues to work correctly by\n"
|
|
|
|
"\tsetting the environment variable GST_COMPAT to a value containing\n"
|
|
|
|
"\tthe string 'live-preroll'.", GST_ELEMENT_NAME (element));
|
|
|
|
goto no_latency;
|
|
|
|
}
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
goto was_busy;
|
2007-03-21 11:52:04 +00:00
|
|
|
}
|
2005-06-30 09:41:15 +00:00
|
|
|
}
|
2007-03-21 11:52:04 +00:00
|
|
|
no_latency:
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
|
2007-08-14 13:37:16 +00:00
|
|
|
no_preroll:
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_DEBUG_OBJECT (bin,
|
|
|
|
"setting element %s to %s, base_time %" GST_TIME_FORMAT,
|
|
|
|
GST_ELEMENT_NAME (element), gst_element_state_get_name (next),
|
|
|
|
GST_TIME_ARGS (base_time));
|
|
|
|
|
|
|
|
/* set base_time on child */
|
|
|
|
gst_element_set_base_time (element, base_time);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
|
|
|
/* change state */
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
ret = gst_element_set_state (element, next);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
|
|
|
return ret;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
|
|
|
locked:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (element,
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
"element is locked, return previous return %s",
|
|
|
|
gst_element_state_change_return_get_name (ret));
|
|
|
|
return ret;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
|
|
|
was_busy:
|
|
|
|
{
|
2007-08-14 14:10:36 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "element was busy, delaying state change");
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
return GST_STATE_CHANGE_ASYNC;
|
|
|
|
}
|
2005-06-30 09:41:15 +00:00
|
|
|
}
|
|
|
|
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
/* gst_iterator_fold functions for pads_activate
|
|
|
|
* Note how we don't stop the iterator when we fail an activation. This is
|
|
|
|
* probably a FIXME since when one pad activation fails, we don't want to
|
|
|
|
* continue our state change. */
|
|
|
|
static gboolean
|
|
|
|
activate_pads (GstPad * pad, GValue * ret, gboolean * active)
|
|
|
|
{
|
|
|
|
if (!gst_pad_set_active (pad, *active))
|
|
|
|
g_value_set_boolean (ret, FALSE);
|
|
|
|
else if (!*active)
|
|
|
|
gst_pad_set_caps (pad, NULL);
|
|
|
|
|
|
|
|
/* unref the object that was reffed for us by _fold */
|
|
|
|
gst_object_unref (pad);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns false on error or early cutout (will never happen because the fold
|
|
|
|
* function always returns TRUE, see FIXME above) of the fold, true if all
|
|
|
|
* pads in @iter were (de)activated successfully. */
|
|
|
|
static gboolean
|
|
|
|
iterator_activate_fold_with_resync (GstIterator * iter, gpointer user_data)
|
|
|
|
{
|
|
|
|
GstIteratorResult ires;
|
|
|
|
GValue ret = { 0 };
|
|
|
|
|
|
|
|
/* no need to unset this later, it's just a boolean */
|
|
|
|
g_value_init (&ret, G_TYPE_BOOLEAN);
|
|
|
|
g_value_set_boolean (&ret, TRUE);
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
ires = gst_iterator_fold (iter, (GstIteratorFoldFunction) activate_pads,
|
|
|
|
&ret, user_data);
|
|
|
|
switch (ires) {
|
|
|
|
case GST_ITERATOR_RESYNC:
|
|
|
|
/* need to reset the result again */
|
|
|
|
g_value_set_boolean (&ret, TRUE);
|
|
|
|
gst_iterator_resync (iter);
|
|
|
|
break;
|
|
|
|
case GST_ITERATOR_DONE:
|
|
|
|
/* all pads iterated, return collected value */
|
|
|
|
goto done;
|
|
|
|
default:
|
2007-04-23 07:30:38 +00:00
|
|
|
/* iterator returned _ERROR or premature end with _OK,
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
* mark an error and exit */
|
|
|
|
g_value_set_boolean (&ret, FALSE);
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
done:
|
|
|
|
/* return collected value */
|
|
|
|
return g_value_get_boolean (&ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* is called with STATE_LOCK
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_bin_src_pads_activate (GstBin * bin, gboolean active)
|
|
|
|
{
|
|
|
|
GstIterator *iter;
|
|
|
|
gboolean fold_ok;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "src_pads_activate with active %d", active);
|
|
|
|
|
|
|
|
iter = gst_element_iterate_src_pads ((GstElement *) bin);
|
|
|
|
fold_ok = iterator_activate_fold_with_resync (iter, &active);
|
|
|
|
gst_iterator_free (iter);
|
|
|
|
if (G_UNLIKELY (!fold_ok))
|
|
|
|
goto failed;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "pads_activate successful");
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (bin, "source pads_activate failed");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2007-09-13 21:27:33 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
do_bin_latency (GstElement * element)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
GstClockTime min_latency, max_latency;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (element, "querying latency");
|
|
|
|
|
|
|
|
query = gst_query_new_latency ();
|
|
|
|
if ((res = gst_element_query (element, query))) {
|
|
|
|
gboolean live;
|
|
|
|
|
|
|
|
gst_query_parse_latency (query, &live, &min_latency, &max_latency);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (element,
|
|
|
|
"got min latency %" GST_TIME_FORMAT ", max latency %"
|
|
|
|
GST_TIME_FORMAT ", live %d", GST_TIME_ARGS (min_latency),
|
|
|
|
GST_TIME_ARGS (max_latency), live);
|
|
|
|
|
|
|
|
if (max_latency < min_latency) {
|
|
|
|
/* this is an impossible situation, some parts of the pipeline might not
|
|
|
|
* work correctly. We post a warning for now. */
|
|
|
|
GST_ELEMENT_WARNING (element, CORE, CLOCK, (NULL),
|
|
|
|
("Impossible to configure latency: max %" GST_TIME_FORMAT " < min %"
|
|
|
|
GST_TIME_FORMAT ". Add queues or other buffering elements.",
|
|
|
|
GST_TIME_ARGS (max_latency), GST_TIME_ARGS (min_latency)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* configure latency on elements */
|
|
|
|
res = gst_element_send_event (element, gst_event_new_latency (min_latency));
|
|
|
|
if (res) {
|
|
|
|
GST_INFO_OBJECT (element, "configured latency of %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min_latency));
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (element,
|
|
|
|
"failed to configure latency of %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min_latency));
|
|
|
|
GST_ELEMENT_WARNING (element, CORE, CLOCK, (NULL),
|
|
|
|
("Failed to configure latency of %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (min_latency)));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* this is not a real problem, we just don't configure any latency. */
|
|
|
|
GST_WARNING_OBJECT (element, "failed to query latency");
|
|
|
|
}
|
|
|
|
gst_query_unref (query);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
static GstStateChangeReturn
|
2005-10-10 11:52:58 +00:00
|
|
|
gst_bin_change_state_func (GstElement * element, GstStateChange transition)
|
2004-07-12 21:27:11 +00:00
|
|
|
{
|
2005-03-28 14:54:33 +00:00
|
|
|
GstBin *bin;
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret;
|
2005-10-10 11:52:58 +00:00
|
|
|
GstState current, next;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
gboolean have_async;
|
|
|
|
gboolean have_no_preroll;
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
GstClockTime base_time;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
GstIterator *it;
|
|
|
|
gboolean done;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
/* we don't need to take the STATE_LOCK, it is already taken */
|
2006-10-06 14:46:04 +00:00
|
|
|
current = (GstState) GST_STATE_TRANSITION_CURRENT (transition);
|
|
|
|
next = (GstState) GST_STATE_TRANSITION_NEXT (transition);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"changing state of children from %s to %s",
|
2005-10-10 11:52:58 +00:00
|
|
|
gst_element_state_get_name (current), gst_element_state_get_name (next));
|
2005-03-28 14:54:33 +00:00
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
bin = GST_BIN_CAST (element);
|
|
|
|
|
2005-11-21 19:13:13 +00:00
|
|
|
switch (next) {
|
2007-09-13 21:27:33 +00:00
|
|
|
case GST_STATE_PLAYING:
|
|
|
|
{
|
|
|
|
gboolean toplevel;
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
toplevel = BIN_IS_TOPLEVEL (bin);
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
|
|
|
|
if (toplevel)
|
|
|
|
do_bin_latency (element);
|
|
|
|
break;
|
|
|
|
}
|
2005-11-21 19:13:13 +00:00
|
|
|
case GST_STATE_PAUSED:
|
|
|
|
/* Clear EOS list on next PAUSED */
|
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
GST_DEBUG_OBJECT (element, "clearing EOS elements");
|
|
|
|
bin_remove_messages (bin, NULL, GST_MESSAGE_EOS);
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
if (current == GST_STATE_READY)
|
|
|
|
if (!(gst_bin_src_pads_activate (bin, TRUE)))
|
|
|
|
goto activate_failure;
|
2005-11-21 19:13:13 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_READY:
|
|
|
|
/* Clear message list on next READY */
|
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
GST_DEBUG_OBJECT (element, "clearing all cached messages");
|
|
|
|
bin_remove_messages (bin, NULL, GST_MESSAGE_ANY);
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
if (current == GST_STATE_PAUSED)
|
|
|
|
if (!(gst_bin_src_pads_activate (bin, FALSE)))
|
|
|
|
goto activate_failure;
|
|
|
|
break;
|
|
|
|
case GST_STATE_NULL:
|
|
|
|
if (current == GST_STATE_READY)
|
|
|
|
if (!(gst_bin_src_pads_activate (bin, FALSE)))
|
|
|
|
goto activate_failure;
|
2005-11-21 19:13:13 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
}
|
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
bin->polling = TRUE;
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
/* iterate in state change order */
|
|
|
|
it = gst_bin_iterate_sorted (bin);
|
2005-06-30 09:41:15 +00:00
|
|
|
|
2007-08-02 11:15:46 +00:00
|
|
|
/* mark if we've seen an ASYNC element in the bin when we did a state change.
|
|
|
|
* Note how we don't reset this value when a resync happens, the reason being
|
|
|
|
* that the async element posted ASYNC_START and we want to post ASYNC_DONE
|
|
|
|
* even after a resync when the async element is gone */
|
|
|
|
have_async = FALSE;
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
restart:
|
2007-02-20 10:45:13 +00:00
|
|
|
/* take base_time */
|
2005-10-08 18:01:04 +00:00
|
|
|
base_time = gst_element_get_base_time (element);
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
have_no_preroll = FALSE;
|
2005-05-14 15:54:49 +00:00
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
done = FALSE;
|
|
|
|
while (!done) {
|
|
|
|
gpointer data;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
switch (gst_iterator_next (it, &data)) {
|
|
|
|
case GST_ITERATOR_OK:
|
|
|
|
{
|
2005-10-08 18:01:04 +00:00
|
|
|
GstElement *child;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
2005-10-08 18:01:04 +00:00
|
|
|
child = GST_ELEMENT_CAST (data);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
/* set state and base_time now */
|
|
|
|
ret = gst_bin_element_set_state (bin, child, base_time, current, next);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
|
|
|
|
switch (ret) {
|
|
|
|
case GST_STATE_CHANGE_SUCCESS:
|
2005-10-08 18:01:04 +00:00
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
"child '%s' changed state to %d(%s) successfully",
|
2005-10-10 11:52:58 +00:00
|
|
|
GST_ELEMENT_NAME (child), next,
|
|
|
|
gst_element_state_get_name (next));
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_ASYNC:
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
{
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
2007-02-20 10:45:13 +00:00
|
|
|
"child '%s' is changing state asynchronously to %s",
|
|
|
|
GST_ELEMENT_NAME (child), gst_element_state_get_name (next));
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
have_async = TRUE;
|
|
|
|
break;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
case GST_STATE_CHANGE_FAILURE:
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"child '%s' failed to go to state %d(%s)",
|
2005-10-08 18:01:04 +00:00
|
|
|
GST_ELEMENT_NAME (child),
|
2005-10-10 11:52:58 +00:00
|
|
|
next, gst_element_state_get_name (next));
|
2005-10-08 18:01:04 +00:00
|
|
|
gst_object_unref (child);
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
goto done;
|
|
|
|
case GST_STATE_CHANGE_NO_PREROLL:
|
2005-10-08 18:01:04 +00:00
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
"child '%s' changed state to %d(%s) successfully without preroll",
|
2005-10-10 11:52:58 +00:00
|
|
|
GST_ELEMENT_NAME (child), next,
|
|
|
|
gst_element_state_get_name (next));
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
have_no_preroll = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
2005-10-08 18:01:04 +00:00
|
|
|
gst_object_unref (child);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
}
|
|
|
|
case GST_ITERATOR_RESYNC:
|
2005-09-30 08:00:12 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_STATES, "iterator doing resync");
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
gst_iterator_resync (it);
|
|
|
|
goto restart;
|
2005-03-28 14:54:33 +00:00
|
|
|
default:
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
case GST_ITERATOR_DONE:
|
2005-09-30 08:00:12 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_STATES, "iterator done");
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
done = TRUE;
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
ret = parent_class->change_state (element, transition);
|
2007-02-20 10:45:13 +00:00
|
|
|
if (G_UNLIKELY (ret == GST_STATE_CHANGE_FAILURE))
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
goto done;
|
|
|
|
|
2005-06-23 10:37:09 +00:00
|
|
|
if (have_no_preroll) {
|
2005-09-02 15:42:00 +00:00
|
|
|
ret = GST_STATE_CHANGE_NO_PREROLL;
|
2005-06-23 10:37:09 +00:00
|
|
|
} else if (have_async) {
|
2005-09-02 15:42:00 +00:00
|
|
|
ret = GST_STATE_CHANGE_ASYNC;
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
|
|
|
|
check/gst/gstbin.c: Enable check that works now.
Original commit message from CVS:
* check/gst/gstbin.c: (GST_START_TEST):
Enable check that works now.
* gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree),
(update_outdegree), (find_element), (gst_bin_sort_iterator_next),
(gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free),
(gst_bin_iterate_sorted), (gst_bin_element_set_state),
(gst_bin_change_state):
* gst/gstbin.h:
Redid the state change algorithm using a topological sort algo.
Handles all cases correctly.
Exposed iterator for state change order.
* gst/gstelement.h:
Temp storage for state changes. Need to get rid of this soon.
2005-09-27 16:16:39 +00:00
|
|
|
done:
|
2005-10-08 18:01:04 +00:00
|
|
|
gst_iterator_free (it);
|
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
bin->polling = FALSE;
|
|
|
|
if (ret != GST_STATE_CHANGE_ASYNC) {
|
2007-08-02 11:15:46 +00:00
|
|
|
/* no element returned ASYNC, we can just complete. */
|
2007-06-19 10:41:33 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "no async elements");
|
|
|
|
goto state_end;
|
|
|
|
}
|
2007-08-02 11:15:46 +00:00
|
|
|
/* when we get here an ASYNC element was found */
|
2007-06-19 10:41:33 +00:00
|
|
|
if (GST_STATE_TARGET (bin) <= GST_STATE_READY) {
|
2007-08-02 11:15:46 +00:00
|
|
|
/* we ignore ASYNC state changes when we go to READY or NULL */
|
2007-06-19 10:41:33 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "target state %s <= READY",
|
|
|
|
gst_element_state_get_name (GST_STATE_TARGET (bin)));
|
|
|
|
goto state_end;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "check async elements");
|
|
|
|
/* check if all elements managed to commit their state already */
|
|
|
|
if (!find_message (bin, NULL, GST_MESSAGE_ASYNC_START)) {
|
2007-08-02 11:15:46 +00:00
|
|
|
/* nothing found, remove all old ASYNC_DONE messages. This can happen when
|
|
|
|
* all the elements commited their state while we were doing the state
|
|
|
|
* change. We will still return ASYNC for consistency but we commit the
|
|
|
|
* state already so that a _get_state() will return immediatly. */
|
2007-06-19 10:41:33 +00:00
|
|
|
bin_remove_messages (bin, NULL, GST_MESSAGE_ASYNC_DONE);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "async elements commited");
|
|
|
|
bin_handle_async_done (bin, GST_STATE_CHANGE_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
state_end:
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
"done changing bin's state from %s to %s, now in %s, ret %s",
|
2005-10-10 11:52:58 +00:00
|
|
|
gst_element_state_get_name (current),
|
|
|
|
gst_element_state_get_name (next),
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
gst_element_state_get_name (GST_STATE (element)),
|
|
|
|
gst_element_state_change_return_get_name (ret));
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
return ret;
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
|
2007-02-20 10:45:13 +00:00
|
|
|
/* ERRORS */
|
gst/gstbin.c: (de)activate src pads before calling state_change on the childs.
Original commit message from CVS:
* gst/gstbin.c: (activate_pads),
(iterator_activate_fold_with_resync), (gst_bin_src_pads_activate),
(gst_bin_change_state_func):
(de)activate src pads before calling state_change on the childs.
This is to avoid the case where a src ghostpad is blocked (holding the
stream lock), which would block the deactivation of the ghostpad's
target pad.
* gst/gstghostpad.c: (gst_proxy_pad_do_query_type),
(gst_proxy_pad_do_event), (gst_proxy_pad_do_query),
(gst_proxy_pad_do_internal_link), (gst_proxy_pad_do_bufferalloc),
(gst_proxy_pad_do_chain), (gst_proxy_pad_do_getrange),
(gst_proxy_pad_do_checkgetrange), (gst_proxy_pad_do_getcaps),
(gst_proxy_pad_do_acceptcaps), (gst_proxy_pad_do_fixatecaps),
(gst_proxy_pad_do_setcaps), (gst_proxy_pad_set_target_unlocked),
(gst_proxy_pad_set_target), (gst_proxy_pad_get_internal),
(gst_proxy_pad_dispose), (gst_proxy_pad_init),
(gst_ghost_pad_parent_set), (gst_ghost_pad_parent_unset),
(gst_ghost_pad_class_init),
(gst_ghost_pad_internal_do_activate_push),
(gst_ghost_pad_internal_do_activate_pull),
(gst_ghost_pad_do_activate_push), (gst_ghost_pad_do_activate_pull),
(gst_ghost_pad_do_link), (gst_ghost_pad_do_unlink),
(gst_ghost_pad_dispose), (gst_ghost_pad_new_no_target),
(gst_ghost_pad_new), (gst_ghost_pad_set_target):
GhostPads now create their internal GstProxyPad at creation (and not
when they're linked, as it was being done previously).
The internal and target pads are linked straight away.
The data will also travel through the other pad in order to make
pad blocking and probes non-hackish (the probe/block now really happens
on the GhostPad and not on the target).
* gst/gstpad.c: (gst_pad_set_blocked_async),
(gst_pad_link_prepare), (gst_pad_push_event):
Remove previous ghostpad cruft.
* gst/gstutils.c: (gst_pad_add_data_probe),
(gst_pad_add_event_probe), (gst_pad_add_buffer_probe),
(gst_pad_remove_data_probe), (gst_pad_remove_event_probe),
(gst_pad_remove_buffer_probe):
Remove previous ghost pad cruft.
Added more detailed debug statements.
* tests/check/gst/gstghostpad.c: (GST_START_TEST):
Fix the testsuite for refcounting changes.
The comments about who has references were correct, but the refcount
being checked wasn't the same (!?!).
2006-07-11 16:20:09 +00:00
|
|
|
activate_failure:
|
2007-02-20 10:45:13 +00:00
|
|
|
{
|
|
|
|
GST_CAT_WARNING_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"failure (de)activating src pads");
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Add default event/set_manager handlers. The set_manager handler takes care that the manager is distribu...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_manager),
(gst_bin_send_event):
Add default event/set_manager handlers. The set_manager handler
takes care that the manager is distributed over kids that were
already in the bin before the manager was set. The event handler
is a utility virtual function that sends the event over all sinks,
so that gst_element_send_event (bin, event); has the expected
behaviour.
* gst/gstpad.c: (gst_pad_event_default):
Re-install default event handling for discontinuities, so that
seeking works without requiring hacks in applications or extra
code in sinks.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_send_event):
Half hack, half utility: set a pipeline to PAUSED for seek events,
since that is the only way we can guarantee a/v sync. Means that
you can do gst_element_seek (pipeline, method, pos); on a pipeline
and it "just works".
2005-03-25 09:57:42 +00:00
|
|
|
/*
|
|
|
|
* This function is a utility event handler for seek events.
|
2006-04-28 18:55:17 +00:00
|
|
|
* It will send the event to all sinks or sources depending on the
|
|
|
|
* event-direction.
|
|
|
|
*
|
gst/gstbin.c: Add default event/set_manager handlers. The set_manager handler takes care that the manager is distribu...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_manager),
(gst_bin_send_event):
Add default event/set_manager handlers. The set_manager handler
takes care that the manager is distributed over kids that were
already in the bin before the manager was set. The event handler
is a utility virtual function that sends the event over all sinks,
so that gst_element_send_event (bin, event); has the expected
behaviour.
* gst/gstpad.c: (gst_pad_event_default):
Re-install default event handling for discontinuities, so that
seeking works without requiring hacks in applications or extra
code in sinks.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_send_event):
Half hack, half utility: set a pipeline to PAUSED for seek events,
since that is the only way we can guarantee a/v sync. Means that
you can do gst_element_seek (pipeline, method, pos); on a pipeline
and it "just works".
2005-03-25 09:57:42 +00:00
|
|
|
* Applications are free to override this behaviour and
|
|
|
|
* implement their own seek handler, but this will work for
|
|
|
|
* pretty much all cases in practice.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_bin_send_event (GstElement * element, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstBin *bin = GST_BIN (element);
|
|
|
|
GstIterator *iter;
|
|
|
|
gboolean res = TRUE;
|
2005-03-28 14:54:33 +00:00
|
|
|
gboolean done = FALSE;
|
gst/gstbin.c: Add default event/set_manager handlers. The set_manager handler takes care that the manager is distribu...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_manager),
(gst_bin_send_event):
Add default event/set_manager handlers. The set_manager handler
takes care that the manager is distributed over kids that were
already in the bin before the manager was set. The event handler
is a utility virtual function that sends the event over all sinks,
so that gst_element_send_event (bin, event); has the expected
behaviour.
* gst/gstpad.c: (gst_pad_event_default):
Re-install default event handling for discontinuities, so that
seeking works without requiring hacks in applications or extra
code in sinks.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_send_event):
Half hack, half utility: set a pipeline to PAUSED for seek events,
since that is the only way we can guarantee a/v sync. Means that
you can do gst_element_seek (pipeline, method, pos); on a pipeline
and it "just works".
2005-03-25 09:57:42 +00:00
|
|
|
|
2006-01-26 06:57:14 +00:00
|
|
|
if (GST_EVENT_IS_DOWNSTREAM (event)) {
|
|
|
|
iter = gst_bin_iterate_sources (bin);
|
|
|
|
GST_DEBUG_OBJECT (bin, "Sending %s event to src children",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
|
|
|
} else {
|
|
|
|
iter = gst_bin_iterate_sinks (bin);
|
|
|
|
GST_DEBUG_OBJECT (bin, "Sending %s event to sink children",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
|
|
|
}
|
gst/gstbin.c: Add default event/set_manager handlers. The set_manager handler takes care that the manager is distribu...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_manager),
(gst_bin_send_event):
Add default event/set_manager handlers. The set_manager handler
takes care that the manager is distributed over kids that were
already in the bin before the manager was set. The event handler
is a utility virtual function that sends the event over all sinks,
so that gst_element_send_event (bin, event); has the expected
behaviour.
* gst/gstpad.c: (gst_pad_event_default):
Re-install default event handling for discontinuities, so that
seeking works without requiring hacks in applications or extra
code in sinks.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_send_event):
Half hack, half utility: set a pipeline to PAUSED for seek events,
since that is the only way we can guarantee a/v sync. Means that
you can do gst_element_seek (pipeline, method, pos); on a pipeline
and it "just works".
2005-03-25 09:57:42 +00:00
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
while (!done) {
|
|
|
|
gpointer data;
|
|
|
|
|
|
|
|
switch (gst_iterator_next (iter, &data)) {
|
|
|
|
case GST_ITERATOR_OK:
|
|
|
|
{
|
2006-01-26 06:57:14 +00:00
|
|
|
GstElement *child;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
gst_event_ref (event);
|
2006-01-26 06:57:14 +00:00
|
|
|
child = GST_ELEMENT_CAST (data);
|
|
|
|
res &= gst_element_send_event (child, event);
|
|
|
|
gst_object_unref (child);
|
2005-03-28 14:54:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_ITERATOR_RESYNC:
|
|
|
|
gst_iterator_resync (iter);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
case GST_ITERATOR_DONE:
|
|
|
|
done = TRUE;
|
|
|
|
break;
|
2006-01-26 06:57:14 +00:00
|
|
|
case GST_ITERATOR_ERROR:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
2005-03-28 14:54:33 +00:00
|
|
|
}
|
gst/gstbin.c: Add default event/set_manager handlers. The set_manager handler takes care that the manager is distribu...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_set_manager),
(gst_bin_send_event):
Add default event/set_manager handlers. The set_manager handler
takes care that the manager is distributed over kids that were
already in the bin before the manager was set. The event handler
is a utility virtual function that sends the event over all sinks,
so that gst_element_send_event (bin, event); has the expected
behaviour.
* gst/gstpad.c: (gst_pad_event_default):
Re-install default event handling for discontinuities, so that
seeking works without requiring hacks in applications or extra
code in sinks.
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_send_event):
Half hack, half utility: set a pipeline to PAUSED for seek events,
since that is the only way we can guarantee a/v sync. Means that
you can do gst_element_seek (pipeline, method, pos); on a pipeline
and it "just works".
2005-03-25 09:57:42 +00:00
|
|
|
}
|
|
|
|
gst_iterator_free (iter);
|
|
|
|
gst_event_unref (event);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-10-18 15:15:11 +00:00
|
|
|
static void
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
gst_bin_continue_func (BinContinueData * data)
|
2005-10-18 15:15:11 +00:00
|
|
|
{
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
GstBin *bin;
|
2007-09-17 17:17:29 +00:00
|
|
|
GstState current, next, pending;
|
|
|
|
GstStateChange transition;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
bin = data->bin;
|
|
|
|
pending = data->pending;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "waiting for state lock");
|
2005-10-18 15:15:11 +00:00
|
|
|
GST_STATE_LOCK (bin);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "doing state continue");
|
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
|
2007-07-18 14:31:21 +00:00
|
|
|
if (data->cookie != GST_ELEMENT_CAST (bin)->state_cookie)
|
|
|
|
goto interrupted;
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
current = GST_STATE (bin);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
next = GST_STATE_GET_NEXT (current, pending);
|
|
|
|
transition = (GstStateChange) GST_STATE_TRANSITION (current, next);
|
|
|
|
|
|
|
|
GST_STATE_NEXT (bin) = next;
|
|
|
|
/* mark busy */
|
|
|
|
GST_STATE_RETURN (bin) = GST_STATE_CHANGE_ASYNC;
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin,
|
|
|
|
"continue state change %s to %s, final %s",
|
|
|
|
gst_element_state_get_name (current),
|
|
|
|
gst_element_state_get_name (next), gst_element_state_get_name (pending));
|
|
|
|
|
|
|
|
ret = gst_element_change_state (GST_ELEMENT_CAST (bin), transition);
|
|
|
|
|
2005-10-18 15:15:11 +00:00
|
|
|
GST_STATE_UNLOCK (bin);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "state continue done");
|
2005-10-18 15:15:11 +00:00
|
|
|
gst_object_unref (bin);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
g_free (data);
|
2007-07-18 14:31:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
interrupted:
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
GST_STATE_UNLOCK (bin);
|
|
|
|
GST_DEBUG_OBJECT (bin, "state continue aborted due to intervening change");
|
|
|
|
gst_object_unref (bin);
|
|
|
|
g_free (data);
|
2005-10-18 15:15:11 +00:00
|
|
|
}
|
|
|
|
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
static GstBusSyncReply
|
|
|
|
bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin)
|
|
|
|
{
|
|
|
|
GstBinClass *bclass;
|
|
|
|
|
|
|
|
bclass = GST_BIN_GET_CLASS (bin);
|
|
|
|
if (bclass->handle_message)
|
|
|
|
bclass->handle_message (bin, message);
|
|
|
|
else
|
|
|
|
gst_message_unref (message);
|
|
|
|
|
|
|
|
return GST_BUS_DROP;
|
|
|
|
}
|
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
static void
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
bin_push_state_continue (BinContinueData * data)
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
{
|
|
|
|
GstBinClass *klass;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
GstBin *bin;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* ref was taken */
|
|
|
|
bin = data->bin;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
klass = GST_BIN_GET_CLASS (bin);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "pushing continue on thread pool");
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
g_thread_pool_push (klass->pool, data, NULL);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* an element started an async state change, if we were not busy with a state
|
|
|
|
* change, we perform a lost state.
|
2007-09-13 21:27:33 +00:00
|
|
|
* This function is called with the OBJECT lock.
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
*/
|
|
|
|
static void
|
2007-08-14 14:10:36 +00:00
|
|
|
bin_handle_async_start (GstBin * bin, gboolean new_base_time)
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
{
|
|
|
|
GstState old_state, new_state;
|
2007-08-14 14:10:36 +00:00
|
|
|
gboolean toplevel;
|
|
|
|
GstMessage *amessage = NULL;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
|
|
|
if (GST_STATE_RETURN (bin) == GST_STATE_CHANGE_FAILURE)
|
|
|
|
goto had_error;
|
|
|
|
|
2007-08-14 14:10:36 +00:00
|
|
|
/* get our toplevel state */
|
|
|
|
toplevel = BIN_IS_TOPLEVEL (bin);
|
|
|
|
|
|
|
|
/* prepare an ASYNC_START message, we always post the start message even if we
|
|
|
|
* are busy with a state change or when we are NO_PREROLL. */
|
|
|
|
if (!toplevel)
|
|
|
|
/* non toplevel bin, prepare async-start for the parent */
|
|
|
|
amessage =
|
|
|
|
gst_message_new_async_start (GST_OBJECT_CAST (bin), new_base_time);
|
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
if (bin->polling || GST_STATE_PENDING (bin) != GST_STATE_VOID_PENDING)
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
goto was_busy;
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* async starts are ignored when we are NO_PREROLL */
|
|
|
|
if (GST_STATE_RETURN (bin) == GST_STATE_CHANGE_NO_PREROLL)
|
|
|
|
goto was_no_preroll;
|
|
|
|
|
2007-08-16 11:04:40 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
old_state = GST_STATE (bin);
|
|
|
|
|
2007-06-07 10:11:47 +00:00
|
|
|
/* when we PLAYING we go back to PAUSED, when preroll happens, we go back to
|
|
|
|
* PLAYING after optionally redistributing the base_time. */
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
if (old_state > GST_STATE_PAUSED)
|
|
|
|
new_state = GST_STATE_PAUSED;
|
|
|
|
else
|
|
|
|
new_state = old_state;
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin,
|
|
|
|
"lost state of %s, new %s", gst_element_state_get_name (old_state),
|
|
|
|
gst_element_state_get_name (new_state));
|
|
|
|
|
|
|
|
GST_STATE (bin) = new_state;
|
|
|
|
GST_STATE_NEXT (bin) = new_state;
|
|
|
|
GST_STATE_PENDING (bin) = new_state;
|
|
|
|
GST_STATE_RETURN (bin) = GST_STATE_CHANGE_ASYNC;
|
2007-06-19 10:41:33 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
/* post message */
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin),
|
|
|
|
gst_message_new_state_changed (GST_OBJECT_CAST (bin),
|
|
|
|
new_state, new_state, new_state));
|
|
|
|
|
2007-08-14 14:10:36 +00:00
|
|
|
post_start:
|
|
|
|
if (amessage) {
|
|
|
|
/* post our ASYNC_START. */
|
|
|
|
GST_DEBUG_OBJECT (bin, "posting ASYNC_START to parent");
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin), amessage);
|
|
|
|
}
|
2007-06-19 10:41:33 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
had_error:
|
|
|
|
{
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin, "we had an error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
was_busy:
|
|
|
|
{
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin, "state change busy");
|
2007-08-14 14:10:36 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
goto post_start;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
was_no_preroll:
|
|
|
|
{
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin, "ignoring, we are NO_PREROLL");
|
2007-08-14 14:10:36 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
goto post_start;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
}
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
|
|
|
|
2007-06-07 10:11:47 +00:00
|
|
|
/* this function is called when there are no more async elements in the bin. We
|
2007-09-13 21:27:33 +00:00
|
|
|
* post a state changed message and an ASYNC_DONE message.
|
|
|
|
* This function is called with the OBJECT lock.
|
|
|
|
*/
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
static void
|
2007-06-19 10:41:33 +00:00
|
|
|
bin_handle_async_done (GstBin * bin, GstStateChangeReturn ret)
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
{
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
GstState current, pending, target;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GstStateChangeReturn old_ret;
|
|
|
|
GstState old_state, old_next;
|
2007-06-07 10:11:47 +00:00
|
|
|
gboolean toplevel;
|
2007-06-19 10:41:33 +00:00
|
|
|
GstMessage *smessage = NULL, *amessage = NULL;
|
|
|
|
BinContinueData *cont = NULL;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
if (GST_STATE_RETURN (bin) == GST_STATE_CHANGE_FAILURE)
|
|
|
|
goto had_error;
|
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
pending = GST_STATE_PENDING (bin);
|
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
if (bin->polling)
|
|
|
|
goto was_busy;
|
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
/* check if there is something to commit */
|
|
|
|
if (pending == GST_STATE_VOID_PENDING)
|
|
|
|
goto nothing_pending;
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
old_ret = GST_STATE_RETURN (bin);
|
|
|
|
GST_STATE_RETURN (bin) = ret;
|
|
|
|
|
|
|
|
/* move to the next target state */
|
|
|
|
target = GST_STATE_TARGET (bin);
|
|
|
|
pending = GST_STATE_PENDING (bin) = target;
|
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
amessage = gst_message_new_async_done (GST_OBJECT_CAST (bin));
|
2007-06-07 10:11:47 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
old_state = GST_STATE (bin);
|
|
|
|
/* this is the state we should go to next */
|
|
|
|
old_next = GST_STATE_NEXT (bin);
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
if (old_next != GST_STATE_PLAYING) {
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin,
|
|
|
|
"committing state from %s to %s, old pending %s",
|
|
|
|
gst_element_state_get_name (old_state),
|
|
|
|
gst_element_state_get_name (old_next),
|
|
|
|
gst_element_state_get_name (pending));
|
|
|
|
|
|
|
|
/* update current state */
|
|
|
|
current = GST_STATE (bin) = old_next;
|
|
|
|
} else {
|
|
|
|
current = old_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get our toplevel state */
|
2007-08-02 11:15:46 +00:00
|
|
|
toplevel = BIN_IS_TOPLEVEL (bin);
|
2007-05-25 15:36:52 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* see if we reached the final state. If we are not toplevel, we also have to
|
|
|
|
* stop here, the parent will continue our state. */
|
|
|
|
if ((pending == current) || !toplevel) {
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin,
|
|
|
|
"completed state change, pending VOID");
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* mark VOID pending */
|
|
|
|
pending = GST_STATE_VOID_PENDING;
|
|
|
|
GST_STATE_PENDING (bin) = pending;
|
|
|
|
GST_STATE_NEXT (bin) = GST_STATE_VOID_PENDING;
|
|
|
|
} else {
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin,
|
|
|
|
"continue state change, pending %s",
|
|
|
|
gst_element_state_get_name (pending));
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
2007-06-19 10:41:33 +00:00
|
|
|
cont = g_new0 (BinContinueData, 1);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* ref to the bin */
|
2007-06-19 10:41:33 +00:00
|
|
|
cont->bin = gst_object_ref (bin);
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* cookie to detect concurrent state change */
|
2007-06-19 10:41:33 +00:00
|
|
|
cont->cookie = GST_ELEMENT_CAST (bin)->state_cookie;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* pending target state */
|
2007-06-19 10:41:33 +00:00
|
|
|
cont->pending = pending;
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* mark busy */
|
|
|
|
GST_STATE_RETURN (bin) = GST_STATE_CHANGE_ASYNC;
|
2007-10-14 15:54:02 +00:00
|
|
|
GST_STATE_NEXT (bin) = pending;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
if (old_next != GST_STATE_PLAYING) {
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
if (old_state != old_next || old_ret == GST_STATE_CHANGE_ASYNC) {
|
2007-06-19 10:41:33 +00:00
|
|
|
smessage = gst_message_new_state_changed (GST_OBJECT_CAST (bin),
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
old_state, old_next, pending);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
}
|
2007-06-19 10:41:33 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
|
|
|
|
if (smessage) {
|
|
|
|
GST_DEBUG_OBJECT (bin, "posting state change message");
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin), smessage);
|
|
|
|
}
|
|
|
|
if (amessage) {
|
|
|
|
/* post our combined ASYNC_DONE when all is ASYNC_DONE. */
|
|
|
|
GST_DEBUG_OBJECT (bin, "posting ASYNC_DONE to parent");
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin), amessage);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
if (cont) {
|
|
|
|
/* toplevel, start continue state */
|
|
|
|
GST_DEBUG_OBJECT (bin, "all async-done, starting state continue");
|
|
|
|
bin_push_state_continue (cont);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (bin, "state change complete");
|
|
|
|
GST_STATE_BROADCAST (bin);
|
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
return;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
had_error:
|
|
|
|
{
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin, "we had an error");
|
|
|
|
return;
|
|
|
|
}
|
2007-06-19 10:41:33 +00:00
|
|
|
was_busy:
|
|
|
|
{
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, bin, "state change busy");
|
|
|
|
return;
|
|
|
|
}
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
nothing_pending:
|
|
|
|
{
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, bin, "nothing pending");
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
/* handle child messages:
|
gst/gstbin.c: Update documentation.
Original commit message from CVS:
* gst/gstbin.c:
Update documentation.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_release_request_pad), (gst_element_set_clock),
(gst_element_get_index), (gst_element_add_pad),
(gst_element_remove_pad), (gst_element_get_random_pad),
(gst_element_send_event), (gst_element_get_query_types),
(gst_element_query), (gst_element_post_message),
(gst_element_message_full), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_save_thyself),
(gst_element_restore_thyself):
Documentation updates.
Rename last bit of the new-pad -> pad-added signal rename.
Fix the case where an element query would only work if the source
pad was linked.
Avoid some useless type checking in message handling.
* gst/gstevent.c:
* gst/gstevent.h:
* gst/gstutils.c:
Documentation updates.
2006-09-15 08:32:57 +00:00
|
|
|
*
|
|
|
|
* This method is called synchronously when a child posts a message on
|
2007-04-23 07:30:38 +00:00
|
|
|
* the internal bus.
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
*
|
|
|
|
* GST_MESSAGE_EOS: This message is only posted by sinks
|
|
|
|
* in the PLAYING state. If all sinks posted the EOS message, post
|
|
|
|
* one upwards.
|
|
|
|
*
|
2007-08-16 11:04:40 +00:00
|
|
|
* GST_MESSAGE_STATE_DIRTY: Deprecated
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
*
|
|
|
|
* GST_MESSAGE_SEGMENT_START: just collect, never forward upwards. If an
|
|
|
|
* element posts segment_start twice, only the last message is kept.
|
|
|
|
*
|
|
|
|
* GST_MESSAGE_SEGMENT_DONE: replace SEGMENT_START message from same poster
|
|
|
|
* with the segment_done message. If there are no more segment_start
|
|
|
|
* messages, post segment_done message upwards.
|
|
|
|
*
|
|
|
|
* GST_MESSAGE_DURATION: remove all previously cached duration messages.
|
|
|
|
* Whenever someone performs a duration query on the bin, we store the
|
|
|
|
* result so we can answer it quicker the next time. Any element that
|
|
|
|
* changes its duration marks our cached values invalid.
|
gst/gstbin.c: Update documentation.
Original commit message from CVS:
* gst/gstbin.c:
Update documentation.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_release_request_pad), (gst_element_set_clock),
(gst_element_get_index), (gst_element_add_pad),
(gst_element_remove_pad), (gst_element_get_random_pad),
(gst_element_send_event), (gst_element_get_query_types),
(gst_element_query), (gst_element_post_message),
(gst_element_message_full), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_save_thyself),
(gst_element_restore_thyself):
Documentation updates.
Rename last bit of the new-pad -> pad-added signal rename.
Fix the case where an element query would only work if the source
pad was linked.
Avoid some useless type checking in message handling.
* gst/gstevent.c:
* gst/gstevent.h:
* gst/gstutils.c:
Documentation updates.
2006-09-15 08:32:57 +00:00
|
|
|
* This message is also posted upwards. This is currently disabled
|
|
|
|
* because too many elements don't post DURATION messages when the
|
|
|
|
* duration changes.
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
*
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
* GST_MESSAGE_CLOCK_LOST: This message is posted by an element when it
|
|
|
|
* can no longer provide a clock. The default bin behaviour is to
|
|
|
|
* check if the lost clock was the one provided by the bin. If so and
|
2007-04-23 07:30:38 +00:00
|
|
|
* we are currently in the PLAYING state, we forward the message to
|
|
|
|
* our parent.
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
* This message is also generated when we remove a clock provider from
|
|
|
|
* a bin. If this message is received by the application, it should
|
|
|
|
* PAUSE the pipeline and set it back to PLAYING to force a new clock
|
2007-02-20 10:45:13 +00:00
|
|
|
* and a new base_time distribution.
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
*
|
|
|
|
* GST_MESSAGE_CLOCK_PROVIDE: This message is generated when an element
|
|
|
|
* can provide a clock. This mostly happens when we add a new clock
|
|
|
|
* provider to the bin. The default behaviour of the bin is to mark the
|
|
|
|
* currently selected clock as dirty, which will perform a clock
|
|
|
|
* recalculation the next time we are asked to provide a clock.
|
gst/gstbin.c: Update documentation.
Original commit message from CVS:
* gst/gstbin.c:
Update documentation.
* gst/gstelement.c: (gst_element_class_init),
(gst_element_release_request_pad), (gst_element_set_clock),
(gst_element_get_index), (gst_element_add_pad),
(gst_element_remove_pad), (gst_element_get_random_pad),
(gst_element_send_event), (gst_element_get_query_types),
(gst_element_query), (gst_element_post_message),
(gst_element_message_full), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_save_thyself),
(gst_element_restore_thyself):
Documentation updates.
Rename last bit of the new-pad -> pad-added signal rename.
Fix the case where an element query would only work if the source
pad was linked.
Avoid some useless type checking in message handling.
* gst/gstevent.c:
* gst/gstevent.h:
* gst/gstutils.c:
Documentation updates.
2006-09-15 08:32:57 +00:00
|
|
|
* This message is never sent to the application but is forwarded to
|
Documentation updates.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gstbin.c: (bin_bus_handler), (gst_bin_handle_message_func):
* gst/gstbin.h:
* gst/gstbus.c: (gst_bus_class_init):
* gst/gstbus.h:
* gst/gstclock.c:
* gst/gstelement.c: (gst_element_set_locked_state):
* gst/gstsegment.c:
Documentation updates.
* gst/gstpipeline.c: (gst_pipeline_get_type),
(gst_pipeline_class_init), (gst_pipeline_init),
(gst_pipeline_dispose), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_send_event), (gst_pipeline_change_state),
(gst_pipeline_provide_clock_func), (gst_pipeline_set_delay),
(gst_pipeline_get_delay):
* gst/gstpipeline.h:
Added methods for setting the delay.
API: gst_pipeline_set_delay
API: gst_pipeline_get_delay
Add pipeline debug category
Various cleanups.
Updated docs.
Don't reset stream time when seek failed.
2006-03-13 11:04:38 +00:00
|
|
|
* the parent.
|
|
|
|
*
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
* GST_MESSAGE_ASYNC_START: Create an internal ELEMENT message that stores
|
2007-04-23 07:30:38 +00:00
|
|
|
* the state of the element and the fact that the element will need a
|
2007-08-16 11:04:40 +00:00
|
|
|
* new base_time. This message is not forwarded to the application.
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
*
|
|
|
|
* GST_MESSAGE_ASYNC_DONE: Find the internal ELEMENT message we kept for the
|
|
|
|
* element when it posted ASYNC_START. If all elements are done, post a
|
|
|
|
* ASYNC_DONE message to the parent.
|
|
|
|
*
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
* OTHER: post upwards.
|
|
|
|
*/
|
2005-11-19 18:28:40 +00:00
|
|
|
static void
|
|
|
|
gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
{
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GstObject *src;
|
|
|
|
GstMessageType type;
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
src = GST_MESSAGE_SRC (message);
|
|
|
|
type = GST_MESSAGE_TYPE (message);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "[msg %p] handling child %s message of type %s",
|
|
|
|
message, GST_ELEMENT_NAME (src), GST_MESSAGE_TYPE_NAME (message));
|
|
|
|
|
|
|
|
switch (type) {
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
case GST_MESSAGE_EOS:
|
|
|
|
{
|
|
|
|
gboolean eos;
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
/* collect all eos messages from the children */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
bin_replace_message (bin, message, GST_MESSAGE_EOS);
|
|
|
|
eos = is_eos (bin);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
|
|
|
|
/* if we are completely EOS, we forward an EOS message */
|
|
|
|
if (eos) {
|
|
|
|
GST_DEBUG_OBJECT (bin, "all sinks posted EOS");
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin),
|
|
|
|
gst_message_new_eos (GST_OBJECT_CAST (bin)));
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
}
|
|
|
|
break;
|
2005-07-18 17:12:36 +00:00
|
|
|
}
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
case GST_MESSAGE_STATE_DIRTY:
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
{
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_WARNING_OBJECT (bin, "received deprecated STATE_DIRTY message");
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
|
check/: Small state change torture test.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/stress.c: (GST_START_TEST),
(simple_launch_lines_suite), (main):
Small state change torture test.
* docs/design/part-states.txt:
* gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_handle_object), (gst_base_sink_event), (do_playing),
(gst_base_sink_change_state):
Never take state lock from streaming thread, clean up ugly
hacks. Unfortunatly core does not yet support nice ways to
async commit state.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_recalc_state),
(bin_bus_handler):
Start state recalc if a STATE_DIRTY message is posted, but only
on the toplevel bin.
* gst/gstelement.c: (gst_element_sync_state_with_parent),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state_func), (gst_element_change_state):
* gst/gstelement.h:
State variables are now protected with the LOCK, the state
lock is only used to serialize _set_state().
2005-10-18 17:06:29 +00:00
|
|
|
/* free message */
|
|
|
|
gst_message_unref (message);
|
check/: Check fixes, use API as stated in design docs, remove hacks.
Original commit message from CVS:
* check/Makefile.am:
* check/generic/states.c: (GST_START_TEST):
* check/gst/gstbin.c: (GST_START_TEST):
* check/gst/gstpipeline.c: (GST_START_TEST), (gst_pipeline_suite):
* check/states/sinks.c: (GST_START_TEST):
* check/states/sinks2.c: (GST_START_TEST), (gst_object_suite),
(main):
Check fixes, use API as stated in design docs, remove hacks.
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_change_state):
Catch stopping our task while we're shutting down.
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(bin_bus_handler):
* gst/gstbin.h:
* gst/gstelement.c: (gst_element_init),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state),
(gst_element_set_state), (gst_element_change_state),
(gst_element_change_state_func):
* gst/gstelement.h:
New state change algorithm (see #318116)
* gst/gstpipeline.c: (gst_pipeline_class_init),
(gst_pipeline_init), (gst_pipeline_set_property),
(gst_pipeline_get_property), (do_pipeline_seek),
(gst_pipeline_change_state), (gst_pipeline_provide_clock_func):
* gst/gstpipeline.h:
Remove crude state change hacks.
* gst/gstutils.h:
Remove crude hacks.
* tools/gst-launch.c: (main):
Fixes for state change. Needs some more work to fully use the
new stuff.
2005-10-10 16:38:26 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
case GST_MESSAGE_SEGMENT_START:
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2007-04-23 07:30:38 +00:00
|
|
|
/* replace any previous segment_start message from this source
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
* with the new segment start message */
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
bin_replace_message (bin, message, GST_MESSAGE_SEGMENT_START);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
break;
|
|
|
|
case GST_MESSAGE_SEGMENT_DONE:
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
{
|
|
|
|
gboolean post = FALSE;
|
|
|
|
GstFormat format;
|
|
|
|
gint64 position;
|
|
|
|
|
|
|
|
gst_message_parse_segment_done (message, &format, &position);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
bin_replace_message (bin, message, GST_MESSAGE_SEGMENT_START);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
/* if there are no more segment_start messages, everybody posted
|
|
|
|
* a segment_done and we can post one on the bus. */
|
|
|
|
|
|
|
|
/* we don't care who still has a pending segment start */
|
2007-06-07 10:11:47 +00:00
|
|
|
if (!find_message (bin, NULL, GST_MESSAGE_SEGMENT_START)) {
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
/* nothing found */
|
|
|
|
post = TRUE;
|
|
|
|
/* remove all old segment_done messages */
|
|
|
|
bin_remove_messages (bin, NULL, GST_MESSAGE_SEGMENT_DONE);
|
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
if (post) {
|
|
|
|
/* post segment done with latest format and position. */
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin),
|
|
|
|
gst_message_new_segment_done (GST_OBJECT_CAST (bin),
|
|
|
|
format, position));
|
|
|
|
}
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
break;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
}
|
gst/gstbin.c: Reworked the message handling a bit, cache the messages instead of only the senders. alows us to do mor...
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next),
(gst_bin_change_state_func), (gst_bin_dispose), (bin_bus_handler):
Reworked the message handling a bit, cache the messages instead of
only the senders. alows us to do more in the future.
2005-10-20 17:22:40 +00:00
|
|
|
case GST_MESSAGE_DURATION:
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
{
|
|
|
|
/* remove all cached duration messages, next time somebody asks
|
|
|
|
* for duration, we will recalculate. */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
bin_remove_messages (bin, NULL, GST_MESSAGE_DURATION);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-11-18 11:03:10 +00:00
|
|
|
goto forward;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
}
|
2005-11-18 11:03:10 +00:00
|
|
|
case GST_MESSAGE_CLOCK_LOST:
|
|
|
|
{
|
2006-03-21 14:14:49 +00:00
|
|
|
GstClock **provided_clock_p;
|
|
|
|
GstElement **clock_provider_p;
|
2005-11-18 11:03:10 +00:00
|
|
|
gboolean playing, provided, forward;
|
|
|
|
GstClock *clock;
|
|
|
|
|
|
|
|
gst_message_parse_clock_lost (message, &clock);
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-11-18 11:03:10 +00:00
|
|
|
bin->clock_dirty = TRUE;
|
2007-04-23 07:30:38 +00:00
|
|
|
/* if we lost the clock that we provided, post to parent but
|
2005-11-18 11:03:10 +00:00
|
|
|
* only if we are PLAYING. */
|
|
|
|
provided = (clock == bin->provided_clock);
|
|
|
|
playing = (GST_STATE (bin) == GST_STATE_PLAYING);
|
|
|
|
forward = playing & provided;
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
if (provided) {
|
|
|
|
GST_DEBUG_OBJECT (bin,
|
|
|
|
"Lost clock %" GST_PTR_FORMAT " provided by %" GST_PTR_FORMAT,
|
|
|
|
bin->provided_clock, bin->clock_provider);
|
2006-03-21 14:14:49 +00:00
|
|
|
provided_clock_p = &bin->provided_clock;
|
|
|
|
clock_provider_p = &bin->clock_provider;
|
|
|
|
gst_object_replace ((GstObject **) provided_clock_p, NULL);
|
|
|
|
gst_object_replace ((GstObject **) clock_provider_p, NULL);
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
}
|
2005-11-18 11:03:10 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "provided %d, playing %d, forward %d",
|
|
|
|
provided, playing, forward);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-11-18 11:03:10 +00:00
|
|
|
|
2006-02-28 10:52:02 +00:00
|
|
|
if (forward)
|
2005-11-18 11:03:10 +00:00
|
|
|
goto forward;
|
2006-02-28 10:52:02 +00:00
|
|
|
|
2005-11-25 17:06:36 +00:00
|
|
|
/* free message */
|
|
|
|
gst_message_unref (message);
|
2005-11-18 11:03:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_MESSAGE_CLOCK_PROVIDE:
|
|
|
|
{
|
|
|
|
gboolean forward;
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
2005-11-18 11:03:10 +00:00
|
|
|
bin->clock_dirty = TRUE;
|
|
|
|
/* a new clock is available, post to parent but not
|
|
|
|
* to the application */
|
|
|
|
forward = GST_OBJECT_PARENT (bin) != NULL;
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-11-18 11:03:10 +00:00
|
|
|
|
|
|
|
if (forward)
|
|
|
|
goto forward;
|
2006-02-28 10:52:02 +00:00
|
|
|
|
2005-11-25 17:06:36 +00:00
|
|
|
/* free message */
|
|
|
|
gst_message_unref (message);
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
break;
|
2005-11-18 11:03:10 +00:00
|
|
|
}
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
case GST_MESSAGE_ASYNC_START:
|
|
|
|
{
|
2007-08-14 14:10:36 +00:00
|
|
|
gboolean new_base_time;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GstState target;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "ASYNC_START message %p, %s", message,
|
|
|
|
GST_OBJECT_NAME (src));
|
|
|
|
|
|
|
|
gst_message_parse_async_start (message, &new_base_time);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
/* we ignore the message if we are going to <= READY */
|
|
|
|
target = GST_STATE_TARGET (bin);
|
|
|
|
if (target <= GST_STATE_READY)
|
|
|
|
goto ignore_start_message;
|
|
|
|
|
gst/gstbin.*: Immediatly commit the toplevel bin state when receiving an async-done message. This enables us to avoid...
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_add_func),
(gst_bin_remove_func), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_continue_func),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
* gst/gstbin.h:
Immediatly commit the toplevel bin state when receiving an async-done
message. This enables us to avoid spawning a thread to commit the state
in some common cases and it also avoids some races.
Avoid spawning a state thread when adding/removing async elements to a
toplevel bin. Instead we immediatly update the bin state.
Get rid of iterating all the children when getting the state in the bin
because it is now always up-to-date.
Fix bug where locked elements would always return _SUCCESS even it they
returned NO_PREROLL before being locked.
Fix the order of the state_change, async-start/done messages that was
sometimes incorrect.
Mark the state_dirty field as deprecated, we don't need it anymore as we
are always up-to-date.
* gst/gstelement.c: (gst_element_get_state_func),
(gst_element_continue_state):
Small debug inprovements.
Return the previous element state return when nothing is pending instead
of blindly returning SUCCESS.
* tests/check/generic/sinks.c: (GST_START_TEST), (pad_blocked_cb),
(gst_sinks_suite):
Add a whole bunch of new testcases.
2007-06-18 15:12:28 +00:00
|
|
|
/* takes ownership of the message */
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
bin_replace_message (bin, message, GST_MESSAGE_ASYNC_START);
|
|
|
|
|
2007-08-14 14:10:36 +00:00
|
|
|
bin_handle_async_start (bin, new_base_time);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2007-08-14 14:10:36 +00:00
|
|
|
break;
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
|
|
|
|
ignore_start_message:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (bin, "ignoring message, target %s",
|
|
|
|
gst_element_state_get_name (target));
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
gst_message_unref (message);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case GST_MESSAGE_ASYNC_DONE:
|
|
|
|
{
|
|
|
|
GstState target;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "ASYNC_DONE message %p, %s", message,
|
|
|
|
GST_OBJECT_NAME (src));
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (bin);
|
|
|
|
target = GST_STATE_TARGET (bin);
|
|
|
|
/* ignore messages if we are shutting down */
|
|
|
|
if (target <= GST_STATE_READY)
|
|
|
|
goto ignore_done_message;
|
|
|
|
|
|
|
|
bin_replace_message (bin, message, GST_MESSAGE_ASYNC_START);
|
|
|
|
/* if there are no more ASYNC_START messages, everybody posted
|
2007-06-07 10:11:47 +00:00
|
|
|
* a ASYNC_DONE and we can post one on the bus. When checking, we
|
|
|
|
* don't care who still has a pending ASYNC_START */
|
|
|
|
if (!find_message (bin, NULL, GST_MESSAGE_ASYNC_START)) {
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
/* nothing found, remove all old ASYNC_DONE messages */
|
|
|
|
bin_remove_messages (bin, NULL, GST_MESSAGE_ASYNC_DONE);
|
2007-06-07 10:11:47 +00:00
|
|
|
|
2007-08-16 11:04:40 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "async elements commited");
|
2007-06-19 10:41:33 +00:00
|
|
|
bin_handle_async_done (bin, GST_STATE_CHANGE_SUCCESS);
|
docs/gst/gstreamer-sections.txt: Add new element field and method.
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
Add new element field and method.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
(bin_remove_messages), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_get_state_func),
(gst_bin_element_set_state), (gst_bin_change_state_func),
(gst_bin_continue_func), (bin_bus_handler),
(bin_push_state_continue), (bin_handle_async_start),
(bin_handle_async_done), (gst_bin_handle_message_func):
Make async state changes a bit smarter by using new ASYNC_START and
ASYNC_DONE messages. This reduces the number of times we run the state
recalculation thread.
Don't change state of element with a pending ASYNC_START message.
Deprecate STATE_DIRTY messages.
* gst/gstelement.c: (gst_element_init), (gst_element_send_event),
(gst_element_get_state_func), (gst_element_continue_state),
(gst_element_lost_state), (gst_element_set_state_func),
(gst_element_change_state):
* gst/gstelement.h:
Keep the state that was last set by the app in a new element field.
Don't allow state changes when handling an element event.
Post ASYNC_START and ASYNC_DONE messages.
Change lost_state so that we go to PAUSED and wait for the parent to set
us to PLAYING again (so latency calculation can be performed)
Export gst_element_change_state() method so that subclasses can use it.
API: gst_element_change_state()
API: GST_STATE_TARGET
* gst/gstpipeline.c: (gst_pipeline_class_init),
(reset_stream_time), (gst_pipeline_change_state),
(gst_pipeline_handle_message), (gst_pipeline_set_new_stream_time):
Using the new ASYNC_START message we can reset the base_time when
needed. This can then be used to implement base_time redistribution in
flushing seeks so that we can remove the explicit seek handling.
Perform latency query and configuration when going to PLAYING.
* libs/gst/base/gstbasesink.c: (gst_base_sink_commit_state),
(gst_base_sink_query), (gst_base_sink_change_state):
Post new ASYNC_START/ASYNC_DONE messages.
* tests/check/generic/sinks.c: (GST_START_TEST):
Fix test because the bin will not set the async element to PLAYING right
away.
* tests/check/gst/gstbin.c: (pop_async_done), (GST_START_TEST):
Make the message check a little stronger.
Handle ASYNC messages.
* tests/check/pipelines/cleanup.c: (GST_START_TEST):
* tests/check/pipelines/simple-launch-lines.c: (GST_START_TEST):
Expect ASYNC_DONE messages.
2007-03-19 10:47:56 +00:00
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
break;
|
|
|
|
|
|
|
|
ignore_done_message:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (bin, "ignoring message, target %s",
|
|
|
|
gst_element_state_get_name (target));
|
|
|
|
GST_OBJECT_UNLOCK (bin);
|
|
|
|
gst_message_unref (message);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-11-18 11:03:10 +00:00
|
|
|
default:
|
|
|
|
goto forward;
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
}
|
2005-11-19 18:28:40 +00:00
|
|
|
return;
|
2005-11-18 11:03:10 +00:00
|
|
|
|
|
|
|
forward:
|
|
|
|
{
|
|
|
|
/* Send all other messages upward */
|
|
|
|
GST_DEBUG_OBJECT (bin, "posting message upward");
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (bin), message);
|
2005-11-19 18:28:40 +00:00
|
|
|
return;
|
2005-11-18 11:03:10 +00:00
|
|
|
}
|
examples/: Update a couple of the examples to work again.
Original commit message from CVS:
* examples/Makefile.am:
* examples/helloworld/helloworld.c: (event_loop), (main):
* examples/queue/queue.c: (event_loop), (main):
* examples/queue2/queue2.c: (main):
Update a couple of the examples to work again.
* gst/base/gstbasesink.c: (gst_base_sink_preroll_queue_empty),
(gst_base_sink_preroll_queue_flush), (gst_base_sink_handle_event):
Spelling corrections and extra debug.
* gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (is_eos),
(gst_bin_add_func), (bin_element_is_sink), (gst_bin_get_state),
(gst_bin_change_state), (gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
* gst/gstpipeline.c: (gst_pipeline_init), (gst_pipeline_dispose),
(gst_pipeline_change_state):
* gst/gstpipeline.h:
Move the bus handler for children to the GstBin, and create a
separate bus for receiving messages from children to the one the
bus sends 'upwards' on.
2005-07-06 16:22:47 +00:00
|
|
|
}
|
|
|
|
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
/* generic struct passed to all query fold methods */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
2007-02-20 10:45:13 +00:00
|
|
|
gint64 min;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
gint64 max;
|
2007-02-28 16:35:48 +00:00
|
|
|
gboolean live;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
} QueryFold;
|
|
|
|
|
|
|
|
typedef void (*QueryInitFunction) (GstBin * bin, QueryFold * fold);
|
|
|
|
typedef void (*QueryDoneFunction) (GstBin * bin, QueryFold * fold);
|
|
|
|
|
2007-04-23 07:30:38 +00:00
|
|
|
/* for duration/position we collect all durations/positions and take
|
2006-03-20 10:56:08 +00:00
|
|
|
* the MAX of all valid results */
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
static void
|
2007-02-20 10:45:13 +00:00
|
|
|
bin_query_min_max_init (GstBin * bin, QueryFold * fold)
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
{
|
2007-02-20 10:45:13 +00:00
|
|
|
fold->min = 0;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
fold->max = -1;
|
2007-02-28 16:35:48 +00:00
|
|
|
fold->live = FALSE;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
bin_query_duration_fold (GstElement * item, GValue * ret, QueryFold * fold)
|
|
|
|
{
|
|
|
|
if (gst_element_query (item, fold->query)) {
|
|
|
|
gint64 duration;
|
|
|
|
|
|
|
|
g_value_set_boolean (ret, TRUE);
|
|
|
|
|
|
|
|
gst_query_parse_duration (fold->query, NULL, &duration);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (item, "got duration %" G_GINT64_FORMAT, duration);
|
|
|
|
|
|
|
|
if (duration > fold->max)
|
|
|
|
fold->max = duration;
|
|
|
|
}
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
|
|
|
|
gst_object_unref (item);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
bin_query_duration_done (GstBin * bin, QueryFold * fold)
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
gst_query_parse_duration (fold->query, &format, NULL);
|
|
|
|
/* store max in query result */
|
|
|
|
gst_query_set_duration (fold->query, format, fold->max);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "max duration %" G_GINT64_FORMAT, fold->max);
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
|
2006-06-14 10:34:14 +00:00
|
|
|
#ifdef DURATION_CACHING
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
/* and cache now */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
bin->messages = g_list_prepend (bin->messages,
|
|
|
|
gst_message_new_duration (GST_OBJECT_CAST (bin), format, fold->max));
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2006-01-31 18:46:15 +00:00
|
|
|
#endif
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
}
|
|
|
|
|
2006-03-20 10:56:08 +00:00
|
|
|
static gboolean
|
|
|
|
bin_query_position_fold (GstElement * item, GValue * ret, QueryFold * fold)
|
|
|
|
{
|
|
|
|
if (gst_element_query (item, fold->query)) {
|
|
|
|
gint64 position;
|
|
|
|
|
|
|
|
g_value_set_boolean (ret, TRUE);
|
|
|
|
|
|
|
|
gst_query_parse_position (fold->query, NULL, &position);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (item, "got position %" G_GINT64_FORMAT, position);
|
|
|
|
|
|
|
|
if (position > fold->max)
|
|
|
|
fold->max = position;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (item);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
bin_query_position_done (GstBin * bin, QueryFold * fold)
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
gst_query_parse_position (fold->query, &format, NULL);
|
|
|
|
/* store max in query result */
|
|
|
|
gst_query_set_position (fold->query, format, fold->max);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin, "max position %" G_GINT64_FORMAT, fold->max);
|
|
|
|
}
|
|
|
|
|
2007-02-20 10:45:13 +00:00
|
|
|
static gboolean
|
|
|
|
bin_query_latency_fold (GstElement * item, GValue * ret, QueryFold * fold)
|
|
|
|
{
|
|
|
|
if (gst_element_query (item, fold->query)) {
|
|
|
|
GstClockTime min, max;
|
2007-02-28 16:35:48 +00:00
|
|
|
gboolean live;
|
2007-02-20 10:45:13 +00:00
|
|
|
|
2007-02-28 16:35:48 +00:00
|
|
|
gst_query_parse_latency (fold->query, &live, &min, &max);
|
2007-02-20 10:45:13 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (item,
|
2007-02-28 16:35:48 +00:00
|
|
|
"got latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
|
|
|
|
", live %d", GST_TIME_ARGS (min), GST_TIME_ARGS (max), live);
|
2007-02-20 10:45:13 +00:00
|
|
|
|
|
|
|
/* for the combined latency we collect the MAX of all min latencies and
|
|
|
|
* the MIN of all max latencies */
|
|
|
|
if (min > fold->min)
|
|
|
|
fold->min = min;
|
|
|
|
if (fold->max == -1)
|
|
|
|
fold->max = max;
|
|
|
|
else if (max < fold->max)
|
|
|
|
fold->max = max;
|
2007-02-28 16:35:48 +00:00
|
|
|
if (fold->live == FALSE)
|
|
|
|
fold->live = live;
|
2007-09-17 20:55:23 +00:00
|
|
|
} else {
|
|
|
|
g_value_set_boolean (ret, FALSE);
|
|
|
|
GST_DEBUG_OBJECT (item, "failed query");
|
2007-02-20 10:45:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (item);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
bin_query_latency_done (GstBin * bin, QueryFold * fold)
|
|
|
|
{
|
|
|
|
/* store max in query result */
|
2007-02-28 16:35:48 +00:00
|
|
|
gst_query_set_latency (fold->query, fold->live, fold->min, fold->max);
|
2007-02-20 10:45:13 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (bin,
|
2007-02-28 16:35:48 +00:00
|
|
|
"latency min %" GST_TIME_FORMAT ", max %" GST_TIME_FORMAT
|
|
|
|
", live %d", GST_TIME_ARGS (fold->min), GST_TIME_ARGS (fold->max),
|
|
|
|
fold->live);
|
2007-02-20 10:45:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
/* generic fold, return first valid result */
|
|
|
|
static gboolean
|
|
|
|
bin_query_generic_fold (GstElement * item, GValue * ret, QueryFold * fold)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
if ((res = gst_element_query (item, fold->query))) {
|
|
|
|
g_value_set_boolean (ret, TRUE);
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
GST_DEBUG_OBJECT (item, "answered query %p", fold->query);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
}
|
|
|
|
|
gst/gstbin.c: Clean up references to the clock provider when disposed or when handling a clock-lost message from it.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_dispose), (gst_bin_provide_clock_func),
(gst_bin_remove_func), (gst_bin_handle_message_func),
(bin_query_duration_fold), (bin_query_generic_fold):
Clean up references to the clock provider when disposed or when
handling a clock-lost message from it.
Unref sinks when performing a query via gst_iterator_fold, as the
gst_bin_iterate_sinks iterator refs each item. (Fixes #323874)
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_dispose),
(gst_clock_set_master):
Drop our reference to the master clock, if any, when we are disposed.
* gst/gsttypefindfactory.c: (gst_type_find_factory_dispose):
Chain up in dispose.
2006-01-27 01:48:37 +00:00
|
|
|
gst_object_unref (item);
|
|
|
|
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
/* and stop as soon as we have a valid result */
|
|
|
|
return !res;
|
|
|
|
}
|
|
|
|
|
2005-05-12 15:09:17 +00:00
|
|
|
static gboolean
|
|
|
|
gst_bin_query (GstElement * element, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstBin *bin = GST_BIN (element);
|
|
|
|
GstIterator *iter;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
gboolean res = FALSE;
|
|
|
|
GstIteratorFoldFunction fold_func;
|
|
|
|
QueryInitFunction fold_init = NULL;
|
|
|
|
QueryDoneFunction fold_done = NULL;
|
|
|
|
QueryFold fold_data;
|
|
|
|
GValue ret = { 0 };
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_DURATION:
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
{
|
2006-06-14 10:34:14 +00:00
|
|
|
#ifdef DURATION_CACHING
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
GList *cached;
|
|
|
|
GstFormat qformat;
|
|
|
|
|
|
|
|
gst_query_parse_duration (query, &qformat, NULL);
|
|
|
|
|
|
|
|
/* find cached duration query */
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (bin);
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
for (cached = bin->messages; cached; cached = g_list_next (cached)) {
|
|
|
|
GstMessage *message = (GstMessage *) cached->data;
|
|
|
|
|
|
|
|
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION &&
|
|
|
|
GST_MESSAGE_SRC (message) == GST_OBJECT_CAST (bin)) {
|
|
|
|
GstFormat format;
|
|
|
|
gint64 duration;
|
|
|
|
|
|
|
|
gst_message_parse_duration (message, &format, &duration);
|
|
|
|
|
|
|
|
/* if cached same format, copy duration in query result */
|
|
|
|
if (format == qformat) {
|
|
|
|
GST_DEBUG_OBJECT (bin, "return cached duration %" G_GINT64_FORMAT,
|
|
|
|
duration);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
|
|
|
|
gst_query_set_duration (query, qformat, duration);
|
|
|
|
res = TRUE;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (bin);
|
2005-12-29 16:47:27 +00:00
|
|
|
#endif
|
2006-06-14 10:34:14 +00:00
|
|
|
/* no cached value found, iterate and collect durations */
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
fold_func = (GstIteratorFoldFunction) bin_query_duration_fold;
|
2007-02-20 10:45:13 +00:00
|
|
|
fold_init = bin_query_min_max_init;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
fold_done = bin_query_duration_done;
|
|
|
|
break;
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
}
|
2006-03-20 10:56:08 +00:00
|
|
|
case GST_QUERY_POSITION:
|
|
|
|
{
|
|
|
|
fold_func = (GstIteratorFoldFunction) bin_query_position_fold;
|
2007-02-20 10:45:13 +00:00
|
|
|
fold_init = bin_query_min_max_init;
|
2006-03-20 10:56:08 +00:00
|
|
|
fold_done = bin_query_position_done;
|
|
|
|
break;
|
|
|
|
}
|
2007-02-20 10:45:13 +00:00
|
|
|
case GST_QUERY_LATENCY:
|
|
|
|
{
|
|
|
|
fold_func = (GstIteratorFoldFunction) bin_query_latency_fold;
|
|
|
|
fold_init = bin_query_min_max_init;
|
|
|
|
fold_done = bin_query_latency_done;
|
2007-09-17 20:55:23 +00:00
|
|
|
res = TRUE;
|
2007-02-20 10:45:13 +00:00
|
|
|
break;
|
|
|
|
}
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
default:
|
|
|
|
fold_func = (GstIteratorFoldFunction) bin_query_generic_fold;
|
|
|
|
break;
|
|
|
|
}
|
2005-05-12 15:09:17 +00:00
|
|
|
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
fold_data.query = query;
|
|
|
|
|
|
|
|
g_value_init (&ret, G_TYPE_BOOLEAN);
|
2007-09-17 20:55:23 +00:00
|
|
|
g_value_set_boolean (&ret, res);
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
|
2005-05-12 15:09:17 +00:00
|
|
|
iter = gst_bin_iterate_sinks (bin);
|
2007-05-21 12:05:14 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "Sending query %p (type %s) to sink children",
|
|
|
|
query, GST_QUERY_TYPE_NAME (query));
|
2005-05-12 15:09:17 +00:00
|
|
|
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
if (fold_init)
|
|
|
|
fold_init (bin, &fold_data);
|
2005-05-12 15:09:17 +00:00
|
|
|
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
while (TRUE) {
|
|
|
|
GstIteratorResult ires;
|
2005-05-12 15:09:17 +00:00
|
|
|
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
ires = gst_iterator_fold (iter, fold_func, &ret, &fold_data);
|
|
|
|
|
|
|
|
switch (ires) {
|
2005-05-12 15:09:17 +00:00
|
|
|
case GST_ITERATOR_RESYNC:
|
|
|
|
gst_iterator_resync (iter);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
if (fold_init)
|
|
|
|
fold_init (bin, &fold_data);
|
2007-09-17 20:55:23 +00:00
|
|
|
g_value_set_boolean (&ret, res);
|
2005-05-12 15:09:17 +00:00
|
|
|
break;
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
case GST_ITERATOR_OK:
|
2005-05-12 15:09:17 +00:00
|
|
|
case GST_ITERATOR_DONE:
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
res = g_value_get_boolean (&ret);
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
if (fold_done != NULL && res)
|
|
|
|
fold_done (bin, &fold_data);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
goto done;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
goto done;
|
2005-05-12 15:09:17 +00:00
|
|
|
}
|
|
|
|
}
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
done:
|
2005-05-12 15:09:17 +00:00
|
|
|
gst_iterator_free (iter);
|
|
|
|
|
2006-12-07 10:02:19 +00:00
|
|
|
#ifdef DURATION_CACHING
|
|
|
|
exit:
|
|
|
|
#endif
|
gst/gstbin.c: Some doc and debug updates.
Original commit message from CVS:
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Some doc and debug updates.
Cache previously requested query DURATION for speed. invalidate
cached duration if element posts a DURATION message.
2005-10-25 17:41:24 +00:00
|
|
|
GST_DEBUG_OBJECT (bin, "query %p result %d", query, res);
|
docs/design/part-TODO.txt: Update TODO.
Original commit message from CVS:
* docs/design/part-TODO.txt:
Update TODO.
* gst/gstbin.c: (message_check), (bin_replace_message),
(bin_remove_messages), (is_eos), (gst_bin_add_func),
(update_degree), (gst_bin_sort_iterator_next), (bin_bus_handler),
(bin_query_duration_init), (bin_query_duration_fold),
(bin_query_duration_done), (bin_query_generic_fold),
(gst_bin_query):
Handle SEGMENT_START/DONE messages correctly.
More evolved query algorithm that handles duration queries
correctly.
* gst/gstelement.c: (gst_element_send_event), (gst_element_query),
(gst_element_get_state_func), (gst_element_abort_state),
(gst_element_commit_state), (gst_element_lost_state):
Some more debugging.
* gst/gstmessage.h:
Added doc.
2005-10-25 15:39:36 +00:00
|
|
|
|
2005-05-12 15:09:17 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
static gint
|
|
|
|
compare_name (GstElement * element, const gchar * name)
|
|
|
|
{
|
|
|
|
gint eq;
|
|
|
|
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_LOCK (element);
|
gst/: Fix name lookup in GstBin.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_send_event), (compare_name),
(gst_bin_get_by_name):
* gst/gstbuffer.h:
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_class_init),
(gst_clock_finalize):
* gst/gstdata.c: (gst_data_replace):
* gst/gstdata.h:
* gst/gstelement.c: (gst_element_request_pad),
(gst_element_pads_activate):
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_check_compatible_unlocked), (gst_pad_set_caps),
(gst_pad_check_pull_range), (gst_pad_pull_range),
(gst_static_pad_template_get_caps), (gst_pad_start_task),
(gst_pad_pause_task), (gst_pad_stop_task):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_request_pad), (gst_pad_proxy_getcaps):
Fix name lookup in GstBin.
Added _data_replace() function and _buffer_replace()
Use finalize method to clean up clock.
Fix refcounting on request pads.
Fix pad schedule mode error.
Some more object refcounting debug info,
2005-05-05 09:28:01 +00:00
|
|
|
eq = strcmp (GST_ELEMENT_NAME (element), name);
|
2005-11-21 16:34:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
if (eq != 0) {
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
|
|
|
return eq;
|
|
|
|
}
|
|
|
|
|
2000-03-27 19:53:43 +00:00
|
|
|
/**
|
|
|
|
* gst_bin_get_by_name:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2000-03-27 19:53:43 +00:00
|
|
|
* @name: the element name to search for
|
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Gets the element with the given name from a bin. This
|
|
|
|
* function recurses into child bins.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns NULL if no element with the given name is found in the bin.
|
2005-06-27 08:16:51 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* MT safe. Caller owns returned reference.
|
|
|
|
*
|
|
|
|
* Returns: the #GstElement with the given name, or NULL
|
2000-03-27 19:53:43 +00:00
|
|
|
*/
|
2001-12-15 22:37:35 +00:00
|
|
|
GstElement *
|
|
|
|
gst_bin_get_by_name (GstBin * bin, const gchar * name)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *children;
|
|
|
|
GstIterator *result;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2000-11-04 18:54:07 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
gst/: Fix name lookup in GstBin.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_send_event), (compare_name),
(gst_bin_get_by_name):
* gst/gstbuffer.h:
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_class_init),
(gst_clock_finalize):
* gst/gstdata.c: (gst_data_replace):
* gst/gstdata.h:
* gst/gstelement.c: (gst_element_request_pad),
(gst_element_pads_activate):
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_check_compatible_unlocked), (gst_pad_set_caps),
(gst_pad_check_pull_range), (gst_pad_pull_range),
(gst_static_pad_template_get_caps), (gst_pad_start_task),
(gst_pad_pause_task), (gst_pad_stop_task):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_request_pad), (gst_pad_proxy_getcaps):
Fix name lookup in GstBin.
Added _data_replace() function and _buffer_replace()
Use finalize method to clean up clock.
Fix refcounting on request pads.
Fix pad schedule mode error.
Some more object refcounting debug info,
2005-05-05 09:28:01 +00:00
|
|
|
GST_CAT_INFO (GST_CAT_PARENTAGE, "[%s]: looking up child element %s",
|
|
|
|
GST_ELEMENT_NAME (bin), name);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
children = gst_bin_iterate_recurse (bin);
|
|
|
|
result = gst_iterator_find_custom (children,
|
|
|
|
(GCompareFunc) compare_name, (gpointer) name);
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
gst_iterator_free (children);
|
2000-12-30 02:41:15 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return GST_ELEMENT_CAST (result);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
/**
|
|
|
|
* gst_bin_get_by_name_recurse_up:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2001-01-29 00:06:02 +00:00
|
|
|
* @name: the element name to search for
|
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Gets the element with the given name from this bin. If the
|
2001-01-29 00:06:02 +00:00
|
|
|
* element is not found, a recursion is performed on the parent bin.
|
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns NULL if:
|
|
|
|
* - no element with the given name is found in the bin
|
|
|
|
*
|
|
|
|
* MT safe. Caller owns returned reference.
|
|
|
|
*
|
|
|
|
* Returns: the #GstElement with the given name, or NULL
|
2001-01-29 00:06:02 +00:00
|
|
|
*/
|
2001-12-15 22:37:35 +00:00
|
|
|
GstElement *
|
|
|
|
gst_bin_get_by_name_recurse_up (GstBin * bin, const gchar * name)
|
2001-01-29 00:06:02 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GstElement *result;
|
2001-01-29 00:06:02 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
result = gst_bin_get_by_name (bin, name);
|
|
|
|
|
2001-12-15 22:37:35 +00:00
|
|
|
if (!result) {
|
2005-03-07 18:27:42 +00:00
|
|
|
GstObject *parent;
|
|
|
|
|
|
|
|
parent = gst_object_get_parent (GST_OBJECT_CAST (bin));
|
Bump version number, we're now 0.9.0
Original commit message from CVS:
* configure.ac:
* gst/gst_private.h:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove),
(gst_bin_get_by_name_recurse_up):
* gst/gstclock.c: (gst_clock_id_ref), (gst_clock_id_unref),
(gst_clock_id_compare_func), (gst_clock_id_wait),
(gst_clock_id_wait_async), (gst_clock_init),
(gst_clock_adjust_unlocked), (gst_clock_get_time):
* gst/gstelement.h:
* gst/gstinfo.c: (_gst_debug_init):
* gst/gstobject.h:
* gst/gstpad.c: (_gst_pad_default_fixate_foreach),
(gst_pad_collectv), (gst_pad_collect_valist), (gst_pad_query):
* gst/gstpad.h:
Bump version number, we're now 0.9.0
Add future debugging category.
Fix NULL _unref() in _get_by_name_recurse_up
Rearrange gstpad.h.
Update some docs.
2005-03-09 11:08:18 +00:00
|
|
|
if (parent) {
|
|
|
|
if (GST_IS_BIN (parent)) {
|
|
|
|
result = gst_bin_get_by_name_recurse_up (GST_BIN_CAST (parent), name);
|
|
|
|
}
|
|
|
|
gst_object_unref (parent);
|
2001-12-15 22:37:35 +00:00
|
|
|
}
|
2001-01-29 00:06:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
static gint
|
|
|
|
compare_interface (GstElement * element, gpointer interface)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2006-07-07 15:42:08 +00:00
|
|
|
GType interface_type = (GType) interface;
|
2005-03-07 18:27:42 +00:00
|
|
|
gint ret;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2006-07-07 15:42:08 +00:00
|
|
|
if (G_TYPE_CHECK_INSTANCE_TYPE (element, interface_type)) {
|
2005-03-07 18:27:42 +00:00
|
|
|
ret = 0;
|
|
|
|
} else {
|
|
|
|
/* we did not find the element, need to release the ref
|
|
|
|
* added by the iterator */
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
ret = 1;
|
|
|
|
}
|
|
|
|
return ret;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2003-12-16 19:35:26 +00:00
|
|
|
/**
|
|
|
|
* gst_bin_get_by_interface:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2007-02-11 19:59:12 +00:00
|
|
|
* @iface: the #GType of an interface
|
2003-12-16 19:35:26 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Looks for an element inside the bin that implements the given
|
|
|
|
* interface. If such an element is found, it returns the element.
|
|
|
|
* You can cast this element to the given interface afterwards. If you want
|
|
|
|
* all elements that implement the interface, use
|
|
|
|
* gst_bin_iterate_all_by_interface(). This function recurses into child bins.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* MT safe. Caller owns returned reference.
|
2005-06-27 08:16:51 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns: A #GstElement inside the bin implementing the interface
|
2003-12-16 19:35:26 +00:00
|
|
|
*/
|
|
|
|
GstElement *
|
2007-02-11 19:59:12 +00:00
|
|
|
gst_bin_get_by_interface (GstBin * bin, GType iface)
|
2003-12-16 19:35:26 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *children;
|
2006-07-07 15:42:08 +00:00
|
|
|
gpointer result;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-12-16 19:35:26 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
2007-02-11 19:59:12 +00:00
|
|
|
g_return_val_if_fail (G_TYPE_IS_INTERFACE (iface), NULL);
|
2003-12-16 19:35:26 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
children = gst_bin_iterate_recurse (bin);
|
|
|
|
result = gst_iterator_find_custom (children, (GCompareFunc) compare_interface,
|
2007-02-11 19:59:12 +00:00
|
|
|
(gpointer) iface);
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
gst_iterator_free (children);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
return GST_ELEMENT_CAST (result);
|
2003-12-16 19:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-08-23 11:53:58 +00:00
|
|
|
* gst_bin_iterate_all_by_interface:
|
2005-10-28 17:35:43 +00:00
|
|
|
* @bin: a #GstBin
|
2007-02-11 19:59:12 +00:00
|
|
|
* @iface: the #GType of an interface
|
2003-12-16 19:35:26 +00:00
|
|
|
*
|
2004-07-09 08:45:18 +00:00
|
|
|
* Looks for all elements inside the bin that implements the given
|
2003-12-16 19:35:26 +00:00
|
|
|
* interface. You can safely cast all returned elements to the given interface.
|
2005-10-28 17:35:43 +00:00
|
|
|
* The function recurses inside child bins. The iterator will yield a series
|
2005-06-27 08:16:51 +00:00
|
|
|
* of #GstElement that should be unreffed after use.
|
2003-12-16 19:35:26 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Each element yielded by the iterator will have its refcount increased, so
|
|
|
|
* unref after use.
|
|
|
|
*
|
|
|
|
* MT safe. Caller owns returned value.
|
2005-06-27 08:16:51 +00:00
|
|
|
*
|
2005-10-28 17:35:43 +00:00
|
|
|
* Returns: a #GstIterator of #GstElement for all elements in the bin
|
|
|
|
* implementing the given interface, or NULL
|
2003-12-16 19:35:26 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *
|
2007-02-11 19:59:12 +00:00
|
|
|
gst_bin_iterate_all_by_interface (GstBin * bin, GType iface)
|
2003-12-16 19:35:26 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GstIterator *children;
|
|
|
|
GstIterator *result;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-12-16 19:35:26 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BIN (bin), NULL);
|
2007-02-11 19:59:12 +00:00
|
|
|
g_return_val_if_fail (G_TYPE_IS_INTERFACE (iface), NULL);
|
2003-12-16 19:35:26 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
children = gst_bin_iterate_recurse (bin);
|
|
|
|
result = gst_iterator_filter (children, (GCompareFunc) compare_interface,
|
2007-02-11 19:59:12 +00:00
|
|
|
(gpointer) iface);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
return result;
|
2003-12-16 19:35:26 +00:00
|
|
|
}
|
|
|
|
|
2001-06-25 06:45:56 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2001-01-20 03:10:44 +00:00
|
|
|
static xmlNodePtr
|
2001-12-15 22:37:35 +00:00
|
|
|
gst_bin_save_thyself (GstObject * object, xmlNodePtr parent)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2001-01-29 00:06:02 +00:00
|
|
|
GstBin *bin = GST_BIN (object);
|
|
|
|
xmlNodePtr childlist, elementnode;
|
2000-01-30 09:03:00 +00:00
|
|
|
GList *children;
|
|
|
|
GstElement *child;
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
if (GST_OBJECT_CLASS (parent_class)->save_thyself)
|
|
|
|
GST_OBJECT_CLASS (parent_class)->save_thyself (GST_OBJECT (bin), parent);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
childlist = xmlNewChild (parent, NULL, (xmlChar *) "children", NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_INFO (GST_CAT_XML, "[%s]: saving %d children",
|
|
|
|
GST_ELEMENT_NAME (bin), bin->numchildren);
|
2000-12-30 02:41:15 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
children = bin->children;
|
|
|
|
while (children) {
|
2000-11-04 18:54:07 +00:00
|
|
|
child = GST_ELEMENT (children->data);
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
elementnode = xmlNewChild (childlist, NULL, (xmlChar *) "element", NULL);
|
2001-01-29 00:06:02 +00:00
|
|
|
gst_object_save_thyself (GST_OBJECT (child), elementnode);
|
2000-11-04 18:54:07 +00:00
|
|
|
children = g_list_next (children);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2000-09-27 19:33:10 +00:00
|
|
|
return childlist;
|
|
|
|
}
|
|
|
|
|
2001-01-20 03:10:44 +00:00
|
|
|
static void
|
2001-12-15 22:37:35 +00:00
|
|
|
gst_bin_restore_thyself (GstObject * object, xmlNodePtr self)
|
2000-11-04 18:54:07 +00:00
|
|
|
{
|
2001-01-29 00:06:02 +00:00
|
|
|
GstBin *bin = GST_BIN (object);
|
|
|
|
xmlNodePtr field = self->xmlChildrenNode;
|
2000-09-27 19:33:10 +00:00
|
|
|
xmlNodePtr childlist;
|
|
|
|
|
|
|
|
while (field) {
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
if (!strcmp ((char *) field->name, "children")) {
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_INFO (GST_CAT_XML, "[%s]: loading children",
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_ELEMENT_NAME (object));
|
2001-01-18 11:16:53 +00:00
|
|
|
childlist = field->xmlChildrenNode;
|
2000-09-27 19:33:10 +00:00
|
|
|
while (childlist) {
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
if (!strcmp ((char *) childlist->name, "element")) {
|
2006-06-30 13:17:46 +00:00
|
|
|
/* gst_xml_make_element will gst_bin_add() the element to ourself */
|
|
|
|
gst_xml_make_element (childlist, GST_OBJECT (bin));
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
childlist = childlist->next;
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
field = field->next;
|
|
|
|
}
|
2004-07-04 10:26:24 +00:00
|
|
|
if (GST_OBJECT_CLASS (parent_class)->restore_thyself)
|
|
|
|
(GST_OBJECT_CLASS (parent_class)->restore_thyself) (object, self);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2001-10-17 10:21:27 +00:00
|
|
|
#endif /* GST_DISABLE_LOADSAVE */
|