adding GstTagFlag

Original commit message from CVS:
adding GstTagFlag
This commit is contained in:
Thomas Vander Stichele 2004-01-22 13:59:57 +00:00
parent d3cc6cc4b0
commit 38d4e551fa
6 changed files with 98 additions and 64 deletions

View file

@ -1,3 +1,9 @@
2004-01-22 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gsttag.c: (_gst_tag_initialize), (gst_tag_register):
* gst/gsttag.h:
add GstTagFlag
2004-01-20 Thomas Vander Stichele <thomas at apestaart dot org> 2004-01-20 Thomas Vander Stichele <thomas at apestaart dot org>
* docs/gst/gstreamer-sections.txt: * docs/gst/gstreamer-sections.txt:

View file

@ -987,6 +987,8 @@ Is triggered whenever an error occured.
@gstelement: the object which received the signal. @gstelement: the object which received the signal.
@arg1: the error message @arg1: the error message
@arg2: @arg2:
@:
@:
@: @:
<!-- ##### SIGNAL GstElement::found-tag ##### --> <!-- ##### SIGNAL GstElement::found-tag ##### -->

View file

@ -41,6 +41,7 @@ typedef struct {
gchar * blurb; /* translated description of type */ gchar * blurb; /* translated description of type */
GstTagMergeFunc merge_func; /* functions to merge the values */ GstTagMergeFunc merge_func; /* functions to merge the values */
GstTagFlag flag; /* type of tag */
} GstTagInfo; } GstTagInfo;
#define TAGLIST "taglist" #define TAGLIST "taglist"
@ -56,147 +57,147 @@ _gst_tag_initialize (void)
gst_tag_list_quark = g_quark_from_static_string (TAGLIST); gst_tag_list_quark = g_quark_from_static_string (TAGLIST);
__tag_mutex = g_mutex_new (); __tag_mutex = g_mutex_new ();
__tags = g_hash_table_new (g_direct_hash, g_direct_equal); __tags = g_hash_table_new (g_direct_hash, g_direct_equal);
gst_tag_register (GST_TAG_TITLE, gst_tag_register (GST_TAG_TITLE, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("title"), _("title"),
_("commonly used title"), _("commonly used title"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_ARTIST, gst_tag_register (GST_TAG_ARTIST, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("artist"), _("artist"),
_("person(s) responsible for the recording"), _("person(s) responsible for the recording"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_ALBUM, gst_tag_register (GST_TAG_ALBUM, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("album"), _("album"),
_("album containing this data"), _("album containing this data"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_DATE, gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META,
G_TYPE_UINT, /* FIXME: own data type for dates? */ G_TYPE_UINT, /* FIXME: own data type for dates? */
_("date"), _("date"),
_("date the data was created (in Julian calendar days)"), _("date the data was created (in Julian calendar days)"),
NULL); NULL);
gst_tag_register (GST_TAG_GENRE, gst_tag_register (GST_TAG_GENRE, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("genre"), _("genre"),
_("genre this data belongs to"), _("genre this data belongs to"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_COMMENT, gst_tag_register (GST_TAG_COMMENT, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("comment"), _("comment"),
_("free text commenting the data"), _("free text commenting the data"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_TRACK_NUMBER, gst_tag_register (GST_TAG_TRACK_NUMBER, GST_TAG_FLAG_META,
G_TYPE_UINT, G_TYPE_UINT,
_("track number"), _("track number"),
_("track number inside a collection"), _("track number inside a collection"),
gst_tag_merge_use_first); gst_tag_merge_use_first);
gst_tag_register (GST_TAG_TRACK_COUNT, gst_tag_register (GST_TAG_TRACK_COUNT, GST_TAG_FLAG_META,
G_TYPE_UINT, G_TYPE_UINT,
_("track count"), _("track count"),
_("count of tracks inside collection this track belongs to"), _("count of tracks inside collection this track belongs to"),
gst_tag_merge_use_first); gst_tag_merge_use_first);
gst_tag_register (GST_TAG_LOCATION, gst_tag_register (GST_TAG_LOCATION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("location"), _("location"),
_("original location of file as a URI"), _("original location of file as a URI"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_DESCRIPTION, gst_tag_register (GST_TAG_DESCRIPTION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("description"), _("description"),
_("short text describing the content of the data"), _("short text describing the content of the data"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_VERSION, gst_tag_register (GST_TAG_VERSION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("version"), _("version"),
_("version of this data"), _("version of this data"),
NULL); NULL);
gst_tag_register (GST_TAG_ISRC, gst_tag_register (GST_TAG_ISRC, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("ISRC"), _("ISRC"),
_("International Standard Recording Code - see http://www.ifpi.org/isrc/"), _("International Standard Recording Code - see http://www.ifpi.org/isrc/"),
NULL); NULL);
gst_tag_register (GST_TAG_ORGANIZATION, gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("organization"), _("organization"),
_("organization"), /* FIXME */ _("organization"), /* FIXME */
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_COPYRIGHT, gst_tag_register (GST_TAG_COPYRIGHT, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("copyright"), _("copyright"),
_("copyright notice of the data"), _("copyright notice of the data"),
NULL); NULL);
gst_tag_register (GST_TAG_CONTACT, gst_tag_register (GST_TAG_CONTACT, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("contact"), _("contact"),
_("contact information"), _("contact information"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_LICENSE, gst_tag_register (GST_TAG_LICENSE, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("license"), _("license"),
_("license of data"), _("license of data"),
NULL); NULL);
gst_tag_register (GST_TAG_PERFORMER, gst_tag_register (GST_TAG_PERFORMER, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("performer"), _("performer"),
_("person(s) performing"), _("person(s) performing"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_DURATION, gst_tag_register (GST_TAG_DURATION,
G_TYPE_UINT64, G_TYPE_UINT64, GST_TAG_FLAG_DECODED,
_("duration"), _("duration"),
_("length in GStreamer time units (nanoseconds)"), _("length in GStreamer time units (nanoseconds)"),
NULL); NULL);
gst_tag_register (GST_TAG_CODEC, gst_tag_register (GST_TAG_CODEC, GST_TAG_FLAG_ENCODED,
G_TYPE_STRING, G_TYPE_STRING,
_("codec"), _("codec"),
_("codec the data is stored in"), _("codec the data is stored in"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_BITRATE, gst_tag_register (GST_TAG_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("bitrate"), _("bitrate"),
_("exact or average bitrate in bits/s"), _("exact or average bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_NOMINAL_BITRATE, gst_tag_register (GST_TAG_NOMINAL_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("nominal bitrate"), _("nominal bitrate"),
_("nominal bitrate in bits/s"), _("nominal bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_MINIMUM_BITRATE, gst_tag_register (GST_TAG_MINIMUM_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("minimum bitrate"), _("minimum bitrate"),
_("minimum bitrate in bits/s"), _("minimum bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_MAXIMUM_BITRATE, gst_tag_register (GST_TAG_MAXIMUM_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("maximum bitrate"), _("maximum bitrate"),
_("maximum bitrate in bits/s"), _("maximum bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_ENCODER_VERSION, gst_tag_register (GST_TAG_ENCODER_VERSION, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("encoder version"), _("encoder version"),
_("version of the encoder used to encode this stream"), _("version of the encoder used to encode this stream"),
NULL); NULL);
gst_tag_register (GST_TAG_SERIAL, gst_tag_register (GST_TAG_SERIAL, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("serial"), _("serial"),
_("serial number of track"), _("serial number of track"),
NULL); NULL);
gst_tag_register (GST_TAG_TRACK_GAIN, gst_tag_register (GST_TAG_TRACK_GAIN, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain track gain"), _("replaygain track gain"),
_("track gain in db"), _("track gain in db"),
NULL); NULL);
gst_tag_register (GST_TAG_TRACK_PEAK, gst_tag_register (GST_TAG_TRACK_PEAK, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain track peak"), _("replaygain track peak"),
_("peak of the track"), _("peak of the track"),
NULL); NULL);
gst_tag_register (GST_TAG_ALBUM_GAIN, gst_tag_register (GST_TAG_ALBUM_GAIN, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain album gain"), _("replaygain album gain"),
_("album gain in db"), _("album gain in db"),
NULL); NULL);
gst_tag_register (GST_TAG_ALBUM_PEAK, gst_tag_register (GST_TAG_ALBUM_PEAK, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain album peak"), _("replaygain album peak"),
_("peak of the album"), _("peak of the album"),
@ -259,6 +260,7 @@ gst_tag_lookup (GQuark entry)
/** /**
* gst_tag_register: * gst_tag_register:
* @name: the name or identifier string * @name: the name or identifier string
* @flag: a flag describing the type of tag info
* @type: the type this data is in * @type: the type this data is in
* @nick: human-readable name * @nick: human-readable name
* @blurb: a human-readable description about this tag * @blurb: a human-readable description about this tag
@ -267,13 +269,13 @@ gst_tag_lookup (GQuark entry)
* Registers a new tag type for the use with GStreamer's type system. If a type * 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. * with that name is already registered, that one is used.
* The old registration may have used a different type however. So don't rely * The old registration may have used a different type however. So don't rely
* on youre supplied values. * on your supplied values.
* If you know the type is already registered, use gst_tag_lookup instead. * If you know the type is already registered, use gst_tag_lookup instead.
* This function takes ownership of all supplied variables. * This function takes ownership of all supplied variables.
*/ */
void void
gst_tag_register (gchar *name, GType type, gchar *nick, gchar *blurb, gst_tag_register (gchar *name, GstTagFlag flag, GType type,
GstTagMergeFunc func) gchar *nick, gchar *blurb, GstTagMergeFunc func)
{ {
GQuark key; GQuark key;
GstTagInfo *info; GstTagInfo *info;
@ -288,6 +290,7 @@ gst_tag_register (gchar *name, GType type, gchar *nick, gchar *blurb,
g_return_if_fail (info == NULL); g_return_if_fail (info == NULL);
info = g_new (GstTagInfo, 1); info = g_new (GstTagInfo, 1);
info->flag = flag;
info->type = type; info->type = type;
info->nick = nick; info->nick = nick;
info->blurb = blurb; info->blurb = blurb;

View file

@ -41,6 +41,15 @@ typedef enum {
} GstTagMergeMode; } GstTagMergeMode;
#define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT)) #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; typedef GstStructure GstTagList;
#define GST_TAG_LIST(x) ((GstTagList *) (x)) #define GST_TAG_LIST(x) ((GstTagList *) (x))
#define GST_IS_TAG_LIST(x) (gst_is_tag_list (GST_TAG_LIST (x))) #define GST_IS_TAG_LIST(x) (gst_is_tag_list (GST_TAG_LIST (x)))
@ -52,6 +61,7 @@ typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
void _gst_tag_initialize (void); void _gst_tag_initialize (void);
void gst_tag_register (gchar * name, void gst_tag_register (gchar * name,
GstTagFlag flag,
GType type, GType type,
gchar * nick, gchar * nick,
gchar * blurb, gchar * blurb,

View file

@ -41,6 +41,7 @@ typedef struct {
gchar * blurb; /* translated description of type */ gchar * blurb; /* translated description of type */
GstTagMergeFunc merge_func; /* functions to merge the values */ GstTagMergeFunc merge_func; /* functions to merge the values */
GstTagFlag flag; /* type of tag */
} GstTagInfo; } GstTagInfo;
#define TAGLIST "taglist" #define TAGLIST "taglist"
@ -56,147 +57,147 @@ _gst_tag_initialize (void)
gst_tag_list_quark = g_quark_from_static_string (TAGLIST); gst_tag_list_quark = g_quark_from_static_string (TAGLIST);
__tag_mutex = g_mutex_new (); __tag_mutex = g_mutex_new ();
__tags = g_hash_table_new (g_direct_hash, g_direct_equal); __tags = g_hash_table_new (g_direct_hash, g_direct_equal);
gst_tag_register (GST_TAG_TITLE, gst_tag_register (GST_TAG_TITLE, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("title"), _("title"),
_("commonly used title"), _("commonly used title"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_ARTIST, gst_tag_register (GST_TAG_ARTIST, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("artist"), _("artist"),
_("person(s) responsible for the recording"), _("person(s) responsible for the recording"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_ALBUM, gst_tag_register (GST_TAG_ALBUM, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("album"), _("album"),
_("album containing this data"), _("album containing this data"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_DATE, gst_tag_register (GST_TAG_DATE, GST_TAG_FLAG_META,
G_TYPE_UINT, /* FIXME: own data type for dates? */ G_TYPE_UINT, /* FIXME: own data type for dates? */
_("date"), _("date"),
_("date the data was created (in Julian calendar days)"), _("date the data was created (in Julian calendar days)"),
NULL); NULL);
gst_tag_register (GST_TAG_GENRE, gst_tag_register (GST_TAG_GENRE, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("genre"), _("genre"),
_("genre this data belongs to"), _("genre this data belongs to"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_COMMENT, gst_tag_register (GST_TAG_COMMENT, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("comment"), _("comment"),
_("free text commenting the data"), _("free text commenting the data"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_TRACK_NUMBER, gst_tag_register (GST_TAG_TRACK_NUMBER, GST_TAG_FLAG_META,
G_TYPE_UINT, G_TYPE_UINT,
_("track number"), _("track number"),
_("track number inside a collection"), _("track number inside a collection"),
gst_tag_merge_use_first); gst_tag_merge_use_first);
gst_tag_register (GST_TAG_TRACK_COUNT, gst_tag_register (GST_TAG_TRACK_COUNT, GST_TAG_FLAG_META,
G_TYPE_UINT, G_TYPE_UINT,
_("track count"), _("track count"),
_("count of tracks inside collection this track belongs to"), _("count of tracks inside collection this track belongs to"),
gst_tag_merge_use_first); gst_tag_merge_use_first);
gst_tag_register (GST_TAG_LOCATION, gst_tag_register (GST_TAG_LOCATION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("location"), _("location"),
_("original location of file as a URI"), _("original location of file as a URI"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_DESCRIPTION, gst_tag_register (GST_TAG_DESCRIPTION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("description"), _("description"),
_("short text describing the content of the data"), _("short text describing the content of the data"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_VERSION, gst_tag_register (GST_TAG_VERSION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("version"), _("version"),
_("version of this data"), _("version of this data"),
NULL); NULL);
gst_tag_register (GST_TAG_ISRC, gst_tag_register (GST_TAG_ISRC, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("ISRC"), _("ISRC"),
_("International Standard Recording Code - see http://www.ifpi.org/isrc/"), _("International Standard Recording Code - see http://www.ifpi.org/isrc/"),
NULL); NULL);
gst_tag_register (GST_TAG_ORGANIZATION, gst_tag_register (GST_TAG_ORGANIZATION, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("organization"), _("organization"),
_("organization"), /* FIXME */ _("organization"), /* FIXME */
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_COPYRIGHT, gst_tag_register (GST_TAG_COPYRIGHT, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("copyright"), _("copyright"),
_("copyright notice of the data"), _("copyright notice of the data"),
NULL); NULL);
gst_tag_register (GST_TAG_CONTACT, gst_tag_register (GST_TAG_CONTACT, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("contact"), _("contact"),
_("contact information"), _("contact information"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_LICENSE, gst_tag_register (GST_TAG_LICENSE, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("license"), _("license"),
_("license of data"), _("license of data"),
NULL); NULL);
gst_tag_register (GST_TAG_PERFORMER, gst_tag_register (GST_TAG_PERFORMER, GST_TAG_FLAG_META,
G_TYPE_STRING, G_TYPE_STRING,
_("performer"), _("performer"),
_("person(s) performing"), _("person(s) performing"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_DURATION, gst_tag_register (GST_TAG_DURATION,
G_TYPE_UINT64, G_TYPE_UINT64, GST_TAG_FLAG_DECODED,
_("duration"), _("duration"),
_("length in GStreamer time units (nanoseconds)"), _("length in GStreamer time units (nanoseconds)"),
NULL); NULL);
gst_tag_register (GST_TAG_CODEC, gst_tag_register (GST_TAG_CODEC, GST_TAG_FLAG_ENCODED,
G_TYPE_STRING, G_TYPE_STRING,
_("codec"), _("codec"),
_("codec the data is stored in"), _("codec the data is stored in"),
gst_tag_merge_strings_with_comma); gst_tag_merge_strings_with_comma);
gst_tag_register (GST_TAG_BITRATE, gst_tag_register (GST_TAG_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("bitrate"), _("bitrate"),
_("exact or average bitrate in bits/s"), _("exact or average bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_NOMINAL_BITRATE, gst_tag_register (GST_TAG_NOMINAL_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("nominal bitrate"), _("nominal bitrate"),
_("nominal bitrate in bits/s"), _("nominal bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_MINIMUM_BITRATE, gst_tag_register (GST_TAG_MINIMUM_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("minimum bitrate"), _("minimum bitrate"),
_("minimum bitrate in bits/s"), _("minimum bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_MAXIMUM_BITRATE, gst_tag_register (GST_TAG_MAXIMUM_BITRATE, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("maximum bitrate"), _("maximum bitrate"),
_("maximum bitrate in bits/s"), _("maximum bitrate in bits/s"),
NULL); NULL);
gst_tag_register (GST_TAG_ENCODER_VERSION, gst_tag_register (GST_TAG_ENCODER_VERSION, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("encoder version"), _("encoder version"),
_("version of the encoder used to encode this stream"), _("version of the encoder used to encode this stream"),
NULL); NULL);
gst_tag_register (GST_TAG_SERIAL, gst_tag_register (GST_TAG_SERIAL, GST_TAG_FLAG_ENCODED,
G_TYPE_UINT, G_TYPE_UINT,
_("serial"), _("serial"),
_("serial number of track"), _("serial number of track"),
NULL); NULL);
gst_tag_register (GST_TAG_TRACK_GAIN, gst_tag_register (GST_TAG_TRACK_GAIN, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain track gain"), _("replaygain track gain"),
_("track gain in db"), _("track gain in db"),
NULL); NULL);
gst_tag_register (GST_TAG_TRACK_PEAK, gst_tag_register (GST_TAG_TRACK_PEAK, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain track peak"), _("replaygain track peak"),
_("peak of the track"), _("peak of the track"),
NULL); NULL);
gst_tag_register (GST_TAG_ALBUM_GAIN, gst_tag_register (GST_TAG_ALBUM_GAIN, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain album gain"), _("replaygain album gain"),
_("album gain in db"), _("album gain in db"),
NULL); NULL);
gst_tag_register (GST_TAG_ALBUM_PEAK, gst_tag_register (GST_TAG_ALBUM_PEAK, GST_TAG_FLAG_META,
G_TYPE_DOUBLE, G_TYPE_DOUBLE,
_("replaygain album peak"), _("replaygain album peak"),
_("peak of the album"), _("peak of the album"),
@ -259,6 +260,7 @@ gst_tag_lookup (GQuark entry)
/** /**
* gst_tag_register: * gst_tag_register:
* @name: the name or identifier string * @name: the name or identifier string
* @flag: a flag describing the type of tag info
* @type: the type this data is in * @type: the type this data is in
* @nick: human-readable name * @nick: human-readable name
* @blurb: a human-readable description about this tag * @blurb: a human-readable description about this tag
@ -267,13 +269,13 @@ gst_tag_lookup (GQuark entry)
* Registers a new tag type for the use with GStreamer's type system. If a type * 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. * with that name is already registered, that one is used.
* The old registration may have used a different type however. So don't rely * The old registration may have used a different type however. So don't rely
* on youre supplied values. * on your supplied values.
* If you know the type is already registered, use gst_tag_lookup instead. * If you know the type is already registered, use gst_tag_lookup instead.
* This function takes ownership of all supplied variables. * This function takes ownership of all supplied variables.
*/ */
void void
gst_tag_register (gchar *name, GType type, gchar *nick, gchar *blurb, gst_tag_register (gchar *name, GstTagFlag flag, GType type,
GstTagMergeFunc func) gchar *nick, gchar *blurb, GstTagMergeFunc func)
{ {
GQuark key; GQuark key;
GstTagInfo *info; GstTagInfo *info;
@ -288,6 +290,7 @@ gst_tag_register (gchar *name, GType type, gchar *nick, gchar *blurb,
g_return_if_fail (info == NULL); g_return_if_fail (info == NULL);
info = g_new (GstTagInfo, 1); info = g_new (GstTagInfo, 1);
info->flag = flag;
info->type = type; info->type = type;
info->nick = nick; info->nick = nick;
info->blurb = blurb; info->blurb = blurb;

View file

@ -41,6 +41,15 @@ typedef enum {
} GstTagMergeMode; } GstTagMergeMode;
#define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT)) #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; typedef GstStructure GstTagList;
#define GST_TAG_LIST(x) ((GstTagList *) (x)) #define GST_TAG_LIST(x) ((GstTagList *) (x))
#define GST_IS_TAG_LIST(x) (gst_is_tag_list (GST_TAG_LIST (x))) #define GST_IS_TAG_LIST(x) (gst_is_tag_list (GST_TAG_LIST (x)))
@ -52,6 +61,7 @@ typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
void _gst_tag_initialize (void); void _gst_tag_initialize (void);
void gst_tag_register (gchar * name, void gst_tag_register (gchar * name,
GstTagFlag flag,
GType type, GType type,
gchar * nick, gchar * nick,
gchar * blurb, gchar * blurb,