2 * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
4 * gsttaglist.h: Header for tag support
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #ifndef __GST_TAGLIST_H__
24 #define __GST_TAGLIST_H__
26 #include <gst/gstbuffer.h>
27 #include <gst/gststructure.h>
28 #include <gst/glib-compat.h>
34 * @GST_TAG_MERGE_UNDEFINED: undefined merge mode
35 * @GST_TAG_MERGE_REPLACE_ALL: replace all tags (clear list and append)
36 * @GST_TAG_MERGE_REPLACE: replace tags
37 * @GST_TAG_MERGE_APPEND: append tags
38 * @GST_TAG_MERGE_PREPEND: prepend tags
39 * @GST_TAG_MERGE_KEEP: keep existing tags
40 * @GST_TAG_MERGE_KEEP_ALL: keep all existing tags
41 * @GST_TAG_MERGE_COUNT: the number of merge modes
43 * The different tag merging modes are basically replace, overwrite and append,
44 * but they can be seen from two directions. Given two taglists: (A) the tags
45 * already in the element and (B) the ones that are supplied to the element (
46 * e.g. via gst_tag_setter_merge_tags() / gst_tag_setter_add_tags() or a
47 * %GST_EVENT_TAG), how are these tags merged?
48 * In the table below this is shown for the cases that a tag exists in the list
49 * (A) or does not exists (!A) and combinations thereof.
51 * <table frame="all" colsep="1" rowsep="1">
52 * <title>merge mode</title>
53 * <tgroup cols='5' align='left'>
56 * <entry>merge mode</entry>
57 * <entry>A + B</entry>
58 * <entry>A + !B</entry>
59 * <entry>!A + B</entry>
60 * <entry>!A + !B</entry>
65 * <entry>REPLACE_ALL</entry>
72 * <entry>REPLACE</entry>
79 * <entry>APPEND</entry>
86 * <entry>PREPEND</entry>
100 * <entry>KEEP_ALL</entry>
111 GST_TAG_MERGE_UNDEFINED,
112 GST_TAG_MERGE_REPLACE_ALL,
113 GST_TAG_MERGE_REPLACE,
114 GST_TAG_MERGE_APPEND,
115 GST_TAG_MERGE_PREPEND,
117 GST_TAG_MERGE_KEEP_ALL,
122 #define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
126 * @GST_TAG_FLAG_UNDEFINED: undefined flag
127 * @GST_TAG_FLAG_META: tag is meta data
128 * @GST_TAG_FLAG_ENCODED: tag is encoded
129 * @GST_TAG_FLAG_DECODED: tag is decoded
130 * @GST_TAG_FLAG_COUNT: number of tag flags
132 * Extra tag flags used when registering tags.
135 GST_TAG_FLAG_UNDEFINED,
137 GST_TAG_FLAG_ENCODED,
138 GST_TAG_FLAG_DECODED,
142 #define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
147 * Opaque #GstTagList data structure.
149 typedef GstStructure GstTagList;
150 #define GST_TAG_LIST(x) ((GstTagList *) (x))
151 #define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
152 #define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
156 * @list: the #GstTagList
157 * @tag: a name of a tag in @list
158 * @user_data: user data
160 * A function that will be called in gst_tag_list_foreach(). The function may
161 * not modify the tag list.
163 typedef void (*GstTagForeachFunc) (const GstTagList * list,
169 * @dest: the destination #GValue
170 * @src: the source #GValue
172 * A function for merging multiple values of a tag used when registering
175 typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
177 GType gst_tag_list_get_type (void);
179 /* tag registration */
180 void gst_tag_register (const gchar * name,
185 GstTagMergeFunc func);
187 /* some default merging functions */
188 void gst_tag_merge_use_first (GValue * dest, const GValue * src);
189 void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
191 /* basic tag support */
192 gboolean gst_tag_exists (const gchar * tag);
193 GType gst_tag_get_type (const gchar * tag);
194 G_CONST_RETURN gchar * gst_tag_get_nick (const gchar * tag);
195 G_CONST_RETURN gchar * gst_tag_get_description (const gchar * tag);
196 GstTagFlag gst_tag_get_flag (const gchar * tag);
197 gboolean gst_tag_is_fixed (const gchar * tag);
200 GstTagList * gst_tag_list_new (void);
201 GstTagList * gst_tag_list_new_full (const gchar * tag, ...);
202 GstTagList * gst_tag_list_new_full_valist (va_list var_args);
204 gboolean gst_is_tag_list (gconstpointer p);
205 GstTagList * gst_tag_list_copy (const GstTagList * list);
206 gboolean gst_tag_list_is_empty (const GstTagList * list);
207 void gst_tag_list_insert (GstTagList * into,
208 const GstTagList * from,
209 GstTagMergeMode mode);
210 GstTagList * gst_tag_list_merge (const GstTagList * list1,
211 const GstTagList * list2,
212 GstTagMergeMode mode);
213 void gst_tag_list_free (GstTagList * list);
214 guint gst_tag_list_get_tag_size (const GstTagList * list,
216 void gst_tag_list_add (GstTagList * list,
217 GstTagMergeMode mode,
219 ...) G_GNUC_NULL_TERMINATED;
220 void gst_tag_list_add_values (GstTagList * list,
221 GstTagMergeMode mode,
223 ...) G_GNUC_NULL_TERMINATED;
224 void gst_tag_list_add_valist (GstTagList * list,
225 GstTagMergeMode mode,
228 void gst_tag_list_add_valist_values (GstTagList * list,
229 GstTagMergeMode mode,
232 void gst_tag_list_add_value (GstTagList * list,
233 GstTagMergeMode mode,
235 const GValue * value);
236 void gst_tag_list_remove_tag (GstTagList * list,
238 void gst_tag_list_foreach (const GstTagList * list,
239 GstTagForeachFunc func,
242 G_CONST_RETURN GValue *
243 gst_tag_list_get_value_index (const GstTagList * list,
246 gboolean gst_tag_list_copy_value (GValue * dest,
247 const GstTagList * list,
250 /* simplifications (FIXME: do we want them?) */
251 gboolean gst_tag_list_get_char (const GstTagList * list,
254 gboolean gst_tag_list_get_char_index (const GstTagList * list,
258 gboolean gst_tag_list_get_uchar (const GstTagList * list,
261 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
265 gboolean gst_tag_list_get_boolean (const GstTagList * list,
268 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
272 gboolean gst_tag_list_get_int (const GstTagList * list,
275 gboolean gst_tag_list_get_int_index (const GstTagList * list,
279 gboolean gst_tag_list_get_uint (const GstTagList * list,
282 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
286 gboolean gst_tag_list_get_long (const GstTagList * list,
289 gboolean gst_tag_list_get_long_index (const GstTagList * list,
293 gboolean gst_tag_list_get_ulong (const GstTagList * list,
296 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
300 gboolean gst_tag_list_get_int64 (const GstTagList * list,
303 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
307 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
310 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
314 gboolean gst_tag_list_get_float (const GstTagList * list,
317 gboolean gst_tag_list_get_float_index (const GstTagList * list,
321 gboolean gst_tag_list_get_double (const GstTagList * list,
324 gboolean gst_tag_list_get_double_index (const GstTagList * list,
328 gboolean gst_tag_list_get_string (const GstTagList * list,
331 gboolean gst_tag_list_get_string_index (const GstTagList * list,
335 gboolean gst_tag_list_get_pointer (const GstTagList * list,
338 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
342 gboolean gst_tag_list_get_date (const GstTagList * list,
345 gboolean gst_tag_list_get_date_index (const GstTagList * list,
349 gboolean gst_tag_list_get_buffer (const GstTagList * list,
352 gboolean gst_tag_list_get_buffer_index (const GstTagList * list,
357 /* GStreamer core tags */
361 * commonly used title (string)
363 * The title as it should be displayed, e.g. 'The Doll House'
365 #define GST_TAG_TITLE "title"
367 * GST_TAG_TITLE_SORTNAME:
369 * commonly used title, as used for sorting (string)
371 * The title as it should be sorted, e.g. 'Doll House, The'
375 #define GST_TAG_TITLE_SORTNAME "title-sortname"
379 * person(s) responsible for the recording (string)
381 * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
382 * 'The Guitar Heroes'
384 #define GST_TAG_ARTIST "artist"
386 * GST_TAG_ARTIST_SORTNAME:
388 * person(s) responsible for the recording, as used for sorting (string)
390 * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
391 * 'Guitar Heroes, The'
395 /* FIXME 0.11: change to "artist-sortname" */
396 #define GST_TAG_ARTIST_SORTNAME "musicbrainz-sortname"
400 * album containing this data (string)
402 * The album name as it should be displayed, e.g. 'The Jazz Guitar'
404 #define GST_TAG_ALBUM "album"
406 * GST_TAG_ALBUM_SORTNAME:
408 * album containing this data, as used for sorting (string)
410 * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
414 #define GST_TAG_ALBUM_SORTNAME "album-sortname"
416 * GST_TAG_ALBUM_ARTIST
418 * The artist of the entire album, as it should be displayed.
422 #define GST_TAG_ALBUM_ARTIST "album-artist"
424 * GST_TAG_ALBUM_ARTIST_SORTNAME
426 * The artist of the entire album, as it should be sorted.
430 #define GST_TAG_ALBUM_ARTIST_SORTNAME "album-artist-sortname"
434 * person(s) who composed the recording (string)
438 #define GST_TAG_COMPOSER "composer"
442 * date the data was created (#GDate structure)
444 #define GST_TAG_DATE "date"
448 * genre this data belongs to (string)
450 #define GST_TAG_GENRE "genre"
454 * free text commenting the data (string)
456 #define GST_TAG_COMMENT "comment"
458 * GST_TAG_EXTENDED_COMMENT:
460 * key/value text commenting the data (string)
462 * Must be in the form of 'key=comment' or
463 * 'key[lc]=comment' where 'lc' is an ISO-639
466 * This tag is used for unknown Vorbis comment tags,
467 * unknown APE tags and certain ID3v2 comment fields.
471 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
473 * GST_TAG_TRACK_NUMBER:
475 * track number inside a collection (unsigned integer)
477 #define GST_TAG_TRACK_NUMBER "track-number"
479 * GST_TAG_TRACK_COUNT:
481 * count of tracks inside collection this track belongs to (unsigned integer)
483 #define GST_TAG_TRACK_COUNT "track-count"
485 * GST_TAG_ALBUM_VOLUME_NUMBER:
487 * disc number inside a collection (unsigned integer)
489 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
491 * GST_TAG_ALBUM_VOLUME_COUNT:
493 * count of discs inside collection this disc belongs to (unsigned integer)
495 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
499 * Origin of media as a URI (location, where the original of the file or stream
500 * is hosted) (string)
502 #define GST_TAG_LOCATION "location"
506 * Homepage for this media (i.e. artist or movie homepage) (string)
510 #define GST_TAG_HOMEPAGE "homepage"
512 * GST_TAG_DESCRIPTION:
514 * short text describing the content of the data (string)
516 #define GST_TAG_DESCRIPTION "description"
520 * version of this data (string)
522 #define GST_TAG_VERSION "version"
526 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
528 #define GST_TAG_ISRC "isrc"
530 * GST_TAG_ORGANIZATION:
532 * organization (string)
534 #define GST_TAG_ORGANIZATION "organization"
538 * copyright notice of the data (string)
540 #define GST_TAG_COPYRIGHT "copyright"
542 * GST_TAG_COPYRIGHT_URI:
544 * URI to location where copyright details can be found (string)
548 #define GST_TAG_COPYRIGHT_URI "copyright-uri"
552 * contact information (string)
554 #define GST_TAG_CONTACT "contact"
558 * license of data (string)
560 #define GST_TAG_LICENSE "license"
562 * GST_TAG_LICENSE_URI:
564 * URI to location where license details can be found (string)
568 #define GST_TAG_LICENSE_URI "license-uri"
572 * person(s) performing (string)
574 #define GST_TAG_PERFORMER "performer"
578 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
580 #define GST_TAG_DURATION "duration"
584 * codec the data is stored in (string)
586 #define GST_TAG_CODEC "codec"
588 * GST_TAG_VIDEO_CODEC:
590 * codec the video data is stored in (string)
592 #define GST_TAG_VIDEO_CODEC "video-codec"
594 * GST_TAG_AUDIO_CODEC:
596 * codec the audio data is stored in (string)
598 #define GST_TAG_AUDIO_CODEC "audio-codec"
600 * GST_TAG_SUBTITLE_CODEC:
602 * codec/format the subtitle data is stored in (string)
606 #define GST_TAG_SUBTITLE_CODEC "subtitle-codec"
608 * GST_TAG_CONTAINER_FORMAT:
610 * container format the data is stored in (string)
614 #define GST_TAG_CONTAINER_FORMAT "container-format"
618 * exact or average bitrate in bits/s (unsigned integer)
620 #define GST_TAG_BITRATE "bitrate"
622 * GST_TAG_NOMINAL_BITRATE:
624 * nominal bitrate in bits/s (unsigned integer)
626 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
628 * GST_TAG_MINIMUM_BITRATE:
630 * minimum bitrate in bits/s (unsigned integer)
632 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
634 * GST_TAG_MAXIMUM_BITRATE:
636 * maximum bitrate in bits/s (unsigned integer)
638 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
642 * serial number of track (unsigned integer)
644 #define GST_TAG_SERIAL "serial"
648 * encoder used to encode this stream (string)
650 #define GST_TAG_ENCODER "encoder"
652 * GST_TAG_ENCODER_VERSION:
654 * version of the encoder used to encode this stream (unsigned integer)
656 #define GST_TAG_ENCODER_VERSION "encoder-version"
658 * GST_TAG_TRACK_GAIN:
660 * track gain in db (double)
662 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
664 * GST_TAG_TRACK_PEAK:
666 * peak of the track (double)
668 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
670 * GST_TAG_ALBUM_GAIN:
672 * album gain in db (double)
674 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
676 * GST_TAG_ALBUM_PEAK:
678 * peak of the album (double)
680 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
682 * GST_TAG_REFERENCE_LEVEL:
684 * reference level of track and album gain values (double)
688 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
690 * GST_TAG_LANGUAGE_CODE:
692 * Language code (ISO-639-1) (string) of the content
694 #define GST_TAG_LANGUAGE_CODE "language-code"
698 * image (buffer) (buffer caps should specify the content type and preferably
699 * also set "image-type" field as #GstTagImageType)
703 #define GST_TAG_IMAGE "image"
705 * GST_TAG_PREVIEW_IMAGE:
707 * image that is meant for preview purposes, e.g. small icon-sized version
708 * (buffer) (buffer caps should specify the content type)
712 #define GST_TAG_PREVIEW_IMAGE "preview-image"
715 * GST_TAG_ATTACHMENT:
717 * generic file attachment (buffer) (buffer caps should specify the content
718 * type and if possible set "filename" to the file name of the
723 #define GST_TAG_ATTACHMENT "attachment"
726 * GST_TAG_BEATS_PER_MINUTE:
728 * number of beats per minute in audio (double)
732 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
737 * comma separated keywords describing the content (string).
741 #define GST_TAG_KEYWORDS "keywords"
744 * GST_TAG_GEO_LOCATION_NAME:
746 * human readable descriptive location of where the media has been recorded or
747 * produced. (string).
751 #define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
754 * GST_TAG_GEO_LOCATION_LATITUDE:
756 * geo latitude location of where the media has been recorded or produced in
757 * degrees according to WGS84 (zero at the equator, negative values for southern
758 * latitudes) (double).
762 #define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
765 * GST_TAG_GEO_LOCATION_LONGITUDE:
767 * geo longitude location of where the media has been recorded or produced in
768 * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
769 * negative values for western longitudes). (double).
773 #define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
776 * GST_TAG_GEO_LOCATION_ELEVATION:
778 * geo elevation of where the media has been recorded or produced in meters
779 * according to WGS84 (zero is average sea level) (double).
783 #define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
787 #endif /* __GST_TAGLIST_H__ */