2003-10-28 20:25:30 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
|
|
*
|
gst/: splitted gsttypefind into gsttypefind, gsttypefindfactory
Original commit message from CVS:
* gst/Makefile.am:
* gst/elements/gstbufferstore.h:
* gst/elements/gsttypefindelement.c:
* gst/elements/gsttypefindelement.h:
* gst/gst.h:
* gst/gsttypefind.c:
* gst/gsttypefind.h:
* gst/gsttypefindfactory.c: (gst_type_find_factory_get_type),
(gst_type_find_factory_class_init), (gst_type_find_factory_init),
(gst_type_find_factory_dispose),
(gst_type_find_factory_unload_thyself),
(gst_type_find_load_plugin), (gst_type_find_factory_get_list),
(gst_type_find_factory_get_caps),
(gst_type_find_factory_get_extensions),
(gst_type_find_factory_call_function):
* gst/gsttypefindfactory.h:
* gst/registries/gstlibxmlregistry.c:
* gst/registries/gstxmlregistry.c:
splitted gsttypefind into gsttypefind, gsttypefindfactory
2005-09-07 12:35:23 +00:00
|
|
|
* gsttypefindelement.c: element that detects type of stream
|
2003-10-28 20:25:30 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* FIXME: need a better solution for non-seekable streams */
|
|
|
|
|
|
|
|
/* way of operation:
|
|
|
|
* 1) get a list of all typefind functions sorted best to worst
|
|
|
|
* 2) if all elements have been called with all requested data goto 8
|
|
|
|
* 3) call all functions once with all available data
|
|
|
|
* 4) if a function returns a value >= ARG_MAXIMUM goto 8
|
|
|
|
* 5) all functions with a result > ARG_MINIMUM or functions that did not get
|
|
|
|
* all requested data (where peek returned NULL) stay in list
|
|
|
|
* 6) seek to requested offset of best function that still has open data
|
|
|
|
* requests
|
|
|
|
* 7) goto 2
|
|
|
|
* 8) take best available result and use its caps
|
2005-04-12 10:52:55 +00:00
|
|
|
*
|
|
|
|
* The element has two scheduling modes:
|
|
|
|
*
|
|
|
|
* 1) chain based, it will collect buffers and run the typefind function on
|
|
|
|
* the buffer until something is found.
|
|
|
|
* 2) getrange based, it will proxy the getrange function to the sinkpad. It
|
|
|
|
* is assumed that the peer element is happy with whatever format we
|
|
|
|
* eventually read.
|
|
|
|
*
|
|
|
|
* When the element has no connected srcpad, and the sinkpad can operate in
|
|
|
|
* getrange based mode, the element starts its own task to figure out the
|
|
|
|
* type of the stream.
|
|
|
|
*
|
2003-10-28 20:25:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2004-04-29 00:32:28 +00:00
|
|
|
#include "gsttypefindelement.h"
|
2003-10-28 20:25:30 +00:00
|
|
|
#include "gst/gst_private.h"
|
2004-01-13 11:30:00 +00:00
|
|
|
#include "gst/gst-i18n-lib.h"
|
2005-04-12 10:52:55 +00:00
|
|
|
#include "gst/base/gsttypefindhelper.h"
|
2003-10-28 20:25:30 +00:00
|
|
|
|
|
|
|
#include <gst/gsttypefind.h>
|
2004-01-08 04:10:18 +00:00
|
|
|
#include <gst/gstutils.h>
|
2004-01-18 21:36:20 +00:00
|
|
|
#include <gst/gsterror.h>
|
2003-10-28 20:25:30 +00:00
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
|
2003-10-28 20:25:30 +00:00
|
|
|
#define GST_CAT_DEFAULT gst_type_find_element_debug
|
|
|
|
|
2005-09-28 12:52:51 +00:00
|
|
|
static GstElementDetails gst_type_find_element_details =
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_ELEMENT_DETAILS ("TypeFind",
|
|
|
|
"Generic",
|
|
|
|
"Finds the media type of a stream",
|
|
|
|
"Benjamin Otte <in7y118@public.uni-hamburg.de>");
|
2003-10-28 20:25:30 +00:00
|
|
|
|
|
|
|
/* generic templates */
|
2004-03-13 15:27:01 +00:00
|
|
|
GstStaticPadTemplate type_find_element_sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
GstStaticPadTemplate type_find_element_src_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
2003-10-28 20:25:30 +00:00
|
|
|
|
|
|
|
/* TypeFind signals and args */
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-10-28 20:25:30 +00:00
|
|
|
HAVE_TYPE,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-10-28 20:25:30 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_CAPS,
|
|
|
|
ARG_MINIMUM,
|
|
|
|
ARG_MAXIMUM
|
|
|
|
};
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-03-15 19:27:17 +00:00
|
|
|
MODE_NORMAL, /* act as identity */
|
2004-05-28 05:01:05 +00:00
|
|
|
MODE_TYPEFIND /* do typefinding */
|
2003-10-28 20:25:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-01-08 04:10:18 +00:00
|
|
|
#define _do_init(bla) \
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_type_find_element_debug, "typefind", \
|
|
|
|
GST_DEBUG_BG_YELLOW | GST_DEBUG_FG_GREEN, "type finding element");
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_BOILERPLATE_FULL (GstTypeFindElement, gst_type_find_element, GstElement,
|
|
|
|
GST_TYPE_ELEMENT, _do_init);
|
2004-01-08 04:10:18 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_type_find_element_dispose (GObject * object);
|
|
|
|
static void gst_type_find_element_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_type_find_element_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
2003-10-28 20:25:30 +00:00
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
#if 0
|
2004-03-13 15:27:01 +00:00
|
|
|
static const GstEventMask *gst_type_find_element_src_event_mask (GstPad * pad);
|
2005-05-09 10:53:13 +00:00
|
|
|
#endif
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static gboolean gst_type_find_element_src_event (GstPad * pad,
|
|
|
|
GstEvent * event);
|
2005-05-09 10:53:13 +00:00
|
|
|
static gboolean gst_type_find_handle_src_query (GstPad * pad, GstQuery * query);
|
2003-10-28 20:25:30 +00:00
|
|
|
|
2005-04-12 10:52:55 +00:00
|
|
|
static gboolean gst_type_find_element_handle_event (GstPad * pad,
|
|
|
|
GstEvent * event);
|
|
|
|
static GstFlowReturn gst_type_find_element_chain (GstPad * sinkpad,
|
|
|
|
GstBuffer * buffer);
|
|
|
|
static GstFlowReturn gst_type_find_element_getrange (GstPad * srcpad,
|
|
|
|
guint64 offset, guint length, GstBuffer ** buffer);
|
2005-05-05 21:45:54 +00:00
|
|
|
static gboolean gst_type_find_element_checkgetrange (GstPad * srcpad);
|
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_type_find_element_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
static gboolean gst_type_find_element_activate (GstPad * pad);
|
2005-04-12 10:52:55 +00:00
|
|
|
static gboolean
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active);
|
2003-10-28 20:25:30 +00:00
|
|
|
|
|
|
|
static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_type_find_element_have_type (GstTypeFindElement * typefind,
|
|
|
|
guint probability, const GstCaps * caps)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
g_assert (typefind->caps == NULL);
|
|
|
|
g_assert (caps != NULL);
|
|
|
|
|
2004-01-29 01:44:08 +00:00
|
|
|
GST_INFO_OBJECT (typefind, "found caps %" GST_PTR_FORMAT, caps);
|
2003-12-24 07:42:43 +00:00
|
|
|
typefind->caps = gst_caps_copy (caps);
|
2005-04-12 10:52:55 +00:00
|
|
|
gst_pad_set_caps (typefind->src, (GstCaps *) caps);
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
static void
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_type_find_element_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-07-25 15:01:52 +00:00
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&type_find_element_src_template));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&type_find_element_sink_template));
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_class_set_details (gstelement_class,
|
|
|
|
&gst_type_find_element_details);
|
2003-10-31 19:32:47 +00:00
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
2004-01-08 04:10:18 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (typefind_class);
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (typefind_class);
|
2003-10-28 20:25:30 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gobject_class->set_property =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_type_find_element_set_property);
|
|
|
|
gobject_class->get_property =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_type_find_element_get_property);
|
|
|
|
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_type_find_element_dispose);
|
2003-10-28 20:25:30 +00:00
|
|
|
|
|
|
|
typefind_class->have_type = gst_type_find_element_have_type;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, ARG_CAPS,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_boxed ("caps", _("caps"),
|
2004-03-15 19:27:17 +00:00
|
|
|
_("detected capabilities in stream"), gst_caps_get_type (),
|
|
|
|
G_PARAM_READABLE));
|
2003-10-28 20:25:30 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_MINIMUM,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_uint ("minimum", _("minimum"),
|
2004-03-15 19:27:17 +00:00
|
|
|
"minimum probability required to accept caps", GST_TYPE_FIND_MINIMUM,
|
|
|
|
GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MINIMUM, G_PARAM_READWRITE));
|
2003-10-28 20:25:30 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_MINIMUM,
|
2004-03-13 15:27:01 +00:00
|
|
|
g_param_spec_uint ("maximum", _("maximum"),
|
2004-03-15 19:27:17 +00:00
|
|
|
"probability to stop typefinding", GST_TYPE_FIND_MINIMUM,
|
|
|
|
GST_TYPE_FIND_MAXIMUM, GST_TYPE_FIND_MAXIMUM, G_PARAM_READWRITE));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
gst_type_find_element_signals[HAVE_TYPE] = g_signal_new ("have_type",
|
|
|
|
G_TYPE_FROM_CLASS (typefind_class), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstTypeFindElementClass, have_type), NULL, NULL,
|
|
|
|
gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_UINT, GST_TYPE_CAPS | G_SIGNAL_TYPE_STATIC_SCOPE);
|
|
|
|
|
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
static void
|
2005-08-28 17:45:58 +00:00
|
|
|
gst_type_find_element_init (GstTypeFindElement * typefind,
|
|
|
|
GstTypeFindElementClass * g_class)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
/* sinkpad */
|
2004-03-13 15:27:01 +00:00
|
|
|
typefind->sink =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&type_find_element_sink_template), "sink");
|
2005-04-12 10:52:55 +00:00
|
|
|
gst_pad_set_activate_function (typefind->sink,
|
|
|
|
gst_type_find_element_activate);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_pad_set_chain_function (typefind->sink, gst_type_find_element_chain);
|
2005-04-12 10:52:55 +00:00
|
|
|
gst_pad_set_event_function (typefind->sink,
|
|
|
|
gst_type_find_element_handle_event);
|
2003-10-28 20:25:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);
|
|
|
|
/* srcpad */
|
2004-03-13 15:27:01 +00:00
|
|
|
typefind->src =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&type_find_element_src_template), "src");
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
gst_pad_set_activatepull_function (typefind->src,
|
|
|
|
gst_type_find_element_activate_src_pull);
|
2005-04-12 10:52:55 +00:00
|
|
|
gst_pad_set_checkgetrange_function (typefind->src,
|
|
|
|
gst_type_find_element_checkgetrange);
|
|
|
|
gst_pad_set_getrange_function (typefind->src, gst_type_find_element_getrange);
|
2003-10-28 20:25:30 +00:00
|
|
|
gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
|
2004-11-08 15:45:31 +00:00
|
|
|
gst_pad_set_query_function (typefind->src,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_type_find_handle_src_query));
|
2005-04-12 10:52:55 +00:00
|
|
|
gst_pad_use_fixed_caps (typefind->src);
|
2003-10-28 20:25:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);
|
|
|
|
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
typefind->mode = MODE_TYPEFIND;
|
2003-10-28 20:25:30 +00:00
|
|
|
typefind->caps = NULL;
|
|
|
|
typefind->min_probability = 1;
|
|
|
|
typefind->max_probability = GST_TYPE_FIND_MAXIMUM;
|
|
|
|
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
typefind->store = NULL;
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_type_find_element_dispose (GObject * object)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (object);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
|
|
|
|
if (typefind->store) {
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
gst_buffer_unref (typefind->store);
|
2003-10-28 20:25:30 +00:00
|
|
|
typefind->store = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_type_find_element_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
GstTypeFindElement *typefind;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_TYPE_FIND_ELEMENT (object));
|
|
|
|
|
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_MINIMUM:
|
|
|
|
typefind->min_probability = g_value_get_uint (value);
|
|
|
|
g_object_notify (object, "minimum");
|
|
|
|
break;
|
|
|
|
case ARG_MAXIMUM:
|
|
|
|
typefind->max_probability = g_value_get_uint (value);
|
|
|
|
g_object_notify (object, "maximum");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_type_find_element_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
GstTypeFindElement *typefind;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_TYPE_FIND_ELEMENT (object));
|
|
|
|
|
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_CAPS:
|
|
|
|
g_value_set_boxed (value, typefind->caps);
|
|
|
|
break;
|
|
|
|
case ARG_MINIMUM:
|
|
|
|
g_value_set_uint (value, typefind->min_probability);
|
|
|
|
break;
|
|
|
|
case ARG_MAXIMUM:
|
|
|
|
g_value_set_uint (value, typefind->max_probability);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-11-08 15:45:31 +00:00
|
|
|
|
|
|
|
static gboolean
|
2005-05-09 10:53:13 +00:00
|
|
|
gst_type_find_handle_src_query (GstPad * pad, GstQuery * query)
|
2004-11-08 15:45:31 +00:00
|
|
|
{
|
2005-05-09 10:53:13 +00:00
|
|
|
GstTypeFindElement *typefind;
|
2004-11-08 15:45:31 +00:00
|
|
|
gboolean res;
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
res = gst_pad_query (GST_PAD_PEER (typefind->sink), query);
|
2004-11-08 15:45:31 +00:00
|
|
|
if (!res)
|
|
|
|
return FALSE;
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_POSITION:
|
|
|
|
{
|
|
|
|
gint64 peer_pos, peer_total;
|
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
if (typefind->store == NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
gst_query_parse_position (query, &format, &peer_pos, &peer_total);
|
|
|
|
|
|
|
|
/* FIXME: this code assumes that there's no discont in the queue */
|
|
|
|
switch (format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
peer_pos -= typefind->store->size;
|
2005-05-09 10:53:13 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* FIXME */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
gst_query_set_position (query, format, peer_pos, peer_total);
|
|
|
|
break;
|
2004-11-08 15:45:31 +00:00
|
|
|
}
|
2005-05-09 10:53:13 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-11-08 15:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
#if 0
|
2003-10-28 20:25:30 +00:00
|
|
|
static const GstEventMask *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_type_find_element_src_event_mask (GstPad * pad)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
static const GstEventMask mask[] = {
|
2004-03-13 15:27:01 +00:00
|
|
|
{GST_EVENT_SEEK,
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_SEEK_METHOD_SET | GST_SEEK_METHOD_CUR | GST_SEEK_METHOD_END |
|
|
|
|
GST_SEEK_FLAG_FLUSH},
|
2003-10-28 20:25:30 +00:00
|
|
|
/* add more if you want, event masks suck and need to die anyway */
|
2004-03-13 15:27:01 +00:00
|
|
|
{0,}
|
2003-10-28 20:25:30 +00:00
|
|
|
};
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
return mask;
|
|
|
|
}
|
2005-05-09 10:53:13 +00:00
|
|
|
#endif
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_type_find_element_src_event (GstPad * pad, GstEvent * event)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
|
|
|
|
|
2004-09-26 17:48:05 +00:00
|
|
|
if (typefind->mode != MODE_NORMAL) {
|
2003-10-28 20:25:30 +00:00
|
|
|
/* need to do more? */
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT (event));
|
2003-10-28 20:25:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return gst_pad_event_default (pad, event);
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstTypeFindFactory *factory;
|
|
|
|
gint probability;
|
|
|
|
GstCaps *caps;
|
|
|
|
guint requested_size;
|
|
|
|
GstTypeFindElement *self;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
TypeFindEntry;
|
2004-02-03 22:13:13 +00:00
|
|
|
|
|
|
|
static inline TypeFindEntry *
|
|
|
|
new_entry (void)
|
|
|
|
{
|
|
|
|
return g_new0 (TypeFindEntry, 1);
|
|
|
|
}
|
2003-10-28 20:25:30 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
free_entry (TypeFindEntry * entry)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
if (entry->caps)
|
2005-03-07 18:27:42 +00:00
|
|
|
gst_caps_unref (entry->caps);
|
2003-10-28 20:25:30 +00:00
|
|
|
g_free (entry);
|
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
start_typefinding (GstTypeFindElement * typefind)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
g_assert (typefind->possibilities == NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
GST_DEBUG_OBJECT (typefind, "starting typefinding");
|
2005-04-12 10:52:55 +00:00
|
|
|
gst_pad_set_caps (typefind->src, NULL);
|
2004-05-06 21:40:55 +00:00
|
|
|
if (typefind->caps) {
|
|
|
|
gst_caps_replace (&typefind->caps, NULL);
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
typefind->mode = MODE_TYPEFIND;
|
|
|
|
typefind->stream_length_available = TRUE;
|
|
|
|
typefind->stream_length = 0;
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
stop_typefinding (GstTypeFindElement * typefind)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
2005-09-02 15:42:00 +00:00
|
|
|
GstState state;
|
2005-04-12 10:52:55 +00:00
|
|
|
gboolean push_cached_buffers;
|
|
|
|
|
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
|
|
|
gst_element_get_state (GST_ELEMENT (typefind), &state, NULL,
|
|
|
|
GST_CLOCK_TIME_NONE);
|
2005-04-12 10:52:55 +00:00
|
|
|
|
|
|
|
push_cached_buffers = (state >= GST_STATE_PAUSED);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (typefind, "stopping typefinding%s",
|
|
|
|
push_cached_buffers ? " and pushing cached buffers" : "");
|
2003-10-28 20:25:30 +00:00
|
|
|
if (typefind->possibilities != NULL) {
|
|
|
|
/* this should only happen on PAUSED => READY or EOS */
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_LOG_OBJECT (typefind, "freeing remaining %u typefind functions",
|
2004-03-15 19:27:17 +00:00
|
|
|
g_list_length (typefind->possibilities));
|
2003-10-28 20:25:30 +00:00
|
|
|
g_list_foreach (typefind->possibilities, (GFunc) free_entry, NULL);
|
|
|
|
g_list_free (typefind->possibilities);
|
|
|
|
typefind->possibilities = NULL;
|
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
//typefind->mode = MODE_TRANSITION;
|
2003-10-28 20:25:30 +00:00
|
|
|
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
if (typefind->store) {
|
|
|
|
if (!push_cached_buffers) {
|
|
|
|
gst_buffer_unref (typefind->store);
|
|
|
|
} else {
|
|
|
|
typefind->mode = MODE_NORMAL;
|
2005-08-01 11:15:47 +00:00
|
|
|
gst_buffer_set_caps (typefind->store, typefind->caps);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
gst_pad_push (typefind->src, typefind->store);
|
|
|
|
}
|
|
|
|
typefind->store = NULL;
|
2004-09-26 17:48:05 +00:00
|
|
|
}
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
static guint64
|
|
|
|
find_element_get_length (gpointer data)
|
|
|
|
{
|
|
|
|
TypeFindEntry *entry = (TypeFindEntry *) data;
|
|
|
|
GstTypeFindElement *typefind = entry->self;
|
|
|
|
GstFormat format = GST_FORMAT_BYTES;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
if (!typefind->stream_length_available) {
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_LOG_OBJECT (entry->self,
|
2004-03-15 19:27:17 +00:00
|
|
|
"'%s' called get_length () but we know it's not available",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
2003-10-28 20:25:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (entry->self->stream_length == 0) {
|
2005-05-09 10:53:13 +00:00
|
|
|
if (!gst_pad_query_position (GST_PAD_PEER (entry->self->sink), &format,
|
|
|
|
NULL, (gint64 *) & entry->self->stream_length))
|
|
|
|
goto no_length;
|
|
|
|
|
|
|
|
if (format != GST_FORMAT_BYTES) {
|
2003-10-28 20:25:30 +00:00
|
|
|
typefind->stream_length_available = FALSE;
|
2005-05-09 10:53:13 +00:00
|
|
|
entry->self->stream_length = 0;
|
2003-10-28 20:25:30 +00:00
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_DEBUG_OBJECT (entry->self,
|
2004-03-15 19:27:17 +00:00
|
|
|
"'%s' called get_length () and it's %" G_GUINT64_FORMAT " bytes",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->self->stream_length);
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return entry->self->stream_length;
|
2005-05-09 10:53:13 +00:00
|
|
|
|
|
|
|
no_length:
|
|
|
|
{
|
|
|
|
typefind->stream_length_available = FALSE;
|
|
|
|
GST_DEBUG_OBJECT (entry->self,
|
|
|
|
"'%s' called get_length () but it's not available",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
|
|
|
return 0;
|
|
|
|
}
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_type_find_element_handle_event (GstPad * pad, GstEvent * event)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
2005-04-12 10:52:55 +00:00
|
|
|
gboolean res = FALSE;
|
2003-10-28 20:25:30 +00:00
|
|
|
TypeFindEntry *entry;
|
|
|
|
GstTypeFindElement *typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
|
|
|
|
|
2004-10-08 09:36:50 +00:00
|
|
|
GST_DEBUG_OBJECT (typefind, "got event %d in mode %d", GST_EVENT_TYPE (event),
|
|
|
|
typefind->mode);
|
|
|
|
|
2004-09-26 17:48:05 +00:00
|
|
|
switch (typefind->mode) {
|
|
|
|
case MODE_TYPEFIND:
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
/* this should only happen when we got all available data */
|
|
|
|
entry =
|
|
|
|
(TypeFindEntry *) typefind->possibilities ? typefind->
|
|
|
|
possibilities->data : NULL;
|
|
|
|
if (entry && entry->probability >= typefind->min_probability) {
|
|
|
|
GST_INFO_OBJECT (typefind,
|
|
|
|
"'%s' is the best typefind left after we got all data, using it now (probability %u)",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability);
|
|
|
|
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
|
|
|
|
0, entry->probability, entry->caps);
|
|
|
|
stop_typefinding (typefind);
|
2005-08-01 11:15:47 +00:00
|
|
|
gst_buffer_set_caps (typefind->store, typefind->caps);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
gst_pad_push (typefind->src, typefind->store);
|
|
|
|
typefind->store = NULL;
|
2005-04-12 10:52:55 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
2004-09-26 17:48:05 +00:00
|
|
|
} else {
|
2005-04-12 10:52:55 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
2004-09-26 17:48:05 +00:00
|
|
|
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL),
|
|
|
|
(NULL));
|
|
|
|
stop_typefinding (typefind);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
check/Makefile.am: remove GstData checks
Original commit message from CVS:
* check/Makefile.am: remove GstData checks
* check/gst-libs/gdp.c: (START_TEST): fix for API changes
* gst/Makefile.am: add miniobject, remove data
* gst/gst.h: add miniobject, remove data
* gst/gstdata.c: remove
* gst/gstdata.h: remove
* gst/gstdata_private.h: remove
* gst/gsttypes.h: remove GstEvent and GstMessage
* gst/gstelement.c: (gst_element_post_message): fix for API changes
* gst/gstmarshal.list: change BOXED -> OBJECT
Implement GstMiniObject.
* gst/gstminiobject.c:
* gst/gstminiobject.h:
Modify to be subclasses of GstMiniObject.
* gst/gstbuffer.c: (_gst_buffer_initialize), (gst_buffer_get_type),
(gst_buffer_class_init), (gst_buffer_finalize), (_gst_buffer_copy),
(gst_buffer_init), (gst_buffer_new), (gst_buffer_new_and_alloc),
(gst_subbuffer_get_type), (gst_subbuffer_init),
(gst_buffer_create_sub), (gst_buffer_is_span_fast),
(gst_buffer_span):
* gst/gstbuffer.h:
* gst/gstevent.c: (_gst_event_initialize), (gst_event_get_type),
(gst_event_class_init), (gst_event_init), (gst_event_finalize),
(_gst_event_copy), (gst_event_new):
* gst/gstevent.h:
* gst/gstmessage.c: (_gst_message_initialize),
(gst_message_get_type), (gst_message_class_init),
(gst_message_init), (gst_message_finalize), (_gst_message_copy),
(gst_message_new), (gst_message_new_error),
(gst_message_new_warning), (gst_message_new_tag),
(gst_message_new_state_changed), (gst_message_new_application):
* gst/gstmessage.h:
* gst/gstprobe.c: (gst_probe_perform),
(gst_probe_dispatcher_dispatch):
* gst/gstprobe.h:
* gst/gstquery.c: (_gst_query_initialize), (gst_query_get_type),
(gst_query_class_init), (gst_query_finalize), (gst_query_init),
(_gst_query_copy), (gst_query_new):
Update elements for GstData -> GstMiniObject changes
* gst/gstquery.h:
* gst/gstqueue.c: (gst_queue_finalize), (gst_queue_locked_flush),
(gst_queue_chain), (gst_queue_loop):
* gst/elements/gstbufferstore.c:
(gst_buffer_store_add_buffer_func),
(gst_buffer_store_cleared_func), (gst_buffer_store_get_buffer):
* gst/elements/gstfakesink.c: (gst_fakesink_class_init),
(gst_fakesink_render):
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init):
* gst/elements/gstfilesrc.c: (gst_mmap_buffer_get_type),
(gst_mmap_buffer_class_init), (gst_mmap_buffer_init),
(gst_mmap_buffer_finalize), (gst_filesrc_map_region),
(gst_filesrc_create_read):
* gst/elements/gstidentity.c: (gst_identity_class_init):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_src_event), (free_entry_buffers),
(gst_type_find_element_handle_event):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_header_from_buffer):
* libs/gst/dataprotocol/dataprotocol.h:
* libs/gst/dataprotocol/dp-private.h:
2005-05-16 20:21:55 +00:00
|
|
|
gst_mini_object_unref (GST_MINI_OBJECT (event));
|
2005-04-12 10:52:55 +00:00
|
|
|
res = TRUE;
|
2004-09-26 17:48:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MODE_NORMAL:
|
2005-06-23 11:43:39 +00:00
|
|
|
if (FALSE) { // GST_EVENT_TYPE (event) == GST_EVENT_DISCONTINUOUS) {
|
2004-09-26 17:48:05 +00:00
|
|
|
start_typefinding (typefind);
|
|
|
|
gst_event_unref (event);
|
2005-04-12 10:52:55 +00:00
|
|
|
res = TRUE;
|
2004-09-26 17:48:05 +00:00
|
|
|
} else {
|
2005-04-12 10:52:55 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
2004-09-26 17:48:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
return res;
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
static guint8 *
|
|
|
|
find_peek (gpointer data, gint64 offset, guint size)
|
|
|
|
{
|
|
|
|
TypeFindEntry *entry = (TypeFindEntry *) data;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (entry->self, "'%s' called peek (%" G_GINT64_FORMAT ", %u)",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory), offset, size);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
if (offset != 0)
|
|
|
|
return NULL;
|
2003-10-28 20:25:30 +00:00
|
|
|
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
if (size <= entry->self->store->size) {
|
|
|
|
return GST_BUFFER_DATA (entry->self->store);
|
2003-10-28 20:25:30 +00:00
|
|
|
} else {
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
entry->requested_size = size;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (entry->self,
|
|
|
|
"setting requested peek (%" G_GINT64_FORMAT ", %u) on '%s'", offset,
|
|
|
|
size, GST_PLUGIN_FEATURE_NAME (entry->factory));
|
2003-10-28 20:25:30 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
find_suggest (gpointer data, guint probability, const GstCaps * caps)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
TypeFindEntry *entry = (TypeFindEntry *) data;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (entry->self, "'%s' called suggest (%u, %" GST_PTR_FORMAT ")",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory), probability, caps);
|
2003-10-28 20:25:30 +00:00
|
|
|
if (((gint) probability) > entry->probability) {
|
|
|
|
entry->probability = probability;
|
gst/: Make gst_caps_replace() work like other _replace() functions.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_basesink_base_init),
(gst_basesink_pad_getcaps), (gst_basesink_init),
(gst_basesink_chain_unlocked):
* gst/base/gsttypefindhelper.c: (helper_find_suggest),
(gst_type_find_helper):
* gst/elements/gsttypefindelement.c:
(gst_type_find_element_have_type), (gst_type_find_element_init),
(stop_typefinding), (gst_type_find_element_handle_event),
(find_suggest), (gst_type_find_element_chain),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_getrange), (do_typefind),
(gst_type_find_element_activate):
* gst/gstbuffer.c: (_gst_buffer_sub_free),
(gst_buffer_default_free), (gst_buffer_default_copy),
(gst_buffer_set_caps):
* gst/gstcaps.c: (gst_caps_ref), (gst_caps_unref),
(gst_caps_replace):
* gst/gstmessage.c: (gst_message_new),
(gst_message_new_state_changed):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_prepare_filtered), (gst_pad_relink_filtered),
(gst_pad_set_caps), (gst_pad_check_pull_range),
(gst_pad_pull_range), (gst_static_pad_template_get_caps):
* gst/gstpad.h:
* gst/gsttypefind.c: (gst_type_find_register):
Make gst_caps_replace() work like other _replace() functions.
Use _caps_replace() where possible.
Make sure _message_new() initialises its field.
Add gst_static_pad_template_get_caps()
2005-04-20 09:10:42 +00:00
|
|
|
gst_caps_replace (&entry->caps, (GstCaps *) caps);
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
#if 0
|
2003-10-28 20:25:30 +00:00
|
|
|
static gint
|
|
|
|
compare_type_find_entry (gconstpointer a, gconstpointer b)
|
|
|
|
{
|
|
|
|
TypeFindEntry *one = (TypeFindEntry *) a;
|
|
|
|
TypeFindEntry *two = (TypeFindEntry *) b;
|
|
|
|
|
|
|
|
if (one->probability == two->probability) {
|
|
|
|
/* FIXME: can be improved by analyzing requests */
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return two->probability - one->probability;
|
|
|
|
}
|
|
|
|
}
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
#endif
|
2005-04-12 10:52:55 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
static gint
|
|
|
|
compare_type_find_factory (gconstpointer fac1, gconstpointer fac2)
|
|
|
|
{
|
|
|
|
return GST_PLUGIN_FEATURE (fac1)->rank - GST_PLUGIN_FEATURE (fac2)->rank;
|
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
|
|
|
GstTypeFindElement *typefind;
|
|
|
|
GList *entries;
|
|
|
|
TypeFindEntry *entry;
|
|
|
|
GList *walk;
|
2005-04-12 10:52:55 +00:00
|
|
|
GstFlowReturn res = GST_FLOW_OK;
|
2004-03-13 15:27:01 +00:00
|
|
|
GstTypeFind find = { find_peek, find_suggest, NULL, find_element_get_length };
|
2003-10-28 20:25:30 +00:00
|
|
|
|
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
|
2005-04-12 10:52:55 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
switch (typefind->mode) {
|
|
|
|
case MODE_NORMAL:
|
2005-08-01 11:15:47 +00:00
|
|
|
gst_buffer_set_caps (buffer, typefind->caps);
|
2005-04-12 10:52:55 +00:00
|
|
|
return gst_pad_push (typefind->src, buffer);
|
2004-03-13 15:27:01 +00:00
|
|
|
case MODE_TYPEFIND:{
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
gboolean done = TRUE;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
if (typefind->store)
|
|
|
|
typefind->store = gst_buffer_join (typefind->store, buffer);
|
|
|
|
else
|
|
|
|
typefind->store = buffer;
|
2005-04-12 10:52:55 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
if (typefind->possibilities == NULL) {
|
2004-03-15 19:27:17 +00:00
|
|
|
/* not yet started, get all typefinding functions into our "queue" */
|
|
|
|
GList *all_factories = gst_type_find_factory_get_list ();
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (typefind, "starting with %u typefinding functions",
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
g_list_length (all_factories));
|
2004-03-15 19:27:17 +00:00
|
|
|
|
|
|
|
all_factories = g_list_sort (all_factories, compare_type_find_factory);
|
|
|
|
walk = all_factories;
|
|
|
|
while (all_factories) {
|
|
|
|
entry = new_entry ();
|
|
|
|
|
|
|
|
entry->factory = GST_TYPE_FIND_FACTORY (all_factories->data);
|
|
|
|
entry->self = typefind;
|
|
|
|
entry->probability = 0;
|
|
|
|
typefind->possibilities =
|
|
|
|
g_list_prepend (typefind->possibilities, entry);
|
|
|
|
all_factories = g_list_next (all_factories);
|
|
|
|
}
|
2005-09-16 03:46:14 +00:00
|
|
|
gst_plugin_feature_list_free (all_factories);
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
/* call every typefind function once */
|
|
|
|
walk = entries = typefind->possibilities;
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_INFO_OBJECT (typefind, "iterating %u typefinding functions",
|
2004-03-15 19:27:17 +00:00
|
|
|
g_list_length (entries));
|
2003-10-28 20:25:30 +00:00
|
|
|
typefind->possibilities = NULL;
|
|
|
|
while (walk) {
|
2004-03-15 19:27:17 +00:00
|
|
|
find.data = entry = (TypeFindEntry *) walk->data;
|
|
|
|
walk = g_list_next (walk);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
if (entry->probability == 0) {
|
|
|
|
entry->requested_size = 0;
|
|
|
|
gst_type_find_factory_call_function (entry->factory, &find);
|
|
|
|
} else {
|
|
|
|
typefind->possibilities =
|
|
|
|
g_list_prepend (typefind->possibilities, entry);
|
|
|
|
continue;
|
|
|
|
}
|
2004-03-15 19:27:17 +00:00
|
|
|
if (entry->probability == 0 && entry->requested_size == 0) {
|
|
|
|
GST_DEBUG_OBJECT (typefind,
|
|
|
|
"'%s' was removed - no chance of being the right plugin",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory));
|
|
|
|
free_entry (entry);
|
|
|
|
} else if (entry->probability >= typefind->max_probability) {
|
|
|
|
/* wooha, got caps */
|
|
|
|
GstCaps *found_caps = entry->caps;
|
|
|
|
guint probability = entry->probability;
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (typefind,
|
|
|
|
"'%s' returned %u/%u probability, using it NOW",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory), probability,
|
|
|
|
typefind->max_probability);
|
|
|
|
while (walk) {
|
|
|
|
free_entry ((TypeFindEntry *) walk->data);
|
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
walk = typefind->possibilities;
|
|
|
|
while (walk) {
|
|
|
|
free_entry (walk->data);
|
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
g_list_free (typefind->possibilities);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
typefind->possibilities = NULL;
|
2004-03-15 19:27:17 +00:00
|
|
|
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
|
|
|
|
probability, found_caps);
|
|
|
|
free_entry (entry);
|
|
|
|
} else {
|
|
|
|
typefind->possibilities =
|
|
|
|
g_list_prepend (typefind->possibilities, entry);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
if (entry->requested_size != 0)
|
|
|
|
done = FALSE;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
g_list_free (entries);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
/* we may now already have caps or we might be left without functions to try */
|
|
|
|
if (typefind->caps) {
|
2004-03-15 19:27:17 +00:00
|
|
|
stop_typefinding (typefind);
|
2003-10-28 20:25:30 +00:00
|
|
|
} else if (typefind->possibilities == NULL) {
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
|
2004-07-25 15:01:52 +00:00
|
|
|
stop_typefinding (typefind);
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
} else if (done) {
|
|
|
|
TypeFindEntry *best = NULL;
|
2004-03-15 19:27:17 +00:00
|
|
|
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
walk = typefind->possibilities;
|
|
|
|
while (walk) {
|
2004-03-15 19:27:17 +00:00
|
|
|
entry = (TypeFindEntry *) typefind->possibilities->data;
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
if ((!best || entry->probability > best->probability) &&
|
|
|
|
entry->probability >= typefind->min_probability) {
|
|
|
|
best = entry;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
gst/base/gstbasesrc.c: Don't go in pull mode for non-seekable sources.
Original commit message from CVS:
* gst/base/gstbasesrc.c: (gst_basesrc_activate):
Don't go in pull mode for non-seekable sources.
* gst/elements/gsttypefindelement.c: (gst_type_find_element_init),
(gst_type_find_element_dispose), (gst_type_find_handle_src_query),
(free_entry), (stop_typefinding),
(gst_type_find_element_handle_event), (find_peek),
(gst_type_find_element_chain), (do_pull_typefind),
(gst_type_find_element_change_state):
Allow typefinding (w/o seeking) in push-mode, simplified version
of what was in 0.8.
* gst/gstutils.c: (gst_buffer_join):
* gst/gstutils.h:
gst_buffer_join() from 0.8.
2005-05-25 15:57:57 +00:00
|
|
|
walk = g_list_next (walk);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (best) {
|
|
|
|
GST_INFO_OBJECT (typefind,
|
|
|
|
"'%s' is the only typefind left, using it now (probability %u)",
|
|
|
|
GST_PLUGIN_FEATURE_NAME (entry->factory), entry->probability);
|
|
|
|
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
|
|
|
|
0, entry->probability, entry->caps);
|
|
|
|
g_list_foreach (typefind->possibilities, (GFunc) free_entry, NULL);
|
|
|
|
g_list_free (typefind->possibilities);
|
|
|
|
typefind->possibilities = NULL;
|
|
|
|
stop_typefinding (typefind);
|
|
|
|
} else {
|
|
|
|
GST_ELEMENT_ERROR (typefind, STREAM, TYPE_NOT_FOUND, (NULL), (NULL));
|
|
|
|
stop_typefinding (typefind);
|
|
|
|
return GST_FLOW_ERROR;
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2005-04-12 10:52:55 +00:00
|
|
|
return GST_FLOW_ERROR;
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
|
|
|
|
return res;
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
|
|
|
|
static gboolean
|
2005-05-05 21:45:54 +00:00
|
|
|
gst_type_find_element_checkgetrange (GstPad * srcpad)
|
2005-04-12 10:52:55 +00:00
|
|
|
{
|
|
|
|
GstTypeFindElement *typefind;
|
|
|
|
|
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (srcpad));
|
|
|
|
|
2005-05-05 21:45:54 +00:00
|
|
|
return gst_pad_check_pull_range (typefind->sink);
|
2005-04-12 10:52:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_type_find_element_getrange (GstPad * srcpad,
|
|
|
|
guint64 offset, guint length, GstBuffer ** buffer)
|
|
|
|
{
|
|
|
|
GstTypeFindElement *typefind;
|
2005-08-01 09:10:01 +00:00
|
|
|
GstFlowReturn ret;
|
2005-04-12 10:52:55 +00:00
|
|
|
|
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (srcpad));
|
|
|
|
|
2005-08-01 09:10:01 +00:00
|
|
|
ret = gst_pad_pull_range (typefind->sink, offset, length, buffer);
|
|
|
|
|
2005-08-01 11:15:47 +00:00
|
|
|
if (ret == GST_FLOW_OK && buffer && *buffer)
|
|
|
|
gst_buffer_set_caps (*buffer, typefind->caps);
|
2005-08-01 09:10:01 +00:00
|
|
|
|
|
|
|
return ret;
|
2005-04-12 10:52:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active)
|
2005-04-12 10:52:55 +00:00
|
|
|
{
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
GstTypeFindElement *typefind;
|
2005-04-12 10:52:55 +00:00
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (GST_OBJECT_PARENT (pad));
|
2005-04-12 10:52:55 +00:00
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
return gst_pad_activate_pull (typefind->sink, active);
|
2005-04-12 10:52:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
gst_type_find_element_activate (GstPad * pad)
|
2005-04-12 10:52:55 +00:00
|
|
|
{
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
GstCaps *found_caps = NULL;
|
2005-04-12 10:52:55 +00:00
|
|
|
GstTypeFindElement *typefind;
|
|
|
|
|
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (GST_OBJECT_PARENT (pad));
|
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
/* 1. try to activate in pull mode. if not, switch to push and succeed.
|
|
|
|
2. try to pull type find.
|
|
|
|
3. deactivate pull mode.
|
|
|
|
4. src pad might have been activated push by the state change. deactivate.
|
|
|
|
5. if we didn't find any caps, fail.
|
|
|
|
6. emit have-type; maybe the app connected the source pad to something.
|
|
|
|
7. if the sink pad is activated, we are in pull mode. succeed.
|
|
|
|
otherwise activate both pads in push mode and succeed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* 1 */
|
|
|
|
if (!gst_pad_activate_pull (pad, TRUE)) {
|
|
|
|
start_typefinding (typefind);
|
|
|
|
return gst_pad_activate_push (pad, TRUE);
|
2005-04-12 10:52:55 +00:00
|
|
|
}
|
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
/* 2 */
|
|
|
|
{
|
|
|
|
GstPad *peer;
|
|
|
|
|
|
|
|
peer = gst_pad_get_peer (pad);
|
|
|
|
if (peer) {
|
|
|
|
gint64 size;
|
|
|
|
GstFormat format = GST_FORMAT_BYTES;
|
|
|
|
|
|
|
|
gst_pad_query_position (peer, &format, NULL, &size);
|
|
|
|
found_caps = gst_type_find_helper (peer, (guint64) size);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (peer);
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 3 */
|
|
|
|
gst_pad_activate_pull (pad, FALSE);
|
|
|
|
|
|
|
|
/* 4 */
|
|
|
|
gst_pad_activate_push (typefind->src, FALSE);
|
|
|
|
|
|
|
|
/* 5 */
|
|
|
|
if (!found_caps)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* 6 */
|
|
|
|
g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE],
|
|
|
|
0, 100, found_caps);
|
|
|
|
typefind->mode = MODE_NORMAL;
|
|
|
|
/* FIXME see if I can unref the caps here */
|
|
|
|
|
|
|
|
/* 7 */
|
|
|
|
if (gst_pad_is_active (pad))
|
|
|
|
return TRUE;
|
|
|
|
else {
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
ret = gst_pad_activate_push (typefind->src, TRUE);
|
|
|
|
ret &= gst_pad_activate_push (pad, TRUE);
|
|
|
|
return ret;
|
|
|
|
}
|
2005-04-12 10:52:55 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_type_find_element_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
2003-10-28 20:25:30 +00:00
|
|
|
{
|
2005-09-02 15:42:00 +00:00
|
|
|
GstStateChangeReturn ret;
|
2003-10-28 20:25:30 +00:00
|
|
|
GstTypeFindElement *typefind;
|
|
|
|
|
|
|
|
typefind = GST_TYPE_FIND_ELEMENT (element);
|
|
|
|
|
2005-04-12 10:52:55 +00:00
|
|
|
|
2005-09-02 15:42:00 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2005-04-12 10:52:55 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:42:00 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2004-01-11 18:23:48 +00:00
|
|
|
gst_caps_replace (&typefind->caps, NULL);
|
2003-10-28 20:25:30 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-04-12 10:52:55 +00:00
|
|
|
return ret;
|
2003-10-28 20:25:30 +00:00
|
|
|
}
|