2000-12-28 22:12:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
2005-03-07 18:27:42 +00:00
|
|
|
* 2004 Wim Taymans <wim@fluendo.com>
|
2000-12-28 22:12:02 +00:00
|
|
|
*
|
|
|
|
* gstelement.c: The base element, all elements derive from this
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2004-05-07 02:36:28 +00:00
|
|
|
#include "gst_private.h"
|
2001-12-04 22:12:50 +00:00
|
|
|
#include <glib.h>
|
2001-12-13 23:37:47 +00:00
|
|
|
#include <stdarg.h>
|
2002-05-26 03:23:25 +00:00
|
|
|
#include <gobject/gvaluecollector.h>
|
2000-12-28 22:12:02 +00:00
|
|
|
|
2000-12-15 01:57:34 +00:00
|
|
|
#include "gstelement.h"
|
2005-03-21 17:34:02 +00:00
|
|
|
#include "gstbus.h"
|
2004-02-03 03:31:26 +00:00
|
|
|
#include "gstmarshal.h"
|
2004-01-18 21:36:20 +00:00
|
|
|
#include "gsterror.h"
|
2001-12-18 19:03:07 +00:00
|
|
|
#include "gstevent.h"
|
2001-03-03 17:38:26 +00:00
|
|
|
#include "gstutils.h"
|
2003-06-29 14:05:49 +00:00
|
|
|
#include "gstinfo.h"
|
2004-01-18 21:36:20 +00:00
|
|
|
#include "gst-i18n-lib.h"
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* Element signals and args */
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
STATE_CHANGE,
|
|
|
|
NEW_PAD,
|
2001-05-25 21:00:07 +00:00
|
|
|
PAD_REMOVED,
|
2004-05-10 16:48:44 +00:00
|
|
|
NO_MORE_PADS,
|
2003-11-24 02:09:23 +00:00
|
|
|
/* add more above */
|
2000-01-30 09:03:00 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-01-30 20:48:13 +00:00
|
|
|
ARG_0
|
2004-03-13 15:27:01 +00:00
|
|
|
/* FILL ME */
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
extern void __gst_element_details_clear (GstElementDetails * dp);
|
|
|
|
extern void __gst_element_details_copy (GstElementDetails * dest,
|
|
|
|
const GstElementDetails * src);
|
2003-10-31 19:32:47 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_element_class_init (GstElementClass * klass);
|
|
|
|
static void gst_element_init (GstElement * element);
|
|
|
|
static void gst_element_base_class_init (gpointer g_class);
|
|
|
|
static void gst_element_base_class_finalize (gpointer g_class);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void gst_element_dispose (GObject * object);
|
2005-03-07 18:27:42 +00:00
|
|
|
static void gst_element_finalize (GObject * object);
|
2000-07-17 17:14:15 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static GstElementStateReturn gst_element_change_state (GstElement * element);
|
2005-03-21 17:34:02 +00:00
|
|
|
static GstElementStateReturn gst_element_get_state_func (GstElement * element,
|
|
|
|
GstElementState * state, GstElementState * pending, GTimeVal * timeout);
|
|
|
|
static void gst_element_set_bus_func (GstElement * element, GstBus * bus);
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2001-06-25 06:45:56 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2004-03-13 15:27:01 +00:00
|
|
|
static xmlNodePtr gst_element_save_thyself (GstObject * object,
|
|
|
|
xmlNodePtr parent);
|
|
|
|
static void gst_element_restore_thyself (GstObject * parent, xmlNodePtr self);
|
2001-06-24 21:18:28 +00:00
|
|
|
#endif
|
2000-07-17 17:14:15 +00:00
|
|
|
|
2004-06-12 13:45:17 +00:00
|
|
|
GType _gst_element_type = 0;
|
2001-10-17 10:21:27 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
static GstObjectClass *parent_class = NULL;
|
|
|
|
static guint gst_element_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
GType
|
|
|
|
gst_element_get_type (void)
|
2001-10-17 10:21:27 +00:00
|
|
|
{
|
|
|
|
if (!_gst_element_type) {
|
2001-06-25 01:20:11 +00:00
|
|
|
static const GTypeInfo element_info = {
|
2004-03-13 15:27:01 +00:00
|
|
|
sizeof (GstElementClass),
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_element_base_class_init,
|
|
|
|
gst_element_base_class_finalize,
|
2004-03-13 15:27:01 +00:00
|
|
|
(GClassInitFunc) gst_element_class_init,
|
2001-06-25 01:20:11 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-13 15:27:01 +00:00
|
|
|
sizeof (GstElement),
|
2001-06-25 01:20:11 +00:00
|
|
|
0,
|
2004-03-13 15:27:01 +00:00
|
|
|
(GInstanceInitFunc) gst_element_init,
|
2001-09-14 22:16:47 +00:00
|
|
|
NULL
|
2000-01-30 09:03:00 +00:00
|
|
|
};
|
2004-03-15 19:27:17 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
_gst_element_type = g_type_register_static (GST_TYPE_OBJECT, "GstElement",
|
2004-03-15 19:27:17 +00:00
|
|
|
&element_info, G_TYPE_FLAG_ABSTRACT);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2001-10-17 10:21:27 +00:00
|
|
|
return _gst_element_type;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2001-01-20 03:10:44 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_class_init (GstElementClass * klass)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2001-06-25 01:20:11 +00:00
|
|
|
GObjectClass *gobject_class;
|
2001-01-29 00:06:02 +00:00
|
|
|
GstObjectClass *gstobject_class;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstobject_class = (GstObjectClass *) klass;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
parent_class = g_type_class_ref (GST_TYPE_OBJECT);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-01-24 17:04:08 +00:00
|
|
|
/**
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
* GstElement::state-changed:
|
2005-01-24 17:04:08 +00:00
|
|
|
* @gstelement: the object which received the signal
|
2005-08-24 13:04:31 +00:00
|
|
|
* @int:
|
|
|
|
* @int:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
*
|
|
|
|
* the #GstElementState of the element has been changed
|
|
|
|
*/
|
2000-01-30 09:03:00 +00:00
|
|
|
gst_element_signals[STATE_CHANGE] =
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
g_signal_new ("state-changed", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstElementClass, state_changed), NULL,
|
2004-03-13 15:27:01 +00:00
|
|
|
NULL, gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
2005-01-24 17:04:08 +00:00
|
|
|
/**
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
* GstElement::pad-added:
|
2005-01-24 17:04:08 +00:00
|
|
|
* @gstelement: the object which received the signal
|
2005-08-24 13:04:31 +00:00
|
|
|
* @object:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
*
|
|
|
|
* a new #GstPad has been added to the element
|
|
|
|
*/
|
2000-01-30 09:03:00 +00:00
|
|
|
gst_element_signals[NEW_PAD] =
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
g_signal_new ("pad-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstElementClass, pad_added), NULL, NULL,
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
2005-01-24 17:04:08 +00:00
|
|
|
/**
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
* GstElement::pad-removed:
|
2005-01-24 17:04:08 +00:00
|
|
|
* @gstelement: the object which received the signal
|
2005-08-24 13:04:31 +00:00
|
|
|
* @object:
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
*
|
|
|
|
* a #GstPad has been removed from the element
|
|
|
|
*/
|
2001-05-25 21:00:07 +00:00
|
|
|
gst_element_signals[PAD_REMOVED] =
|
2004-03-13 15:27:01 +00:00
|
|
|
g_signal_new ("pad-removed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GstElementClass, pad_removed), NULL, NULL,
|
|
|
|
gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
2005-01-24 17:04:08 +00:00
|
|
|
/**
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
* GstElement::no-more-pads:
|
2005-01-24 17:04:08 +00:00
|
|
|
* @gstelement: the object which received the signal
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
*
|
2005-08-24 13:04:31 +00:00
|
|
|
* ?
|
Docs updates, clean up some headers.
Original commit message from CVS:
* docs/design/part-MT-refcounting.txt:
* docs/design/part-conventions.txt:
* docs/design/part-gstobject.txt:
* docs/design/part-relations.txt:
* docs/design/part-standards.txt:
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_add),
(gst_bin_remove_func), (gst_bin_remove), (gst_bin_iterate_recurse),
(gst_bin_get_by_name), (gst_bin_get_by_interface),
(gst_bin_iterate_all_by_interface):
* gst/gstbuffer.h:
* gst/gstclock.h:
* gst/gstelement.c: (gst_element_class_init),
(gst_element_change_state), (gst_element_set_loop_function):
* gst/gstelement.h:
* gst/gstiterator.c:
* gst/gstobject.c: (gst_object_class_init), (gst_object_ref),
(gst_object_unref), (gst_object_sink), (gst_object_dispose),
(gst_object_dispatch_properties_changed), (gst_object_set_name),
(gst_object_set_parent), (gst_object_unparent),
(gst_object_check_uniqueness):
* gst/gstobject.h:
Docs updates, clean up some headers.
Free iterators in GstBin.
GstObject is now looking good.
2005-03-08 14:38:06 +00:00
|
|
|
*/
|
2004-05-13 15:07:56 +00:00
|
|
|
gst_element_signals[NO_MORE_PADS] =
|
2004-05-10 16:48:44 +00:00
|
|
|
g_signal_new ("no-more-pads", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstElementClass, no_more_pads), NULL,
|
|
|
|
NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_element_dispose);
|
2005-03-07 18:27:42 +00:00
|
|
|
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_element_finalize);
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2001-06-25 06:45:56 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2004-03-13 15:27:01 +00:00
|
|
|
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_element_save_thyself);
|
|
|
|
gstobject_class->restore_thyself =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_element_restore_thyself);
|
2001-06-24 21:18:28 +00:00
|
|
|
#endif
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
klass->change_state = GST_DEBUG_FUNCPTR (gst_element_change_state);
|
2005-03-21 17:34:02 +00:00
|
|
|
klass->get_state = GST_DEBUG_FUNCPTR (gst_element_get_state_func);
|
|
|
|
klass->set_bus = GST_DEBUG_FUNCPTR (gst_element_set_bus_func);
|
2004-03-13 15:27:01 +00:00
|
|
|
klass->numpadtemplates = 0;
|
2003-11-02 16:46:12 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
klass->elementfactory = NULL;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2001-05-26 22:58:15 +00:00
|
|
|
static void
|
2003-10-31 19:32:47 +00:00
|
|
|
gst_element_base_class_init (gpointer g_class)
|
2001-05-26 22:58:15 +00:00
|
|
|
{
|
2004-01-03 01:25:01 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
2004-02-05 23:46:13 +00:00
|
|
|
memset (&element_class->details, 0, sizeof (GstElementDetails));
|
2004-01-03 01:25:01 +00:00
|
|
|
element_class->padtemplates = NULL;
|
2001-05-26 22:58:15 +00:00
|
|
|
}
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
static void
|
|
|
|
gst_element_base_class_finalize (gpointer g_class)
|
|
|
|
{
|
2004-03-13 00:14:46 +00:00
|
|
|
GstElementClass *klass = GST_ELEMENT_CLASS (g_class);
|
2003-10-31 19:32:47 +00:00
|
|
|
|
2004-04-06 19:45:27 +00:00
|
|
|
g_list_foreach (klass->padtemplates, (GFunc) gst_object_unref, NULL);
|
2003-10-31 19:32:47 +00:00
|
|
|
g_list_free (klass->padtemplates);
|
|
|
|
__gst_element_details_clear (&klass->details);
|
|
|
|
}
|
|
|
|
|
2001-01-20 03:10:44 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_init (GstElement * element)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2000-07-17 17:14:15 +00:00
|
|
|
element->current_state = GST_STATE_NULL;
|
2001-12-18 19:03:07 +00:00
|
|
|
element->pending_state = GST_STATE_VOID_PENDING;
|
2005-03-08 17:42:29 +00:00
|
|
|
element->state_lock = g_mutex_new ();
|
2001-12-18 19:03:07 +00:00
|
|
|
element->state_cond = g_cond_new ();
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2004-07-26 18:23:12 +00:00
|
|
|
/**
|
2002-07-30 19:17:25 +00:00
|
|
|
* gst_element_default_error:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @object: a #GObject that signalled the error.
|
|
|
|
* @orig: the #GstObject that initiated the error.
|
2004-01-18 21:36:20 +00:00
|
|
|
* @error: the GError.
|
|
|
|
* @debug: an additional debug information string, or NULL.
|
2002-07-30 19:17:25 +00:00
|
|
|
*
|
2004-01-18 21:36:20 +00:00
|
|
|
* A default error signal callback to attach to an element.
|
|
|
|
* The user data passed to the g_signal_connect is ignored.
|
|
|
|
*
|
|
|
|
* The default handler will simply print the error string using g_print.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-07-30 19:17:25 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_default_error (GObject * object, GstObject * source, GError * error,
|
|
|
|
gchar * debug)
|
2004-01-18 21:36:20 +00:00
|
|
|
{
|
|
|
|
gchar *name = gst_object_get_path_string (source);
|
|
|
|
|
2004-02-02 17:29:30 +00:00
|
|
|
g_print (_("ERROR: from element %s: %s\n"), name, error->message);
|
2004-01-18 21:36:20 +00:00
|
|
|
if (debug)
|
|
|
|
g_print (_("Additional debug info:\n%s\n"), debug);
|
|
|
|
|
2002-11-20 21:13:07 +00:00
|
|
|
g_free (name);
|
2004-01-18 21:36:20 +00:00
|
|
|
}
|
2002-07-30 19:17:25 +00:00
|
|
|
|
2002-06-12 22:26:36 +00:00
|
|
|
/**
|
|
|
|
* gst_element_release_request_pad:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to release the request pad of.
|
|
|
|
* @pad: the #GstPad to release.
|
2002-06-12 22:26:36 +00:00
|
|
|
*
|
2002-08-30 14:02:15 +00:00
|
|
|
* Makes the element free the previously requested pad as obtained
|
2002-06-12 22:26:36 +00:00
|
|
|
* with gst_element_get_request_pad().
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-06-12 22:26:36 +00:00
|
|
|
*/
|
2002-04-28 13:27:32 +00:00
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_release_request_pad (GstElement * element, GstPad * pad)
|
2002-04-28 13:27:32 +00:00
|
|
|
{
|
|
|
|
GstElementClass *oclass;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
2002-04-28 13:27:32 +00:00
|
|
|
if (oclass->release_pad)
|
|
|
|
(oclass->release_pad) (element, pad);
|
2005-01-17 13:48:13 +00:00
|
|
|
else
|
|
|
|
gst_element_remove_pad (element, pad);
|
2002-04-28 13:27:32 +00:00
|
|
|
}
|
|
|
|
|
2002-11-27 20:47:39 +00:00
|
|
|
/**
|
|
|
|
* gst_element_requires_clock:
|
|
|
|
* @element: a #GstElement to query
|
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Query if the element requires a clock.
|
2002-11-27 20:47:39 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the element requires a clock
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-11-27 20:47:39 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_requires_clock (GstElement * element)
|
2002-11-27 20:47:39 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), result);
|
2002-11-27 20:47:39 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
result = (GST_ELEMENT_GET_CLASS (element)->set_clock != NULL);
|
|
|
|
|
|
|
|
return result;
|
2002-11-27 20:47:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_provides_clock:
|
|
|
|
* @element: a #GstElement to query
|
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Query if the element provides a clock.
|
2002-11-27 20:47:39 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the element provides a clock
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-11-27 20:47:39 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_provides_clock (GstElement * element)
|
2002-11-27 20:47:39 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result = FALSE;
|
|
|
|
|
2002-11-27 20:47:39 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
result = (GST_ELEMENT_GET_CLASS (element)->get_clock != NULL);
|
|
|
|
|
|
|
|
return result;
|
2002-11-27 20:47:39 +00:00
|
|
|
}
|
|
|
|
|
2002-02-03 20:07:09 +00:00
|
|
|
/**
|
|
|
|
* gst_element_set_clock:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to set the clock for.
|
|
|
|
* @clock: the #GstClock to set for the element.
|
2002-02-03 20:07:09 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Sets the clock for the element. This function increases the
|
|
|
|
* refcount on the clock. Any previously set clock on the object
|
|
|
|
* is unreffed.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2002-02-03 20:07:09 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_set_clock (GstElement * element, GstClock * clock)
|
2002-02-03 20:07:09 +00:00
|
|
|
{
|
2002-12-19 21:31:03 +00:00
|
|
|
GstElementClass *oclass;
|
|
|
|
|
2002-02-03 20:07:09 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
|
|
|
if (oclass->set_clock)
|
|
|
|
oclass->set_clock (element, clock);
|
2002-05-26 21:54:27 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_object_replace ((GstObject **) & element->clock, (GstObject *) clock);
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_UNLOCK (element);
|
2002-02-03 20:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_get_clock:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to get the clock of.
|
2002-02-03 20:07:09 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Gets the clock of the element. If the element provides a clock,
|
|
|
|
* this function will return this clock. For elements that do not
|
|
|
|
* provide a clock, this function returns NULL.
|
|
|
|
*
|
|
|
|
* Returns: the #GstClock of the element. unref after usage.
|
2002-03-31 14:04:50 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* MT safe.
|
2002-02-03 20:07:09 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstClock *
|
|
|
|
gst_element_get_clock (GstElement * element)
|
2002-02-03 20:07:09 +00:00
|
|
|
{
|
2002-12-19 21:31:03 +00:00
|
|
|
GstElementClass *oclass;
|
|
|
|
|
2002-02-03 20:07:09 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2002-12-19 21:31:03 +00:00
|
|
|
|
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
if (oclass->get_clock)
|
|
|
|
return oclass->get_clock (element);
|
2002-02-03 20:07:09 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
/**
|
|
|
|
* gst_element_set_base_time:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
* @time: the base time to set.
|
|
|
|
*
|
|
|
|
* Set the base time of an element. See @gst_element_get_base_time().
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_element_set_base_time (GstElement * element, GstClockTime time)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
|
|
|
GST_LOCK (element);
|
|
|
|
element->base_time = time;
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_get_base_time:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
*
|
|
|
|
* Returns the base time of the element. The base time is the
|
|
|
|
* absolute time of the clock when this element was last put to
|
|
|
|
* PLAYING. Substracting the base time from the clock time gives
|
|
|
|
* the stream time of the element.
|
|
|
|
*
|
|
|
|
* Returns: the base time of the element.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
GstClockTime
|
|
|
|
gst_element_get_base_time (GstElement * element)
|
|
|
|
{
|
|
|
|
GstClockTime result;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_CLOCK_TIME_NONE);
|
|
|
|
|
|
|
|
GST_LOCK (element);
|
|
|
|
result = element->base_time;
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2003-02-10 20:32:32 +00:00
|
|
|
#ifndef GST_DISABLE_INDEX
|
2002-12-14 13:02:16 +00:00
|
|
|
/**
|
|
|
|
* gst_element_is_indexable:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
*
|
gst/gstclock.*: deprecate old interface and disable functions that aren't in use anymore.
Original commit message from CVS:
2004-01-13 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_init),
(gst_clock_set_speed), (gst_clock_set_active),
(gst_clock_is_active), (gst_clock_reset),
(gst_clock_handle_discont):
* gst/gstclock.h:
deprecate old interface and disable functions that aren't in use
anymore.
* gst/gstelement.h:
* gst/gstelement.c: (gst_element_get_time), (gst_element_wait),
(gst_element_set_time), (gst_element_adjust_time):
add concept of "element time" and functions to get/set this time.
* gst/gstelement.c: (gst_element_change_state):
update element time correctly.
* gst/gstelement.c: (gst_element_get_compatible_pad_filtered):
This is a debug message, not a g_critical.
* gst/gstpad.c: (gst_pad_event_default):
handle discontinuous events right with element time.
* gst/gstscheduler.c: (gst_scheduler_state_transition):
update to clocking fixes.
set clocks on elements in READY=>PAUSED. The old behaviour caused
a wrong element time on the first element that started playing.
* gst/schedulers/gstbasicscheduler.c:
(gst_basic_scheduler_class_init):
* gst/schedulers/gstoptimalscheduler.c:
(gst_opt_scheduler_class_init):
remove code that just implements the default behaviour.
* gst/elements/gstfakesink.c: (gst_fakesink_chain):
update to use new clocking functions
* testsuite/clock/clock1.c: (gst_clock_debug), (main):
* testsuite/clock/clock2.c: (gst_clock_debug), (main):
update to test new element time.
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps):
use _get_allowed_caps instead of _get_caps. This catches filtered
caps correctly.
* testsuite/debug/commandline.c:
update for new GST_DEBUG syntax.
* testsuite/threads/Makefile.am:
disable a test that only works sometimes.
2004-01-14 00:46:48 +00:00
|
|
|
* Queries if the element can be indexed.
|
2002-12-14 13:02:16 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the element can be indexed.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-12-14 13:02:16 +00:00
|
|
|
*/
|
2002-11-27 20:47:39 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_is_indexable (GstElement * element)
|
2002-11-27 20:47:39 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result = FALSE;
|
2002-11-27 20:47:39 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), result);
|
|
|
|
|
|
|
|
result = (GST_ELEMENT_GET_CLASS (element)->set_index != NULL);
|
|
|
|
|
|
|
|
return result;
|
2002-11-27 20:47:39 +00:00
|
|
|
}
|
|
|
|
|
2002-12-14 13:02:16 +00:00
|
|
|
/**
|
|
|
|
* gst_element_set_index:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
* @index: a #GstIndex.
|
|
|
|
*
|
|
|
|
* Set the specified GstIndex on the element.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-12-14 13:02:16 +00:00
|
|
|
*/
|
2002-11-27 20:47:39 +00:00
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_set_index (GstElement * element, GstIndex * index)
|
2002-11-27 20:47:39 +00:00
|
|
|
{
|
2002-12-19 21:31:03 +00:00
|
|
|
GstElementClass *oclass;
|
|
|
|
|
2002-11-27 20:47:39 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
2002-12-12 22:14:36 +00:00
|
|
|
g_return_if_fail (GST_IS_INDEX (index));
|
2002-11-27 20:47:39 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
|
|
|
if (oclass->set_index)
|
|
|
|
oclass->set_index (element, index);
|
2002-11-27 20:47:39 +00:00
|
|
|
}
|
|
|
|
|
2002-12-14 13:02:16 +00:00
|
|
|
/**
|
|
|
|
* gst_element_get_index:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
*
|
|
|
|
* Gets the index from the element.
|
|
|
|
*
|
|
|
|
* Returns: a #GstIndex or NULL when no index was set on the
|
2005-03-07 18:27:42 +00:00
|
|
|
* element. unref after usage.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2002-12-14 13:02:16 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstIndex *
|
|
|
|
gst_element_get_index (GstElement * element)
|
2002-11-27 20:47:39 +00:00
|
|
|
{
|
2002-12-19 21:31:03 +00:00
|
|
|
GstElementClass *oclass;
|
|
|
|
|
gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.
Original commit message from CVS:
reviewed by: Wim Taymans, Ronald Bultje.
* gst/cothreads.c: (cothread_create):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_child_state_change_func):
* gst/gstbuffer.c: (gst_buffer_span):
* gst/gstelement.c: (gst_element_get_index),
(gst_element_get_event_masks), (gst_element_get_query_types),
(gst_element_get_formats):
* gst/gsterror.c: (_gst_core_errors_init),
(_gst_library_errors_init), (_gst_resource_errors_init),
(_gst_stream_errors_init):
* gst/gstobject.c: (gst_object_default_deep_notify):
* gst/gstpad.c: (gst_pad_get_event_masks),
(gst_pad_get_internal_links_default):
* gst/gstplugin.c: (gst_plugin_register_func),
(gst_plugin_get_module):
* gst/gststructure.c: (gst_structure_get_string),
(gst_structure_get_abbrs), (gst_structure_from_abbr),
(gst_structure_to_abbr):
* gst/gstutils.c: (gst_print_element_args):
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
(setup_group_scheduler), (gst_opt_scheduler_iterate):
Aplied part of patch #157127: Cleanup of issues reported by
sparse.
Also do not try to use cothreads when there is no cothread
context yet.
2004-11-02 15:02:12 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2002-11-27 20:47:39 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
|
|
|
if (oclass->get_index)
|
|
|
|
return oclass->get_index (element);
|
2002-11-27 20:47:39 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2003-02-10 20:32:32 +00:00
|
|
|
#endif
|
2002-11-27 20:47:39 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/**
|
|
|
|
* gst_element_add_pad:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to add the pad to.
|
|
|
|
* @pad: the #GstPad to add to the element.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
* Adds a pad (link point) to @element. @pad's parent will be set to @element;
|
|
|
|
* see gst_object_set_parent() for refcounting information.
|
|
|
|
*
|
2005-05-11 09:21:24 +00:00
|
|
|
* Pads are not automatically activated so elements should perform the needed
|
|
|
|
* steps to activate the pad.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* The pad and the element should be unlocked when calling this function.
|
|
|
|
*
|
|
|
|
* Returns: TRUE if the pad could be added. This function can fail when
|
|
|
|
* passing bad arguments or when a pad with the same name already existed.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_add_pad (GstElement * element, GstPad * pad)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gchar *pad_name;
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
|
|
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
|
|
|
|
|
|
|
/* locking pad to look at the name */
|
|
|
|
GST_LOCK (pad);
|
|
|
|
pad_name = g_strdup (GST_PAD_NAME (pad));
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "adding pad '%s'",
|
|
|
|
GST_STR_NULL (pad_name));
|
|
|
|
GST_UNLOCK (pad);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* then check to see if there's already a pad by that name here */
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (element);
|
|
|
|
if (G_UNLIKELY (!gst_object_check_uniqueness (element->pads, pad_name)))
|
|
|
|
goto name_exists;
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* try to set the pad's parent */
|
|
|
|
if (G_UNLIKELY (!gst_object_set_parent (GST_OBJECT_CAST (pad),
|
|
|
|
GST_OBJECT_CAST (element))))
|
|
|
|
goto had_parent;
|
2004-02-20 13:18:32 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_free (pad_name);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
|
|
|
/* add it to the list */
|
gst/gstpad.c (_gst_real_pad_fixate_accumulator): s/pointer/boxed/.
Original commit message from CVS:
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-05 13:51:26 +00:00
|
|
|
switch (gst_pad_get_direction (pad)) {
|
2004-03-13 15:27:01 +00:00
|
|
|
case GST_PAD_SRC:
|
2005-03-07 18:27:42 +00:00
|
|
|
element->srcpads = g_list_prepend (element->srcpads, pad);
|
2004-03-13 15:27:01 +00:00
|
|
|
element->numsrcpads++;
|
|
|
|
break;
|
|
|
|
case GST_PAD_SINK:
|
2005-03-07 18:27:42 +00:00
|
|
|
element->sinkpads = g_list_prepend (element->sinkpads, pad);
|
2004-03-13 15:27:01 +00:00
|
|
|
element->numsinkpads++;
|
|
|
|
break;
|
|
|
|
default:
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
goto no_direction;
|
gst/gstpad.c (_gst_real_pad_fixate_accumulator): s/pointer/boxed/.
Original commit message from CVS:
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-05 13:51:26 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
element->pads = g_list_prepend (element->pads, pad);
|
|
|
|
element->numpads++;
|
|
|
|
element->pads_cookie++;
|
|
|
|
GST_UNLOCK (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/* emit the NEW_PAD signal */
|
2001-06-25 01:20:11 +00:00
|
|
|
g_signal_emit (G_OBJECT (element), gst_element_signals[NEW_PAD], 0, pad);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERROR cases */
|
|
|
|
name_exists:
|
|
|
|
{
|
|
|
|
g_critical ("Padname %s is not unique in element %s, not adding",
|
|
|
|
pad_name, GST_ELEMENT_NAME (element));
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
g_free (pad_name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
had_parent:
|
|
|
|
{
|
|
|
|
g_critical
|
|
|
|
("Pad %s already has parent when trying to add to element %s",
|
|
|
|
pad_name, GST_ELEMENT_NAME (element));
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
g_free (pad_name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
no_direction:
|
|
|
|
{
|
|
|
|
GST_LOCK (pad);
|
|
|
|
g_critical
|
|
|
|
("Trying to add pad %s to element %s, but it has no direction",
|
|
|
|
GST_OBJECT_NAME (pad), GST_ELEMENT_NAME (element));
|
|
|
|
GST_UNLOCK (pad);
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
return FALSE;
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
gst/gstpad.c (_gst_real_pad_fixate_accumulator): s/pointer/boxed/.
Original commit message from CVS:
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-05 13:51:26 +00:00
|
|
|
}
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
/**
|
|
|
|
* gst_element_remove_pad:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to remove pad from.
|
|
|
|
* @pad: the #GstPad to remove from the element.
|
2001-05-25 21:00:07 +00:00
|
|
|
*
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
* Removes @pad from @element. @pad will be destroyed if it has not been
|
|
|
|
* referenced elsewhere.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the pad could be removed. Can return FALSE if the
|
|
|
|
* pad is not belonging to the provided element or when wrong parameters
|
|
|
|
* are passed to this function.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2001-05-25 21:00:07 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_remove_pad (GstElement * element, GstPad * pad)
|
2001-05-25 21:00:07 +00:00
|
|
|
{
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
GstPad *peer;
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
|
|
|
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
/* locking pad to look at the name and parent */
|
|
|
|
GST_LOCK (pad);
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_ELEMENT_PADS, element, "removing pad '%s'",
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
GST_STR_NULL (GST_PAD_NAME (pad)));
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (GST_PAD_PARENT (pad) != element))
|
|
|
|
goto not_our_pad;
|
|
|
|
GST_UNLOCK (pad);
|
|
|
|
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
/* unlink */
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
if ((peer = gst_pad_get_peer (pad))) {
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
/* window for MT unsafeness, someone else could unlink here
|
|
|
|
* and then we call unlink with wrong pads. The unlink
|
|
|
|
* function would catch this and safely return failed. */
|
|
|
|
if (GST_PAD_IS_SRC (pad))
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
gst_pad_unlink (pad, peer);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
else
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
gst_pad_unlink (peer, pad);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (peer);
|
2002-01-27 22:35:08 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (element);
|
2002-01-27 22:35:08 +00:00
|
|
|
/* remove it from the list */
|
gst/gstpad.c (_gst_real_pad_fixate_accumulator): s/pointer/boxed/.
Original commit message from CVS:
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-05 13:51:26 +00:00
|
|
|
switch (gst_pad_get_direction (pad)) {
|
2004-03-13 15:27:01 +00:00
|
|
|
case GST_PAD_SRC:
|
2005-03-07 18:27:42 +00:00
|
|
|
element->srcpads = g_list_remove (element->srcpads, pad);
|
2004-03-13 15:27:01 +00:00
|
|
|
element->numsrcpads--;
|
|
|
|
break;
|
|
|
|
case GST_PAD_SINK:
|
2005-03-07 18:27:42 +00:00
|
|
|
element->sinkpads = g_list_remove (element->sinkpads, pad);
|
2004-03-13 15:27:01 +00:00
|
|
|
element->numsinkpads--;
|
|
|
|
break;
|
|
|
|
default:
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +00:00
|
|
|
g_critical ("Removing pad without direction???");
|
2004-03-13 15:27:01 +00:00
|
|
|
break;
|
gst/gstpad.c (_gst_real_pad_fixate_accumulator): s/pointer/boxed/.
Original commit message from CVS:
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-05 13:51:26 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
element->pads = g_list_remove (element->pads, pad);
|
|
|
|
element->numpads--;
|
|
|
|
element->pads_cookie++;
|
|
|
|
GST_UNLOCK (element);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2001-06-25 01:20:11 +00:00
|
|
|
g_signal_emit (G_OBJECT (element), gst_element_signals[PAD_REMOVED], 0, pad);
|
2001-05-25 21:00:07 +00:00
|
|
|
|
|
|
|
gst_object_unparent (GST_OBJECT (pad));
|
2000-12-31 22:18:05 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return TRUE;
|
gst/gstpad.c (_gst_real_pad_fixate_accumulator): s/pointer/boxed/.
Original commit message from CVS:
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-05 13:51:26 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
not_our_pad:
|
|
|
|
{
|
|
|
|
/* FIXME, locking order? */
|
|
|
|
GST_LOCK (element);
|
|
|
|
g_critical ("Padname %s:%s does not belong to element %s when removing",
|
|
|
|
GST_ELEMENT_NAME (GST_PAD_PARENT (pad)), GST_PAD_NAME (pad),
|
|
|
|
GST_ELEMENT_NAME (element));
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
GST_UNLOCK (pad);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-12-31 22:18:05 +00:00
|
|
|
}
|
|
|
|
|
2004-05-10 16:48:44 +00:00
|
|
|
/**
|
|
|
|
* gst_element_no_more_pads:
|
|
|
|
* @element: a #GstElement
|
|
|
|
*
|
|
|
|
* Use this function to signal that the element does not expect any more pads
|
|
|
|
* to show up in the current pipeline. This function should be called whenever
|
2004-07-26 18:23:12 +00:00
|
|
|
* pads have been added by the element itself. Elements with GST_PAD_SOMETIMES
|
|
|
|
* pad templates use this in combination with autopluggers to figure out that
|
2004-05-10 16:48:44 +00:00
|
|
|
* the element is done initializing its pads.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2004-05-10 16:48:44 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_element_no_more_pads (GstElement * element)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
|
|
|
g_signal_emit (element, gst_element_signals[NO_MORE_PADS], 0);
|
|
|
|
}
|
2000-12-31 22:18:05 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
static gint
|
|
|
|
pad_compare_name (GstPad * pad1, const gchar * name)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gint result;
|
2001-01-03 20:44:28 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (pad1);
|
|
|
|
result = strcmp (GST_PAD_NAME (pad1), name);
|
|
|
|
GST_UNLOCK (pad1);
|
2002-11-02 13:19:30 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return result;
|
2002-04-07 23:32:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_get_static_pad:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to find a static pad of.
|
|
|
|
* @name: the name of the static #GstPad to retrieve.
|
2002-04-07 23:32:16 +00:00
|
|
|
*
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
* Retrieves a pad from @element by name. This version only retrieves
|
2002-04-07 23:32:16 +00:00
|
|
|
* already-existing (i.e. 'static') pads.
|
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Returns: the requested #GstPad if found, otherwise NULL. unref after
|
|
|
|
* usage.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2002-04-07 23:32:16 +00:00
|
|
|
*/
|
|
|
|
GstPad *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_get_static_pad (GstElement * element, const gchar * name)
|
2002-04-07 23:32:16 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GList *find;
|
|
|
|
GstPad *result = NULL;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (element);
|
|
|
|
find =
|
|
|
|
g_list_find_custom (element->pads, name, (GCompareFunc) pad_compare_name);
|
|
|
|
if (find) {
|
|
|
|
result = GST_PAD_CAST (find->data);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (result);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (result == NULL) {
|
|
|
|
GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "no such pad '%s' in element \"%s\"",
|
|
|
|
name, GST_ELEMENT_NAME (element));
|
|
|
|
} else {
|
|
|
|
GST_CAT_INFO (GST_CAT_ELEMENT_PADS, "found pad %s:%s",
|
|
|
|
GST_ELEMENT_NAME (element), name);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_UNLOCK (element);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstPad *
|
|
|
|
gst_element_request_pad (GstElement * element, GstPadTemplate * templ,
|
|
|
|
const gchar * name)
|
|
|
|
{
|
|
|
|
GstPad *newpad = NULL;
|
|
|
|
GstElementClass *oclass;
|
|
|
|
|
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
|
|
|
if (oclass->request_new_pad)
|
|
|
|
newpad = (oclass->request_new_pad) (element, templ, name);
|
|
|
|
|
gst/: Fix name lookup in GstBin.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_send_event), (compare_name),
(gst_bin_get_by_name):
* gst/gstbuffer.h:
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_class_init),
(gst_clock_finalize):
* gst/gstdata.c: (gst_data_replace):
* gst/gstdata.h:
* gst/gstelement.c: (gst_element_request_pad),
(gst_element_pads_activate):
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_check_compatible_unlocked), (gst_pad_set_caps),
(gst_pad_check_pull_range), (gst_pad_pull_range),
(gst_static_pad_template_get_caps), (gst_pad_start_task),
(gst_pad_pause_task), (gst_pad_stop_task):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_request_pad), (gst_pad_proxy_getcaps):
Fix name lookup in GstBin.
Added _data_replace() function and _buffer_replace()
Use finalize method to clean up clock.
Fix refcounting on request pads.
Fix pad schedule mode error.
Some more object refcounting debug info,
2005-05-05 09:28:01 +00:00
|
|
|
if (newpad)
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (newpad);
|
gst/: Fix name lookup in GstBin.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_send_event), (compare_name),
(gst_bin_get_by_name):
* gst/gstbuffer.h:
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_class_init),
(gst_clock_finalize):
* gst/gstdata.c: (gst_data_replace):
* gst/gstdata.h:
* gst/gstelement.c: (gst_element_request_pad),
(gst_element_pads_activate):
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_check_compatible_unlocked), (gst_pad_set_caps),
(gst_pad_check_pull_range), (gst_pad_pull_range),
(gst_static_pad_template_get_caps), (gst_pad_start_task),
(gst_pad_pause_task), (gst_pad_stop_task):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_request_pad), (gst_pad_proxy_getcaps):
Fix name lookup in GstBin.
Added _data_replace() function and _buffer_replace()
Use finalize method to clean up clock.
Fix refcounting on request pads.
Fix pad schedule mode error.
Some more object refcounting debug info,
2005-05-05 09:28:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return newpad;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
/**
|
|
|
|
* gst_element_get_request_pad:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to find a request pad of.
|
|
|
|
* @name: the name of the request #GstPad to retrieve.
|
2002-04-07 23:32:16 +00:00
|
|
|
*
|
2002-08-30 14:02:15 +00:00
|
|
|
* Retrieves a pad from the element by name. This version only retrieves
|
2002-04-07 23:32:16 +00:00
|
|
|
* request pads.
|
|
|
|
*
|
gst/: Fix name lookup in GstBin.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_send_event), (compare_name),
(gst_bin_get_by_name):
* gst/gstbuffer.h:
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_class_init),
(gst_clock_finalize):
* gst/gstdata.c: (gst_data_replace):
* gst/gstdata.h:
* gst/gstelement.c: (gst_element_request_pad),
(gst_element_pads_activate):
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_check_compatible_unlocked), (gst_pad_set_caps),
(gst_pad_check_pull_range), (gst_pad_pull_range),
(gst_static_pad_template_get_caps), (gst_pad_start_task),
(gst_pad_pause_task), (gst_pad_stop_task):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_request_pad), (gst_pad_proxy_getcaps):
Fix name lookup in GstBin.
Added _data_replace() function and _buffer_replace()
Use finalize method to clean up clock.
Fix refcounting on request pads.
Fix pad schedule mode error.
Some more object refcounting debug info,
2005-05-05 09:28:01 +00:00
|
|
|
* Returns: requested #GstPad if found, otherwise NULL. Unref after usage.
|
2002-04-07 23:32:16 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstPad *
|
|
|
|
gst_element_get_request_pad (GstElement * element, const gchar * name)
|
2002-04-07 23:32:16 +00:00
|
|
|
{
|
|
|
|
GstPadTemplate *templ = NULL;
|
|
|
|
GstPad *pad;
|
|
|
|
const gchar *req_name = NULL;
|
|
|
|
gboolean templ_found = FALSE;
|
|
|
|
GList *list;
|
|
|
|
gint n;
|
|
|
|
const gchar *data;
|
|
|
|
gchar *str, *endptr = NULL;
|
2005-03-07 18:27:42 +00:00
|
|
|
GstElementClass *class;
|
2002-04-07 23:32:16 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
class = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
if (strstr (name, "%")) {
|
2005-03-07 18:27:42 +00:00
|
|
|
templ = gst_element_class_get_pad_template (class, name);
|
2002-04-07 23:32:16 +00:00
|
|
|
req_name = NULL;
|
|
|
|
if (templ)
|
|
|
|
templ_found = TRUE;
|
|
|
|
} else {
|
2005-03-07 18:27:42 +00:00
|
|
|
list = gst_element_class_get_pad_template_list (class);
|
2002-04-07 23:32:16 +00:00
|
|
|
while (!templ_found && list) {
|
2004-03-13 15:27:01 +00:00
|
|
|
templ = (GstPadTemplate *) list->data;
|
2002-04-07 23:32:16 +00:00
|
|
|
if (templ->presence == GST_PAD_REQUEST) {
|
2004-03-15 19:27:17 +00:00
|
|
|
/* Because of sanity checks in gst_pad_template_new(), we know that %s
|
|
|
|
and %d, occurring at the end of the name_template, are the only
|
|
|
|
possibilities. */
|
|
|
|
GST_CAT_DEBUG (GST_CAT_PADS, "comparing %s to %s", name,
|
|
|
|
templ->name_template);
|
|
|
|
if ((str = strchr (templ->name_template, '%'))
|
|
|
|
&& strncmp (templ->name_template, name,
|
|
|
|
str - templ->name_template) == 0
|
|
|
|
&& strlen (name) > str - templ->name_template) {
|
|
|
|
data = name + (str - templ->name_template);
|
|
|
|
if (*(str + 1) == 'd') {
|
|
|
|
/* it's an int */
|
|
|
|
n = (gint) strtol (data, &endptr, 10);
|
|
|
|
if (endptr && *endptr == '\0') {
|
|
|
|
templ_found = TRUE;
|
|
|
|
req_name = name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* it's a string */
|
|
|
|
templ_found = TRUE;
|
|
|
|
req_name = name;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-04-07 23:32:16 +00:00
|
|
|
}
|
|
|
|
list = list->next;
|
|
|
|
}
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
if (!templ_found)
|
2004-03-13 15:27:01 +00:00
|
|
|
return NULL;
|
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
pad = gst_element_request_pad (element, templ, req_name);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
return pad;
|
|
|
|
}
|
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/**
|
2005-03-07 18:27:42 +00:00
|
|
|
* gst_element_get_pad:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
* @name: the name of the pad to retrieve.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Retrieves a pad from @element by name. Tries gst_element_get_static_pad()
|
|
|
|
* first, then gst_element_get_request_pad().
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Returns: the #GstPad if found, otherwise %NULL. Unref after usage.
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
GstPad *
|
|
|
|
gst_element_get_pad (GstElement * element, const gchar * name)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
GstPad *pad;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
pad = gst_element_get_static_pad (element, name);
|
|
|
|
if (!pad)
|
|
|
|
pad = gst_element_get_request_pad (element, name);
|
|
|
|
|
|
|
|
return pad;
|
|
|
|
}
|
|
|
|
|
|
|
|
GstIteratorItem
|
|
|
|
iterate_pad (GstIterator * it, GstPad * pad)
|
|
|
|
{
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (pad);
|
2005-03-07 18:27:42 +00:00
|
|
|
return GST_ITERATOR_ITEM_PASS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_iterate_pads:
|
|
|
|
* @element: a #GstElement to iterate pads of.
|
|
|
|
*
|
|
|
|
* Retrieves an iterattor of @element's pads.
|
|
|
|
*
|
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
|
|
|
* Returns: the #GstIterator of #GstPad. Unref each pad after use.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
GstIterator *
|
|
|
|
gst_element_iterate_pads (GstElement * element)
|
|
|
|
{
|
|
|
|
GstIterator *result;
|
|
|
|
|
2000-11-11 15:13:50 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (element);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
result = gst_iterator_new_list (GST_GET_LOCK (element),
|
|
|
|
&element->pads_cookie,
|
|
|
|
&element->pads,
|
|
|
|
element,
|
|
|
|
(GstIteratorItemFunction) iterate_pad,
|
|
|
|
(GstIteratorDisposeFunction) gst_object_unref);
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
|
|
|
|
return result;
|
2000-01-30 09:03:00 +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
|
|
|
static gint
|
|
|
|
direction_filter (gconstpointer pad, gconstpointer direction)
|
|
|
|
{
|
|
|
|
if (GST_PAD_DIRECTION (pad) == GPOINTER_TO_INT (direction)) {
|
|
|
|
/* pass the ref through */
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
/* unref */
|
2005-06-28 09:59:01 +00:00
|
|
|
/* FIXME: this is very stupid */
|
|
|
|
gst_object_unref (GST_OBJECT_CAST (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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_iterate_src_pads:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
*
|
|
|
|
* Retrieves an iterator of @element's source pads.
|
|
|
|
*
|
|
|
|
* Returns: the #GstIterator of #GstPad. Unref each pad after use.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
GstIterator *
|
|
|
|
gst_element_iterate_src_pads (GstElement * element)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
|
|
|
|
|
|
|
return gst_iterator_filter (gst_element_iterate_pads (element),
|
|
|
|
direction_filter, GINT_TO_POINTER (GST_PAD_SRC));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_iterate_sink_pads:
|
|
|
|
* @element: a #GstElement.
|
|
|
|
*
|
|
|
|
* Retrieves an iterator of @element's sink pads.
|
|
|
|
*
|
|
|
|
* Returns: the #GstIterator of #GstPad. Unref each pad after use.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
GstIterator *
|
|
|
|
gst_element_iterate_sink_pads (GstElement * element)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
|
|
|
|
|
|
|
return gst_iterator_filter (gst_element_iterate_pads (element),
|
|
|
|
direction_filter, GINT_TO_POINTER (GST_PAD_SINK));
|
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
|
2001-07-11 12:33:17 +00:00
|
|
|
/**
|
2002-04-11 20:35:18 +00:00
|
|
|
* gst_element_class_add_pad_template:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @klass: the #GstElementClass to add the pad template to.
|
|
|
|
* @templ: a #GstPadTemplate to add to the element class.
|
2001-07-11 12:33:17 +00:00
|
|
|
*
|
2003-10-31 19:32:47 +00:00
|
|
|
* Adds a padtemplate to an element class. This is mainly used in the _base_init
|
|
|
|
* functions of classes.
|
2001-07-11 12:33:17 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_class_add_pad_template (GstElementClass * klass,
|
|
|
|
GstPadTemplate * templ)
|
2001-07-11 12:33:17 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
|
2002-04-11 20:35:18 +00:00
|
|
|
g_return_if_fail (GST_IS_PAD_TEMPLATE (templ));
|
2004-02-20 13:18:32 +00:00
|
|
|
|
2004-01-02 23:52:59 +00:00
|
|
|
/* avoid registering pad templates with the same name */
|
2004-03-13 15:27:01 +00:00
|
|
|
g_return_if_fail (gst_element_class_get_pad_template (klass,
|
2004-03-15 19:27:17 +00:00
|
|
|
templ->name_template) == NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-02-20 13:18:32 +00:00
|
|
|
klass->padtemplates = g_list_append (klass->padtemplates,
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (templ));
|
2001-07-11 12:33:17 +00:00
|
|
|
klass->numpadtemplates++;
|
|
|
|
}
|
|
|
|
|
2003-10-31 19:32:47 +00:00
|
|
|
/**
|
|
|
|
* gst_element_class_set_details:
|
|
|
|
* @klass: class to set details for
|
|
|
|
* @details: details to set
|
|
|
|
*
|
|
|
|
* Sets the detailed information for a #GstElementClass.
|
|
|
|
* <note>This function is for use in _base_init functions only.</note>
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
gst_element_class_set_details (GstElementClass * klass,
|
|
|
|
const GstElementDetails * details)
|
2003-10-31 19:32:47 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT_DETAILS (details));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-02-05 23:46:13 +00:00
|
|
|
__gst_element_details_copy (&klass->details, details);
|
2003-10-31 19:32:47 +00:00
|
|
|
}
|
|
|
|
|
2003-11-08 23:28:04 +00:00
|
|
|
/**
|
|
|
|
* gst_element_class_get_pad_template_list:
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
* @element_class: a #GstElementClass to get pad templates of.
|
2003-11-08 23:28:04 +00:00
|
|
|
*
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
* Retrieves a list of the pad templates associated with @element_class. The
|
|
|
|
* list must not be modified by the calling code.
|
2004-03-24 13:38:17 +00:00
|
|
|
* <note>If you use this function in the #GInstanceInitFunc of an object class
|
2004-07-26 18:23:12 +00:00
|
|
|
* that has subclasses, make sure to pass the g_class parameter of the
|
2004-03-24 13:38:17 +00:00
|
|
|
* #GInstanceInitFunc here.</note>
|
2003-11-08 23:28:04 +00:00
|
|
|
*
|
|
|
|
* Returns: the #GList of padtemplates.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GList *
|
|
|
|
gst_element_class_get_pad_template_list (GstElementClass * element_class)
|
2003-11-08 23:28:04 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT_CLASS (element_class), NULL);
|
|
|
|
|
|
|
|
return element_class->padtemplates;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_class_get_pad_template:
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
* @element_class: a #GstElementClass to get the pad template of.
|
2003-11-08 23:28:04 +00:00
|
|
|
* @name: the name of the #GstPadTemplate to get.
|
|
|
|
*
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
* Retrieves a padtemplate from @element_class with the given name.
|
2004-03-24 13:38:17 +00:00
|
|
|
* <note>If you use this function in the #GInstanceInitFunc of an object class
|
2004-07-26 18:23:12 +00:00
|
|
|
* that has subclasses, make sure to pass the g_class parameter of the
|
2004-03-24 13:38:17 +00:00
|
|
|
* #GInstanceInitFunc here.</note>
|
2003-11-08 23:28:04 +00:00
|
|
|
*
|
2004-07-26 18:23:12 +00:00
|
|
|
* Returns: the #GstPadTemplate with the given name, or NULL if none was found.
|
2003-11-08 23:28:04 +00:00
|
|
|
* No unreferencing is necessary.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstPadTemplate *
|
|
|
|
gst_element_class_get_pad_template (GstElementClass * element_class,
|
|
|
|
const gchar * name)
|
2003-11-08 23:28:04 +00:00
|
|
|
{
|
|
|
|
GList *padlist;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT_CLASS (element_class), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
padlist = gst_element_class_get_pad_template_list (element_class);
|
|
|
|
|
|
|
|
while (padlist) {
|
2004-03-13 15:27:01 +00:00
|
|
|
GstPadTemplate *padtempl = (GstPadTemplate *) padlist->data;
|
2003-11-08 23:28:04 +00:00
|
|
|
|
|
|
|
if (strcmp (padtempl->name_template, name) == 0)
|
|
|
|
return padtempl;
|
|
|
|
|
|
|
|
padlist = g_list_next (padlist);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
static GstPad *
|
|
|
|
gst_element_get_random_pad (GstElement * element, GstPadDirection dir)
|
|
|
|
{
|
|
|
|
GstPad *result = NULL;
|
|
|
|
GList *pads;
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "getting a random pad");
|
gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky way to do inheritance.
Original commit message from CVS:
2004-02-10 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_custom_new): Add a FIXME, this is a hacky
way to do inheritance.
(gst_pad_get_event_masks, gst_pad_get_event_masks_default)
(gst_pad_get_query_types, gst_pad_get_query_types_default):
Routine docs.
(gst_pad_set_link_function, gst_pad_set_fixate_function)
(gst_pad_set_getcaps_function): Doc from Dave's negotation random
doc.
(gst_pad_unlink, gst_pad_is_linked): Docs.
(gst_pad_renegotiate): A brief description of capsnego.
(gst_pad_try_set_caps): Document.
(gst_pad_try_set_caps_nonfixed): Document.
(gst_pad_can_link_filtered, gst_pad_link_filtered): Doc fixes.
(gst_pad_set_parent): Deprecated (although not out of the API).
(gst_pad_get_parent): Deprecated, although many plugins use this.
(gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad): Doc that these
are private and will go away in 0.9.
(gst_pad_perform_negotiate): Doc.
(gst_pad_link_unnegotiate): I think this is meant to be static.
(gst_pad_get_negotiated_caps, gst_pad_get_pad_template_caps)
(gst_pad_template_get_caps_by_name, gst_pad_check_compatibility)
(gst_pad_get_peer): Doc updates.
(gst_pad_caps_change_notify): Doc.
(gst_pad_alloc_buffer, gst_pad_push, gst_static_pad_template_get)
(gst_ghost_pad_new): Doc fixes.
* gst/gstobject.c (gst_object_get_parent, gst_object_unparent)
(gst_object_check_uniqueness):
* gst/gstelement.c (gst_element_add_pad)
(gst_element_add_ghost_pad, gst_element_remove_pad)
(gst_element_remove_ghost_pad, gst_element_get_pad)
(gst_element_get_static_pad, gst_element_get_pad_list)
(gst_element_class_get_pad_template_list)
(gst_element_class_get_pad_template): Work on the docs.
(gst_element_get_pad_template_list): Uses the class method.
(gst_element_get_compatible_pad_template): Docs, and consolidate
some test conditions.
(gst_element_get_pad_from_template): New static function.
(gst_element_request_compatible_pad): Docs, and work with
non-request compatible templates.
(gst_element_get_compatible_pad_filtered): Docs and remove
redundant checks.
(gst_element_get_compatible_pad, gst_element_link_pads_filtered)
(gst_element_link_filtered, gst_element_link_many)
(gst_element_link, gst_element_link_pads)
(gst_element_unlink_many): Docs.
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (_gst_real_pad_fixate_accumulator):
s/pointer/boxed/.
* gst/gstmarshal.list (VOID:BOXED, BOXED:BOXED): New marshallers.
* gst/gstpad.c (gst_real_pad_class_init): Use a BOXED:BOXED
marshaller for ::fixate, and VOID:BOXED for ::caps-nego-failed,
with the type=GST_TYPE_CAPS. This allows language bindings to know
what kind of data they're dealing with.
* gst/gstcaps.c (_gst_caps_value_init): GBoxed values initialize
to NULL when g_value_init is called. GstCaps, which rolls its own
type implementation, now does the same instead of allocating empty
caps.
(_gst_caps_initialize, _gst_caps_collect_value,
_gst_caps_lcopy_value): Provide collect_value and lcopy_value type
table methods. This allows G_VALUE_COLLECT to work.
2004-02-05 Andy Wingo <wingo@pobox.com>
* configure.ac:
* testsuite/Makefile.am (SUBDIRS):
* testsuite/ghostpads/Makefile.am:
* testsuite/ghostpads/ghostpads.c: A new test for ghost pads.
* gst/gstpad.c (gst_pad_add_ghost_pad, gst_pad_remove_ghost_pad):
These two routines are the only ones that set
GST_GPAD_REALPAD(gpad), the ghost pad list, and the ghost pad's
pad template. They should be made static, depending on ABI needs.
(gst_real_pad_dispose): Handle the case of ghost pads without a
parent. Assert after dealing with ghost pads that the ghost pad
list is empty.
(gst_ghost_pad_class_init): New property added, ::real-pad. Can be
set after creation.
(gst_ghost_pad_dispose): Set ::real-pad to NULL.
(gst_ghost_pad_set_property, gst_ghost_pad_get_property): New
functions. set_property will call add_ghost_pad/remove_ghost_pad
as appropriate.
(gst_ghost_pad_new): All the work is offloaded to g_object_new.
* gst/gstelement.c (gst_element_add_pad): Handle ghost pads as well.
(gst_element_add_ghost_pad): Remove code duplicated from _add_pad.
(gst_element_remove_pad): Handle ghost pads as well.
(gst_element_remove_ghost_pad): Deprecated (could be removed,
depending on API-stability needs).
2004-02-05 Andy Wingo <wingo@pobox.com>
* gst/gstbin.[ch]: (gst_bin_get_by_interface): GTypes are scalars,
of course they're const
2004-02-11 13:26:04 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
switch (dir) {
|
|
|
|
case GST_PAD_SRC:
|
2005-03-08 17:42:29 +00:00
|
|
|
GST_LOCK (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
pads = element->srcpads;
|
|
|
|
break;
|
|
|
|
case GST_PAD_SINK:
|
2005-03-08 17:42:29 +00:00
|
|
|
GST_LOCK (element);
|
2005-03-07 18:27:42 +00:00
|
|
|
pads = element->sinkpads;
|
|
|
|
break;
|
|
|
|
default:
|
2005-03-08 17:42:29 +00:00
|
|
|
goto wrong_direction;
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
|
|
|
for (; pads; pads = g_list_next (pads)) {
|
|
|
|
GstPad *pad = GST_PAD (pads->data);
|
2005-02-04 15:36:37 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (pad);
|
|
|
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "checking pad %s:%s",
|
|
|
|
GST_DEBUG_PAD_NAME (pad));
|
2001-01-23 18:42:23 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (GST_PAD_IS_LINKED (pad)) {
|
|
|
|
GST_UNLOCK (pad);
|
|
|
|
result = pad;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "pad %s:%s is not linked",
|
|
|
|
GST_DEBUG_PAD_NAME (pad));
|
2001-01-23 18:42:23 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_UNLOCK (pad);
|
2001-01-23 18:42:23 +00:00
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
if (result)
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (result);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
GST_UNLOCK (element);
|
2001-01-23 18:42:23 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return result;
|
2005-03-08 17:42:29 +00:00
|
|
|
|
|
|
|
/* ERROR handling */
|
|
|
|
wrong_direction:
|
|
|
|
{
|
2005-05-19 16:26:50 +00:00
|
|
|
g_warning ("unknown pad direction %d", dir);
|
2005-03-08 17:42:29 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2001-01-23 18:42:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-03-07 18:27:42 +00:00
|
|
|
* gst_element_send_event:
|
|
|
|
* @element: a #GstElement to send the event to.
|
|
|
|
* @event: the #GstEvent to send to the element.
|
2001-01-23 18:42:23 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Sends an event to an element. If the element doesn't
|
|
|
|
* implement an event handler, the event will be forwarded
|
|
|
|
* to a random sink pad. This function takes owership of the
|
|
|
|
* provided event so you should _ref it if you want to reuse
|
|
|
|
* the event after this call.
|
|
|
|
*
|
|
|
|
* Returns: TRUE if the event was handled.
|
2001-01-23 18:42:23 +00:00
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* MT safe.
|
2001-01-23 18:42:23 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean
|
|
|
|
gst_element_send_event (GstElement * element, GstEvent * event)
|
2002-05-30 19:03:30 +00:00
|
|
|
{
|
2002-12-19 21:31:03 +00:00
|
|
|
GstElementClass *oclass;
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result = FALSE;
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2002-05-30 19:03:30 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (oclass->send_event) {
|
|
|
|
result = oclass->send_event (element, event);
|
|
|
|
} else {
|
2002-12-30 17:42:11 +00:00
|
|
|
GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-12-31 10:34:35 +00:00
|
|
|
if (pad) {
|
2005-03-07 18:27:42 +00:00
|
|
|
GstPad *peer = gst_pad_get_peer (pad);
|
|
|
|
|
|
|
|
if (peer) {
|
|
|
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS,
|
|
|
|
"sending event to random pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
|
|
|
|
|
|
|
result = gst_pad_send_event (peer, event);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (peer);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (pad);
|
2002-12-31 10:34:35 +00:00
|
|
|
}
|
2002-12-30 17:42:11 +00:00
|
|
|
}
|
2003-06-29 14:05:49 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "can't send event on element %s",
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_ELEMENT_NAME (element));
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
return result;
|
2002-05-30 19:03:30 +00:00
|
|
|
}
|
|
|
|
|
2003-08-04 21:48:06 +00:00
|
|
|
/**
|
|
|
|
* gst_element_seek:
|
|
|
|
* @element: a #GstElement to send the event to.
|
2005-08-24 13:04:31 +00:00
|
|
|
* @seek_method: the method to use for seeking (GST_SEEK_METHOD_*).
|
|
|
|
* @seek_format: the #GstFormat to use for seeking (GST_FORMAT_*).
|
|
|
|
* @seek_flags: the flags to use for seeking (GST_SEEK_FLAG_*).
|
|
|
|
* @offset: the offset to seek to (in the given seek_format).
|
2003-08-04 21:48:06 +00:00
|
|
|
*
|
|
|
|
* Sends a seek event to an element.
|
|
|
|
*
|
|
|
|
* Returns: TRUE if the event was handled.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2003-08-04 21:48:06 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
Some docs updates
Original commit message from CVS:
* CHANGES-0.9:
* docs/design/part-TODO.txt:
* docs/design/part-events.txt:
Some docs updates
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_event_handler),
(gst_base_src_loop):
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_configure_caps), (gst_base_transform_setcaps),
(gst_base_transform_get_size), (gst_base_transform_buffer_alloc),
(gst_base_transform_event), (gst_base_transform_handle_buffer),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
* gst/elements/gstfilesink.c: (gst_file_sink_event):
Event updates.
* gst/gstbuffer.h:
Use faster casts.
* gst/gstelement.c: (gst_element_seek):
* gst/gstelement.h:
Update gst_element_seek.
* gst/gstevent.c: (gst_event_finalize), (_gst_event_copy),
(gst_event_new), (gst_event_new_custom), (gst_event_get_structure),
(gst_event_new_flush_start), (gst_event_new_flush_stop),
(gst_event_new_eos), (gst_event_new_newsegment),
(gst_event_parse_newsegment), (gst_event_new_tag),
(gst_event_parse_tag), (gst_event_new_filler), (gst_event_new_qos),
(gst_event_parse_qos), (gst_event_new_seek),
(gst_event_parse_seek), (gst_event_new_navigation):
* gst/gstevent.h:
Make GstEvent use GstStructure. Add parsing code, make sure the
API is sufficiently generic.
Mark possible directions of events and serialization.
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize),
(_gst_message_copy), (gst_message_new_segment_start),
(gst_message_new_segment_done), (gst_message_new_custom),
(gst_message_parse_segment_start),
(gst_message_parse_segment_done):
Small cleanups.
* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Update for new events.
Catch events sent in wrong directions.
* gst/gstqueue.c: (gst_queue_link_src),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_handle_src_query):
Event updates.
* gst/gsttag.c:
* gst/gsttag.h:
Remove event code from this file.
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Event updates.
2005-07-27 18:33:03 +00:00
|
|
|
gst_element_seek (GstElement * element, gdouble rate, GstFormat format,
|
|
|
|
GstSeekFlags flags, GstSeekType cur_type, gint64 cur,
|
|
|
|
GstSeekType stop_type, gint64 stop)
|
2003-08-04 21:48:06 +00:00
|
|
|
{
|
2005-05-09 10:53:13 +00:00
|
|
|
GstEvent *event;
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result;
|
|
|
|
|
2005-05-09 10:53:13 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
|
|
|
|
Some docs updates
Original commit message from CVS:
* CHANGES-0.9:
* docs/design/part-TODO.txt:
* docs/design/part-events.txt:
Some docs updates
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_do_sync),
(gst_base_sink_activate_push), (gst_base_sink_activate_pull):
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_event_handler),
(gst_base_src_loop):
* gst/base/gstbasetransform.c: (gst_base_transform_transform_caps),
(gst_base_transform_configure_caps), (gst_base_transform_setcaps),
(gst_base_transform_get_size), (gst_base_transform_buffer_alloc),
(gst_base_transform_event), (gst_base_transform_handle_buffer),
(gst_base_transform_set_passthrough),
(gst_base_transform_is_passthrough):
* gst/elements/gstfakesink.c: (gst_fake_sink_event):
* gst/elements/gstfilesink.c: (gst_file_sink_event):
Event updates.
* gst/gstbuffer.h:
Use faster casts.
* gst/gstelement.c: (gst_element_seek):
* gst/gstelement.h:
Update gst_element_seek.
* gst/gstevent.c: (gst_event_finalize), (_gst_event_copy),
(gst_event_new), (gst_event_new_custom), (gst_event_get_structure),
(gst_event_new_flush_start), (gst_event_new_flush_stop),
(gst_event_new_eos), (gst_event_new_newsegment),
(gst_event_parse_newsegment), (gst_event_new_tag),
(gst_event_parse_tag), (gst_event_new_filler), (gst_event_new_qos),
(gst_event_parse_qos), (gst_event_new_seek),
(gst_event_parse_seek), (gst_event_new_navigation):
* gst/gstevent.h:
Make GstEvent use GstStructure. Add parsing code, make sure the
API is sufficiently generic.
Mark possible directions of events and serialization.
* gst/gstmessage.c: (gst_message_init), (gst_message_finalize),
(_gst_message_copy), (gst_message_new_segment_start),
(gst_message_new_segment_done), (gst_message_new_custom),
(gst_message_parse_segment_start),
(gst_message_parse_segment_done):
Small cleanups.
* gst/gstpad.c: (gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Update for new events.
Catch events sent in wrong directions.
* gst/gstqueue.c: (gst_queue_link_src),
(gst_queue_handle_sink_event), (gst_queue_chain), (gst_queue_loop),
(gst_queue_handle_src_query):
Event updates.
* gst/gsttag.c:
* gst/gsttag.h:
Remove event code from this file.
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_event),
(gst_dp_event_from_packet):
Event updates.
2005-07-27 18:33:03 +00:00
|
|
|
event =
|
|
|
|
gst_event_new_seek (rate, format, flags, cur_type, cur, stop_type, stop);
|
2005-03-07 18:27:42 +00:00
|
|
|
result = gst_element_send_event (element, event);
|
2003-08-04 21:48:06 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
return result;
|
2003-08-04 21:48:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-30 17:42:11 +00:00
|
|
|
/**
|
|
|
|
* gst_element_get_query_types:
|
|
|
|
* @element: a #GstElement to query
|
|
|
|
*
|
|
|
|
* Get an array of query types from the element.
|
2004-07-26 18:23:12 +00:00
|
|
|
* If the element doesn't implement a query types function,
|
|
|
|
* the query will be forwarded to a random sink pad.
|
|
|
|
*
|
2005-03-07 18:27:42 +00:00
|
|
|
* Returns: An array of #GstQueryType elements that should not
|
|
|
|
* be freed or modified.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2002-12-30 17:42:11 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
const GstQueryType *
|
|
|
|
gst_element_get_query_types (GstElement * element)
|
2002-06-08 14:59:34 +00:00
|
|
|
{
|
2002-12-30 17:42:11 +00:00
|
|
|
GstElementClass *oclass;
|
2005-03-07 18:27:42 +00:00
|
|
|
const GstQueryType *result = NULL;
|
2002-06-08 14:59:34 +00:00
|
|
|
|
gst/: Aplied part of patch #157127: Cleanup of issues reported by sparse.
Original commit message from CVS:
reviewed by: Wim Taymans, Ronald Bultje.
* gst/cothreads.c: (cothread_create):
* gst/gstbin.c: (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_child_state_change_func):
* gst/gstbuffer.c: (gst_buffer_span):
* gst/gstelement.c: (gst_element_get_index),
(gst_element_get_event_masks), (gst_element_get_query_types),
(gst_element_get_formats):
* gst/gsterror.c: (_gst_core_errors_init),
(_gst_library_errors_init), (_gst_resource_errors_init),
(_gst_stream_errors_init):
* gst/gstobject.c: (gst_object_default_deep_notify):
* gst/gstpad.c: (gst_pad_get_event_masks),
(gst_pad_get_internal_links_default):
* gst/gstplugin.c: (gst_plugin_register_func),
(gst_plugin_get_module):
* gst/gststructure.c: (gst_structure_get_string),
(gst_structure_get_abbrs), (gst_structure_from_abbr),
(gst_structure_to_abbr):
* gst/gstutils.c: (gst_print_element_args):
* gst/schedulers/gstoptimalscheduler.c: (add_to_group),
(setup_group_scheduler), (gst_opt_scheduler_iterate):
Aplied part of patch #157127: Cleanup of issues reported by
sparse.
Also do not try to use cothreads when there is no cothread
context yet.
2004-11-02 15:02:12 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-12-30 17:42:11 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (oclass->get_query_types) {
|
|
|
|
result = oclass->get_query_types (element);
|
|
|
|
} else {
|
2002-12-30 17:42:11 +00:00
|
|
|
GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SINK);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (pad) {
|
|
|
|
GstPad *peer = gst_pad_get_peer (pad);
|
2002-12-30 17:42:11 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (peer) {
|
|
|
|
result = gst_pad_get_query_types (peer);
|
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (peer);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (pad);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
2002-06-08 14:59:34 +00:00
|
|
|
}
|
|
|
|
|
2002-06-12 22:26:36 +00:00
|
|
|
/**
|
|
|
|
* gst_element_query:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to perform the query on.
|
2005-06-29 12:23:35 +00:00
|
|
|
* @query: the #GstQuery.
|
2002-06-12 22:26:36 +00:00
|
|
|
*
|
2002-08-30 14:02:15 +00:00
|
|
|
* Performs a query on the given element. If the format is set
|
2004-07-26 18:23:12 +00:00
|
|
|
* to GST_FORMAT_DEFAULT and this function returns TRUE, the
|
2002-06-12 22:26:36 +00:00
|
|
|
* format pointer will hold the default format.
|
|
|
|
* For element that don't implement a query handler, this function
|
2002-12-30 17:42:11 +00:00
|
|
|
* forwards the query to a random usable sinkpad of this element.
|
2004-07-26 18:23:12 +00:00
|
|
|
*
|
2002-06-12 22:26:36 +00:00
|
|
|
* Returns: TRUE if the query could be performed.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2002-06-12 22:26:36 +00:00
|
|
|
*/
|
2002-06-08 14:59:34 +00:00
|
|
|
gboolean
|
2005-05-09 10:53:13 +00:00
|
|
|
gst_element_query (GstElement * element, GstQuery * query)
|
2002-06-08 14:59:34 +00:00
|
|
|
{
|
2002-12-19 21:31:03 +00:00
|
|
|
GstElementClass *oclass;
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result = FALSE;
|
2002-12-19 21:31:03 +00:00
|
|
|
|
2002-06-08 14:59:34 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
2005-05-09 10:53:13 +00:00
|
|
|
g_return_val_if_fail (query != NULL, FALSE);
|
2002-12-19 21:31:03 +00:00
|
|
|
|
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (oclass->query) {
|
2005-05-09 10:53:13 +00:00
|
|
|
result = oclass->query (element, query);
|
2005-03-07 18:27:42 +00:00
|
|
|
} else {
|
2003-11-17 01:08:00 +00:00
|
|
|
GstPad *pad = gst_element_get_random_pad (element, GST_PAD_SRC);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (pad) {
|
2005-05-09 10:53:13 +00:00
|
|
|
result = gst_pad_query (pad, query);
|
2002-12-30 17:42:11 +00:00
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (pad);
|
2005-03-07 18:27:42 +00:00
|
|
|
} else {
|
|
|
|
pad = gst_element_get_random_pad (element, GST_PAD_SINK);
|
|
|
|
if (pad) {
|
|
|
|
GstPad *peer = gst_pad_get_peer (pad);
|
|
|
|
|
|
|
|
if (peer) {
|
2005-05-09 10:53:13 +00:00
|
|
|
result = gst_pad_query (peer, query);
|
2005-03-07 18:27:42 +00:00
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (peer);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (pad);
|
2005-03-07 18:27:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
2002-12-30 17:42:11 +00:00
|
|
|
}
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
/**
|
|
|
|
* gst_element_post_message:
|
|
|
|
* @element: a #GstElement posting the message
|
|
|
|
* @message: a #GstMessage to post
|
|
|
|
*
|
2005-07-09 22:54:28 +00:00
|
|
|
* Post a message on the element's #GstBus.
|
2005-03-21 17:34:02 +00:00
|
|
|
*
|
2005-07-09 15:18:53 +00:00
|
|
|
* Returns: TRUE if the message was successfully posted.
|
2005-03-21 17:34:02 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_element_post_message (GstElement * element, GstMessage * message)
|
|
|
|
{
|
|
|
|
GstBus *bus;
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
GST_DEBUG ("posting message %p ...", message);
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
|
|
|
g_return_val_if_fail (message != NULL, FALSE);
|
|
|
|
|
|
|
|
GST_LOCK (element);
|
|
|
|
bus = element->bus;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (bus == NULL)) {
|
|
|
|
GST_DEBUG ("... but I won't because I have no bus");
|
|
|
|
GST_UNLOCK (element);
|
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_message_unref (message);
|
2005-03-21 17:34:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (bus);
|
2005-07-09 15:18:53 +00:00
|
|
|
GST_DEBUG ("... on bus %" GST_PTR_FORMAT, bus);
|
2005-03-21 17:34:02 +00:00
|
|
|
GST_UNLOCK (element);
|
|
|
|
|
|
|
|
result = gst_bus_post (bus, message);
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (bus);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2004-01-19 11:32:35 +00:00
|
|
|
/**
|
2004-01-19 18:23:19 +00:00
|
|
|
* _gst_element_error_printf:
|
2004-01-19 11:32:35 +00:00
|
|
|
* @format: the printf-like format to use, or NULL
|
|
|
|
*
|
|
|
|
* This function is only used internally by the #gst_element_error macro.
|
|
|
|
*
|
|
|
|
* Returns: a newly allocated string, or NULL if the format was NULL or ""
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2004-01-19 11:32:35 +00:00
|
|
|
*/
|
|
|
|
gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
_gst_element_error_printf (const gchar * format, ...)
|
2004-01-19 11:32:35 +00:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
gchar *buffer;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (format == NULL)
|
|
|
|
return NULL;
|
|
|
|
if (format[0] == 0)
|
|
|
|
return NULL;
|
2004-01-19 11:32:35 +00:00
|
|
|
|
|
|
|
va_start (args, format);
|
|
|
|
buffer = g_strdup_vprintf (format, args);
|
|
|
|
va_end (args);
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2000-02-02 06:26:44 +00:00
|
|
|
/**
|
2005-03-21 17:34:02 +00:00
|
|
|
* gst_element_message_full:
|
|
|
|
* @element: a #GstElement to send message from
|
|
|
|
* @type: the #GstMessageType
|
|
|
|
* @domain: the GStreamer GError domain this message belongs to
|
|
|
|
* @code: the GError code belonging to the domain
|
|
|
|
* @text: an allocated text string to be used as a replacement for the
|
|
|
|
* default message connected to code, or NULL
|
|
|
|
* @debug: an allocated debug message to be used as a replacement for the
|
|
|
|
* default debugging information, or NULL
|
|
|
|
* @file: the source code file where the error was generated
|
2004-03-30 09:15:47 +00:00
|
|
|
* @function: the source code function where the error was generated
|
2005-03-21 17:34:02 +00:00
|
|
|
* @line: the source code line where the error was generated
|
2000-02-02 06:26:44 +00:00
|
|
|
*
|
2005-03-21 17:34:02 +00:00
|
|
|
* Post an error or warning message on the bus from inside an element.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2000-02-02 06:26:44 +00:00
|
|
|
*/
|
2005-03-21 17:34:02 +00:00
|
|
|
void gst_element_message_full
|
|
|
|
(GstElement * element, GstMessageType type,
|
|
|
|
GQuark domain, gint code, gchar * text,
|
2004-03-13 15:27:01 +00:00
|
|
|
gchar * debug, const gchar * file, const gchar * function, gint line)
|
2001-12-18 19:03:07 +00:00
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
GError *gerror = NULL;
|
2004-01-31 19:09:38 +00:00
|
|
|
gchar *name;
|
2005-03-21 17:34:02 +00:00
|
|
|
gchar *sent_text;
|
2004-01-18 21:36:20 +00:00
|
|
|
gchar *sent_debug;
|
2005-03-21 17:34:02 +00:00
|
|
|
GstMessage *message = NULL;
|
2004-01-18 21:36:20 +00:00
|
|
|
|
2002-02-06 19:05:19 +00:00
|
|
|
/* checks */
|
2005-03-21 17:34:02 +00:00
|
|
|
GST_DEBUG ("start");
|
2001-12-22 21:18:17 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
2005-03-21 17:34:02 +00:00
|
|
|
g_return_if_fail ((type == GST_MESSAGE_ERROR) ||
|
|
|
|
(type == GST_MESSAGE_WARNING));
|
|
|
|
|
|
|
|
/* check if we send the given text or the default error text */
|
|
|
|
if ((text == NULL) || (text[0] == 0)) {
|
|
|
|
/* text could have come from g_strdup_printf (""); */
|
|
|
|
g_free (text);
|
|
|
|
sent_text = gst_error_get_message (domain, code);
|
2004-03-13 15:27:01 +00:00
|
|
|
} else
|
2005-03-21 17:34:02 +00:00
|
|
|
sent_text = text;
|
2001-12-22 21:18:17 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
/* construct a sent_debug with extra information from source */
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((debug == NULL) || (debug[0] == 0)) {
|
2005-03-21 17:34:02 +00:00
|
|
|
/* debug could have come from g_strdup_printf (""); */
|
|
|
|
sent_debug = NULL;
|
|
|
|
} else {
|
|
|
|
name = gst_object_get_path_string (GST_OBJECT (element));
|
2004-01-31 19:09:38 +00:00
|
|
|
sent_debug = g_strdup_printf ("%s(%d): %s: %s:\n%s",
|
2004-03-15 19:27:17 +00:00
|
|
|
file, line, function, name, debug ? debug : "");
|
2005-03-21 17:34:02 +00:00
|
|
|
g_free (name);
|
2004-01-18 21:36:20 +00:00
|
|
|
}
|
2005-03-21 17:34:02 +00:00
|
|
|
g_free (debug);
|
2001-12-22 21:18:17 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
/* create gerror and post message */
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_ERROR_SYSTEM, element, "posting message: %s",
|
|
|
|
sent_text);
|
|
|
|
gerror = g_error_new_literal (domain, code, sent_text);
|
2004-03-05 22:01:42 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
if (type == GST_MESSAGE_ERROR) {
|
|
|
|
message = gst_message_new_error (GST_OBJECT (element), gerror, sent_debug);
|
2005-07-12 16:28:36 +00:00
|
|
|
} else if (type == GST_MESSAGE_WARNING) {
|
2005-03-21 17:34:02 +00:00
|
|
|
message = gst_message_new_warning (GST_OBJECT (element), gerror,
|
|
|
|
sent_debug);
|
2005-07-12 16:28:36 +00:00
|
|
|
} else {
|
|
|
|
g_assert_not_reached ();
|
2003-06-03 21:18:39 +00:00
|
|
|
}
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_element_post_message (element, message);
|
2003-06-03 21:18:39 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_ERROR_SYSTEM, element, "posted message: %s",
|
|
|
|
sent_text);
|
2002-12-27 22:57:13 +00:00
|
|
|
|
2002-02-06 19:05:19 +00:00
|
|
|
/* cleanup */
|
2005-07-12 16:28:36 +00:00
|
|
|
g_error_free (gerror);
|
|
|
|
g_free (sent_debug);
|
2005-03-21 17:34:02 +00:00
|
|
|
g_free (sent_text);
|
2001-12-18 19:03:07 +00:00
|
|
|
}
|
|
|
|
|
2003-04-08 21:14:23 +00:00
|
|
|
/**
|
2003-04-11 00:00:46 +00:00
|
|
|
* gst_element_is_locked_state:
|
2003-04-08 21:14:23 +00:00
|
|
|
* @element: a #GstElement.
|
|
|
|
*
|
|
|
|
* Checks if the state of an element is locked.
|
2004-07-26 18:23:12 +00:00
|
|
|
* If the state of an element is locked, state changes of the parent don't
|
2003-04-08 21:14:23 +00:00
|
|
|
* affect the element.
|
|
|
|
* This way you can leave currently unused elements inside bins. Just lock their
|
|
|
|
* state before changing the state from #GST_STATE_NULL.
|
|
|
|
*
|
|
|
|
* Returns: TRUE, if the element's state is locked.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2003-04-08 21:14:23 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_is_locked_state (GstElement * element)
|
2003-04-08 21:14:23 +00:00
|
|
|
{
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean result = FALSE;
|
|
|
|
|
2003-04-08 21:14:23 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (element);
|
|
|
|
result = GST_FLAG_IS_SET (element, GST_ELEMENT_LOCKED_STATE);
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
|
|
|
|
return result;
|
2003-04-08 21:14:23 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-04-08 21:14:23 +00:00
|
|
|
/**
|
2003-04-11 00:00:46 +00:00
|
|
|
* gst_element_set_locked_state:
|
|
|
|
* @element: a #GstElement
|
|
|
|
* @locked_state: TRUE to lock the element's state
|
2003-04-08 21:14:23 +00:00
|
|
|
*
|
|
|
|
* Locks the state of an element, so state changes of the parent don't affect
|
|
|
|
* this element anymore.
|
2005-03-07 18:27:42 +00:00
|
|
|
*
|
|
|
|
* Returns: TRUE if the state was changed, FALSE if bad params were given or
|
|
|
|
* the element was already in the correct state.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2003-04-08 21:14:23 +00:00
|
|
|
*/
|
2005-03-07 18:27:42 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_set_locked_state (GstElement * element, gboolean locked_state)
|
2003-04-08 21:14:23 +00:00
|
|
|
{
|
2003-04-11 00:00:46 +00:00
|
|
|
gboolean old;
|
2003-04-08 21:14:23 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
2003-04-11 00:00:46 +00:00
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_LOCK (element);
|
2003-04-11 00:00:46 +00:00
|
|
|
old = GST_FLAG_IS_SET (element, GST_ELEMENT_LOCKED_STATE);
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
if (G_UNLIKELY (old == locked_state))
|
|
|
|
goto was_ok;
|
2003-04-11 00:00:46 +00:00
|
|
|
|
|
|
|
if (locked_state) {
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_STATES, "locking state of element %s",
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_ELEMENT_NAME (element));
|
2003-04-11 00:00:46 +00:00
|
|
|
GST_FLAG_SET (element, GST_ELEMENT_LOCKED_STATE);
|
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
GST_CAT_DEBUG (GST_CAT_STATES, "unlocking state of element %s",
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_ELEMENT_NAME (element));
|
2003-04-11 00:00:46 +00:00
|
|
|
GST_FLAG_UNSET (element, GST_ELEMENT_LOCKED_STATE);
|
|
|
|
}
|
2005-03-07 18:27:42 +00:00
|
|
|
GST_UNLOCK (element);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
was_ok:
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
|
|
|
|
return FALSE;
|
2003-04-08 21:14:23 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-04-08 21:14:23 +00:00
|
|
|
/**
|
2003-04-11 00:00:46 +00:00
|
|
|
* gst_element_sync_state_with_parent:
|
2003-04-08 21:14:23 +00:00
|
|
|
* @element: a #GstElement.
|
|
|
|
*
|
2003-04-11 00:00:46 +00:00
|
|
|
* Tries to change the state of the element to the same as its parent.
|
|
|
|
* If this function returns FALSE, the state of element is undefined.
|
2003-04-08 21:14:23 +00:00
|
|
|
*
|
2003-04-11 00:00:46 +00:00
|
|
|
* Returns: TRUE, if the element's state could be synced to the parent's state.
|
2003-04-08 21:14:23 +00:00
|
|
|
*/
|
2003-04-11 00:00:46 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_sync_state_with_parent (GstElement * element)
|
2003-04-08 21:14:23 +00:00
|
|
|
{
|
2003-04-11 00:00:46 +00:00
|
|
|
GstElement *parent;
|
2003-04-08 21:14:23 +00:00
|
|
|
|
2003-04-11 00:00:46 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
2004-03-13 15:27:01 +00:00
|
|
|
parent = GST_ELEMENT (GST_ELEMENT_PARENT (element));
|
2003-04-11 00:00:46 +00:00
|
|
|
g_return_val_if_fail (GST_IS_BIN (parent), FALSE);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
GST_CAT_DEBUG (GST_CAT_STATES, "syncing state of element %s (%s) to %s (%s)",
|
|
|
|
GST_ELEMENT_NAME (element),
|
|
|
|
gst_element_state_get_name (GST_STATE (element)),
|
|
|
|
GST_ELEMENT_NAME (parent),
|
|
|
|
gst_element_state_get_name (GST_STATE (parent)));
|
2005-03-07 18:27:42 +00:00
|
|
|
|
2003-04-11 00:00:46 +00:00
|
|
|
if (gst_element_set_state (element, GST_STATE (parent)) == GST_STATE_FAILURE) {
|
|
|
|
return FALSE;
|
2003-04-08 21:14:23 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
/* MT safe */
|
|
|
|
static GstElementStateReturn
|
|
|
|
gst_element_get_state_func (GstElement * element,
|
|
|
|
GstElementState * state, GstElementState * pending, GTimeVal * timeout)
|
|
|
|
{
|
|
|
|
GstElementStateReturn ret = GST_STATE_FAILURE;
|
2005-03-28 14:54:33 +00:00
|
|
|
GstElementState old_pending;
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "getting state");
|
|
|
|
|
|
|
|
GST_STATE_LOCK (element);
|
|
|
|
/* we got an error, report immediatly */
|
2005-06-23 10:37:09 +00:00
|
|
|
if (GST_STATE_NO_PREROLL (element)) {
|
|
|
|
ret = GST_STATE_NO_PREROLL;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we got an error, report immediatly */
|
|
|
|
if (GST_STATE_ERROR (element)) {
|
|
|
|
ret = GST_STATE_FAILURE;
|
2005-03-28 14:54:33 +00:00
|
|
|
goto done;
|
2005-06-23 10:37:09 +00:00
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
old_pending = GST_STATE_PENDING (element);
|
|
|
|
if (old_pending != GST_STATE_VOID_PENDING) {
|
|
|
|
GTimeVal *timeval, abstimeout;
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "wait for pending");
|
|
|
|
if (timeout) {
|
|
|
|
/* make timeout absolute */
|
|
|
|
g_get_current_time (&abstimeout);
|
|
|
|
g_time_val_add (&abstimeout,
|
|
|
|
timeout->tv_sec * G_USEC_PER_SEC + timeout->tv_usec);
|
|
|
|
timeval = &abstimeout;
|
|
|
|
} else {
|
|
|
|
timeval = NULL;
|
|
|
|
}
|
|
|
|
/* we have a pending state change, wait for it to complete */
|
|
|
|
if (!GST_STATE_TIMED_WAIT (element, timeval)) {
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "timeout");
|
|
|
|
/* timeout triggered */
|
|
|
|
ret = GST_STATE_ASYNC;
|
|
|
|
} else {
|
|
|
|
/* could be success or failure */
|
|
|
|
if (old_pending == GST_STATE (element)) {
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "got success");
|
|
|
|
ret = GST_STATE_SUCCESS;
|
|
|
|
} else {
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "got failure");
|
|
|
|
ret = GST_STATE_FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* if nothing is pending anymore we can return SUCCESS */
|
|
|
|
if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING) {
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "nothing pending");
|
|
|
|
ret = GST_STATE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (state)
|
|
|
|
*state = GST_STATE (element);
|
|
|
|
if (pending)
|
|
|
|
*pending = GST_STATE_PENDING (element);
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
2005-06-23 10:37:09 +00:00
|
|
|
"state current: %s, pending: %s, error: %d, no_preroll: %d, result: %d",
|
2005-03-28 14:54:33 +00:00
|
|
|
gst_element_state_get_name (GST_STATE (element)),
|
2005-06-23 10:37:09 +00:00
|
|
|
gst_element_state_get_name (GST_STATE_PENDING (element)),
|
|
|
|
GST_STATE_ERROR (element), GST_STATE_NO_PREROLL (element), ret);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
GST_STATE_UNLOCK (element);
|
2005-03-21 17:34:02 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2001-10-21 18:00:31 +00:00
|
|
|
/**
|
|
|
|
* gst_element_get_state:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to get the state of.
|
2005-03-21 17:34:02 +00:00
|
|
|
* @state: a pointer to #GstElementState to hold the state. Can be NULL.
|
|
|
|
* @pending: a pointer to #GstElementState to hold the pending state.
|
|
|
|
* Can be NULL.
|
|
|
|
* @timeout: a #GTimeVal to specify the timeout for an async
|
|
|
|
* state change or NULL for infinite timeout.
|
|
|
|
*
|
|
|
|
* Gets the state of the element.
|
|
|
|
*
|
|
|
|
* For elements that performed an ASYNC state change, as reported by
|
|
|
|
* #gst_element_set_state(), this function will block up to the
|
|
|
|
* specified timeout value for the state change to complete.
|
|
|
|
* If the element completes the state change or goes into
|
|
|
|
* an error, this function returns immediatly with a return value of
|
|
|
|
* GST_STATE_SUCCESS or GST_STATE_FAILURE respectively.
|
|
|
|
*
|
|
|
|
* Returns: GST_STATE_SUCCESS if the element has no more pending state and
|
|
|
|
* the last state change succeeded, GST_STATE_ASYNC
|
|
|
|
* if the element is still performing a state change or
|
|
|
|
* GST_STATE_FAILURE if the last state change failed.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
GstElementStateReturn
|
|
|
|
gst_element_get_state (GstElement * element,
|
|
|
|
GstElementState * state, GstElementState * pending, GTimeVal * timeout)
|
|
|
|
{
|
|
|
|
GstElementClass *oclass;
|
|
|
|
GstElementStateReturn result = GST_STATE_FAILURE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
|
|
|
|
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
|
|
|
if (oclass->get_state)
|
|
|
|
result = (oclass->get_state) (element, state, pending, timeout);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_element_abort_state:
|
|
|
|
* @element: a #GstElement to abort the state of.
|
|
|
|
*
|
|
|
|
* Abort the state change of the element. This function is used
|
|
|
|
* by elements that do asynchronous state changes and find out
|
|
|
|
* something is wrong.
|
2001-10-21 18:00:31 +00:00
|
|
|
*
|
2005-03-21 17:34:02 +00:00
|
|
|
* This function should be called with the STATE_LOCK held.
|
2001-10-21 18:00:31 +00:00
|
|
|
*
|
2005-03-21 17:34:02 +00:00
|
|
|
* MT safe.
|
2001-10-21 18:00:31 +00:00
|
|
|
*/
|
2005-03-21 17:34:02 +00:00
|
|
|
void
|
|
|
|
gst_element_abort_state (GstElement * element)
|
2001-10-17 10:21:27 +00:00
|
|
|
{
|
2005-03-28 14:54:33 +00:00
|
|
|
GstElementState pending;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
|
|
|
pending = GST_STATE_PENDING (element);
|
|
|
|
|
|
|
|
if (pending != GST_STATE_VOID_PENDING && !GST_STATE_ERROR (element)) {
|
2005-04-10 21:42:32 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2005-03-28 14:54:33 +00:00
|
|
|
GstElementState old_state = GST_STATE (element);
|
2005-04-10 21:42:32 +00:00
|
|
|
#endif
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"aborting state from %s to %s", gst_element_state_get_name (old_state),
|
|
|
|
gst_element_state_get_name (pending));
|
|
|
|
|
|
|
|
/* flag error */
|
|
|
|
GST_STATE_ERROR (element) = TRUE;
|
|
|
|
|
|
|
|
GST_STATE_BROADCAST (element);
|
|
|
|
}
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
2001-10-17 10:21:27 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
/**
|
|
|
|
* gst_element_commit_state:
|
|
|
|
* @element: a #GstElement to commit the state of.
|
|
|
|
*
|
|
|
|
* Commit the state change of the element. This function is used
|
|
|
|
* by elements that do asynchronous state changes.
|
|
|
|
*
|
|
|
|
* This function can only be called with the STATE_LOCK held.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_element_commit_state (GstElement * element)
|
|
|
|
{
|
2005-03-28 14:54:33 +00:00
|
|
|
GstElementState pending;
|
|
|
|
GstMessage *message;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
|
|
|
pending = GST_STATE_PENDING (element);
|
|
|
|
|
|
|
|
if (pending != GST_STATE_VOID_PENDING) {
|
|
|
|
GstElementState old_state = GST_STATE (element);
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"commiting state from %s to %s", gst_element_state_get_name (old_state),
|
|
|
|
gst_element_state_get_name (pending));
|
|
|
|
|
|
|
|
GST_STATE (element) = pending;
|
|
|
|
GST_STATE_PENDING (element) = GST_STATE_VOID_PENDING;
|
|
|
|
GST_STATE_ERROR (element) = FALSE;
|
|
|
|
|
|
|
|
g_signal_emit (G_OBJECT (element), gst_element_signals[STATE_CHANGE],
|
|
|
|
0, old_state, pending);
|
|
|
|
message = gst_message_new_state_changed (GST_OBJECT (element),
|
|
|
|
old_state, pending);
|
|
|
|
gst_element_post_message (element, message);
|
|
|
|
GST_STATE_BROADCAST (element);
|
|
|
|
}
|
2001-10-17 10:21:27 +00:00
|
|
|
}
|
|
|
|
|
2001-12-09 13:17:54 +00:00
|
|
|
/**
|
2005-03-21 17:34:02 +00:00
|
|
|
* gst_element_lost_state:
|
|
|
|
* @element: a #GstElement the state is lost of
|
2001-12-09 13:17:54 +00:00
|
|
|
*
|
2005-03-21 17:34:02 +00:00
|
|
|
* Brings the element to the lost state. The current state of the
|
|
|
|
* element is copied to the pending state so that any call to
|
|
|
|
* #gst_element_get_state() will return ASYNC.
|
|
|
|
* This is mostly used for elements that lost their preroll buffer
|
|
|
|
* in the PAUSED state after a flush, they become PAUSED again
|
|
|
|
* if a new preroll buffer is queued.
|
|
|
|
* This function can only be called when the element is currently
|
|
|
|
* not in error or an async state change.
|
|
|
|
*
|
|
|
|
* This function can only be called with the STATE_LOCK held.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2001-12-09 13:17:54 +00:00
|
|
|
*/
|
2001-12-04 22:12:50 +00:00
|
|
|
void
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_element_lost_state (GstElement * element)
|
2001-12-04 22:12:50 +00:00
|
|
|
{
|
2005-03-28 14:54:33 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
|
|
|
if (GST_STATE_PENDING (element) == GST_STATE_VOID_PENDING &&
|
|
|
|
!GST_STATE_ERROR (element)) {
|
|
|
|
GstElementState current_state = GST_STATE (element);
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"lost state of %s", gst_element_state_get_name (current_state));
|
|
|
|
|
|
|
|
GST_STATE_PENDING (element) = current_state;
|
|
|
|
GST_STATE_ERROR (element) = FALSE;
|
|
|
|
}
|
2001-12-04 22:12:50 +00:00
|
|
|
}
|
2002-04-07 23:32:16 +00:00
|
|
|
|
2000-01-30 09:03:00 +00:00
|
|
|
/**
|
|
|
|
* gst_element_set_state:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to change state of.
|
|
|
|
* @state: the element's new #GstElementState.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
2002-04-23 10:32:16 +00:00
|
|
|
* Sets the state of the element. This function will try to set the
|
|
|
|
* requested state by going through all the intermediary states and calling
|
|
|
|
* the class's state change function for each.
|
2000-01-30 09:03:00 +00:00
|
|
|
*
|
2005-03-21 17:34:02 +00:00
|
|
|
* Returns: Result of the state change using #GstElementStateReturn.
|
|
|
|
*
|
|
|
|
* MT safe.
|
2000-01-30 09:03:00 +00:00
|
|
|
*/
|
2002-10-29 17:53:42 +00:00
|
|
|
GstElementStateReturn
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_set_state (GstElement * element, GstElementState state)
|
2004-07-12 21:27:11 +00:00
|
|
|
{
|
2005-03-28 14:54:33 +00:00
|
|
|
GstElementClass *oclass;
|
|
|
|
GstElementState current;
|
|
|
|
GstElementStateReturn return_val = GST_STATE_SUCCESS;
|
2005-06-23 10:37:09 +00:00
|
|
|
GstElementStateReturn ret;
|
|
|
|
GstElementState pending;
|
|
|
|
GTimeVal tv;
|
|
|
|
|
|
|
|
|
|
|
|
/* get current element state, need to call the method so that
|
|
|
|
* we call the virtual method and subclasses can implement their
|
|
|
|
* own algorithms */
|
|
|
|
GST_TIME_TO_TIMEVAL (0, tv);
|
|
|
|
ret = gst_element_get_state (element, ¤t, &pending, &tv);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
/* get the element state lock */
|
|
|
|
GST_STATE_LOCK (element);
|
2005-06-25 17:42:17 +00:00
|
|
|
/* this is the state we should go to */
|
|
|
|
GST_STATE_FINAL (element) = state;
|
2005-06-23 10:37:09 +00:00
|
|
|
if (ret == GST_STATE_ASYNC) {
|
|
|
|
gst_element_commit_state (element);
|
|
|
|
}
|
2005-03-28 14:54:33 +00:00
|
|
|
|
|
|
|
/* start with the current state */
|
|
|
|
current = GST_STATE (element);
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "setting state from %s to %s",
|
|
|
|
gst_element_state_get_name (current), gst_element_state_get_name (state));
|
|
|
|
|
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
|
|
|
|
/* We always perform at least one state change, even if the
|
|
|
|
* current state is equal to the required state. This is needed
|
|
|
|
* for bins that sync their children. */
|
|
|
|
do {
|
|
|
|
GstElementState pending;
|
|
|
|
|
|
|
|
/* calculate the pending state */
|
|
|
|
if (current < state)
|
|
|
|
pending = current << 1;
|
|
|
|
else if (current > state)
|
|
|
|
pending = current >> 1;
|
|
|
|
else
|
|
|
|
pending = current;
|
|
|
|
|
|
|
|
/* set the pending state variable */
|
|
|
|
GST_STATE_PENDING (element) = pending;
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"%s: setting state from %s to %s",
|
|
|
|
(pending != state ? "intermediate" : "final"),
|
|
|
|
gst_element_state_get_name (current),
|
|
|
|
gst_element_state_get_name (pending));
|
|
|
|
|
|
|
|
/* call the state change function so it can set the state */
|
|
|
|
if (oclass->change_state)
|
|
|
|
return_val = (oclass->change_state) (element);
|
|
|
|
else
|
|
|
|
return_val = GST_STATE_FAILURE;
|
|
|
|
|
2005-06-23 17:11:49 +00:00
|
|
|
/* clear the error and preroll flag, we need to do that after
|
|
|
|
* calling the virtual change_state function so that it can use the
|
|
|
|
* old previous value. */
|
|
|
|
GST_STATE_ERROR (element) = FALSE;
|
|
|
|
GST_STATE_NO_PREROLL (element) = FALSE;
|
|
|
|
|
2005-03-28 14:54:33 +00:00
|
|
|
switch (return_val) {
|
|
|
|
case GST_STATE_FAILURE:
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"have failed change_state return");
|
|
|
|
/* state change failure exits the loop */
|
|
|
|
gst_element_abort_state (element);
|
|
|
|
goto exit;
|
|
|
|
case GST_STATE_ASYNC:
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
|
|
|
"element will change state async");
|
|
|
|
/* an async state change exits the loop, we can only
|
|
|
|
* go to the next state change when this one completes. */
|
|
|
|
goto exit;
|
|
|
|
case GST_STATE_SUCCESS:
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
2005-07-09 15:18:53 +00:00
|
|
|
"element changed state successfully");
|
2005-03-28 14:54:33 +00:00
|
|
|
/* we can commit the state now and proceed to the next state */
|
|
|
|
gst_element_commit_state (element);
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "commited state");
|
|
|
|
break;
|
2005-06-23 10:37:09 +00:00
|
|
|
case GST_STATE_NO_PREROLL:
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element,
|
2005-07-09 15:18:53 +00:00
|
|
|
"element changed state successfully and can't preroll");
|
2005-06-23 10:37:09 +00:00
|
|
|
/* we can commit the state now and proceed to the next state */
|
|
|
|
gst_element_commit_state (element);
|
|
|
|
GST_STATE_NO_PREROLL (element) = TRUE;
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "commited state");
|
|
|
|
break;
|
2005-03-28 14:54:33 +00:00
|
|
|
default:
|
|
|
|
goto invalid_return;
|
|
|
|
}
|
|
|
|
/* get the current state of the element and see if we need to do more
|
|
|
|
* state changes */
|
|
|
|
current = GST_STATE (element);
|
|
|
|
}
|
|
|
|
while (current != state);
|
|
|
|
|
|
|
|
exit:
|
2005-06-25 17:42:17 +00:00
|
|
|
GST_STATE_FINAL (element) = GST_STATE_VOID_PENDING;
|
2005-03-28 14:54:33 +00:00
|
|
|
GST_STATE_UNLOCK (element);
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, "exit state change");
|
|
|
|
|
|
|
|
return return_val;
|
|
|
|
|
|
|
|
/* ERROR */
|
|
|
|
invalid_return:
|
|
|
|
{
|
2005-06-25 17:42:17 +00:00
|
|
|
GST_STATE_FINAL (element) = GST_STATE_VOID_PENDING;
|
2005-03-28 14:54:33 +00:00
|
|
|
GST_STATE_UNLOCK (element);
|
|
|
|
/* somebody added a GST_STATE_ and forgot to do stuff here ! */
|
2005-06-23 11:43:39 +00:00
|
|
|
g_critical ("unknown return value %d from a state change function",
|
|
|
|
return_val);
|
2005-03-28 14:54:33 +00:00
|
|
|
return GST_STATE_FAILURE;
|
|
|
|
}
|
2001-12-04 22:12:50 +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
|
|
|
/* gst_iterator_fold functions for pads_activate */
|
|
|
|
|
2002-01-20 11:55:35 +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
|
|
|
activate_pads (GstPad * pad, GValue * ret, gboolean * active)
|
2002-12-27 22:57:13 +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
|
|
|
if (!gst_pad_set_active (pad, *active))
|
|
|
|
g_value_set_boolean (ret, FALSE);
|
2005-03-28 14:54:33 +00:00
|
|
|
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (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
|
|
|
return TRUE;
|
|
|
|
}
|
2005-03-28 14:54:33 +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
|
|
|
/* returns false on error or early cutout of the fold, true otherwise */
|
|
|
|
static gboolean
|
|
|
|
iterator_fold_with_resync (GstIterator * iter, GstIteratorFoldFunction func,
|
|
|
|
GValue * ret, gpointer user_data)
|
|
|
|
{
|
|
|
|
GstIteratorResult ires;
|
|
|
|
gboolean res = TRUE;
|
gst/: Fix name lookup in GstBin.
Original commit message from CVS:
* gst/gstbin.c: (gst_bin_send_event), (compare_name),
(gst_bin_get_by_name):
* gst/gstbuffer.h:
* gst/gstclock.c: (gst_clock_entry_new), (gst_clock_class_init),
(gst_clock_finalize):
* gst/gstdata.c: (gst_data_replace):
* gst/gstdata.h:
* gst/gstelement.c: (gst_element_request_pad),
(gst_element_pads_activate):
* gst/gstobject.c: (gst_object_init), (gst_object_ref),
(gst_object_unref):
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_peer_set_active),
(gst_pad_set_checkgetrange_function),
(gst_pad_link_check_compatible_unlocked), (gst_pad_set_caps),
(gst_pad_check_pull_range), (gst_pad_pull_range),
(gst_static_pad_template_get_caps), (gst_pad_start_task),
(gst_pad_pause_task), (gst_pad_stop_task):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_request_pad), (gst_pad_proxy_getcaps):
Fix name lookup in GstBin.
Added _data_replace() function and _buffer_replace()
Use finalize method to clean up clock.
Fix refcounting on request pads.
Fix pad schedule mode error.
Some more object refcounting debug info,
2005-05-05 09:28:01 +00:00
|
|
|
|
gst/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
|
|
|
while (1) {
|
|
|
|
ires = gst_iterator_fold (iter, func, ret, user_data);
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +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
|
|
|
switch (ires) {
|
|
|
|
case GST_ITERATOR_RESYNC:
|
2005-07-18 12:49:53 +00:00
|
|
|
gst_iterator_resync (iter);
|
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
|
|
|
break;
|
|
|
|
case GST_ITERATOR_DONE:
|
|
|
|
res = TRUE;
|
|
|
|
goto done;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
2005-03-28 14:54:33 +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
|
|
|
done:
|
|
|
|
return res;
|
|
|
|
}
|
gst/gstutils.c: RPAD fixes all around.
Original commit message from CVS:
2005-06-08 Andy Wingo <wingo@pobox.com>
* gst/gstutils.c: RPAD fixes all around.
(gst_element_link_pads): Refcounting fixes.
* tools/gst-inspect.c:
* tools/gst-xmlinspect.c:
* parse/grammar.y:
* gst/base/gsttypefindhelper.c:
* gst/base/gstbasesink.c:
* gst/gstqueue.c: RPAD fixes.
* gst/gstghostpad.h:
* gst/gstghostpad.c: New ghost pad implementation as full proxy
pads. The tricky thing is they provide both source and sink
interfaces, since they proxy the internal pad for the external
pad, and vice versa. Implement with lower-level ProxyPad objects,
with the interior proxy pad as a child of the exterior ghost pad.
Should write a doc on this.
* gst/gstpad.h: s/RPAD/PAD/, s/RealPad/Pad/.
(gst_pad_set_name, gst_pad_set_parent): Macros removed, use
gst_object API.
* gst/gstpad.c: Big changes. No more stub base GstPad, now all
pads are real pads. No ghost pads in this file. Not documenting
the myriad s/RPAD/PAD/ and REALIZE fixes.
(gst_pad_class_init): Add properties for "direction" and
"template". Both are construct-only, so they can't change during
the life of the pad. Fixes properly deriving from GstPad.
(gst_pad_custom_new, gst_pad_custom_new_from_template): Gone. For
derived objects, just set properties when creating the objects via
g_object_new.
(gst_pad_get_parent): Implement as a function, return NULL if the
parent is not an element.
(gst_pad_get_real_parent, gst_pad_add_ghost_pad)
(gst_pad_remove_ghost_pad, gst_pad_realize): Removed.
* gst/gstobject.c (gst_object_class_init): Make name a construct
property. Don't set it in the object init.
* gst/gstelement.c (gst_element_add_pad): Don't allow adding pads
with UNKNOWN direction.
(gst_element_add_ghost_pad): Remove non-orthogonal API. Replace
with gst_element_add_pad (e, gst_ghost_pad_new (name, pad)).
(gst_element_remove_pad): Remove ghost-pad special cases.
(gst_element_pads_activate): Remove rpad cruft.
* gst/gstbin.c (gst_bin_change_state): Use gst_pad_get_parent to
catch the pad's-parent-not-an-element case.
* gst/gst.h: Include gstghostpad.h.
* gst/gst.c (init_post): No more real, ghost pads.
* gst/Makefile.am: Add gstghostpad.[ch].
* check/Makefile.am:
* check/gst/gstbin.c:
* check/gst/gstghostpad.c (test_ghost_pads): Check that linking
into a bin creates ghost pads, and that the refcounts are right.
Partly moved from gstbin.c.
2005-06-08 22:16:27 +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
|
|
|
/* is called with STATE_LOCK
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_element_pads_activate (GstElement * element, gboolean active)
|
|
|
|
{
|
|
|
|
GValue ret = { 0, };
|
|
|
|
GstIterator *iter;
|
|
|
|
gboolean fold_ok;
|
|
|
|
|
|
|
|
/* no need to unset this later, it's just a boolean */
|
|
|
|
g_value_init (&ret, G_TYPE_BOOLEAN);
|
|
|
|
g_value_set_boolean (&ret, TRUE);
|
|
|
|
|
|
|
|
iter = gst_element_iterate_src_pads (element);
|
|
|
|
fold_ok = iterator_fold_with_resync
|
|
|
|
(iter, (GstIteratorFoldFunction) activate_pads, &ret, &active);
|
|
|
|
gst_iterator_free (iter);
|
|
|
|
if (!fold_ok || !g_value_get_boolean (&ret))
|
|
|
|
return FALSE;
|
2005-03-28 14:54:33 +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
|
|
|
iter = gst_element_iterate_sink_pads (element);
|
|
|
|
fold_ok = iterator_fold_with_resync
|
|
|
|
(iter, (GstIteratorFoldFunction) activate_pads, &ret, &active);
|
|
|
|
gst_iterator_free (iter);
|
|
|
|
if (!fold_ok || !g_value_get_boolean (&ret))
|
|
|
|
return FALSE;
|
2005-03-28 14:54:33 +00:00
|
|
|
|
gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any remaining buffer.
Original commit message from CVS:
2005-06-27 Andy Wingo <wingo@pobox.com>
* gst/base/gsttypefindhelper.c (gst_type_find_helper): Unref any
remaining buffer.
* gst/gsttrace.c (gst_alloc_trace_list_sorted): New helper,
returns a sorted copy of the trace list.
(gst_alloc_trace_print_live): New API, only prints traces with
live objects. Sort the list.
(gst_alloc_trace_print_all): Sort the list.
(gst_alloc_trace_print): Align columns.
* gst/elements/gstttypefindelement.c:
* gst/elements/gsttee.c:
* gst/base/gstbasesrc.c:
* gst/base/gstbasesink.c:
* gst/base/gstbasetransform.c:
* gst/gstqueue.c: Adapt for pad activation changes.
* gst/gstpipeline.c (gst_pipeline_init): Unref after parenting
sched.
(gst_pipeline_dispose): Drop ref on sched.
* gst/gstpad.c (gst_pad_init): Set the default activate func.
(gst_pad_activate_default): Push mode by default.
(pre_activate_switch, post_activate_switch): New stubs, things to
do before and after switching activation modes on pads.
(gst_pad_set_active): Take a boolean and not a mode, dispatch to
the pad's activate function to choose which mode to activate.
Shortcut on deactivation and call the right function directly.
(gst_pad_activate_pull): New API, (de)activates a pad in pull
mode.
(gst_pad_activate_push): New API, same for push mode.
(gst_pad_set_activate_function)
(gst_pad_set_activatepull_function)
(gst_pad_set_activatepush_function): Setters for new API.
* gst/gstminiobject.c (gst_mini_object_new, gst_mini_object_free):
Trace all miniobjects.
(gst_mini_object_make_writable): Unref the arg if we copy, like
gst_caps_make_writable.
* gst/gstmessage.c (_gst_message_initialize): No trace init.
* gst/gstghostpad.c (gst_proxy_pad_do_activate)
(gst_proxy_pad_do_activatepull, gst_proxy_pad_do_activatepush):
Adapt for new pad API.
* gst/gstevent.c (_gst_event_initialize): Don't initialize trace.
* gst/gstelement.h:
* gst/gstelement.c (gst_element_iterate_src_pads)
(gst_element_iterate_sink_pads): New API functions.
* gst/gstelement.c (iterator_fold_with_resync): New utility,
should fold into gstiterator.c in some form.
(gst_element_pads_activate): Simplified via use of fold and
delegation of decisions to gstpad->activate.
* gst/gstbus.c (gst_bus_source_finalize): Set the bus to NULL,
help in debugging.
* gst/gstbuffer.c (_gst_buffer_initialize): Ref the buffer type
class once in init, like gstmessage. Didn't run into this issue
but it seems correct. Don't initialize a trace, gstminiobject does
that.
* check/pipelines/simple_launch_lines.c (test_stop_from_app): New
test, runs fakesrc ! fakesink, stopping on ::handoff via a message
to the bus.
(assert_live_count): New util function, uses alloc traces to check
cleanup.
* check/gst/gstghostpad.c (test_ghost_pads): More refcount checks.
To be modified when unlink drops the internal pad.
2005-06-27 18:35:05 +00:00
|
|
|
return TRUE;
|
2002-12-27 22:57:13 +00:00
|
|
|
}
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
/* is called with STATE_LOCK */
|
2001-12-04 22:12:50 +00:00
|
|
|
static GstElementStateReturn
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_change_state (GstElement * element)
|
2001-12-04 22:12:50 +00:00
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
GstElementState old_state;
|
|
|
|
gint old_pending, old_transition;
|
|
|
|
GstElementStateReturn result = GST_STATE_SUCCESS;
|
2001-12-04 22:12:50 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
|
|
|
|
|
|
|
|
old_state = GST_STATE (element);
|
2002-01-20 16:04:16 +00:00
|
|
|
old_pending = GST_STATE_PENDING (element);
|
|
|
|
old_transition = GST_STATE_TRANSITION (element);
|
2001-12-04 22:12:50 +00:00
|
|
|
|
2004-07-09 11:20:59 +00:00
|
|
|
/* if the element already is in the given state, we just return success */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (old_pending == GST_STATE_VOID_PENDING ||
|
2002-08-30 14:02:15 +00:00
|
|
|
old_state == GST_STATE_PENDING (element)) {
|
2004-02-20 13:18:32 +00:00
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element,
|
2004-03-15 19:27:17 +00:00
|
|
|
"element is already in the %s state",
|
|
|
|
gst_element_state_get_name (old_state));
|
2005-06-23 17:11:49 +00:00
|
|
|
if (GST_STATE_NO_PREROLL (element))
|
|
|
|
return GST_STATE_NO_PREROLL;
|
|
|
|
else
|
|
|
|
return GST_STATE_SUCCESS;
|
2001-12-04 22:12:50 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2004-02-20 13:18:32 +00:00
|
|
|
GST_CAT_LOG_OBJECT (GST_CAT_STATES, element,
|
2004-07-12 10:03:04 +00:00
|
|
|
"default handler tries setting state from %s to %s (%04x)",
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_state_get_name (old_state),
|
|
|
|
gst_element_state_get_name (old_pending), old_transition);
|
2001-12-04 22:12:50 +00:00
|
|
|
|
2002-07-24 21:06:17 +00:00
|
|
|
switch (old_transition) {
|
2005-03-21 17:34:02 +00:00
|
|
|
case GST_STATE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_PAUSED:
|
|
|
|
if (!gst_element_pads_activate (element, TRUE)) {
|
|
|
|
result = GST_STATE_FAILURE;
|
gst/gstclock.*: deprecate old interface and disable functions that aren't in use anymore.
Original commit message from CVS:
2004-01-13 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_init),
(gst_clock_set_speed), (gst_clock_set_active),
(gst_clock_is_active), (gst_clock_reset),
(gst_clock_handle_discont):
* gst/gstclock.h:
deprecate old interface and disable functions that aren't in use
anymore.
* gst/gstelement.h:
* gst/gstelement.c: (gst_element_get_time), (gst_element_wait),
(gst_element_set_time), (gst_element_adjust_time):
add concept of "element time" and functions to get/set this time.
* gst/gstelement.c: (gst_element_change_state):
update element time correctly.
* gst/gstelement.c: (gst_element_get_compatible_pad_filtered):
This is a debug message, not a g_critical.
* gst/gstpad.c: (gst_pad_event_default):
handle discontinuous events right with element time.
* gst/gstscheduler.c: (gst_scheduler_state_transition):
update to clocking fixes.
set clocks on elements in READY=>PAUSED. The old behaviour caused
a wrong element time on the first element that started playing.
* gst/schedulers/gstbasicscheduler.c:
(gst_basic_scheduler_class_init):
* gst/schedulers/gstoptimalscheduler.c:
(gst_opt_scheduler_class_init):
remove code that just implements the default behaviour.
* gst/elements/gstfakesink.c: (gst_fakesink_chain):
update to use new clocking functions
* testsuite/clock/clock1.c: (gst_clock_debug), (main):
* testsuite/clock/clock2.c: (gst_clock_debug), (main):
update to test new element time.
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps):
use _get_allowed_caps instead of _get_caps. This catches filtered
caps correctly.
* testsuite/debug/commandline.c:
update for new GST_DEBUG syntax.
* testsuite/threads/Makefile.am:
disable a test that only works sometimes.
2004-01-14 00:46:48 +00:00
|
|
|
}
|
2002-12-27 22:57:13 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
2005-03-21 17:34:02 +00:00
|
|
|
case GST_STATE_PLAYING_TO_PAUSED:
|
2002-07-24 21:06:17 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
2005-05-27 09:27:35 +00:00
|
|
|
case GST_STATE_READY_TO_NULL:
|
|
|
|
/* deactivate pads in both cases, since they are activated on
|
|
|
|
ready->paused but the element might not have made it to paused */
|
2005-03-21 17:34:02 +00:00
|
|
|
if (!gst_element_pads_activate (element, FALSE)) {
|
|
|
|
result = GST_STATE_FAILURE;
|
|
|
|
} else {
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
GST_LOCK (element);
|
2005-03-21 17:34:02 +00:00
|
|
|
element->base_time = 0;
|
gst/base/gstbasesink.*: Store and use discont values when syncing buffers as described in design docs.
Original commit message from CVS:
* gst/base/gstbasesink.c: (gst_base_sink_handle_object),
(gst_base_sink_event), (gst_base_sink_get_times),
(gst_base_sink_do_sync), (gst_base_sink_change_state):
* gst/base/gstbasesink.h:
Store and use discont values when syncing buffers as described
in design docs.
* gst/base/gstbasesrc.c: (gst_base_src_send_discont),
(gst_base_src_do_seek), (gst_base_src_loop), (gst_base_src_start),
(gst_base_src_activate_push):
Push discont event when starting.
* gst/elements/gstidentity.c: (gst_identity_transform):
Small cleanups.
* gst/gstbin.c: (gst_bin_change_state):
Small cleanups in base_time distribution.
* gst/gstelement.c: (gst_element_set_base_time),
(gst_element_get_base_time), (gst_element_change_state):
* gst/gstelement.h:
Added methods for the base_time of the element.
Some MT fixes.
* gst/gstpipeline.c: (gst_pipeline_send_event),
(gst_pipeline_change_state), (gst_pipeline_set_new_stream_time),
(gst_pipeline_get_last_stream_time):
* gst/gstpipeline.h:
MT fixes.
Handle seeking as described in design doc, remove stream_time
hack.
Cleanups clock and stream_time selection code. Added accessors
for the stream_time.
2005-07-16 14:41:25 +00:00
|
|
|
GST_UNLOCK (element);
|
2005-03-21 17:34:02 +00:00
|
|
|
}
|
2002-07-24 21:06:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-07-09 11:20:59 +00:00
|
|
|
/* this will catch real but unhandled state changes;
|
|
|
|
* can only be caused by:
|
|
|
|
* - a new state was added
|
|
|
|
* - somehow the element was asked to jump across an intermediate state
|
|
|
|
*/
|
2004-09-06 18:47:14 +00:00
|
|
|
g_warning ("Unhandled state change from %s to %s",
|
|
|
|
gst_element_state_get_name (old_state),
|
|
|
|
gst_element_state_get_name (old_pending));
|
2002-07-24 21:06:17 +00:00
|
|
|
break;
|
2002-01-20 11:55:35 +00:00
|
|
|
}
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
return result;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2003-11-02 16:46:12 +00:00
|
|
|
/**
|
|
|
|
* gst_element_get_factory:
|
|
|
|
* @element: a #GstElement to request the element factory of.
|
|
|
|
*
|
|
|
|
* Retrieves the factory that was used to create this element.
|
|
|
|
*
|
|
|
|
* Returns: the #GstElementFactory used for creating this element.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
GstElementFactory *
|
|
|
|
gst_element_get_factory (GstElement * element)
|
2003-11-02 16:46:12 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-11-02 16:46:12 +00:00
|
|
|
return GST_ELEMENT_GET_CLASS (element)->elementfactory;
|
|
|
|
}
|
|
|
|
|
2001-05-25 21:00:07 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_dispose (GObject * object)
|
2001-05-25 21:00:07 +00:00
|
|
|
{
|
|
|
|
GstElement *element = GST_ELEMENT (object);
|
2003-01-09 14:15:37 +00:00
|
|
|
|
2003-10-28 20:25:30 +00:00
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "dispose");
|
2001-05-25 21:00:07 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
/* ref so we don't hit 0 again */
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_ref (object);
|
2002-02-17 19:58:29 +00:00
|
|
|
|
2005-07-08 16:41:45 +00:00
|
|
|
/* first we break all our links with the outside */
|
2004-04-17 03:26:46 +00:00
|
|
|
while (element->pads) {
|
check/gst/gstghostpad.c: Added some more tests for wrong hierarchy
Original commit message from CVS:
* check/gst/gstghostpad.c: (GST_START_TEST), (gst_ghost_pad_suite):
Added some more tests for wrong hierarchy
* docs/design/part-overview.txt:
Some updates.
* gst/gstbin.c: (gst_bin_remove_func), (gst_bin_dispose):
Cleanups.
* gst/gstelement.c: (gst_element_remove_pad), (gst_element_seek),
(gst_element_dispose):
Some more cleanups.
* gst/gstpad.c: (gst_pad_link_check_compatible_unlocked),
(gst_pad_link_check_hierarchy), (gst_pad_link_prepare),
(gst_pad_get_caps_unlocked), (gst_pad_accept_caps),
(gst_pad_set_caps), (gst_pad_send_event):
Check for correct hierarchy when linking pads. Moving to
strict requirement for ghostpads when linking elements in
different bins.
* gst/gstpad.h:
Clean ups. Added WRONG_HIERARCHY return value.
2005-07-28 11:24:33 +00:00
|
|
|
gst_element_remove_pad (element, GST_PAD_CAST (element->pads->data));
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
2005-03-09 16:10:59 +00:00
|
|
|
if (G_UNLIKELY (element->pads != 0)) {
|
|
|
|
g_critical ("could not remove pads from element %s",
|
|
|
|
GST_STR_NULL (GST_OBJECT_NAME (object)));
|
|
|
|
}
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
GST_LOCK (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_object_replace ((GstObject **) & element->clock, NULL);
|
2005-03-09 16:10:59 +00:00
|
|
|
GST_UNLOCK (element);
|
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "dispose parent");
|
2003-01-17 18:50:07 +00:00
|
|
|
|
2001-09-28 19:16:02 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2005-03-07 18:27:42 +00:00
|
|
|
static void
|
|
|
|
gst_element_finalize (GObject * object)
|
|
|
|
{
|
2005-03-08 17:42:29 +00:00
|
|
|
GstElement *element = GST_ELEMENT (object);
|
|
|
|
|
2005-03-09 16:10:59 +00:00
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize");
|
|
|
|
|
|
|
|
GST_STATE_LOCK (element);
|
|
|
|
if (element->state_cond)
|
|
|
|
g_cond_free (element->state_cond);
|
|
|
|
element->state_cond = NULL;
|
|
|
|
GST_STATE_UNLOCK (element);
|
2005-03-08 17:42:29 +00:00
|
|
|
g_mutex_free (element->state_lock);
|
2005-03-09 16:10:59 +00:00
|
|
|
|
|
|
|
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize parent");
|
2005-03-07 18:27:42 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2001-06-25 06:45:56 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2000-03-27 19:53:43 +00:00
|
|
|
/**
|
|
|
|
* gst_element_save_thyself:
|
2002-08-30 14:02:15 +00:00
|
|
|
* @element: a #GstElement to save.
|
|
|
|
* @parent: the xml parent node.
|
2000-03-27 19:53:43 +00:00
|
|
|
*
|
2002-08-30 14:02:15 +00:00
|
|
|
* Saves the element as part of the given XML structure.
|
2000-03-27 19:53:43 +00:00
|
|
|
*
|
2002-08-30 14:02:15 +00:00
|
|
|
* Returns: the new #xmlNodePtr.
|
2000-03-27 19:53:43 +00:00
|
|
|
*/
|
2001-01-29 00:06:02 +00:00
|
|
|
static xmlNodePtr
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_save_thyself (GstObject * object, xmlNodePtr parent)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2000-01-30 09:03:00 +00:00
|
|
|
GList *pads;
|
|
|
|
GstElementClass *oclass;
|
2002-01-11 15:49:47 +00:00
|
|
|
GParamSpec **specs, *spec;
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
guint nspecs;
|
|
|
|
gint i;
|
2002-02-06 19:05:19 +00:00
|
|
|
GValue value = { 0, };
|
2001-01-29 00:06:02 +00:00
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (object), parent);
|
|
|
|
|
|
|
|
element = GST_ELEMENT (object);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
2000-01-30 09:03:00 +00:00
|
|
|
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
xmlNewChild (parent, NULL, (xmlChar *) "name",
|
|
|
|
(xmlChar *) GST_ELEMENT_NAME (element));
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2003-11-02 16:46:12 +00:00
|
|
|
if (oclass->elementfactory != NULL) {
|
2004-03-13 15:27:01 +00:00
|
|
|
GstElementFactory *factory = (GstElementFactory *) oclass->elementfactory;
|
2003-11-02 16:46:12 +00:00
|
|
|
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
xmlNewChild (parent, NULL, (xmlChar *) "type",
|
|
|
|
(xmlChar *) GST_PLUGIN_FEATURE (factory)->name);
|
2003-11-02 16:46:12 +00:00
|
|
|
}
|
|
|
|
|
2005-08-24 13:04:31 +00:00
|
|
|
/* FIXME: what is this? */
|
|
|
|
/* if (element->manager) */
|
|
|
|
/* xmlNewChild(parent, NULL, "manager", GST_ELEMENT_NAME(element->manager)); */
|
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
/* params */
|
|
|
|
specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &nspecs);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
for (i = 0; i < nspecs; i++) {
|
2002-01-11 15:49:47 +00:00
|
|
|
spec = specs[i];
|
|
|
|
if (spec->flags & G_PARAM_READABLE) {
|
|
|
|
xmlNodePtr param;
|
2002-09-08 18:27:36 +00:00
|
|
|
char *contents;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (spec));
|
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
g_object_get_property (G_OBJECT (element), spec->name, &value);
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
param = xmlNewChild (parent, NULL, (xmlChar *) "param", NULL);
|
|
|
|
xmlNewChild (param, NULL, (xmlChar *) "name", (xmlChar *) spec->name);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
if (G_IS_PARAM_SPEC_STRING (spec))
|
2004-03-15 19:27:17 +00:00
|
|
|
contents = g_value_dup_string (&value);
|
2002-01-11 15:49:47 +00:00
|
|
|
else if (G_IS_PARAM_SPEC_ENUM (spec))
|
2004-03-15 19:27:17 +00:00
|
|
|
contents = g_strdup_printf ("%d", g_value_get_enum (&value));
|
2002-02-06 19:05:19 +00:00
|
|
|
else if (G_IS_PARAM_SPEC_INT64 (spec))
|
2004-03-15 19:27:17 +00:00
|
|
|
contents = g_strdup_printf ("%" G_GINT64_FORMAT,
|
|
|
|
g_value_get_int64 (&value));
|
2002-01-11 15:49:47 +00:00
|
|
|
else
|
2004-03-15 19:27:17 +00:00
|
|
|
contents = g_strdup_value_contents (&value);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
xmlNewChild (param, NULL, (xmlChar *) "value", (xmlChar *) contents);
|
2002-09-08 18:27:36 +00:00
|
|
|
g_free (contents);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
g_value_unset (&value);
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-24 13:04:31 +00:00
|
|
|
g_free (specs);
|
|
|
|
|
2001-03-07 21:52:56 +00:00
|
|
|
pads = GST_ELEMENT_PADS (element);
|
|
|
|
|
2000-12-28 00:18:26 +00:00
|
|
|
while (pads) {
|
2001-01-29 00:06:02 +00:00
|
|
|
GstPad *pad = GST_PAD (pads->data);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-12-14 22:59:21 +00:00
|
|
|
/* figure out if it's a direct pad or a ghostpad */
|
2001-03-07 21:52:56 +00:00
|
|
|
if (GST_ELEMENT (GST_OBJECT_PARENT (pad)) == element) {
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
xmlNodePtr padtag = xmlNewChild (parent, NULL, (xmlChar *) "pad", NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
gst_object_save_thyself (GST_OBJECT (pad), padtag);
|
2001-03-07 21:52:56 +00:00
|
|
|
}
|
2000-12-28 00:18:26 +00:00
|
|
|
pads = g_list_next (pads);
|
|
|
|
}
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
return parent;
|
2000-01-30 09:03:00 +00:00
|
|
|
}
|
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_element_restore_thyself (GstObject * object, xmlNodePtr self)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2002-01-11 15:49:47 +00:00
|
|
|
xmlNodePtr children;
|
2000-09-27 19:33:10 +00:00
|
|
|
GstElement *element;
|
2002-08-12 16:59:39 +00:00
|
|
|
gchar *name = NULL;
|
|
|
|
gchar *value = NULL;
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
element = GST_ELEMENT (object);
|
|
|
|
g_return_if_fail (element != NULL);
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
/* parameters */
|
2001-01-29 00:06:02 +00:00
|
|
|
children = self->xmlChildrenNode;
|
2000-09-27 19:33:10 +00:00
|
|
|
while (children) {
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
if (!strcmp ((char *) children->name, "param")) {
|
2001-01-18 11:16:53 +00:00
|
|
|
xmlNodePtr child = children->xmlChildrenNode;
|
2000-09-27 19:33:10 +00:00
|
|
|
|
|
|
|
while (child) {
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
if (!strcmp ((char *) child->name, "name")) {
|
|
|
|
name = (gchar *) xmlNodeGetContent (child);
|
|
|
|
} else if (!strcmp ((char *) child->name, "value")) {
|
|
|
|
value = (gchar *) xmlNodeGetContent (child);
|
2004-03-15 19:27:17 +00:00
|
|
|
}
|
|
|
|
child = child->next;
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
2002-01-11 15:49:47 +00:00
|
|
|
/* FIXME: can this just be g_object_set ? */
|
2002-08-30 14:02:15 +00:00
|
|
|
gst_util_set_object_arg (G_OBJECT (element), name, value);
|
2003-09-11 12:19:22 +00:00
|
|
|
/* g_object_set (G_OBJECT (element), name, value, NULL); */
|
2004-08-17 09:16:42 +00:00
|
|
|
g_free (name);
|
|
|
|
g_free (value);
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
2000-12-28 00:18:26 +00:00
|
|
|
children = children->next;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
/* pads */
|
2001-01-29 00:06:02 +00:00
|
|
|
children = self->xmlChildrenNode;
|
2000-12-28 00:18:26 +00:00
|
|
|
while (children) {
|
GCC 4 fixen.
Original commit message from CVS:
2005-05-04 Andy Wingo <wingo@pobox.com>
* check/Makefile.am:
* docs/gst/tmpl/gstatomic.sgml:
* docs/gst/tmpl/gstplugin.sgml:
* gst/base/gstbasesink.c: (gst_basesink_activate):
* gst/base/gstbasesrc.c: (gst_basesrc_class_init),
(gst_basesrc_init), (gst_basesrc_set_dataflow_funcs),
(gst_basesrc_query), (gst_basesrc_set_property),
(gst_basesrc_get_property), (gst_basesrc_check_get_range),
(gst_basesrc_activate):
* gst/base/gstbasesrc.h:
* gst/base/gstbasetransform.c: (gst_base_transform_sink_activate),
(gst_base_transform_src_activate):
* gst/elements/gstelements.c:
* gst/elements/gstfakesrc.c: (gst_fakesrc_class_init),
(gst_fakesrc_set_property), (gst_fakesrc_get_property):
* gst/elements/gsttee.c: (gst_tee_sink_activate):
* gst/elements/gsttypefindelement.c: (find_element_get_length),
(gst_type_find_element_checkgetrange),
(gst_type_find_element_activate):
* gst/gstbin.c: (gst_bin_save_thyself), (gst_bin_restore_thyself):
* gst/gstcaps.c: (gst_caps_do_simplify), (gst_caps_save_thyself),
(gst_caps_load_thyself):
* gst/gstelement.c: (gst_element_pads_activate),
(gst_element_save_thyself), (gst_element_restore_thyself):
* gst/gstpad.c: (gst_pad_load_and_link), (gst_pad_save_thyself),
(gst_ghost_pad_save_thyself), (gst_pad_check_pull_range):
* gst/gstpad.h:
* gst/gstxml.c: (gst_xml_write), (gst_xml_parse_doc),
(gst_xml_parse_file), (gst_xml_parse_memory),
(gst_xml_get_element), (gst_xml_make_element):
* gst/indexers/gstfileindex.c: (gst_file_index_load),
(_file_index_id_save_xml), (gst_file_index_commit):
* gst/registries/gstlibxmlregistry.c: (read_string), (read_uint),
(read_enum), (load_pad_template), (load_feature), (load_plugin),
(load_paths):
* libs/gst/dataprotocol/dataprotocol.c: (gst_dp_packet_from_caps),
(gst_dp_packet_from_event), (gst_dp_caps_from_packet):
* tools/gst-complete.c: (main):
* tools/gst-compprep.c: (main):
* tools/gst-inspect.c: (print_element_properties_info):
* tools/gst-launch.c: (xmllaunch_parse_cmdline):
* tools/gst-xmlinspect.c: (print_element_properties):
GCC 4 fixen.
2005-05-04 21:29:44 +00:00
|
|
|
if (!strcmp ((char *) children->name, "pad")) {
|
2003-01-09 14:15:37 +00:00
|
|
|
gst_pad_load_and_link (children, GST_OBJECT (element));
|
2000-12-28 00:18:26 +00:00
|
|
|
}
|
2000-09-27 19:33:10 +00:00
|
|
|
children = children->next;
|
|
|
|
}
|
|
|
|
|
2002-12-19 21:31:03 +00:00
|
|
|
if (GST_OBJECT_CLASS (parent_class)->restore_thyself)
|
|
|
|
(GST_OBJECT_CLASS (parent_class)->restore_thyself) (object, self);
|
2000-09-27 19:33:10 +00:00
|
|
|
}
|
2001-10-17 10:21:27 +00:00
|
|
|
#endif /* GST_DISABLE_LOADSAVE */
|
2000-09-27 19:33:10 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
static void
|
|
|
|
gst_element_set_bus_func (GstElement * element, GstBus * bus)
|
2001-12-22 23:19:17 +00:00
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
|
|
|
GST_CAT_DEBUG_OBJECT (GST_CAT_PARENTAGE, element, "setting bus to %p", bus);
|
|
|
|
|
|
|
|
GST_LOCK (element);
|
|
|
|
gst_object_replace ((GstObject **) & GST_ELEMENT_BUS (element),
|
|
|
|
GST_OBJECT (bus));
|
|
|
|
GST_UNLOCK (element);
|
|
|
|
}
|
|
|
|
|
2000-02-02 06:26:44 +00:00
|
|
|
/**
|
2005-03-21 17:34:02 +00:00
|
|
|
* gst_element_set_bus:
|
|
|
|
* @element: a #GstElement to set the bus of.
|
|
|
|
* @bus: the #GstBus to set.
|
2000-02-02 06:26:44 +00:00
|
|
|
*
|
2005-03-21 17:34:02 +00:00
|
|
|
* Sets the bus of the element. For internal use only, unless you're
|
|
|
|
* testing elements.
|
2000-11-23 21:49:09 +00:00
|
|
|
*
|
2005-03-21 17:34:02 +00:00
|
|
|
* MT safe.
|
2000-02-02 06:26:44 +00:00
|
|
|
*/
|
2001-01-20 03:10:44 +00:00
|
|
|
void
|
2005-03-21 17:34:02 +00:00
|
|
|
gst_element_set_bus (GstElement * element, GstBus * bus)
|
2000-11-11 15:13:50 +00:00
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
GstElementClass *oclass;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2001-12-28 20:20:26 +00:00
|
|
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
oclass = GST_ELEMENT_GET_CLASS (element);
|
2002-12-15 12:18:04 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
if (oclass->set_bus)
|
|
|
|
oclass->set_bus (element, bus);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
/**
|
2005-03-21 17:34:02 +00:00
|
|
|
* gst_element_get_bus:
|
|
|
|
* @element: a #GstElement to get the bus of.
|
|
|
|
*
|
|
|
|
* Returns the bus of the element.
|
|
|
|
*
|
2005-06-28 19:45:26 +00:00
|
|
|
* Returns: the element's #GstBus. unref after usage.
|
2005-03-21 17:34:02 +00:00
|
|
|
*
|
|
|
|
* MT safe.
|
2003-11-24 02:09:23 +00:00
|
|
|
*/
|
2005-03-21 17:34:02 +00:00
|
|
|
GstBus *
|
|
|
|
gst_element_get_bus (GstElement * element)
|
2003-04-18 23:31:18 +00:00
|
|
|
{
|
2005-03-21 17:34:02 +00:00
|
|
|
GstBus *result = NULL;
|
2003-04-18 23:31:18 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
g_return_val_if_fail (GST_IS_ELEMENT (element), result);
|
2003-04-18 23:31:18 +00:00
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
GST_LOCK (element);
|
|
|
|
result = GST_ELEMENT_BUS (element);
|
2005-06-28 19:45:26 +00:00
|
|
|
gst_object_ref (result);
|
2005-03-21 17:34:02 +00:00
|
|
|
GST_UNLOCK (element);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-07-10 00:07:51 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "got bus %" GST_PTR_FORMAT, result);
|
|
|
|
|
2005-03-21 17:34:02 +00:00
|
|
|
return result;
|
2003-04-18 23:31:18 +00:00
|
|
|
}
|