From: Stefan Kost Date: Wed, 7 Sep 2005 13:22:16 +0000 (+0000) Subject: renamed gsttag -> gsttaglist, gsttaginterface -> gsttagsetter inlined docs for gsttra... X-Git-Tag: RELEASE-0_9_3~187 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5454f7c5cc8d1db0005af252498022c00da0ddb;p=platform%2Fupstream%2Fgstreamer.git renamed gsttag -> gsttaglist, gsttaginterface -> gsttagsetter inlined docs for gsttrace, gsttrashstack Original commit message from CVS: * docs/gst/gstreamer-docs.sgml: * docs/gst/tmpl/.cvsignore: * docs/gst/tmpl/gsttrace.sgml: * docs/gst/tmpl/gsttrashstack.sgml: * gst/Makefile.am: * gst/gst.h: * gst/gstelement.h: * gst/gstevent.h: * gst/gstmessage.c: * gst/gstmessage.h: * gst/gsttag.c: * gst/gsttag.h: * gst/gsttaginterface.c: * gst/gsttaginterface.h: * gst/gsttaglist.c: * gst/gsttaglist.h: * gst/gsttagsetter.c: * gst/gsttagsetter.h: * gst/gsttrace.c: * gst/gsttrace.h: * gst/gsttrashstack.c: renamed gsttag -> gsttaglist, gsttaginterface -> gsttagsetter inlined docs for gsttrace, gsttrashstack --- diff --git a/ChangeLog b/ChangeLog index 83a90ca..0f5687f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,31 @@ 2005-09-07 Stefan Kost + * docs/gst/gstreamer-docs.sgml: + * docs/gst/tmpl/.cvsignore: + * docs/gst/tmpl/gsttrace.sgml: + * docs/gst/tmpl/gsttrashstack.sgml: + * gst/Makefile.am: + * gst/gst.h: + * gst/gstelement.h: + * gst/gstevent.h: + * gst/gstmessage.c: + * gst/gstmessage.h: + * gst/gsttag.c: + * gst/gsttag.h: + * gst/gsttaginterface.c: + * gst/gsttaginterface.h: + * gst/gsttaglist.c: + * gst/gsttaglist.h: + * gst/gsttagsetter.c: + * gst/gsttagsetter.h: + * gst/gsttrace.c: + * gst/gsttrace.h: + * gst/gsttrashstack.c: + renamed gsttag -> gsttaglist, gsttaginterface -> gsttagsetter + inlined docs for gsttrace, gsttrashstack + +2005-09-07 Stefan Kost + * gst/Makefile.am: * gst/elements/gstbufferstore.h: * gst/elements/gsttypefindelement.c: diff --git a/docs/gst/gstreamer-docs.sgml b/docs/gst/gstreamer-docs.sgml index 2154dc6..e84fe9f 100644 --- a/docs/gst/gstreamer-docs.sgml +++ b/docs/gst/gstreamer-docs.sgml @@ -165,6 +165,7 @@ &GstMacros; &GstMemChunk; &GstTrace; + &GstTrashStack; @@ -213,19 +214,20 @@ - GStreamer Base Classes + GStreamer Base and Utillity Classes libgstbase-&GST_MAJORMINOR;.so provides some base classes to be extended - by elements. + by elements and utillity classes that are most useful for plugin developers. - &GstAdapter; &GstBaseSrc; &GstBaseSink; &GstBaseTransform; - &GstCollectPads; &GstPushSrc; + &GstAdapter; + &GstCollectPads; + diff --git a/docs/gst/tmpl/.gitignore b/docs/gst/tmpl/.gitignore index 500d16b..037375c 100644 --- a/docs/gst/tmpl/.gitignore +++ b/docs/gst/tmpl/.gitignore @@ -44,6 +44,8 @@ gstsystemclock.sgml gsttaglist.sgml gsttagsetter.sgml gsttask.sgml +gsttrace.sgml +gsttrashstack.sgml gsttypefind.sgml gsttypefindfactory.sgml gsturihandler.sgml diff --git a/docs/gst/tmpl/gsttrace.sgml b/docs/gst/tmpl/gsttrace.sgml deleted file mode 100644 index 0f69f42..0000000 --- a/docs/gst/tmpl/gsttrace.sgml +++ /dev/null @@ -1,241 +0,0 @@ - -GstTrace - - -Tracing functionality - - - -Tracing functionality - - - - - - - - - - - - - - - -@filename: -@fd: -@buf: -@bufsize: -@bufoffset: - - - - - - -@timestamp: -@sequence: -@data: -@message: - - - - - - -@filename: -@size: -@Returns: - - - - - - - -@trace: - - - - - - - -@trace: - - - - - - - -@trace: - - - - - - - -@trace: - - - - - - - -@trace: - - - - - - - -@trace: - - - - - - - -@trace: - - - - - - - -@dst: - - - - -Flags indicating which tracing feature to enable. - - -@GST_ALLOC_TRACE_LIVE: Trace number of non-freed memory -@GST_ALLOC_TRACE_MEM_LIVE: trace pointers of unfreed memory - - - -The main tracing object - - -@name: The name of the tracing object -@flags: Flags for this object -@live: counter for live memory -@mem_live: list with pointers to unfreed memory - - - - - - -@Returns: - - - - - - - -@Returns: - - - - - - - -@Returns: - - - - - - - - - - - - - - -@flags: - - - - - - - -@name: -@Returns: - - - - - - - -@trace: - - - - - - - - - - - - - - -@trace: -@flags: - - - - -Register a new alloc tracer with the given name - - -@name: The name of the tracer object - - - - -Use the tracer to trace a new memory allocation - - -@trace: The tracer to use -@mem: The memory allocated - - - - -Trace a memory free operation - - -@trace: The tracer to use -@mem: The memory that is freed - - - - - - - -@trace: -@seq: -@data: -@msg: - - diff --git a/docs/gst/tmpl/gsttrashstack.sgml b/docs/gst/tmpl/gsttrashstack.sgml deleted file mode 100644 index 27eeeeb..0000000 --- a/docs/gst/tmpl/gsttrashstack.sgml +++ /dev/null @@ -1,54 +0,0 @@ - -gsttrashstack - - - - - - - - - - - - - - - - - - - - - - -@head: -@count: -@lock: - - - - - - -@next: - - - - - - - - - - - - - - - - - - - - diff --git a/gst/Makefile.am b/gst/Makefile.am index b4c1d48..b71b32b 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -109,8 +109,8 @@ libgstreamer_@GST_MAJORMINOR@_la_SOURCES = \ gstqueue.c \ gststructure.c \ gstsystemclock.c \ - gsttag.c \ - gsttaginterface.c \ + gsttaglist.c \ + gsttagsetter.c \ gsttask.c \ $(GST_TRACE_SRC) \ gsttrashstack.c \ @@ -186,8 +186,8 @@ gst_headers = \ gstqueue.h \ gststructure.h \ gstsystemclock.h \ - gsttag.h \ - gsttaginterface.h \ + gsttaglist.h \ + gsttagsetter.h \ gsttask.h \ gsttrace.h \ gsttrashstack.h \ diff --git a/gst/gst.h b/gst/gst.h index 715291d..1d0eb47 100644 --- a/gst/gst.h +++ b/gst/gst.h @@ -53,8 +53,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/gst/gstelement.h b/gst/gstelement.h index e6c7dfa..22f9794 100644 --- a/gst/gstelement.h +++ b/gst/gstelement.h @@ -50,7 +50,7 @@ typedef enum { #include #include #include -#include +#include G_BEGIN_DECLS diff --git a/gst/gstevent.h b/gst/gstevent.h index 5c99ce2..d235266 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include G_BEGIN_DECLS diff --git a/gst/gstmessage.c b/gst/gstmessage.c index 86c6179..29a267d 100644 --- a/gst/gstmessage.c +++ b/gst/gstmessage.c @@ -39,7 +39,7 @@ #include "gstinfo.h" #include "gstmemchunk.h" #include "gstmessage.h" -#include "gsttag.h" +#include "gsttaglist.h" #include "gstutils.h" diff --git a/gst/gstmessage.h b/gst/gstmessage.h index ac6ebbc..6325a5e 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -71,7 +71,7 @@ typedef enum #include #include #include -#include +#include #include #define GST_MESSAGE_TRACE_NAME "GstMessage" diff --git a/gst/gsttag.c b/gst/gsttag.c deleted file mode 100644 index 3e54176..0000000 --- a/gst/gsttag.c +++ /dev/null @@ -1,949 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttag.c: tag support (aka metadata) - * - * 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. - */ -/** - * SECTION:gsttaglist - * @short_description: List of tags and values used to describe media metadata - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gst_private.h" -#include "gst-i18n-lib.h" -#include "gsttag.h" -#include "gstinfo.h" -#include "gstvalue.h" - -#include -#include - -#define GST_TAG_IS_VALID(tag) (gst_tag_get_info (tag) != NULL) - -typedef struct -{ - GType type; /* type the data is in */ - - gchar *nick; /* translated name */ - gchar *blurb; /* translated description of type */ - - GstTagMergeFunc merge_func; /* functions to merge the values */ - GstTagFlag flag; /* type of tag */ -} -GstTagInfo; - -#define TAGLIST "taglist" -static GQuark gst_tag_list_quark; -static GMutex *__tag_mutex; -static GHashTable *__tags; - -#define TAG_LOCK g_mutex_lock (__tag_mutex) -#define TAG_UNLOCK g_mutex_unlock (__tag_mutex) - -GType -gst_tag_list_get_type (void) -{ - static GType _gst_tag_list_type; - - if (_gst_tag_list_type == 0) { - _gst_tag_list_type = g_boxed_type_register_static ("GstTagList", - (GBoxedCopyFunc) gst_tag_list_copy, (GBoxedFreeFunc) gst_tag_list_free); - -#if 0 - g_value_register_transform_func (_gst_tag_list_type, G_TYPE_STRING, - _gst_structure_transform_to_string); -#endif - } - - return _gst_tag_list_type; -} - -void -_gst_tag_initialize (void) -{ - gst_tag_list_quark = g_quark_from_static_string (TAGLIST); - __tag_mutex = g_mutex_new (); - __tags = g_hash_table_new (g_direct_hash, g_direct_equal); - gst_tag_register (GST_TAG_TITLE, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("title"), _("commonly used title"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_ARTIST, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("artist"), - _("person(s) responsible for the recording"), - gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_ALBUM, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("album"), - _("album containing this data"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META, G_TYPE_UINT, /* FIXME: own data type for dates? */ - _("date"), - _("date the data was created (in Julian calendar days)"), NULL); - gst_tag_register (GST_TAG_GENRE, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("genre"), - _("genre this data belongs to"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_COMMENT, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("comment"), - _("free text commenting the data"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_TRACK_NUMBER, GST_TAG_FLAG_META, - G_TYPE_UINT, - _("track number"), - _("track number inside a collection"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_TRACK_COUNT, GST_TAG_FLAG_META, - G_TYPE_UINT, - _("track count"), - _("count of tracks inside collection this track belongs to"), - gst_tag_merge_use_first); - gst_tag_register (GST_TAG_ALBUM_VOLUME_NUMBER, GST_TAG_FLAG_META, - G_TYPE_UINT, - _("disc number"), - _("disc number inside a collection"), gst_tag_merge_use_first); - gst_tag_register (GST_TAG_ALBUM_VOLUME_COUNT, GST_TAG_FLAG_META, - G_TYPE_UINT, - _("disc count"), - _("count of discs inside collection this disc belongs to"), - gst_tag_merge_use_first); - gst_tag_register (GST_TAG_LOCATION, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("location"), - _("original location of file as a URI"), - gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_DESCRIPTION, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("description"), - _("short text describing the content of the data"), - gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_VERSION, GST_TAG_FLAG_META, - G_TYPE_STRING, _("version"), _("version of this data"), NULL); - gst_tag_register (GST_TAG_ISRC, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("ISRC"), - _ - ("International Standard Recording Code - see http://www.ifpi.org/isrc/"), - NULL); - gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META, G_TYPE_STRING, _("organization"), _("organization"), /* FIXME */ - gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_COPYRIGHT, GST_TAG_FLAG_META, - G_TYPE_STRING, _("copyright"), _("copyright notice of the data"), NULL); - gst_tag_register (GST_TAG_CONTACT, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("contact"), _("contact information"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_LICENSE, GST_TAG_FLAG_META, - G_TYPE_STRING, _("license"), _("license of data"), NULL); - gst_tag_register (GST_TAG_PERFORMER, GST_TAG_FLAG_META, - G_TYPE_STRING, - _("performer"), - _("person(s) performing"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_DURATION, GST_TAG_FLAG_DECODED, - G_TYPE_UINT64, - _("duration"), _("length in GStreamer time units (nanoseconds)"), NULL); - gst_tag_register (GST_TAG_CODEC, GST_TAG_FLAG_ENCODED, - G_TYPE_STRING, - _("codec"), - _("codec the data is stored in"), gst_tag_merge_strings_with_comma); - gst_tag_register (GST_TAG_VIDEO_CODEC, GST_TAG_FLAG_ENCODED, - G_TYPE_STRING, - _("video codec"), _("codec the video data is stored in"), NULL); - gst_tag_register (GST_TAG_AUDIO_CODEC, GST_TAG_FLAG_ENCODED, - G_TYPE_STRING, - _("audio codec"), _("codec the audio data is stored in"), NULL); - gst_tag_register (GST_TAG_BITRATE, GST_TAG_FLAG_ENCODED, - G_TYPE_UINT, _("bitrate"), _("exact or average bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_NOMINAL_BITRATE, GST_TAG_FLAG_ENCODED, - G_TYPE_UINT, _("nominal bitrate"), _("nominal bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_MINIMUM_BITRATE, GST_TAG_FLAG_ENCODED, - G_TYPE_UINT, _("minimum bitrate"), _("minimum bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_MAXIMUM_BITRATE, GST_TAG_FLAG_ENCODED, - G_TYPE_UINT, _("maximum bitrate"), _("maximum bitrate in bits/s"), NULL); - gst_tag_register (GST_TAG_ENCODER, GST_TAG_FLAG_ENCODED, - G_TYPE_STRING, - _("encoder"), _("encoder used to encode this stream"), NULL); - gst_tag_register (GST_TAG_ENCODER_VERSION, GST_TAG_FLAG_ENCODED, - G_TYPE_UINT, - _("encoder version"), - _("version of the encoder used to encode this stream"), NULL); - gst_tag_register (GST_TAG_SERIAL, GST_TAG_FLAG_ENCODED, - G_TYPE_UINT, _("serial"), _("serial number of track"), NULL); - gst_tag_register (GST_TAG_TRACK_GAIN, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("replaygain track gain"), _("track gain in db"), NULL); - gst_tag_register (GST_TAG_TRACK_PEAK, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("replaygain track peak"), _("peak of the track"), NULL); - gst_tag_register (GST_TAG_ALBUM_GAIN, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("replaygain album gain"), _("album gain in db"), NULL); - gst_tag_register (GST_TAG_ALBUM_PEAK, GST_TAG_FLAG_META, - G_TYPE_DOUBLE, _("replaygain album peak"), _("peak of the album"), NULL); - gst_tag_register (GST_TAG_LANGUAGE_CODE, GST_TAG_FLAG_META, G_TYPE_STRING, - _("language code"), - _("language code for this stream, conforming to ISO-639-1"), NULL); -} - -/** - * gst_tag_merge_use_first: - * @dest: uninitialized GValue to store result in - * @src: GValue to copy from - * - * This is a convenience function for the func argument of gst_tag_register(). - * It creates a copy of the first value from the list. - */ -void -gst_tag_merge_use_first (GValue * dest, const GValue * src) -{ - const GValue *ret = gst_value_list_get_value (src, 0); - - g_value_init (dest, G_VALUE_TYPE (ret)); - g_value_copy (ret, dest); -} - -/** - * gst_tag_merge_strings_with_comma: - * @dest: uninitialized GValue to store result in - * @src: GValue to copy from - * - * This is a convenience function for the func argument of gst_tag_register(). - * It concatenates all given strings using a comma. The tag must be registered - * as a G_TYPE_STRING or this function will fail. - */ -void -gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src) -{ - GString *str; - gint i, count; - - count = gst_value_list_get_size (src); - str = g_string_new (g_value_get_string (gst_value_list_get_value (src, 0))); - for (i = 1; i < count; i++) { - /* seperator between two string */ - str = g_string_append (str, _(", ")); - str = - g_string_append (str, g_value_get_string (gst_value_list_get_value (src, - 1))); - } - - g_value_init (dest, G_TYPE_STRING); - g_value_set_string_take_ownership (dest, str->str); - g_string_free (str, FALSE); -} -static GstTagInfo * -gst_tag_lookup (GQuark entry) -{ - GstTagInfo *ret; - - TAG_LOCK; - ret = g_hash_table_lookup (__tags, GUINT_TO_POINTER (entry)); - TAG_UNLOCK; - - return ret; -} - -/** - * gst_tag_register: - * @name: the name or identifier string - * @flag: a flag describing the type of tag info - * @type: the type this data is in - * @nick: human-readable name - * @blurb: a human-readable description about this tag - * @func: function for merging multiple values of this tag - * - * Registers a new tag type for the use with GStreamer's type system. If a type - * with that name is already registered, that one is used. - * The old registration may have used a different type however. So don't rely - * on your supplied values. - * This function takes ownership of all supplied variables. - */ -void -gst_tag_register (const gchar * name, GstTagFlag flag, GType type, - const gchar * nick, const gchar * blurb, GstTagMergeFunc func) -{ - GQuark key; - GstTagInfo *info; - - g_return_if_fail (name != NULL); - g_return_if_fail (nick != NULL); - g_return_if_fail (blurb != NULL); - g_return_if_fail (type != 0 && type != GST_TYPE_LIST); - - key = g_quark_from_string (name); - info = gst_tag_lookup (key); - - if (info) { - g_return_if_fail (info->type == type); - return; - } - - info = g_new (GstTagInfo, 1); - info->flag = flag; - info->type = type; - info->nick = g_strdup (nick); - info->blurb = g_strdup (blurb); - info->merge_func = func; - - TAG_LOCK; - g_hash_table_insert (__tags, GUINT_TO_POINTER (key), info); - TAG_UNLOCK; -} - -/** - * gst_tag_exists: - * @tag: name of the tag - * - * Checks if the given type is already registered. - * - * Returns: TRUE if the type is already registered - */ -gboolean -gst_tag_exists (const gchar * tag) -{ - g_return_val_if_fail (tag != NULL, FALSE); - - return gst_tag_lookup (g_quark_from_string (tag)) != NULL; -} - -/** - * gst_tag_get_type: - * @tag: the tag - * - * Gets the #GType used for this tag. - * - * Returns: the #GType of this tag - */ -GType -gst_tag_get_type (const gchar * tag) -{ - GstTagInfo *info; - - g_return_val_if_fail (tag != NULL, 0); - info = gst_tag_lookup (g_quark_from_string (tag)); - g_return_val_if_fail (info != NULL, 0); - - return info->type; -} - -/** - * gst_tag_get_nick - * @tag: the tag - * - * Returns the human-readable name of this tag, You must not change or free - * this string. - * - * Returns: the human-readable name of this tag - */ -const gchar * -gst_tag_get_nick (const gchar * tag) -{ - GstTagInfo *info; - - g_return_val_if_fail (tag != NULL, NULL); - info = gst_tag_lookup (g_quark_from_string (tag)); - g_return_val_if_fail (info != NULL, NULL); - - return info->nick; -} - -/** - * gst_tag_get_description: - * @tag: the tag - * - * Returns the human-readable description of this tag, You must not change or - * free this string. - * - * Returns: the human-readable description of this tag - */ -const gchar * -gst_tag_get_description (const gchar * tag) -{ - GstTagInfo *info; - - g_return_val_if_fail (tag != NULL, NULL); - info = gst_tag_lookup (g_quark_from_string (tag)); - g_return_val_if_fail (info != NULL, NULL); - - return info->blurb; -} - -/** - * gst_tag_get_flag: - * @tag: the tag - * - * Gets the flag of @tag. - * - * Returns the flag of this tag. - */ -GstTagFlag -gst_tag_get_flag (const gchar * tag) -{ - GstTagInfo *info; - - g_return_val_if_fail (tag != NULL, GST_TAG_FLAG_UNDEFINED); - info = gst_tag_lookup (g_quark_from_string (tag)); - g_return_val_if_fail (info != NULL, GST_TAG_FLAG_UNDEFINED); - - return info->flag; -} - -/** - * gst_tag_is_fixed: - * @tag: tag to check - * - * Checks if the given tag is fixed. A fixed tag can only contain one value. - * Unfixed tags can contain lists of values. - * - * Returns: TRUE, if the given tag is fixed. - */ -gboolean -gst_tag_is_fixed (const gchar * tag) -{ - GstTagInfo *info; - - g_return_val_if_fail (tag != NULL, FALSE); - info = gst_tag_lookup (g_quark_from_string (tag)); - g_return_val_if_fail (info != NULL, FALSE); - - return info->merge_func == NULL; -} - -/** - * gst_tag_list_new: - * - * Creates a new empty GstTagList. - * - * Returns: An empty tag list - */ -GstTagList * -gst_tag_list_new (void) -{ - return GST_TAG_LIST (gst_structure_new (TAGLIST, NULL)); -} - -/** - * gst_is_tag_list: - * @p: Object that might be a taglist - * - * Checks if the given pointer is a taglist. - * - * Returns: TRUE, if the given pointer is a taglist - */ -gboolean -gst_is_tag_list (gconstpointer p) -{ - g_return_val_if_fail (p != NULL, FALSE); - - return ((GstStructure *) p)->name == gst_tag_list_quark; -} -typedef struct -{ - GstStructure *list; - GstTagMergeMode mode; -} -GstTagCopyData; -static void -gst_tag_list_add_value_internal (GstStructure * list, GstTagMergeMode mode, - GQuark tag, const GValue * value) -{ - GstTagInfo *info = gst_tag_lookup (tag); - const GValue *value2; - - g_assert (info != NULL); - - if (info->merge_func - && (value2 = gst_structure_id_get_value (list, tag)) != NULL) { - GValue dest = { 0, }; - - switch (mode) { - case GST_TAG_MERGE_REPLACE_ALL: - case GST_TAG_MERGE_REPLACE: - gst_structure_id_set_value (list, tag, value); - break; - case GST_TAG_MERGE_PREPEND: - gst_value_list_concat (&dest, value, value2); - gst_structure_id_set_value (list, tag, &dest); - g_value_unset (&dest); - break; - case GST_TAG_MERGE_APPEND: - gst_value_list_concat (&dest, value2, value); - gst_structure_id_set_value (list, tag, &dest); - g_value_unset (&dest); - break; - case GST_TAG_MERGE_KEEP: - case GST_TAG_MERGE_KEEP_ALL: - break; - default: - g_assert_not_reached (); - break; - } - } else { - switch (mode) { - case GST_TAG_MERGE_APPEND: - case GST_TAG_MERGE_KEEP: - if (gst_structure_id_get_value (list, tag) != NULL) - break; - /* fall through */ - case GST_TAG_MERGE_REPLACE_ALL: - case GST_TAG_MERGE_REPLACE: - case GST_TAG_MERGE_PREPEND: - gst_structure_id_set_value (list, tag, value); - break; - case GST_TAG_MERGE_KEEP_ALL: - break; - default: - g_assert_not_reached (); - break; - } - } -} -static gboolean -gst_tag_list_copy_foreach (GQuark tag, const GValue * value, gpointer user_data) -{ - GstTagCopyData *copy = (GstTagCopyData *) user_data; - - gst_tag_list_add_value_internal (copy->list, copy->mode, tag, value); - - return TRUE; -} - -/** - * gst_tag_list_insert: - * @into: list to merge into - * @from: list to merge from - * @mode: the mode to use - * - * Inserts the tags of the second list into the first list using the given mode. - */ -void -gst_tag_list_insert (GstTagList * into, const GstTagList * from, - GstTagMergeMode mode) -{ - GstTagCopyData data; - - g_return_if_fail (GST_IS_TAG_LIST (into)); - g_return_if_fail (GST_IS_TAG_LIST (from)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - - data.list = (GstStructure *) into; - data.mode = mode; - if (mode == GST_TAG_MERGE_REPLACE_ALL) { - gst_structure_remove_all_fields (data.list); - } - gst_structure_foreach ((GstStructure *) from, gst_tag_list_copy_foreach, - &data); -} - -/** - * gst_tag_list_copy: - * @list: list to copy - * - * Copies a given #GstTagList. - * - * Returns: copy of the given list - */ -GstTagList * -gst_tag_list_copy (const GstTagList * list) -{ - g_return_val_if_fail (GST_IS_TAG_LIST (list), NULL); - - return GST_TAG_LIST (gst_structure_copy ((GstStructure *) list)); -} - -/** - * gst_tag_list_merge: - * @list1: first list to merge - * @list2: second list to merge - * @mode: the mode to use - * - * Merges the two given lists into a new list. If one of the lists is NULL, a - * copy of the other is returned. If both lists are NULL, NULL is returned. - * - * Returns: the new list - */ -GstTagList * -gst_tag_list_merge (const GstTagList * list1, const GstTagList * list2, - GstTagMergeMode mode) -{ - g_return_val_if_fail (list1 == NULL || GST_IS_TAG_LIST (list1), NULL); - g_return_val_if_fail (list2 == NULL || GST_IS_TAG_LIST (list2), NULL); - g_return_val_if_fail (GST_TAG_MODE_IS_VALID (mode), NULL); - - if (!list1 && !list2) { - return NULL; - } else if (!list1) { - return gst_tag_list_copy (list2); - } else if (!list2) { - return gst_tag_list_copy (list1); - } else { - GstTagList *ret; - - ret = gst_tag_list_copy (list1); - gst_tag_list_insert (ret, list2, mode); - return ret; - } -} - -/** - * gst_tag_list_free: - * @list: the list to free - * - * Frees the given list and all associated values. - */ -void -gst_tag_list_free (GstTagList * list) -{ - g_return_if_fail (GST_IS_TAG_LIST (list)); - gst_structure_free ((GstStructure *) list); -} - -/** - * gst_tag_list_get_tag_size: - * @list: a taglist - * @tag: the tag to query - * - * Checks how many value are stored in this tag list for the given tag. - * - * Returns: The number of tags stored - */ -guint -gst_tag_list_get_tag_size (const GstTagList * list, const gchar * tag) -{ - const GValue *value; - - g_return_val_if_fail (GST_IS_TAG_LIST (list), 0); - - value = gst_structure_get_value ((GstStructure *) list, tag); - if (value == NULL) - return 0; - if (G_VALUE_TYPE (value) != GST_TYPE_LIST) - return 1; - - return gst_value_list_get_size (value); -} - -/** - * gst_tag_list_add: - * @list: list to set tags in - * @mode: the mode to use - * @tag: tag - * @...: NULL-terminated list of values to set - * - * Sets the values for the given tags using the specified mode. - */ -void -gst_tag_list_add (GstTagList * list, GstTagMergeMode mode, const gchar * tag, - ...) -{ - va_list args; - - g_return_if_fail (GST_IS_TAG_LIST (list)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - g_return_if_fail (tag != NULL); - - va_start (args, tag); - gst_tag_list_add_valist (list, mode, tag, args); - va_end (args); -} - -/** - * gst_tag_list_add_values: - * @list: list to set tags in - * @mode: the mode to use - * @tag: tag - * @...: GValues to set - * - * Sets the GValues for the given tags using the specified mode. - */ -void -gst_tag_list_add_values (GstTagList * list, GstTagMergeMode mode, - const gchar * tag, ...) -{ - va_list args; - - g_return_if_fail (GST_IS_TAG_LIST (list)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - g_return_if_fail (tag != NULL); - - va_start (args, tag); - gst_tag_list_add_valist_values (list, mode, tag, args); - va_end (args); -} - -/** - * gst_tag_list_add_valist: - * @list: list to set tags in - * @mode: the mode to use - * @tag: tag - * @var_args: tag / value pairs to set - * - * Sets the values for the given tags using the specified mode. - */ -void -gst_tag_list_add_valist (GstTagList * list, GstTagMergeMode mode, - const gchar * tag, va_list var_args) -{ - GstTagInfo *info; - GQuark quark; - gchar *error = NULL; - - g_return_if_fail (GST_IS_TAG_LIST (list)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - g_return_if_fail (tag != NULL); - - while (tag != NULL) { - GValue value = { 0, }; - - quark = g_quark_from_string (tag); - info = gst_tag_lookup (quark); - if (info == NULL) - g_warning ("no GstTag for %s", tag); - g_return_if_fail (info != NULL); - g_value_init (&value, info->type); - G_VALUE_COLLECT (&value, var_args, 0, &error); - if (error) { - g_warning ("%s: %s", G_STRLOC, error); - g_free (error); - /* we purposely leak the value here, it might not be - * in a sane state if an error condition occoured - */ - return; - } - gst_tag_list_add_value_internal (list, mode, quark, &value); - g_value_unset (&value); - tag = va_arg (var_args, gchar *); - } -} - -/** - * gst_tag_list_add_valist_values: - * @list: list to set tags in - * @mode: the mode to use - * @tag: tag - * @var_args: tag / GValue pairs to set - * - * Sets the GValues for the given tags using the specified mode. - */ -void -gst_tag_list_add_valist_values (GstTagList * list, GstTagMergeMode mode, - const gchar * tag, va_list var_args) -{ - GstTagInfo *info; - GQuark quark; - - g_return_if_fail (GST_IS_TAG_LIST (list)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - g_return_if_fail (tag != NULL); - - while (tag != NULL) { - quark = g_quark_from_string (tag); - info = gst_tag_lookup (quark); - g_return_if_fail (info != NULL); - gst_tag_list_add_value_internal (list, mode, quark, va_arg (var_args, - GValue *)); - tag = va_arg (var_args, gchar *); - } -} - -/** - * gst_tag_list_remove_tag: - * @list: list to remove tag from - * @tag: tag to remove - * - * Removes the goven tag from the taglist. - */ -void -gst_tag_list_remove_tag (GstTagList * list, const gchar * tag) -{ - g_return_if_fail (GST_IS_TAG_LIST (list)); - g_return_if_fail (tag != NULL); - - gst_structure_remove_field ((GstStructure *) list, tag); -} -typedef struct -{ - GstTagForeachFunc func; - GstTagList *tag_list; - gpointer data; -} -TagForeachData; -static int -structure_foreach_wrapper (GQuark field_id, const GValue * value, - gpointer user_data) -{ - TagForeachData *data = (TagForeachData *) user_data; - - data->func (data->tag_list, g_quark_to_string (field_id), data->data); - return TRUE; -} - -/** - * gst_tag_list_foreach: - * @list: list to iterate over - * @func: function to be called for each tag - * @user_data: user specified data - * - * Calls the given function for each tag inside the tag list. Note that if there - * is no tag, the function won't be called at all. - */ -void -gst_tag_list_foreach (GstTagList * list, GstTagForeachFunc func, - gpointer user_data) -{ - TagForeachData data; - - g_return_if_fail (GST_IS_TAG_LIST (list)); - g_return_if_fail (func != NULL); - - data.func = func; - data.tag_list = list; - data.data = user_data; - gst_structure_foreach ((GstStructure *) list, structure_foreach_wrapper, - &data); -} - -/** - * gst_tag_list_get_value_index: - * @list: a #GStTagList - * @tag: tag to read out - * @index: number of entry to read out - * - * Gets the value that is at the given index for the given tag in the given - * list. - * - * Returns: The GValue for the specified entry or NULL if the tag wasn't - * available or the tag doesn't have as many entries - */ -G_CONST_RETURN GValue * -gst_tag_list_get_value_index (const GstTagList * list, const gchar * tag, - guint index) -{ - const GValue *value; - - g_return_val_if_fail (GST_IS_TAG_LIST (list), NULL); - g_return_val_if_fail (tag != NULL, NULL); - - value = gst_structure_get_value ((GstStructure *) list, tag); - if (value == NULL) - return NULL; - - if (GST_VALUE_HOLDS_LIST (value)) { - if (index >= gst_value_list_get_size (value)) - return NULL; - return gst_value_list_get_value (value, index); - } else { - if (index > 0) - return NULL; - return value; - } -} - -/** - * gst_tag_list_copy_value: - * @dest: uninitialized #GValue to copy into - * @list: list to get the tag from - * @tag: tag to read out - * - * Copies the contents for the given tag into the value, - * merging multiple values into one if multiple values are associated - * with the tag. - * You must g_value_unset() the value after use. - * - * Returns: TRUE, if a value was copied, FALSE if the tag didn't exist in the - * given list. - */ -gboolean -gst_tag_list_copy_value (GValue * dest, const GstTagList * list, - const gchar * tag) -{ - const GValue *src; - - g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE); - g_return_val_if_fail (tag != NULL, FALSE); - g_return_val_if_fail (dest != NULL, FALSE); - g_return_val_if_fail (G_VALUE_TYPE (dest) == 0, FALSE); - - src = gst_structure_get_value ((GstStructure *) list, tag); - if (!src) - return FALSE; - - if (G_VALUE_TYPE (src) == GST_TYPE_LIST) { - GstTagInfo *info = gst_tag_lookup (g_quark_from_string (tag)); - - /* must be there or lists aren't allowed */ - g_assert (info->merge_func); - info->merge_func (dest, src); - } else { - g_value_init (dest, G_VALUE_TYPE (src)); - g_value_copy (src, dest); - } - return TRUE; -} - -/***** evil macros to get all the gst_tag_list_get_*() functions right *****/ - -#define TAG_MERGE_FUNCS(name,type) \ -gboolean \ -gst_tag_list_get_ ## name (const GstTagList *list, const gchar *tag, \ - type *value) \ -{ \ - GValue v = { 0, }; \ - \ - g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE); \ - g_return_val_if_fail (tag != NULL, FALSE); \ - g_return_val_if_fail (value != NULL, FALSE); \ - \ - if (!gst_tag_list_copy_value (&v, list, tag)) \ - return FALSE; \ - *value = COPY_FUNC (g_value_get_ ## name (&v)); \ - g_value_unset (&v); \ - return TRUE; \ -} \ - \ -gboolean \ -gst_tag_list_get_ ## name ## _index (const GstTagList *list, \ - const gchar *tag, \ - guint index, type *value) \ -{ \ - const GValue *v; \ - \ - g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE); \ - g_return_val_if_fail (tag != NULL, FALSE); \ - g_return_val_if_fail (value != NULL, FALSE); \ - \ - if ((v = gst_tag_list_get_value_index (list, tag, index)) == NULL) \ - return FALSE; \ - *value = COPY_FUNC (g_value_get_ ## name (v)); \ - return TRUE; \ -} - -#define COPY_FUNC /**/ -TAG_MERGE_FUNCS (char, gchar) -TAG_MERGE_FUNCS (uchar, guchar) -TAG_MERGE_FUNCS (boolean, gboolean) -TAG_MERGE_FUNCS (int, gint) -TAG_MERGE_FUNCS (uint, guint) -TAG_MERGE_FUNCS (long, glong) -TAG_MERGE_FUNCS (ulong, gulong) -TAG_MERGE_FUNCS (int64, gint64) -TAG_MERGE_FUNCS (uint64, guint64) -TAG_MERGE_FUNCS (float, gfloat) -TAG_MERGE_FUNCS (double, gdouble) -TAG_MERGE_FUNCS (pointer, gpointer) -#undef COPY_FUNC -#define COPY_FUNC g_strdup -TAG_MERGE_FUNCS (string, gchar *) diff --git a/gst/gsttag.h b/gst/gsttag.h deleted file mode 100644 index cb5aea6..0000000 --- a/gst/gsttag.h +++ /dev/null @@ -1,436 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttag.h: Header for tag support - * - * 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. - */ - - -#ifndef __GST_TAG_H__ -#define __GST_TAG_H__ - -#include - -G_BEGIN_DECLS - -typedef enum { - GST_TAG_MERGE_UNDEFINED, - GST_TAG_MERGE_REPLACE_ALL, - GST_TAG_MERGE_REPLACE, - GST_TAG_MERGE_APPEND, - GST_TAG_MERGE_PREPEND, - GST_TAG_MERGE_KEEP, - GST_TAG_MERGE_KEEP_ALL, - /* add more */ - GST_TAG_MERGE_COUNT -} GstTagMergeMode; -#define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT)) - -typedef enum { - GST_TAG_FLAG_UNDEFINED, - GST_TAG_FLAG_META, - GST_TAG_FLAG_ENCODED, - GST_TAG_FLAG_DECODED, - GST_TAG_FLAG_COUNT -} GstTagFlag; -#define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT)) - -typedef GstStructure GstTagList; -#define GST_TAG_LIST(x) ((GstTagList *) (x)) -#define GST_IS_TAG_LIST(x) (gst_is_tag_list (GST_TAG_LIST (x))) -#define GST_TYPE_TAG_LIST (gst_tag_list_get_type ()) - -typedef void (* GstTagForeachFunc) (const GstTagList *list, const gchar *tag, gpointer user_data); -typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src); - -/* initialize tagging system */ -void _gst_tag_initialize (void); -GType gst_tag_list_get_type (void); - -void gst_tag_register (const gchar * name, - GstTagFlag flag, - GType type, - const gchar * nick, - const gchar * blurb, - GstTagMergeFunc func); -/* some default merging functions */ -void gst_tag_merge_use_first (GValue * dest, - const GValue * src); -void gst_tag_merge_strings_with_comma (GValue * dest, - const GValue * src); - -/* basic tag support */ -gboolean gst_tag_exists (const gchar * tag); -GType gst_tag_get_type (const gchar * tag); -G_CONST_RETURN gchar * - gst_tag_get_nick (const gchar * tag); -G_CONST_RETURN gchar * - gst_tag_get_description (const gchar * tag); -GstTagFlag gst_tag_get_flag (const gchar * tag); -gboolean gst_tag_is_fixed (const gchar * tag); - -/* tag lists */ -GstTagList * gst_tag_list_new (void); -gboolean gst_is_tag_list (gconstpointer p); -GstTagList * gst_tag_list_copy (const GstTagList * list); -void gst_tag_list_insert (GstTagList * into, - const GstTagList * from, - GstTagMergeMode mode); -GstTagList * gst_tag_list_merge (const GstTagList * list1, - const GstTagList * list2, - GstTagMergeMode mode); -void gst_tag_list_free (GstTagList * list); -guint gst_tag_list_get_tag_size (const GstTagList * list, - const gchar * tag); -void gst_tag_list_add (GstTagList * list, - GstTagMergeMode mode, - const gchar * tag, - ...); -void gst_tag_list_add_values (GstTagList * list, - GstTagMergeMode mode, - const gchar * tag, - ...); -void gst_tag_list_add_valist (GstTagList * list, - GstTagMergeMode mode, - const gchar * tag, - va_list var_args); -void gst_tag_list_add_valist_values (GstTagList * list, - GstTagMergeMode mode, - const gchar * tag, - va_list var_args); -void gst_tag_list_remove_tag (GstTagList * list, - const gchar * tag); -void gst_tag_list_foreach (GstTagList * list, - GstTagForeachFunc func, - gpointer user_data); - -G_CONST_RETURN GValue * - gst_tag_list_get_value_index (const GstTagList * list, - const gchar * tag, - guint index); -gboolean gst_tag_list_copy_value (GValue * dest, - const GstTagList * list, - const gchar * tag); - -/* simplifications (FIXME: do we want them?) */ -gboolean gst_tag_list_get_char (const GstTagList * list, - const gchar * tag, - gchar * value); -gboolean gst_tag_list_get_char_index (const GstTagList * list, - const gchar * tag, - guint index, - gchar * value); -gboolean gst_tag_list_get_uchar (const GstTagList * list, - const gchar * tag, - guchar * value); -gboolean gst_tag_list_get_uchar_index (const GstTagList * list, - const gchar * tag, - guint index, - guchar * value); -gboolean gst_tag_list_get_boolean (const GstTagList * list, - const gchar * tag, - gboolean * value); -gboolean gst_tag_list_get_boolean_index (const GstTagList * list, - const gchar * tag, - guint index, - gboolean * value); -gboolean gst_tag_list_get_int (const GstTagList * list, - const gchar * tag, - gint * value); -gboolean gst_tag_list_get_int_index (const GstTagList * list, - const gchar * tag, - guint index, - gint * value); -gboolean gst_tag_list_get_uint (const GstTagList * list, - const gchar * tag, - guint * value); -gboolean gst_tag_list_get_uint_index (const GstTagList * list, - const gchar * tag, - guint index, - guint * value); -gboolean gst_tag_list_get_long (const GstTagList * list, - const gchar * tag, - glong * value); -gboolean gst_tag_list_get_long_index (const GstTagList * list, - const gchar * tag, - guint index, - glong * value); -gboolean gst_tag_list_get_ulong (const GstTagList * list, - const gchar * tag, - gulong * value); -gboolean gst_tag_list_get_ulong_index (const GstTagList * list, - const gchar * tag, - guint index, - gulong * value); -gboolean gst_tag_list_get_int64 (const GstTagList * list, - const gchar * tag, - gint64 * value); -gboolean gst_tag_list_get_int64_index (const GstTagList * list, - const gchar * tag, - guint index, - gint64 * value); -gboolean gst_tag_list_get_uint64 (const GstTagList * list, - const gchar * tag, - guint64 * value); -gboolean gst_tag_list_get_uint64_index (const GstTagList * list, - const gchar * tag, - guint index, - guint64 * value); -gboolean gst_tag_list_get_float (const GstTagList * list, - const gchar * tag, - gfloat * value); -gboolean gst_tag_list_get_float_index (const GstTagList * list, - const gchar * tag, - guint index, - gfloat * value); -gboolean gst_tag_list_get_double (const GstTagList * list, - const gchar * tag, - gdouble * value); -gboolean gst_tag_list_get_double_index (const GstTagList * list, - const gchar * tag, - guint index, - gdouble * value); -gboolean gst_tag_list_get_string (const GstTagList * list, - const gchar * tag, - gchar ** value); -gboolean gst_tag_list_get_string_index (const GstTagList * list, - const gchar * tag, - guint index, - gchar ** value); -gboolean gst_tag_list_get_pointer (const GstTagList * list, - const gchar * tag, - gpointer * value); -gboolean gst_tag_list_get_pointer_index (const GstTagList * list, - const gchar * tag, - guint index, - gpointer * value); - -/* 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" -/** - * GST_TAG_LANGUAGE_CODE: - * - * Language code (ISO-639-1) - */ -#define GST_TAG_LANGUAGE_CODE "language-code" - -G_END_DECLS - -#endif /* __GST_EVENT_H__ */ diff --git a/gst/gsttaginterface.c b/gst/gsttaginterface.c deleted file mode 100644 index 2fae2b8..0000000 --- a/gst/gsttaginterface.c +++ /dev/null @@ -1,283 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttaginterface.c: interface for tag setting on elements - * - * 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. - */ -/** - * SECTION:gsttagsetter - * @short_description: Element interface that allows setting and retrieval of media metadata - * - */ - - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "gst_private.h" -#include "gsttaginterface.h" -#include -#include - -GST_DEBUG_CATEGORY_STATIC (gst_tag_interface_debug); -#define GST_CAT_DEFAULT tag_tag_interface_debug - -static GQuark gst_tag_key; - -typedef struct -{ - GstTagMergeMode mode; - GstTagList *list; -} -GstTagData; - -GType -gst_tag_setter_get_type (void) -{ - static GType tag_setter_type = 0; - - if (!tag_setter_type) { - static const GTypeInfo tag_setter_info = { - sizeof (GstTagSetterIFace), /* class_size */ - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - 0, - 0, - NULL - }; - - GST_DEBUG_CATEGORY_INIT (gst_tag_interface_debug, "GstTagInterface", 0, - "interfaces for tagging"); - - tag_setter_type = g_type_register_static (G_TYPE_INTERFACE, "GstTagSetter", - &tag_setter_info, 0); - - g_type_interface_add_prerequisite (tag_setter_type, GST_TYPE_ELEMENT); - - gst_tag_key = g_quark_from_static_string ("GST_TAG_SETTER"); - } - - return tag_setter_type; -} -static void -gst_tag_data_free (gpointer p) -{ - GstTagData *data = (GstTagData *) p; - - if (data->list) - gst_tag_list_free (data->list); - - g_free (data); -} -static GstTagData * -gst_tag_setter_get_data (GstTagSetter * setter) -{ - GstTagData *data; - - data = g_object_get_qdata (G_OBJECT (setter), gst_tag_key); - if (!data) { - data = g_new (GstTagData, 1); - data->list = NULL; - data->mode = GST_TAG_MERGE_KEEP; - g_object_set_qdata_full (G_OBJECT (setter), gst_tag_key, data, - gst_tag_data_free); - } - - return data; -} - -/** - * gst_tag_setter_merge: - * @setter: a #GstTagSetter - * @list: a tag list to merge from - * @mode: the mode to merge with - * - * Merges the given list into the setter's list using the given mode. - */ -void -gst_tag_setter_merge (GstTagSetter * setter, const GstTagList * list, - GstTagMergeMode mode) -{ - GstTagData *data; - - g_return_if_fail (GST_IS_TAG_SETTER (setter)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - - data = gst_tag_setter_get_data (setter); - if (!data->list) { - data->list = gst_tag_list_copy (list); - } else { - gst_tag_list_merge (data->list, list, mode); - } -} - -/** - * gst_tag_setter_add: - * @setter: a #GstTagSetter - * @mode: the mode to use - * @tag: tag to set - * @...: more tag / value pairs to set - * - * Adds the given tag / value pairs on the setter using the given merge mode. - * The list must be terminated with NULL. - */ -void -gst_tag_setter_add (GstTagSetter * setter, GstTagMergeMode mode, - const gchar * tag, ...) -{ - va_list args; - - g_return_if_fail (GST_IS_TAG_SETTER (setter)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - - va_start (args, tag); - gst_tag_setter_add_valist (setter, mode, tag, args); - va_end (args); -} - -/** - * gst_tag_setter_add_values: - * @setter: a #GstTagSetter - * @mode: the mode to use - * @tag: tag to set - * @...: more tag / GValue pairs to set - * - * Adds the given tag / GValue pairs on the setter using the given merge mode. - * The list must be terminated with NULL. - */ -void -gst_tag_setter_add_values (GstTagSetter * setter, GstTagMergeMode mode, - const gchar * tag, ...) -{ - va_list args; - - g_return_if_fail (GST_IS_TAG_SETTER (setter)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - - va_start (args, tag); - gst_tag_setter_add_valist_values (setter, mode, tag, args); - va_end (args); -} - -/** - * gst_tag_setter_add_valist: - * @setter: a #GstTagSetter - * @mode: the mode to use - * @tag: tag to set - * @var_args: tag / value pairs to set - * - * Adds the given tag / value pairs on the setter using the given merge mode. - * The list must be terminated with NULL. - */ -void -gst_tag_setter_add_valist (GstTagSetter * setter, GstTagMergeMode mode, - const gchar * tag, va_list var_args) -{ - GstTagData *data; - - g_return_if_fail (GST_IS_TAG_SETTER (setter)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - - data = gst_tag_setter_get_data (setter); - if (!data->list) - data->list = gst_tag_list_new (); - - gst_tag_list_add_valist (data->list, mode, tag, var_args); -} - -/** - * gst_tag_setter_add_valist_values: - * @setter: a #GstTagSetter - * @mode: the mode to use - * @tag: tag to set - * @var_args: tag / GValue pairs to set - * - * Adds the given tag / GValue pairs on the setter using the given merge mode. - * The list must be terminated with NULL. - */ -void -gst_tag_setter_add_valist_values (GstTagSetter * setter, GstTagMergeMode mode, - const gchar * tag, va_list var_args) -{ - GstTagData *data; - - g_return_if_fail (GST_IS_TAG_SETTER (setter)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - - data = gst_tag_setter_get_data (setter); - if (!data->list) - data->list = gst_tag_list_new (); - - gst_tag_list_add_valist_values (data->list, mode, tag, var_args); -} - -/** - * gst_tag_setter_get_list: - * @setter: a #GstTagSetter - * - * Returns the current list of tags the setter uses. The list should not be - * modified or freed. - * - * Returns: a current snapshot of the taglist used in the setter - * or NULL if none is used. - */ -G_CONST_RETURN GstTagList * -gst_tag_setter_get_list (GstTagSetter * setter) -{ - g_return_val_if_fail (GST_IS_TAG_SETTER (setter), NULL); - - return gst_tag_setter_get_data (setter)->list; -} - -/** - * gst_tag_setter_set_merge_mode: - * @setter: a #GstTagSetter - * @mode: The mode with which tags are added - * - * Sets the given merge mode that is used for adding tags from events to tags - * specified by this interface. The default is #GST_TAG_MERGE_KEEP, which keeps - * the tags by this interface and discards tags from events. - */ -void -gst_tag_setter_set_merge_mode (GstTagSetter * setter, GstTagMergeMode mode) -{ - g_return_if_fail (GST_IS_TAG_SETTER (setter)); - g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); - - gst_tag_setter_get_data (setter)->mode = mode; -} - -/** - * gst_tag_setter_get_merge_mode: - * @setter: a #GstTagSetter - * - * Queries the mode by which tags inside the setter are overwritten by tags - * from events - * - * Returns: the merge mode used inside the element. - */ -GstTagMergeMode -gst_tag_setter_get_merge_mode (GstTagSetter * setter) -{ - g_return_val_if_fail (GST_IS_TAG_SETTER (setter), FALSE); - - return gst_tag_setter_get_data (setter)->mode; -} diff --git a/gst/gsttaginterface.h b/gst/gsttaginterface.h deleted file mode 100644 index eaf4940..0000000 --- a/gst/gsttaginterface.h +++ /dev/null @@ -1,83 +0,0 @@ -/* GStreamer - * Copyright (C) 2003 Benjamin Otte - * - * gsttaginterface.h: Interfaces for tagging - * - * 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. - */ - -#ifndef __GST_TAG_INTERFACE_H__ -#define __GST_TAG_INTERFACE_H__ - -#include - -G_BEGIN_DECLS - -#define GST_TYPE_TAG_SETTER (gst_tag_setter_get_type ()) -#define GST_TAG_SETTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TAG_SETTER, GstTagSetter)) -#define GST_TAG_SETTER_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GST_TYPE_TAG_SETTER, GstTagSetter)) -#define GST_IS_TAG_SETTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TAG_SETTER)) -#define GST_TAG_SETTER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_TAG_SETTER, GstTagSetterIFace)) - -typedef struct _GstTagSetter GstTagSetter; /* Dummy typedef */ -typedef struct _GstTagSetterIFace GstTagSetterIFace; - -/* use an empty interface here to allow detection of elements using user-set - tags */ -struct _GstTagSetterIFace -{ - GTypeInterface g_iface; - - /* signals */ - - /* virtual table */ -}; - -GType gst_tag_setter_get_type (void); - -void gst_tag_setter_merge (GstTagSetter * setter, - const GstTagList * list, - GstTagMergeMode mode); -void gst_tag_setter_add (GstTagSetter * setter, - GstTagMergeMode mode, - const gchar * tag, - ...); - -void gst_tag_setter_add_values (GstTagSetter * setter, - GstTagMergeMode mode, - const gchar * tag, - ...); - -void gst_tag_setter_add_valist (GstTagSetter * setter, - GstTagMergeMode mode, - const gchar * tag, - va_list var_args); - -void gst_tag_setter_add_valist_values(GstTagSetter * setter, - GstTagMergeMode mode, - const gchar * tag, - va_list var_args); - -G_CONST_RETURN GstTagList * - gst_tag_setter_get_list (GstTagSetter * setter); - -void gst_tag_setter_set_merge_mode (GstTagSetter * setter, - GstTagMergeMode mode); -GstTagMergeMode gst_tag_setter_get_merge_mode (GstTagSetter * setter); - -G_END_DECLS - -#endif /* __GST_TAG_INTERFACE_H__ */ diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c index 3e54176..2c47ee1 100644 --- a/gst/gsttaglist.c +++ b/gst/gsttaglist.c @@ -1,7 +1,7 @@ /* GStreamer * Copyright (C) 2003 Benjamin Otte * - * gsttag.c: tag support (aka metadata) + * gsttaglist.c: tag support (aka metadata) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -30,7 +30,7 @@ #include "gst_private.h" #include "gst-i18n-lib.h" -#include "gsttag.h" +#include "gsttaglist.h" #include "gstinfo.h" #include "gstvalue.h" diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h index cb5aea6..a1b9a4f 100644 --- a/gst/gsttaglist.h +++ b/gst/gsttaglist.h @@ -1,7 +1,7 @@ /* GStreamer * Copyright (C) 2003 Benjamin Otte * - * gsttag.h: Header for tag support + * gsttaglist.h: Header for tag support * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -38,6 +38,7 @@ typedef enum { /* add more */ GST_TAG_MERGE_COUNT } GstTagMergeMode; + #define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT)) typedef enum { @@ -47,6 +48,7 @@ typedef enum { GST_TAG_FLAG_DECODED, GST_TAG_FLAG_COUNT } GstTagFlag; + #define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT)) typedef GstStructure GstTagList; diff --git a/gst/gsttagsetter.c b/gst/gsttagsetter.c index 2fae2b8..0da484c 100644 --- a/gst/gsttagsetter.c +++ b/gst/gsttagsetter.c @@ -1,7 +1,7 @@ /* GStreamer * Copyright (C) 2003 Benjamin Otte * - * gsttaginterface.c: interface for tag setting on elements + * gsttagsetter.c: interface for tag setting on elements * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -30,7 +30,7 @@ #endif #include "gst_private.h" -#include "gsttaginterface.h" +#include "gsttagsetter.h" #include #include diff --git a/gst/gsttagsetter.h b/gst/gsttagsetter.h index eaf4940..5daef14 100644 --- a/gst/gsttagsetter.h +++ b/gst/gsttagsetter.h @@ -1,7 +1,7 @@ /* GStreamer * Copyright (C) 2003 Benjamin Otte * - * gsttaginterface.h: Interfaces for tagging + * gsttagsetter.h: Interfaces for tagging * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/gst/gsttrace.c b/gst/gsttrace.c index 0e7043e..3eb1770 100644 --- a/gst/gsttrace.c +++ b/gst/gsttrace.c @@ -2,7 +2,7 @@ * Copyright (C) 1999,2000 Erik Walthinsen * 2000 Wim Taymans * - * gsttrace.c: Tracing functions (depracated) + * gsttrace.c: Tracing functions (deprecated) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -19,6 +19,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +/** + * SECTION:gsttrace + * @short_description: Tracing functionality + * + */ #ifdef HAVE_CONFIG_H diff --git a/gst/gsttrace.h b/gst/gsttrace.h index c32dbbc..fa48444 100644 --- a/gst/gsttrace.h +++ b/gst/gsttrace.h @@ -2,7 +2,7 @@ * Copyright (C) 1999,2000 Erik Walthinsen * 2000 Wim Taymans * - * gsttrace.h: Header for tracing functions (depracated) + * gsttrace.h: Header for tracing functions (deprecated) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -69,14 +69,29 @@ void _gst_trace_add_entry (GstTrace *trace, guint32 seq, void gst_trace_read_tsc (gint64 *dst); -typedef enum -{ +/** + * GstAllocTraceFlags: + * @GST_ALLOC_TRACE_LIVE: Trace number of non-freed memory + * @GST_ALLOC_TRACE_MEM_LIVE: trace pointers of unfreed memory + * + * Flags indicating which tracing feature to enable. + */ +typedef enum { GST_ALLOC_TRACE_LIVE = (1 << 0), GST_ALLOC_TRACE_MEM_LIVE = (1 << 1) } GstAllocTraceFlags; typedef struct _GstAllocTrace GstAllocTrace; +/** + * GstAllocTrace: + * @name: The name of the tracing object + * @flags: Flags for this object + * @live: counter for live memory + * @mem_live: list with pointers to unfreed memory + * + * The main tracing object + */ struct _GstAllocTrace { gchar *name; gint flags; @@ -100,7 +115,21 @@ void gst_alloc_trace_set_flags (GstAllocTrace *trace, GstAllocTraceFlags flags #ifndef GST_DISABLE_ALLOC_TRACE +/** + * gst_alloc_trace_register: + * @name: The name of the tracer object + * + * Register a new alloc tracer with the given name + */ #define gst_alloc_trace_register(name) _gst_alloc_trace_register (name); + +/** + * gst_alloc_trace_new: + * @trace: The tracer to use + * @mem: The memory allocated + * + * Use the tracer to trace a new memory allocation + */ #define gst_alloc_trace_new(trace, mem) \ G_STMT_START { \ if ((trace)->flags & GST_ALLOC_TRACE_LIVE) \ @@ -110,6 +139,13 @@ G_STMT_START { \ g_slist_prepend ((trace)->mem_live, mem); \ } G_STMT_END +/** + * gst_alloc_trace_free: + * @trace: The tracer to use + * @mem: The memory that is freed + * + * Trace a memory free operation + */ #define gst_alloc_trace_free(trace, mem) \ G_STMT_START { \ if ((trace)->flags & GST_ALLOC_TRACE_LIVE) \ diff --git a/gst/gsttrashstack.c b/gst/gsttrashstack.c index 8f011d8..e678c6b 100644 --- a/gst/gsttrashstack.c +++ b/gst/gsttrashstack.c @@ -16,6 +16,12 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +/** + * SECTION:gsttrashstack + * @short_description: + * + */ + #define GST_IMPLEMENT_INLINES 1 #define __GST_TRASH_STACK_C__