From c10560ebec9566d883d7278281621cf0301d67ea Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 8 Mar 2005 14:27:43 +0000 Subject: [PATCH] Backporting some HEAD changes, mostly docs and stuff. Original commit message from CVS: Backporting some HEAD changes, mostly docs and stuff. --- ChangeLog | 59 ++++++++++ MAINTAINERS | 9 +- README | 2 +- autogen.sh | 2 +- configure.ac | 22 ++-- gst/gst.c | 3 +- gst/gst_private.h | 4 + gst/gstbin.c | 6 +- gst/gstbin.h | 22 +++- gst/gstbuffer.c | 1 + gst/gstbuffer.h | 9 +- gst/gstcaps.c | 13 +- gst/gstcaps.h | 8 ++ gst/gstclock.h | 3 +- gst/gstdata.h | 2 +- gst/gstelement.c | 5 +- gst/gstelementfactory.c | 10 +- gst/gsterror.c | 50 ++++---- gst/gsterror.h | 2 +- gst/gstinfo.c | 34 +++++- gst/gstinfo.h | 6 +- gst/gstmessage.h | 8 +- gst/gstpad.c | 2 + gst/gstplugin.c | 20 +++- gst/gstplugin.h | 1 + gst/gstpluginfeature.c | 17 ++- gst/gstprobe.c | 40 ++++++- gst/gstprobe.h | 7 +- gst/gstregistry.h | 9 ++ gst/gsttag.h | 170 +++++++++++++++++++++++++++ gst/gsttaglist.h | 170 +++++++++++++++++++++++++++ gst/gsttypes.h | 37 +++--- gst/gstutils.c | 60 ---------- gst/gstvalue.c | 67 +++++++++-- gst/gstvalue.h | 1 + gst/gstversion.h.in | 4 + libs/gst/dataprotocol/dataprotocol.c | 2 +- tools/gst-inspect.c | 1 - 38 files changed, 709 insertions(+), 179 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca45b3fb0c..09db5d36bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,62 @@ +2005-03-08 Wim Taymans + + * MAINTAINERS: + * README: + * autogen.sh: + * configure.ac: + * gst/gst.c: (gst_init_get_popt_table), (init_post): + * gst/gst_private.h: + * gst/gstbin.c: (gst_bin_remove_func), (gst_bin_iterate_sinks), + (gst_bin_get_by_name), (gst_bin_get_by_interface), + (gst_bin_iterate_all_by_interface): + * gst/gstbin.h: + * gst/gstbuffer.c: + * gst/gstbuffer.h: + * gst/gstcaps.c: (gst_static_caps_get), (gst_caps_append), + (gst_caps_copy_nth), (gst_caps_intersect): + * gst/gstcaps.h: + * gst/gstclock.h: + * gst/gstdata.h: + * gst/gstelement.c: (gst_element_release_request_pad), + (gst_element_message_full), (gst_element_get_state_func), + (gst_element_lost_state): + * gst/gstelementfactory.c: (gst_element_factory_create): + * gst/gsterror.c: (_gst_resource_errors_init), + (_gst_stream_errors_init), (gst_error_get_message): + * gst/gsterror.h: + * gst/gstinfo.c: (_gst_debug_init), (gst_debug_log_default), + (gst_debug_remove_log_function), + (gst_debug_remove_log_function_by_data): + * gst/gstinfo.h: + * gst/gstmessage.h: + * 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/gstpad.c: (gst_real_pad_init): + * gst/gstplugin.c: (gst_plugin_get_version): + * gst/gstplugin.h: + * gst/gstpluginfeature.c: (gst_plugin_feature_ensure_loaded): + * gst/gstprobe.c: (_gst_probe_copy), (gst_probe_get_type), + (gst_probe_new), (gst_probe_perform), + (gst_probe_dispatcher_add_probe), + (gst_probe_dispatcher_remove_probe), + (gst_probe_dispatcher_dispatch): + * gst/gstprobe.h: + * gst/gstregistry.h: + * gst/gststructure.c: (gst_structure_copy_conditional): + * gst/gsttag.h: + * gst/gsttypes.h: + * gst/gstutils.c: + * gst/gstvalue.c: (gst_string_wrap), + (gst_value_deserialize_string): + * gst/gstvalue.h: + * gst/gstversion.h.in: + * libs/gst/dataprotocol/dataprotocol.c: (gst_dp_dump_byte_array): + * tools/gst-inspect.c: (print_children_info): + Backporting some HEAD changes, mostly docs and stuff. + 2005-03-07 Andy Wingo * check/gst/gstobject.c (test_fake_object_name): The object *does* diff --git a/MAINTAINERS b/MAINTAINERS index 325bd24de4..99d3500fe1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1,10 +1,11 @@ GStreamer is currently maintained by the consensus of a number of people, including, but not limited to: - David Schleef - Benjamin Otte - Ronald Bultje - Thomas Vander Stichele + Wim Taymans + David Schleef + Benjamin Otte + Ronald Bultje + Thomas Vander Stichele Maintainer-related issues should be addressed to: diff --git a/README b/README index 68cb8ded6c..1dbcd0bd47 100644 --- a/README +++ b/README @@ -67,6 +67,6 @@ some build scripts like that. When you have done this once, you can use autoregen.sh to re-autogen with the last passed options as a handy shortcut. Use it. - After the autogen.sh stage, you can follow the directions listed in "COMPILING FROM SOURCE" + diff --git a/autogen.sh b/autogen.sh index bb84be30f3..adbaa7e250 100755 --- a/autogen.sh +++ b/autogen.sh @@ -67,7 +67,7 @@ if test -f po/Makefile.in.in; then patch -p0 -R < common/gettext.patch fi -tool_run "$autopoint --force" +tool_run "$autopoint" "--force" "patch -p0 < common/gettext.patch" patch -p0 < common/gettext.patch # aclocal diff --git a/configure.ac b/configure.ac index 057b5051a2..77b893b2f2 100644 --- a/configure.ac +++ b/configure.ac @@ -324,15 +324,6 @@ dnl ###################################################################### dnl FIXME: simplify all this down using a few m4 macros -AC_ARG_ENABLE(libmmx, -AC_HELP_STRING([--enable-libmmx],[use libmmx, if available]), -[case "${enableval}" in - yes) USE_LIBMMX=$HAVE_LIBMMX ;; - no) USE_LIBMMX=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-libmmx) ;; -esac], -[USE_LIBMMX=$HAVE_LIBMMX]) dnl Default value - AC_ARG_ENABLE(fast-stack-trash, AC_HELP_STRING([--enable-fast-stack-trash],[use fast memory allocator (i586 or above)]), [case "${enableval}" in @@ -443,7 +434,14 @@ esac], [USE_DEBUG=yes]) dnl Default value dnl valgrind inclusion -USE_VALGRIND="$USE_DEBUG" +AC_ARG_ENABLE(valgrind, +AC_HELP_STRING([--disable-valgrind],[disable run-time valgrind detection]), +[case "${enableval}" in + yes) USE_VALGRIND="$USE_DEBUG" ;; + no) USE_VALGRIND=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;; +esac], +[USE_VALGRIND="$USE_DEBUG"]) dnl Default value VALGRIND_REQ="2.1" if test "x$USE_VALGRIND" = xyes; then @@ -463,10 +461,6 @@ dnl ################################################ dnl These should be "USE_*" instead of "HAVE_*", but some packages expect dnl HAVE_ and it is likely to be easier to stick with the old name -if test "x$USE_LIBMMX" = xyes; then - AC_DEFINE(HAVE_LIBMMX, 1, [Define if libmmx is available]) -fi - if test "x$USE_FAST_STACK_TRASH" = xyes; then AC_DEFINE(USE_FAST_STACK_TRASH, 1, [Define if we should use i586 optimized stack functions]) fi diff --git a/gst/gst.c b/gst/gst.c index 3aa7085cb5..53b1c27aa5 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -189,7 +189,7 @@ gst_init_get_popt_table (void) {"gst-plugin-load", NUL, POPT_ARG_STRING | POPT_ARGFLAG_STRIP, NULL, ARG_PLUGIN_LOAD, N_("Comma-separated list of plugins to preload in addition to the " - "list stored in envronment variable GST_PLUGIN_PATH"), + "list stored in environment variable GST_PLUGIN_PATH"), N_("PLUGINS")}, {"gst-disable-segtrap", NUL, POPT_ARG_NONE | POPT_ARGFLAG_STRIP, NULL, ARG_SEGTRAP_DISABLE, @@ -584,6 +584,7 @@ init_post (void) _gst_format_initialize (); _gst_query_type_initialize (); gst_object_get_type (); + gst_probe_get_type (); gst_pad_get_type (); gst_real_pad_get_type (); gst_ghost_pad_get_type (); diff --git a/gst/gst_private.h b/gst/gst_private.h index 7b97df96d5..03fee6a2d2 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -78,6 +78,8 @@ extern GstDebugCategory *GST_CAT_EVENT; extern GstDebugCategory *GST_CAT_MESSAGE; extern GstDebugCategory *GST_CAT_PARAMS; extern GstDebugCategory *GST_CAT_CALL_TRACE; +extern GstDebugCategory *GST_CAT_SIGNAL; +extern GstDebugCategory *GST_CAT_PROBE; #else @@ -109,6 +111,8 @@ extern GstDebugCategory *GST_CAT_CALL_TRACE; #define GST_CAT_MESSAGE NULL #define GST_CAT_PARAMS NULL #define GST_CAT_CALL_TRACE NULL +#define GST_CAT_SIGNAL NULL +#define GST_CAT_PROBE NULL #endif diff --git a/gst/gstbin.c b/gst/gstbin.c index 1cfc3d6a4e..afd0311282 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -466,6 +466,7 @@ gst_bin_remove_func (GstBin * bin, GstElement * element) gst_object_unparent (GST_OBJECT (element)); g_signal_emit (G_OBJECT (bin), gst_bin_signals[ELEMENT_REMOVED], 0, element); + /* element is really out of our control now */ gst_object_unref (GST_OBJECT (element)); return TRUE; @@ -717,6 +718,7 @@ gst_bin_iterate_sinks (GstBin * bin) children = gst_bin_iterate_elements (bin); result = gst_iterator_filter (children, (GCompareFunc) bin_element_is_sink, bin); + gst_iterator_free (children); return result; } @@ -1051,6 +1053,7 @@ gst_bin_get_by_name (GstBin * bin, const gchar * name) children = gst_bin_iterate_recurse (bin); result = gst_iterator_find_custom (children, (GCompareFunc) compare_name, (gpointer) name); + gst_iterator_free (children); return GST_ELEMENT_CAST (result); } @@ -1092,7 +1095,6 @@ gst_bin_get_by_name_recurse_up (GstBin * bin, const gchar * name) return result; } - static gint compare_interface (GstElement * element, gpointer interface) { @@ -1136,6 +1138,7 @@ gst_bin_get_by_interface (GstBin * bin, GType interface) children = gst_bin_iterate_recurse (bin); result = gst_iterator_find_custom (children, (GCompareFunc) compare_interface, GINT_TO_POINTER (interface)); + gst_iterator_free (children); return GST_ELEMENT_CAST (result); } @@ -1164,6 +1167,7 @@ gst_bin_iterate_all_by_interface (GstBin * bin, GType interface) children = gst_bin_iterate_recurse (bin); result = gst_iterator_filter (children, (GCompareFunc) compare_interface, GINT_TO_POINTER (interface)); + gst_iterator_free (children); return result; } diff --git a/gst/gstbin.h b/gst/gstbin.h index ded86d3e22..bb9d81e33e 100644 --- a/gst/gstbin.h +++ b/gst/gstbin.h @@ -39,8 +39,28 @@ GST_EXPORT GType _gst_bin_type; #define GST_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_BIN, GstBinClass)) #define GST_BIN_CAST(obj) ((GstBin*)(obj)) +/** + * GstBinFlags: + * @GST_BIN_FLAG_MANAGER: this bin is a manager of child elements, i.e. + * a pipeline or thread. + * @GST_BIN_SELF_SCHEDULABLE: the bin iterates itself. + * @GST_BIN_FLAG_PREFER_COTHREADS: we prefer to have cothreads when its + * an option, over chain-based. + * @GST_BIN_FLAG_FIXED_CLOCK: bin has one clock that cannot be changed. + * @GST_BIN_STATE_LOCKED: indicator that we are in a non-recursive + * state-change on the bin, or that kids should not change parent state. + * Both are internally used to prevent infinitely recursive loops of + * state changes. Since they are mutually exclusive and serve the same + * purpose, we use the same flag for them. + * @GST_BIN_FLAG_LAST: the last enum in the series of flags in a bin, + * derived classes can use this as first value in a list of flags. + * + * GstBinFlags are a set of flags specific to bins. Most are set/used + * internally. They can be checked using the GST_FLAG_IS_SET () macro, + * and (un)set using GST_FLAG_SET () and GST_FLAG_UNSET (). + */ typedef enum { - GST_BIN_FLAG_FIXED_CLOCK, + GST_BIN_FLAG_FIXED_CLOCK = GST_ELEMENT_FLAG_LAST, /* padding */ GST_BIN_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 5 diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 2a5fbd4279..af4c87ed1f 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -114,6 +114,7 @@ gst_buffer_default_free (GstBuffer * buffer) gst_buffer_free_chunk (buffer); } + /** * gst_buffer_default_copy: * @buffer: a #GstBuffer to make a copy of. diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h index 95d931dc3e..ed2f932d45 100644 --- a/gst/gstbuffer.h +++ b/gst/gstbuffer.h @@ -81,10 +81,11 @@ extern GType _gst_buffer_type; * @GST_BUFFER_ORIGINAL: buffer is not a copy of another buffer. * @GST_BUFFER_DONTFREE: do not try to free the data when this buffer is * unreferenced. - * @GST_BUFFER_PREROLL: The buffer is part of the preroll phase and should not - * be displayed. - * @GST_BUFFER_DISCONT: The buffer is the first after a discontinuity in the - * stream. + * @GST_BUFFER_KEY_UNIT: the buffer holds a key unit, a unit that can be + * decoded independently of other buffers. + * This flag has been deprecated, see #GST_BUFFER_DELTA_UNIT. + * @GST_BUFFER_DONTKEEP: the buffer should not be ref()ed, but copied instead + * before doing anything with it (for specially allocated hw buffers and such) * @GST_BUFFER_IN_CAPS: the buffer has been added as a field in a #GstCaps. * @GST_BUFFER_GAP: the buffer has been created to fill a gap in the stream. * @GST_BUFFER_DELTA_UNIT: this unit cannot be decoded independently. diff --git a/gst/gstcaps.c b/gst/gstcaps.c index be51493b7d..300003f53c 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -196,7 +196,7 @@ gst_caps_new_full_valist (GstStructure * structure, va_list var_args) /** * gst_caps_copy: - * @caps: the caps structure to copy + * @caps: the #GstCaps to copy * * Creates a new #GstCaps as a copy of the old @caps. The new caps will have a * refcount of 1, owned by the caller. The structures are copied as well. @@ -355,7 +355,6 @@ gst_static_caps_get (GstStaticCaps * static_caps) GstCaps *caps = (GstCaps *) static_caps; gboolean ret; - if (caps->type == 0) { caps->type = GST_TYPE_CAPS; /* initialize the caps to a refcount of 1 so the caps can be writable... */ @@ -407,7 +406,11 @@ gst_caps_append (GstCaps * caps1, GstCaps * caps2) g_return_if_fail (IS_WRITABLE (caps1)); g_return_if_fail (IS_WRITABLE (caps2)); +#ifdef USE_POISONING + CAPS_POISON (caps2); +#endif if (gst_caps_is_any (caps1) || gst_caps_is_any (caps2)) { + /* FIXME: this leaks */ caps1->flags |= GST_CAPS_FLAGS_ANY; for (i = caps2->structs->len - 1; i >= 0; i--) { structure = gst_caps_remove_and_get_structure (caps2, i); @@ -421,7 +424,6 @@ gst_caps_append (GstCaps * caps1, GstCaps * caps2) gst_caps_append_structure (caps1, structure); } } - gst_caps_unref (caps2); /* guaranteed to free it */ } @@ -474,11 +476,11 @@ gst_caps_remove_structure (GstCaps * caps, guint idx) /** * gst_caps_split_one: - * @caps: + * @caps: a #GstCaps * * This function is not implemented. * - * Returns: + * Returns: NULL */ GstCaps * gst_caps_split_one (GstCaps * caps) @@ -974,7 +976,6 @@ gst_caps_intersect (const GstCaps * caps1, const GstCaps * caps2) j--; } } - gst_caps_do_simplify (dest); return dest; } diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 0a75fbdeae..84eb9204d8 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -40,8 +40,10 @@ G_BEGIN_DECLS #define GST_CAPS_IS_SIMPLE(caps) (gst_caps_get_size(caps) == 1) #define gst_caps_is_simple(caps) GST_CAPS_IS_SIMPLE(caps) +#ifndef GST_DISABLE_DEPRECATED #define GST_DEBUG_CAPS(string, caps) \ GST_DEBUG ( string "%s: " GST_PTR_FORMAT, caps) +#endif #define GST_STATIC_CAPS(string) \ { \ @@ -146,6 +148,12 @@ void gst_caps_replace (GstCaps gchar * gst_caps_to_string (const GstCaps *caps); GstCaps * gst_caps_from_string (const gchar *string); +gboolean gst_caps_structure_fixate_field_nearest_int (GstStructure *structure, + const char *field_name, + int target); +gboolean gst_caps_structure_fixate_field_nearest_double (GstStructure *structure, + const char *field_name, + double target); G_END_DECLS diff --git a/gst/gstclock.h b/gst/gstclock.h index d8e46d86bd..41a6b001c0 100644 --- a/gst/gstclock.h +++ b/gst/gstclock.h @@ -166,7 +166,7 @@ struct _GstClockClass { GstClockReturn (*wait) (GstClock *clock, GstClockEntry *entry); GstClockReturn (*wait_async) (GstClock *clock, GstClockEntry *entry); void (*unschedule) (GstClock *clock, GstClockEntry *entry); - + /*< private >*/ gpointer _gst_reserved[GST_PADDING]; }; @@ -204,7 +204,6 @@ GstClockReturn gst_clock_id_wait_async (GstClockID id, gpointer user_data); void gst_clock_id_unschedule (GstClockID id); - G_END_DECLS #endif /* __GST_CLOCK_H__ */ diff --git a/gst/gstdata.h b/gst/gstdata.h index d75db8748c..9cd447b2b4 100644 --- a/gst/gstdata.h +++ b/gst/gstdata.h @@ -74,7 +74,7 @@ struct _GstData { GstAtomicInt refcount; guint16 flags; - + /*< protected >*/ /* utility function pointers, can override default */ GstDataFreeFunction free; /* free the data */ diff --git a/gst/gstelement.c b/gst/gstelement.c index 7a0af14254..5d2fcc2bd9 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -26,7 +26,6 @@ #include #include "gstelement.h" - #include "gstmarshal.h" #include "gsterror.h" #include "gstevent.h" @@ -243,6 +242,8 @@ gst_element_release_request_pad (GstElement * element, GstPad * pad) if (oclass->release_pad) (oclass->release_pad) (element, pad); + else + gst_element_remove_pad (element, pad); } /** @@ -1429,7 +1430,7 @@ void gst_element_message_full if ((text == NULL) || (text[0] == 0)) { /* text could have come from g_strdup_printf (""); */ g_free (text); - sent_text = gst_error_get_text (domain, code); + sent_text = gst_error_get_message (domain, code); } else sent_text = text; diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index a719a8124f..810026539e 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -27,7 +27,9 @@ #include "gstregistrypool.h" #include "gstinfo.h" #include "gsturi.h" +#ifndef GST_DISABLE_REGISTRY #include "registries/gstxmlregistry.h" /* g_critical in gst_element_factory_create */ +#endif GST_DEBUG_CATEGORY_STATIC (element_factory_debug); #define GST_CAT_DEFAULT element_factory_debug @@ -296,6 +298,7 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name) GST_INFO ("creating \"%s\"", GST_PLUGIN_FEATURE_NAME (factory)); if (factory->type == 0) { +#ifndef GST_DISABLE_REGISTRY GstPlugin *plugin = GST_PLUGIN_FEATURE (factory)->manager; g_critical @@ -304,6 +307,10 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name) gst_plugin_get_name (plugin), gst_plugin_get_filename (plugin), GST_IS_XML_REGISTRY (plugin->manager) ? GST_XML_REGISTRY (plugin-> manager)->location : "Unknown"); +#else + g_critical ("Factory for `%s' has no type", + GST_PLUGIN_FEATURE_NAME (factory)); +#endif return NULL; } @@ -317,7 +324,8 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name) g_type_class_unref (oclass); - gst_object_set_name (GST_OBJECT (element), name); + if (name) + gst_object_set_name (GST_OBJECT (element), name); return element; } diff --git a/gst/gsterror.c b/gst/gsterror.c index 829a2865dc..72364e6680 100644 --- a/gst/gsterror.c +++ b/gst/gsterror.c @@ -28,11 +28,10 @@ #define TABLE(t, d, a, b) t[GST_ ## d ## _ERROR_ ## a] = g_strdup (b) #define QUARK_FUNC(string) \ GQuark gst_ ## string ## _error_quark (void) { \ - static GQuark q; \ - if (!q) \ - q = g_quark_from_static_string ("gst-" # string "-error-quark"); \ - return q; \ -} + static GQuark quark; \ + if (!quark) \ + quark = g_quark_from_static_string ("gst-" # string "-error-quark"); \ + return quark; } GType gst_g_error_get_type (void) @@ -111,7 +110,7 @@ _gst_resource_errors_init (void) t = g_new0 (gchar *, GST_RESOURCE_ERROR_NUM_ERRORS); TABLE (t, RESOURCE, FAILED, - N_("GStreamer encountered a general supporting library error.")); + N_("GStreamer encountered a general resource error.")); TABLE (t, RESOURCE, TOO_LAZY, N_("GStreamer developers were too lazy to assign an error code " "to this error. Please file a bug.")); @@ -141,7 +140,7 @@ _gst_stream_errors_init (void) t = g_new0 (gchar *, GST_STREAM_ERROR_NUM_ERRORS); TABLE (t, STREAM, FAILED, - N_("GStreamer encountered a general supporting library error.")); + N_("GStreamer encountered a general stream error.")); TABLE (t, STREAM, TOO_LAZY, N_("GStreamer developers were too lazy to assign an error code " "to this error. Please file a bug.")); @@ -162,30 +161,29 @@ _gst_stream_errors_init (void) return t; } -QUARK_FUNC (core); -QUARK_FUNC (library); -QUARK_FUNC (resource); -QUARK_FUNC (stream); +QUARK_FUNC (core) + QUARK_FUNC (library) + QUARK_FUNC (resource) + QUARK_FUNC (stream) /** - * gst_error_get_text: + * gst_error_get_message: * @domain: the GStreamer error domain this error belongs to. * @code: the error code belonging to the domain. * - * Returns: a newly allocated string describing the error text in the + * Returns: a newly allocated string describing the error message in the * current locale. */ -gchar * -gst_error_get_text (GQuark domain, gint code) + gchar *gst_error_get_message (GQuark domain, gint code) { static gchar **gst_core_errors = NULL; static gchar **gst_library_errors = NULL; static gchar **gst_resource_errors = NULL; static gchar **gst_stream_errors = NULL; - gchar *text = NULL; + gchar *message = NULL; - /* initialize error text tables if necessary */ + /* initialize error message tables if necessary */ if (gst_core_errors == NULL) gst_core_errors = _gst_core_errors_init (); if (gst_library_errors == NULL) @@ -197,23 +195,23 @@ gst_error_get_text (GQuark domain, gint code) if (domain == GST_CORE_ERROR) - text = gst_core_errors[code]; + message = gst_core_errors[code]; else if (domain == GST_LIBRARY_ERROR) - text = gst_library_errors[code]; + message = gst_library_errors[code]; else if (domain == GST_RESOURCE_ERROR) - text = gst_resource_errors[code]; + message = gst_resource_errors[code]; else if (domain == GST_STREAM_ERROR) - text = gst_stream_errors[code]; + message = gst_stream_errors[code]; else { - g_warning ("No error texts for domain %s", g_quark_to_string (domain)); - return g_strdup_printf (_("No error text for domain %s."), + g_warning ("No error messages for domain %s", g_quark_to_string (domain)); + return g_strdup_printf (_("No error message for domain %s."), g_quark_to_string (domain)); } - if (text) - return g_strdup (_(text)); + if (message) + return g_strdup (_(message)); else return g_strdup_printf (_ - ("No standard error text for domain %s and code %d."), + ("No standard error message for domain %s and code %d."), g_quark_to_string (domain), code); } diff --git a/gst/gsterror.h b/gst/gsterror.h index 9ebe26a580..897dc9249d 100644 --- a/gst/gsterror.h +++ b/gst/gsterror.h @@ -196,7 +196,7 @@ typedef enum #define GST_ERROR_SYSTEM ("system error: %s", g_strerror (errno)) GType gst_g_error_get_type (void); -gchar *gst_error_get_text (GQuark domain, gint code); +gchar *gst_error_get_message (GQuark domain, gint code); GQuark gst_stream_error_quark (void); GQuark gst_core_error_quark (void); GQuark gst_resource_error_quark (void); diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 7ac2c23be5..32421a8049 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -48,6 +48,8 @@ /* underscore is to prevent conflict with GST_CAT_DEBUG define */ GST_DEBUG_CATEGORY_STATIC (_GST_CAT_DEBUG); +/* time of initialization, so we get useful debugging output times */ +GstClockTime start_time; #if 0 #if defined __sgi__ @@ -158,6 +160,8 @@ GstDebugCategory *GST_CAT_MESSAGE = NULL; GstDebugCategory *GST_CAT_PARAMS = NULL; GstDebugCategory *GST_CAT_CALL_TRACE = NULL; GstDebugCategory *GST_CAT_SEEK = NULL; +GstDebugCategory *GST_CAT_SIGNAL = NULL; +GstDebugCategory *GST_CAT_PROBE = NULL; /* FIXME: export this? */ gboolean @@ -203,9 +207,15 @@ __gst_in_valgrind (void) void _gst_debug_init (void) { + GTimeVal current; + gst_atomic_int_init (&__default_level, GST_LEVEL_DEFAULT); gst_atomic_int_init (&__use_color, 1); + /* get time we started for debugging messages */ + g_get_current_time (¤t); + start_time = GST_TIMEVAL_TO_TIME (current); + #ifdef HAVE_PRINTF_EXTENSION register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension, _gst_info_printf_extension_arginfo); @@ -240,7 +250,7 @@ _gst_debug_init (void) GST_DEBUG_BOLD | GST_DEBUG_FG_MAGENTA, NULL); /* FIXME: remove GST_CAT_DATAFLOW in 0.9 */ GST_CAT_DATAFLOW = _gst_debug_category_new ("GST_DATAFLOW", - GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, NULL); + GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, "dataflow inside pads"); GST_CAT_BUFFER = _gst_debug_category_new ("GST_BUFFER", GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, NULL); GST_CAT_CAPS = _gst_debug_category_new ("GST_CAPS", @@ -281,7 +291,12 @@ _gst_debug_init (void) GST_CAT_CALL_TRACE = _gst_debug_category_new ("GST_CALL_TRACE", GST_DEBUG_BOLD, NULL); GST_CAT_SEEK = _gst_debug_category_new ("GST_SEEK", - 0, "plugins reacting to seek events"); + GST_DEBUG_BOLD | GST_DEBUG_FG_BLUE, "plugins reacting to seek events"); + GST_CAT_SIGNAL = _gst_debug_category_new ("GST_SIGNAL", + GST_DEBUG_BOLD | GST_DEBUG_FG_WHITE | GST_DEBUG_BG_RED, NULL); + GST_CAT_PROBE = _gst_debug_category_new ("GST_PROBE", + GST_DEBUG_BOLD | GST_DEBUG_FG_GREEN, "pad probes"); + /* print out the valgrind message if we're in valgrind */ __gst_in_valgrind (); @@ -490,6 +505,7 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level, gchar *pidcolor; gint pid; GTimeVal now; + GstClockTime elapsed; if (level > gst_debug_category_get_threshold (category)) return; @@ -512,10 +528,11 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level, obj = object ? gst_debug_print_object (object) : g_strdup (""); g_get_current_time (&now); + elapsed = GST_TIMEVAL_TO_TIME (now) - start_time; g_printerr ("%s (%p - %" GST_TIME_FORMAT ") %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n", gst_debug_level_get_name (level), g_thread_self (), - GST_TIME_ARGS (GST_TIMEVAL_TO_TIME (now)), color, + GST_TIME_ARGS (elapsed), color, gst_debug_category_get_name (category), clear, pidcolor, pid, clear, color, file, line, function, obj, clear, gst_debug_message_get (message)); @@ -1112,6 +1129,17 @@ _gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n, #endif /* HAVE_PRINTF_EXTENSION */ #else /* !GST_DISABLE_GST_DEBUG */ +guint +gst_debug_remove_log_function (GstLogFunction func) +{ + return 0; +} + +guint +gst_debug_remove_log_function_by_data (gpointer data) +{ + return 0; +} gboolean __gst_in_valgrind (void) diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 0113a405f8..bd5ade2b2c 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -617,9 +617,9 @@ G_CONST_RETURN gchar * #define gst_debug_get_default_threshold() (GST_LEVEL_NONE) #define gst_debug_level_get_name(level) ("NONE") -#define gst_debug_add_log_function(func,data) (FALSE) -#define gst_debug_remove_log_function(func) (0) -#define gst_debug_remove_log_function_by_data(data) (0) +#define gst_debug_add_log_function(func,data) /* NOP */ +guint gst_debug_remove_log_function (GstLogFunction func); +guint gst_debug_remove_log_function_by_data (gpointer data); #define gst_debug_set_active(active) /* NOP */ #define gst_debug_is_active() (FALSE) #define gst_debug_set_colored(colored) /* NOP */ diff --git a/gst/gstmessage.h b/gst/gstmessage.h index 1dc9a882bb..5d4658b81f 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -124,15 +124,15 @@ GstMessage * gst_message_new_eos (GstObject * src); GstMessage * gst_message_new_error (GstObject * src, GError * error, gchar * debug); GstMessage * gst_message_new_warning (GstObject * src, GError * error, gchar * debug); GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list); -GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old, - GstElementState new); +GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old_state, + GstElementState new_state); GstMessage * gst_message_new_application (GstStructure *structure); const GstStructure * gst_message_get_structure (GstMessage *message); void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); -void gst_message_parse_state_changed (GstMessage *message, GstElementState *old, - GstElementState *new); +void gst_message_parse_state_changed (GstMessage *message, GstElementState *old_state, + GstElementState *new_state); void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug); diff --git a/gst/gstpad.c b/gst/gstpad.c index 3072c94c84..567ffeda6a 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -235,6 +235,7 @@ gst_real_pad_class_init (GstRealPadClass * klass) static void gst_real_pad_init (GstRealPad * pad) { + pad->direction = GST_PAD_UNKNOWN; pad->peer = NULL; pad->chainfunc = NULL; @@ -2184,6 +2185,7 @@ gst_pad_get_pad_template_caps (GstPad * pad) return gst_static_caps_get (&anycaps); } + /** * gst_pad_get_peer: * @pad: a #GstPad to get the peer of. diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 6795cac1a6..cb5e635db9 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -578,6 +578,22 @@ gst_plugin_get_filename (GstPlugin * plugin) return plugin->filename; } +/** + * gst_plugin_get_version: + * @plugin: plugin to get the version of + * + * get the version of the plugin + * + * Returns: the version of the plugin + */ +G_CONST_RETURN gchar * +gst_plugin_get_version (GstPlugin * plugin) +{ + g_return_val_if_fail (plugin != NULL, NULL); + + return plugin->desc.version; +} + /** * gst_plugin_get_license: * @plugin: plugin to get the license of @@ -874,9 +890,9 @@ gst_plugin_load (const gchar * name) * @name: name of library to load * * Load the named library. Name should be given as - * "liblibrary.so". + * "liblibrary.so". (exception to this rule is 'riff', which .so name is 'gstriff') * - * Returns: whether the library was loaded or not + * Returns: whether the library was loaded or not (and returns TRUE if it was already loaded) */ gboolean gst_library_load (const gchar * name) diff --git a/gst/gstplugin.h b/gst/gstplugin.h index 058cb1f352..e562f4d7b8 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -130,6 +130,7 @@ void _gst_plugin_register_static (GstPluginDesc *desc); G_CONST_RETURN gchar* gst_plugin_get_name (GstPlugin *plugin); G_CONST_RETURN gchar* gst_plugin_get_description (GstPlugin *plugin); G_CONST_RETURN gchar* gst_plugin_get_filename (GstPlugin *plugin); +G_CONST_RETURN gchar* gst_plugin_get_version (GstPlugin *plugin); G_CONST_RETURN gchar* gst_plugin_get_license (GstPlugin *plugin); G_CONST_RETURN gchar* gst_plugin_get_package (GstPlugin *plugin); G_CONST_RETURN gchar* gst_plugin_get_origin (GstPlugin *plugin); diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c index d2af676291..9fa2b234a7 100644 --- a/gst/gstpluginfeature.c +++ b/gst/gstpluginfeature.c @@ -91,11 +91,13 @@ gboolean gst_plugin_feature_ensure_loaded (GstPluginFeature * feature) { GstPlugin *plugin; + static GStaticMutex mutex = G_STATIC_MUTEX_INIT; g_return_val_if_fail (feature != NULL, FALSE); g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE); plugin = (GstPlugin *) (feature->manager); + g_static_mutex_lock (&mutex); if (plugin && !gst_plugin_is_loaded (plugin)) { #ifndef GST_DISABLE_REGISTRY @@ -104,12 +106,21 @@ gst_plugin_feature_ensure_loaded (GstPluginFeature * feature) "loading plugin %s for feature", plugin->desc.name); if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager), - plugin) != GST_REGISTRY_OK) + plugin) != GST_REGISTRY_OK) { + g_static_mutex_unlock (&mutex); return FALSE; - } else -#endif /* GST_DISABLE_REGISTRY */ + } + } else { + g_static_mutex_unlock (&mutex); return FALSE; + } +#else /* GST_DISABLE_REGISTRY */ + g_static_mutex_unlock (&mutex); + return FALSE; +#endif } + + g_static_mutex_unlock (&mutex); return TRUE; } diff --git a/gst/gstprobe.c b/gst/gstprobe.c index e77acb8be0..eb9fd576c2 100644 --- a/gst/gstprobe.c +++ b/gst/gstprobe.c @@ -20,10 +20,29 @@ * Boston, MA 02111-1307, USA. */ - #include "gst_private.h" #include "gstprobe.h" +static GstProbe * +_gst_probe_copy (const GstProbe * src) +{ + return gst_probe_new (src->single_shot, src->callback, src->user_data); +} + +GType +gst_probe_get_type (void) +{ + static GType gst_probe_type = 0; + + if (!gst_probe_type) { + gst_probe_type = g_boxed_type_register_static ("GstProbe", + (GBoxedCopyFunc) _gst_probe_copy, (GBoxedFreeFunc) gst_probe_destroy); + } + + return gst_probe_type; + +} + /** * gst_probe_new: * @single_shot: TRUE if a single shot probe is required @@ -50,6 +69,8 @@ gst_probe_new (gboolean single_shot, probe->callback = callback; probe->user_data = user_data; + GST_CAT_DEBUG (GST_CAT_PROBE, "created probe %p", probe); + return probe; } @@ -57,7 +78,7 @@ gst_probe_new (gboolean single_shot, * gst_probe_destroy: * @probe: The probe to destroy * - * Free the memeory associated with the probe. + * Free the memory associated with the probe. */ void gst_probe_destroy (GstProbe * probe) @@ -87,6 +108,8 @@ gst_probe_perform (GstProbe * probe, GstData ** data) g_return_val_if_fail (probe, res); + GST_CAT_DEBUG (GST_CAT_PROBE, "performing probe %p", probe); + if (probe->callback) res = probe->callback (probe, data, probe->user_data); @@ -177,6 +200,9 @@ gst_probe_dispatcher_add_probe (GstProbeDispatcher * disp, GstProbe * probe) g_return_if_fail (disp); g_return_if_fail (probe); + GST_CAT_DEBUG (GST_CAT_PROBE, "adding probe %p to dispatcher %p", probe, + disp); + disp->probes = g_slist_prepend (disp->probes, probe); } @@ -193,6 +219,9 @@ gst_probe_dispatcher_remove_probe (GstProbeDispatcher * disp, GstProbe * probe) g_return_if_fail (disp); g_return_if_fail (probe); + GST_CAT_DEBUG (GST_CAT_PROBE, "removing probe %p from dispatcher %p", + probe, disp); + disp->probes = g_slist_remove (disp->probes, probe); } @@ -213,6 +242,9 @@ gst_probe_dispatcher_dispatch (GstProbeDispatcher * disp, GstData ** data) g_return_val_if_fail (disp, res); + GST_CAT_DEBUG (GST_CAT_PROBE, "dispatching data %p on dispatcher %p", + *data, disp); + walk = disp->probes; while (walk) { GstProbe *probe = (GstProbe *) walk->data; @@ -220,7 +252,9 @@ gst_probe_dispatcher_dispatch (GstProbeDispatcher * disp, GstData ** data) walk = g_slist_next (walk); res &= gst_probe_perform (probe, data); - if (probe->single_shot) { + /* it might have disappeared in the callback */ + if (disp->active && + g_slist_find (disp->probes, probe) && probe->single_shot) { disp->probes = g_slist_remove (disp->probes, probe); /* do not free the probe here as it cannot be made threadsafe */ diff --git a/gst/gstprobe.h b/gst/gstprobe.h index 1be6c26802..113e71ad67 100644 --- a/gst/gstprobe.h +++ b/gst/gstprobe.h @@ -29,8 +29,12 @@ G_BEGIN_DECLS +#define GST_TYPE_PROBE (gst_probe_get_type()) +#define GST_PROBE(object) ((GstProbe *) object) + typedef struct _GstProbe GstProbe; +GType gst_probe_get_type (void) G_GNUC_CONST; /* the callback should return FALSE if the data should be discarded */ typedef gboolean (*GstProbeCallback) (GstProbe *probe, GstData **data, @@ -71,6 +75,5 @@ gboolean gst_probe_dispatcher_dispatch (GstProbeDispatcher *disp, GstData **da G_END_DECLS - -#endif /* __GST_PAD_H__ */ +#endif /* __GST_PROBE_H__ */ diff --git a/gst/gstregistry.h b/gst/gstregistry.h index e1ac8ee4c6..f4676df63a 100644 --- a/gst/gstregistry.h +++ b/gst/gstregistry.h @@ -36,14 +36,23 @@ /* compatibility for pre-POSIX defines */ #ifdef S_IRUSR +#if defined(_WIN32) && defined(__MINGW32__) +#define REGISTRY_DIR_PERMS (S_ISGID | \ + S_IRUSR | S_IWUSR | S_IXUSR) +#else #define REGISTRY_DIR_PERMS (S_ISGID | \ S_IRUSR | S_IWUSR | S_IXUSR | \ S_IRGRP | S_IXGRP | \ S_IROTH | S_IXOTH) +#endif #define REGISTRY_TMPFILE_PERMS (S_IRUSR | S_IWUSR) +#if defined(_WIN32) && defined(__MINGW32__) +#define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR +#else #define REGISTRY_FILE_PERMS (S_IRUSR | S_IWUSR | \ S_IRGRP | S_IWGRP | \ S_IROTH | S_IWOTH) +#endif #else #define REGISTRY_DIR_PERMS (S_ISGID | \ S_IREAD | S_IWRITE | S_IEXEC) diff --git a/gst/gsttag.h b/gst/gsttag.h index 52c923e0a7..5651178e60 100644 --- a/gst/gsttag.h +++ b/gst/gsttag.h @@ -226,39 +226,209 @@ GstTagList * gst_event_tag_get_list (GstEvent * tag_event); /* GStreamer core tags (need to be discussed) */ +/** + * GST_TAG_TITLE: + * + * commonly used title + */ #define GST_TAG_TITLE "title" +/** + * GST_TAG_ARTIST: + * + * person(s) responsible for the recording + */ #define GST_TAG_ARTIST "artist" +/** + * GST_TAG_ALBUM: + * + * album containing this data + */ #define GST_TAG_ALBUM "album" +/** + * GST_TAG_DATE: + * + * date the data was created (in Julian calendar days) + */ #define GST_TAG_DATE "date" +/** + * GST_TAG_GENRE: + * + * genre this data belongs to + */ #define GST_TAG_GENRE "genre" +/** + * GST_TAG_COMMENT: + * + * free text commenting the data + */ #define GST_TAG_COMMENT "comment" +/** + * GST_TAG_TRACK_NUMBER: + * + * track number inside a collection + */ #define GST_TAG_TRACK_NUMBER "track-number" +/** + * GST_TAG_TRACK_COUNT: + * + * count of tracks inside collection this track belongs to + */ #define GST_TAG_TRACK_COUNT "track-count" +/** + * GST_TAG_ALBUM_VOLUME_NUMBER: + * + * disc number inside a collection + */ #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number" +/** + * GST_TAG_ALBUM_VOLUME_COUNT: + * + * count of discs inside collection this disc belongs to + */ #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count" +/** + * GST_TAG_LOCATION: + * + * original location of file as a URI + */ #define GST_TAG_LOCATION "location" +/** + * GST_TAG_DESCRIPTION: + * + * short text describing the content of the data + */ #define GST_TAG_DESCRIPTION "description" +/** + * GST_TAG_VERSION: + * + * version of this data + */ #define GST_TAG_VERSION "version" +/** + * GST_TAG_ISRC: + * + * International Standard Recording Code - see http://www.ifpi.org/isrc/ + */ #define GST_TAG_ISRC "isrc" +/** + * GST_TAG_ORGANIZATION: + * + * organization + */ #define GST_TAG_ORGANIZATION "organization" +/** + * GST_TAG_COPYRIGHT: + * + * copyright notice of the data + */ #define GST_TAG_COPYRIGHT "copyright" +/** + * GST_TAG_CONTACT: + * + * contact information + */ #define GST_TAG_CONTACT "contact" +/** + * GST_TAG_LICENSE: + * + * license of data + */ #define GST_TAG_LICENSE "license" +/** + * GST_TAG_PERFORMER: + * + * person(s) performing + */ #define GST_TAG_PERFORMER "performer" +/** + * GST_TAG_DURATION: + * + * length in GStreamer time units (nanoseconds) + */ #define GST_TAG_DURATION "duration" +/** + * GST_TAG_CODEC: + * + * codec the data is stored in + */ #define GST_TAG_CODEC "codec" +/** + * GST_TAG_VIDEO_CODEC: + * + * codec the video data is stored in + */ #define GST_TAG_VIDEO_CODEC "video-codec" +/** + * GST_TAG_AUDIO_CODEC: + * + * codec the audio data is stored in + */ #define GST_TAG_AUDIO_CODEC "audio-codec" +/** + * GST_TAG_BITRATE: + * + * exact or average bitrate in bits/s + */ #define GST_TAG_BITRATE "bitrate" +/** + * GST_TAG_NOMINAL_BITRATE: + * + * nominal bitrate in bits/s + */ #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate" +/** + * GST_TAG_MINIMUM_BITRATE: + * + * minimum bitrate in bits/s + */ #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate" +/** + * GST_TAG_MAXIMUM_BITRATE: + * + * maximum bitrate in bits/s + */ #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate" +/** + * GST_TAG_SERIAL: + * + * serial number of track + */ #define GST_TAG_SERIAL "serial" +/** + * GST_TAG_ENCODER: + * + * encoder used to encode this stream + */ #define GST_TAG_ENCODER "encoder" +/** + * GST_TAG_ENCODER_VERSION: + * + * version of the encoder used to encode this stream + */ #define GST_TAG_ENCODER_VERSION "encoder-version" +/** + * GST_TAG_TRACK_GAIN: + * + * track gain in db + */ #define GST_TAG_TRACK_GAIN "replaygain-track-gain" +/** + * GST_TAG_TRACK_PEAK: + * + * peak of the track + */ #define GST_TAG_TRACK_PEAK "replaygain-track-peak" +/** + * GST_TAG_ALBUM_GAIN: + * + * album gain in db + */ #define GST_TAG_ALBUM_GAIN "replaygain-album-gain" +/** + * GST_TAG_ALBUM_PEAK: + * + * peak of the album + */ #define GST_TAG_ALBUM_PEAK "replaygain-album-peak" G_END_DECLS diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h index 52c923e0a7..5651178e60 100644 --- a/gst/gsttaglist.h +++ b/gst/gsttaglist.h @@ -226,39 +226,209 @@ GstTagList * gst_event_tag_get_list (GstEvent * tag_event); /* GStreamer core tags (need to be discussed) */ +/** + * GST_TAG_TITLE: + * + * commonly used title + */ #define GST_TAG_TITLE "title" +/** + * GST_TAG_ARTIST: + * + * person(s) responsible for the recording + */ #define GST_TAG_ARTIST "artist" +/** + * GST_TAG_ALBUM: + * + * album containing this data + */ #define GST_TAG_ALBUM "album" +/** + * GST_TAG_DATE: + * + * date the data was created (in Julian calendar days) + */ #define GST_TAG_DATE "date" +/** + * GST_TAG_GENRE: + * + * genre this data belongs to + */ #define GST_TAG_GENRE "genre" +/** + * GST_TAG_COMMENT: + * + * free text commenting the data + */ #define GST_TAG_COMMENT "comment" +/** + * GST_TAG_TRACK_NUMBER: + * + * track number inside a collection + */ #define GST_TAG_TRACK_NUMBER "track-number" +/** + * GST_TAG_TRACK_COUNT: + * + * count of tracks inside collection this track belongs to + */ #define GST_TAG_TRACK_COUNT "track-count" +/** + * GST_TAG_ALBUM_VOLUME_NUMBER: + * + * disc number inside a collection + */ #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number" +/** + * GST_TAG_ALBUM_VOLUME_COUNT: + * + * count of discs inside collection this disc belongs to + */ #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count" +/** + * GST_TAG_LOCATION: + * + * original location of file as a URI + */ #define GST_TAG_LOCATION "location" +/** + * GST_TAG_DESCRIPTION: + * + * short text describing the content of the data + */ #define GST_TAG_DESCRIPTION "description" +/** + * GST_TAG_VERSION: + * + * version of this data + */ #define GST_TAG_VERSION "version" +/** + * GST_TAG_ISRC: + * + * International Standard Recording Code - see http://www.ifpi.org/isrc/ + */ #define GST_TAG_ISRC "isrc" +/** + * GST_TAG_ORGANIZATION: + * + * organization + */ #define GST_TAG_ORGANIZATION "organization" +/** + * GST_TAG_COPYRIGHT: + * + * copyright notice of the data + */ #define GST_TAG_COPYRIGHT "copyright" +/** + * GST_TAG_CONTACT: + * + * contact information + */ #define GST_TAG_CONTACT "contact" +/** + * GST_TAG_LICENSE: + * + * license of data + */ #define GST_TAG_LICENSE "license" +/** + * GST_TAG_PERFORMER: + * + * person(s) performing + */ #define GST_TAG_PERFORMER "performer" +/** + * GST_TAG_DURATION: + * + * length in GStreamer time units (nanoseconds) + */ #define GST_TAG_DURATION "duration" +/** + * GST_TAG_CODEC: + * + * codec the data is stored in + */ #define GST_TAG_CODEC "codec" +/** + * GST_TAG_VIDEO_CODEC: + * + * codec the video data is stored in + */ #define GST_TAG_VIDEO_CODEC "video-codec" +/** + * GST_TAG_AUDIO_CODEC: + * + * codec the audio data is stored in + */ #define GST_TAG_AUDIO_CODEC "audio-codec" +/** + * GST_TAG_BITRATE: + * + * exact or average bitrate in bits/s + */ #define GST_TAG_BITRATE "bitrate" +/** + * GST_TAG_NOMINAL_BITRATE: + * + * nominal bitrate in bits/s + */ #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate" +/** + * GST_TAG_MINIMUM_BITRATE: + * + * minimum bitrate in bits/s + */ #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate" +/** + * GST_TAG_MAXIMUM_BITRATE: + * + * maximum bitrate in bits/s + */ #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate" +/** + * GST_TAG_SERIAL: + * + * serial number of track + */ #define GST_TAG_SERIAL "serial" +/** + * GST_TAG_ENCODER: + * + * encoder used to encode this stream + */ #define GST_TAG_ENCODER "encoder" +/** + * GST_TAG_ENCODER_VERSION: + * + * version of the encoder used to encode this stream + */ #define GST_TAG_ENCODER_VERSION "encoder-version" +/** + * GST_TAG_TRACK_GAIN: + * + * track gain in db + */ #define GST_TAG_TRACK_GAIN "replaygain-track-gain" +/** + * GST_TAG_TRACK_PEAK: + * + * peak of the track + */ #define GST_TAG_TRACK_PEAK "replaygain-track-peak" +/** + * GST_TAG_ALBUM_GAIN: + * + * album gain in db + */ #define GST_TAG_ALBUM_GAIN "replaygain-album-gain" +/** + * GST_TAG_ALBUM_PEAK: + * + * peak of the album + */ #define GST_TAG_ALBUM_PEAK "replaygain-album-peak" G_END_DECLS diff --git a/gst/gsttypes.h b/gst/gsttypes.h index 78345d0c1c..a6e3a51047 100644 --- a/gst/gsttypes.h +++ b/gst/gsttypes.h @@ -43,39 +43,36 @@ typedef struct _GstSchedulerClass GstSchedulerClass; typedef struct _GstEvent GstEvent; typedef struct _GstMessage GstMessage; -typedef enum -{ - GST_STATE_VOID_PENDING = 0, - GST_STATE_NULL = (1 << 0), - GST_STATE_READY = (1 << 1), - GST_STATE_PAUSED = (1 << 2), - GST_STATE_PLAYING = (1 << 3) +typedef enum { + GST_STATE_VOID_PENDING = 0, + GST_STATE_NULL = (1 << 0), + GST_STATE_READY = (1 << 1), + GST_STATE_PAUSED = (1 << 2), + GST_STATE_PLAYING = (1 << 3) } GstElementState; -typedef enum -{ - GST_STATE_FAILURE = 0, - GST_STATE_SUCCESS = 1, - GST_STATE_ASYNC = 2, +typedef enum { + GST_STATE_FAILURE = 0, + GST_STATE_SUCCESS = 1, + GST_STATE_ASYNC = 2 } GstElementStateReturn; -typedef enum -{ +typedef enum { GST_RESULT_OK, GST_RESULT_NOK, GST_RESULT_NOT_IMPL } GstResult; -typedef enum -{ - GST_RANK_NONE = 0, - GST_RANK_MARGINAL = 64, - GST_RANK_SECONDARY = 128, - GST_RANK_PRIMARY = 256 +typedef enum { + GST_RANK_NONE = 0, + GST_RANK_MARGINAL = 64, + GST_RANK_SECONDARY = 128, + GST_RANK_PRIMARY = 256 } GstRank; #define GST_PADDING 4 #define GST_PADDING_INIT { 0 } G_END_DECLS + #endif /* __GST_TYPES_H__ */ diff --git a/gst/gstutils.c b/gst/gstutils.c index 567cb60f40..10ac425c44 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -370,66 +370,6 @@ gst_print_element_args (GString * buf, gint indent, GstElement * element) g_free (specs); } -GstFlowReturn -gst_element_abort_preroll (GstElement * element) -{ - GstFlowReturn result = GST_FLOW_OK; - - /* grab state change lock */ - GST_STATE_LOCK (element); - /* if we are going to PAUSED, we can abort the state change */ - if (GST_STATE_TRANSITION (element) == GST_STATE_READY_TO_PAUSED) { - gst_element_abort_state (GST_ELEMENT (element)); - } - GST_STATE_UNLOCK (element); - - return result; -} - -/* call with stream lock held */ -GstFlowReturn -gst_element_finish_preroll (GstElement * element, GstPad * pad) -{ - GstFlowReturn result = GST_FLOW_OK; - - /* grab state change lock */ - GST_STATE_LOCK (element); - /* if we are going to PAUSED, we can commit the state change */ - if (GST_STATE_PENDING (element) == GST_STATE_PAUSED) { - gst_element_commit_state (GST_ELEMENT (element)); - } - /* if we are paused we need to wait for playing to continue */ - if (GST_STATE (element) == GST_STATE_PAUSED) { - GST_CAT_DEBUG (GST_CAT_STATES, - "element %s wants to finish preroll", GST_ELEMENT_NAME (element)); - - /* here we wait for the next state change */ - while (GST_STATE (element) == GST_STATE_PAUSED) { - if (GST_RPAD_IS_FLUSHING (pad) || !GST_RPAD_IS_ACTIVE (pad)) { - GST_CAT_DEBUG (GST_CAT_STATES, "pad is flushing"); - result = GST_FLOW_UNEXPECTED; - goto done; - } - - GST_CAT_DEBUG (GST_CAT_STATES, "waiting for next state change"); - - GST_STATE_WAIT (element); - GST_CAT_DEBUG (GST_CAT_STATES, " got state change"); - } - - /* check if we got playing */ - if (GST_STATE (element) != GST_STATE_PLAYING) { - /* not playing, we can't accept the buffer */ - result = GST_FLOW_WRONG_STATE; - } - GST_CAT_DEBUG (GST_CAT_STATES, "done preroll"); - } -done: - GST_STATE_UNLOCK (element); - - return result; -} - /** * gst_element_get_compatible_pad_template: * @element: a #GstElement to get a compatible pad template for. diff --git a/gst/gstvalue.c b/gst/gstvalue.c index a11a3d8f1d..2a24eb7837 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -1241,6 +1241,8 @@ gst_string_wrap (const char *s) len = 0; t = s; + if (!s) + return g_strdup (""); while (*t) { if (GST_ASCII_IS_STRING (*t)) { len++; @@ -1332,6 +1334,8 @@ static gboolean gst_value_deserialize_string (GValue * dest, const char *s) { if (*s != '"') { + if (!g_utf8_validate (s, -1, NULL)) + return FALSE; g_value_set_string (dest, s); return TRUE; } else { @@ -2027,10 +2031,15 @@ gst_value_register_union_func (GType type1, GType type2, GstValueUnionFunc func) /** * gst_value_can_intersect: - * @value1: - * @value2: + * @value1: a value to intersect + * @value2: another value to intersect * - * Returns: + * Determines if intersecting two values will produce a valid result. + * Two values will produce a valid intersection if they have the same + * type, or if there is a method (registered by + * #gst_value_register_intersection_func) to calculate the intersection. + * + * Returns: TRUE if the values can intersect */ gboolean gst_value_can_intersect (const GValue * value1, const GValue * value2) @@ -2057,11 +2066,15 @@ gst_value_can_intersect (const GValue * value1, const GValue * value2) /** * gst_value_intersect: - * @dest: the destination value for intersection + * @dest: a uninitialized #GValue that will hold the calculated + * intersection value * @value1: a value to intersect * @value2: another value to intersect * - * Calculates the intersection of the two values. + * Calculates the intersection of two values. If the values have + * a non-empty intersection, the value representing the intersection + * is placed in @dest. If the intersection is non-empty, @dest is + * not modified. * * Returns: TRUE if the intersection is non-empty */ @@ -2104,10 +2117,26 @@ gst_value_intersect (GValue * dest, const GValue * value1, /** * gst_value_register_intersection_func: - * @type1: - * @type2: - * @func: + * @type1: the first type to intersect + * @type2: the second type to intersect + * @func: the intersection function * + * Registers a function that is called to calculate the intersection + * of the values having the types @type1 and @type2. + */ +/** + * GstValueIntersectFunc: + * @dest: a uninitialized #GValue that will hold the calculated + * intersection value + * @value1: a value to intersect + * @value2: another value to intersect + * + * Functions having this type calculate the intersection of @value1 + * and @value2. If the intersection is non-empty, the result is + * placed in @dest and TRUE is returned. If the intersection is + * empty, @dest is unmodified and FALSE is returned. + * + * Returns: TRUE if the intersection is non-empty, FALSE otherwise */ void gst_value_register_intersect_func (GType type1, GType type2, @@ -2236,8 +2265,22 @@ gst_value_register_subtract_func (GType minuend_type, GType subtrahend_type, /** * gst_value_register: - * @table: + * @table: structure containing functions to register * + * Registers functions to perform calculations on #GValues of a given + * type. + */ +/** + * GstValueTable: + * @type: GType that the functions operate on. + * @compare: A function that compares two values of this type. + * @serialize: A function that transforms a value of this type to a + * string. Strings created by this function must be unique and should + * be human readable. + * @deserialize: A function that transforms a string to a value of + * this type. This function must transform strings created by the + * serialize function back to the original value. This function may + * optionally transform other strings into values. */ void gst_value_register (const GstValueTable * table) @@ -2247,9 +2290,11 @@ gst_value_register (const GstValueTable * table) /** * gst_value_init_and_copy: - * @dest: - * @src: + * @dest: the target value + * @src: the source value * + * Initialises the target value to be of the same type as source and then copies + * the contents from source to target. */ void gst_value_init_and_copy (GValue * dest, const GValue * src) diff --git a/gst/gstvalue.h b/gst/gstvalue.h index 617566c95b..0d8f56f776 100644 --- a/gst/gstvalue.h +++ b/gst/gstvalue.h @@ -77,6 +77,7 @@ struct _GstValueTable { GstValueSerializeFunc serialize; GstValueDeserializeFunc deserialize; + /*< private >*/ void *_gst_reserved [GST_PADDING]; }; diff --git a/gst/gstversion.h.in b/gst/gstversion.h.in index a708cca614..048a2c3892 100644 --- a/gst/gstversion.h.in +++ b/gst/gstversion.h.in @@ -24,6 +24,8 @@ #ifndef __GST_VERSION_H__ #define __GST_VERSION_H__ +G_BEGIN_DECLS + /* * Use these only when you want to know what GStreamer version your stuff was * compiled against. @@ -36,4 +38,6 @@ void gst_version (guint *major, guint *minor, guint *micro); +G_END_DECLS + #endif /* __GST_VERSION_H__ */ diff --git a/libs/gst/dataprotocol/dataprotocol.c b/libs/gst/dataprotocol/dataprotocol.c index 3fd282e077..0ae75af0f0 100644 --- a/libs/gst/dataprotocol/dataprotocol.c +++ b/libs/gst/dataprotocol/dataprotocol.c @@ -83,7 +83,7 @@ gst_dp_dump_byte_array (guint8 * array, guint length) { int i; int n = 8; /* number of bytes per line */ - gchar *line = g_malloc (3 * n); + gchar *line = g_malloc (3 * n + 1); GST_LOG ("dumping byte array of length %d", length); for (i = 0; i < length; ++i) { diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index f356e9ed3b..eff4feb1fa 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -822,7 +822,6 @@ print_children_info (GstElement * element) if (!GST_IS_BIN (element)) return; - //children = (GList *) gst_bin_get_list (GST_BIN (element)); children = (GList *) GST_BIN (element)->children; if (children) { n_print ("\n");