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))
144 /* FIXME 0.11: Don't typedef GstTagList to be a GstStructure, they're
145 * internally the same but not from an API point of view.
151 * Opaque #GstTagList data structure.
153 #ifdef IN_GOBJECT_INTROSPECTION
154 typedef struct _GstTagList GstTagList;
156 typedef GstStructure GstTagList;
159 #define GST_TAG_LIST(x) ((GstTagList *) (x))
160 #define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
161 #define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
165 * @list: the #GstTagList
166 * @tag: a name of a tag in @list
167 * @user_data: user data
169 * A function that will be called in gst_tag_list_foreach(). The function may
170 * not modify the tag list.
172 typedef void (*GstTagForeachFunc) (const GstTagList * list,
178 * @dest: the destination #GValue
179 * @src: the source #GValue
181 * A function for merging multiple values of a tag used when registering
184 typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
186 GType gst_tag_list_get_type (void);
188 /* tag registration */
189 void gst_tag_register (const gchar * name,
194 GstTagMergeFunc func);
196 /* some default merging functions */
197 void gst_tag_merge_use_first (GValue * dest, const GValue * src);
198 void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
200 /* basic tag support */
201 gboolean gst_tag_exists (const gchar * tag);
202 GType gst_tag_get_type (const gchar * tag);
203 G_CONST_RETURN gchar * gst_tag_get_nick (const gchar * tag);
204 G_CONST_RETURN gchar * gst_tag_get_description (const gchar * tag);
205 GstTagFlag gst_tag_get_flag (const gchar * tag);
206 gboolean gst_tag_is_fixed (const gchar * tag);
209 GstTagList * gst_tag_list_new (void);
210 GstTagList * gst_tag_list_new_full (const gchar * tag, ...);
211 GstTagList * gst_tag_list_new_full_valist (va_list var_args);
213 gboolean gst_is_tag_list (gconstpointer p);
214 GstTagList * gst_tag_list_copy (const GstTagList * list);
215 gboolean gst_tag_list_is_empty (const GstTagList * list);
216 void gst_tag_list_insert (GstTagList * into,
217 const GstTagList * from,
218 GstTagMergeMode mode);
219 GstTagList * gst_tag_list_merge (const GstTagList * list1,
220 const GstTagList * list2,
221 GstTagMergeMode mode);
222 void gst_tag_list_free (GstTagList * list);
223 guint gst_tag_list_get_tag_size (const GstTagList * list,
225 void gst_tag_list_add (GstTagList * list,
226 GstTagMergeMode mode,
228 ...) G_GNUC_NULL_TERMINATED;
229 void gst_tag_list_add_values (GstTagList * list,
230 GstTagMergeMode mode,
232 ...) G_GNUC_NULL_TERMINATED;
233 void gst_tag_list_add_valist (GstTagList * list,
234 GstTagMergeMode mode,
237 void gst_tag_list_add_valist_values (GstTagList * list,
238 GstTagMergeMode mode,
241 void gst_tag_list_add_value (GstTagList * list,
242 GstTagMergeMode mode,
244 const GValue * value);
245 void gst_tag_list_remove_tag (GstTagList * list,
247 void gst_tag_list_foreach (const GstTagList * list,
248 GstTagForeachFunc func,
251 G_CONST_RETURN GValue *
252 gst_tag_list_get_value_index (const GstTagList * list,
255 gboolean gst_tag_list_copy_value (GValue * dest,
256 const GstTagList * list,
259 /* simplifications (FIXME: do we want them?) */
260 gboolean gst_tag_list_get_char (const GstTagList * list,
263 gboolean gst_tag_list_get_char_index (const GstTagList * list,
267 gboolean gst_tag_list_get_uchar (const GstTagList * list,
270 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
274 gboolean gst_tag_list_get_boolean (const GstTagList * list,
277 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
281 gboolean gst_tag_list_get_int (const GstTagList * list,
284 gboolean gst_tag_list_get_int_index (const GstTagList * list,
288 gboolean gst_tag_list_get_uint (const GstTagList * list,
291 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
295 gboolean gst_tag_list_get_long (const GstTagList * list,
298 gboolean gst_tag_list_get_long_index (const GstTagList * list,
302 gboolean gst_tag_list_get_ulong (const GstTagList * list,
305 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
309 gboolean gst_tag_list_get_int64 (const GstTagList * list,
312 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
316 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
319 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
323 gboolean gst_tag_list_get_float (const GstTagList * list,
326 gboolean gst_tag_list_get_float_index (const GstTagList * list,
330 gboolean gst_tag_list_get_double (const GstTagList * list,
333 gboolean gst_tag_list_get_double_index (const GstTagList * list,
337 gboolean gst_tag_list_get_string (const GstTagList * list,
340 gboolean gst_tag_list_get_string_index (const GstTagList * list,
344 gboolean gst_tag_list_get_pointer (const GstTagList * list,
347 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
351 gboolean gst_tag_list_get_date (const GstTagList * list,
354 gboolean gst_tag_list_get_date_index (const GstTagList * list,
358 gboolean gst_tag_list_get_buffer (const GstTagList * list,
361 gboolean gst_tag_list_get_buffer_index (const GstTagList * list,
366 /* GStreamer core tags */
370 * commonly used title (string)
372 * The title as it should be displayed, e.g. 'The Doll House'
374 #define GST_TAG_TITLE "title"
376 * GST_TAG_TITLE_SORTNAME:
378 * commonly used title, as used for sorting (string)
380 * The title as it should be sorted, e.g. 'Doll House, The'
384 #define GST_TAG_TITLE_SORTNAME "title-sortname"
388 * person(s) responsible for the recording (string)
390 * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
391 * 'The Guitar Heroes'
393 #define GST_TAG_ARTIST "artist"
395 * GST_TAG_ARTIST_SORTNAME:
397 * person(s) responsible for the recording, as used for sorting (string)
399 * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
400 * 'Guitar Heroes, The'
404 /* FIXME 0.11: change to "artist-sortname" */
405 #define GST_TAG_ARTIST_SORTNAME "musicbrainz-sortname"
409 * album containing this data (string)
411 * The album name as it should be displayed, e.g. 'The Jazz Guitar'
413 #define GST_TAG_ALBUM "album"
415 * GST_TAG_ALBUM_SORTNAME:
417 * album containing this data, as used for sorting (string)
419 * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
423 #define GST_TAG_ALBUM_SORTNAME "album-sortname"
425 * GST_TAG_ALBUM_ARTIST
427 * The artist of the entire album, as it should be displayed.
431 #define GST_TAG_ALBUM_ARTIST "album-artist"
433 * GST_TAG_ALBUM_ARTIST_SORTNAME
435 * The artist of the entire album, as it should be sorted.
439 #define GST_TAG_ALBUM_ARTIST_SORTNAME "album-artist-sortname"
443 * person(s) who composed the recording (string)
447 #define GST_TAG_COMPOSER "composer"
451 * date the data was created (#GDate structure)
453 #define GST_TAG_DATE "date"
457 * genre this data belongs to (string)
459 #define GST_TAG_GENRE "genre"
463 * free text commenting the data (string)
465 #define GST_TAG_COMMENT "comment"
467 * GST_TAG_EXTENDED_COMMENT:
469 * key/value text commenting the data (string)
471 * Must be in the form of 'key=comment' or
472 * 'key[lc]=comment' where 'lc' is an ISO-639
475 * This tag is used for unknown Vorbis comment tags,
476 * unknown APE tags and certain ID3v2 comment fields.
480 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
482 * GST_TAG_TRACK_NUMBER:
484 * track number inside a collection (unsigned integer)
486 #define GST_TAG_TRACK_NUMBER "track-number"
488 * GST_TAG_TRACK_COUNT:
490 * count of tracks inside collection this track belongs to (unsigned integer)
492 #define GST_TAG_TRACK_COUNT "track-count"
494 * GST_TAG_ALBUM_VOLUME_NUMBER:
496 * disc number inside a collection (unsigned integer)
498 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
500 * GST_TAG_ALBUM_VOLUME_COUNT:
502 * count of discs inside collection this disc belongs to (unsigned integer)
504 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
508 * Origin of media as a URI (location, where the original of the file or stream
509 * is hosted) (string)
511 #define GST_TAG_LOCATION "location"
515 * Homepage for this media (i.e. artist or movie homepage) (string)
519 #define GST_TAG_HOMEPAGE "homepage"
521 * GST_TAG_DESCRIPTION:
523 * short text describing the content of the data (string)
525 #define GST_TAG_DESCRIPTION "description"
529 * version of this data (string)
531 #define GST_TAG_VERSION "version"
535 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
537 #define GST_TAG_ISRC "isrc"
539 * GST_TAG_ORGANIZATION:
541 * organization (string)
543 #define GST_TAG_ORGANIZATION "organization"
547 * copyright notice of the data (string)
549 #define GST_TAG_COPYRIGHT "copyright"
551 * GST_TAG_COPYRIGHT_URI:
553 * URI to location where copyright details can be found (string)
557 #define GST_TAG_COPYRIGHT_URI "copyright-uri"
561 * contact information (string)
563 #define GST_TAG_CONTACT "contact"
567 * license of data (string)
569 #define GST_TAG_LICENSE "license"
571 * GST_TAG_LICENSE_URI:
573 * URI to location where license details can be found (string)
577 #define GST_TAG_LICENSE_URI "license-uri"
581 * person(s) performing (string)
583 #define GST_TAG_PERFORMER "performer"
587 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
589 #define GST_TAG_DURATION "duration"
593 * codec the data is stored in (string)
595 #define GST_TAG_CODEC "codec"
597 * GST_TAG_VIDEO_CODEC:
599 * codec the video data is stored in (string)
601 #define GST_TAG_VIDEO_CODEC "video-codec"
603 * GST_TAG_AUDIO_CODEC:
605 * codec the audio data is stored in (string)
607 #define GST_TAG_AUDIO_CODEC "audio-codec"
609 * GST_TAG_SUBTITLE_CODEC:
611 * codec/format the subtitle data is stored in (string)
615 #define GST_TAG_SUBTITLE_CODEC "subtitle-codec"
617 * GST_TAG_CONTAINER_FORMAT:
619 * container format the data is stored in (string)
623 #define GST_TAG_CONTAINER_FORMAT "container-format"
627 * exact or average bitrate in bits/s (unsigned integer)
629 #define GST_TAG_BITRATE "bitrate"
631 * GST_TAG_NOMINAL_BITRATE:
633 * nominal bitrate in bits/s (unsigned integer)
635 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
637 * GST_TAG_MINIMUM_BITRATE:
639 * minimum bitrate in bits/s (unsigned integer)
641 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
643 * GST_TAG_MAXIMUM_BITRATE:
645 * maximum bitrate in bits/s (unsigned integer)
647 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
651 * serial number of track (unsigned integer)
653 #define GST_TAG_SERIAL "serial"
657 * encoder used to encode this stream (string)
659 #define GST_TAG_ENCODER "encoder"
661 * GST_TAG_ENCODER_VERSION:
663 * version of the encoder used to encode this stream (unsigned integer)
665 #define GST_TAG_ENCODER_VERSION "encoder-version"
667 * GST_TAG_TRACK_GAIN:
669 * track gain in db (double)
671 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
673 * GST_TAG_TRACK_PEAK:
675 * peak of the track (double)
677 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
679 * GST_TAG_ALBUM_GAIN:
681 * album gain in db (double)
683 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
685 * GST_TAG_ALBUM_PEAK:
687 * peak of the album (double)
689 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
691 * GST_TAG_REFERENCE_LEVEL:
693 * reference level of track and album gain values (double)
697 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
699 * GST_TAG_LANGUAGE_CODE:
701 * Language code (ISO-639-1) (string) of the content
703 #define GST_TAG_LANGUAGE_CODE "language-code"
707 * image (buffer) (buffer caps should specify the content type and preferably
708 * also set "image-type" field as #GstTagImageType)
712 #define GST_TAG_IMAGE "image"
714 * GST_TAG_PREVIEW_IMAGE:
716 * image that is meant for preview purposes, e.g. small icon-sized version
717 * (buffer) (buffer caps should specify the content type)
721 #define GST_TAG_PREVIEW_IMAGE "preview-image"
724 * GST_TAG_ATTACHMENT:
726 * generic file attachment (buffer) (buffer caps should specify the content
727 * type and if possible set "filename" to the file name of the
732 #define GST_TAG_ATTACHMENT "attachment"
735 * GST_TAG_BEATS_PER_MINUTE:
737 * number of beats per minute in audio (double)
741 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
746 * comma separated keywords describing the content (string).
750 #define GST_TAG_KEYWORDS "keywords"
753 * GST_TAG_GEO_LOCATION_NAME:
755 * human readable descriptive location of where the media has been recorded or
756 * produced. (string).
760 #define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
763 * GST_TAG_GEO_LOCATION_LATITUDE:
765 * geo latitude location of where the media has been recorded or produced in
766 * degrees according to WGS84 (zero at the equator, negative values for southern
767 * latitudes) (double).
771 #define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
774 * GST_TAG_GEO_LOCATION_LONGITUDE:
776 * geo longitude location of where the media has been recorded or produced in
777 * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
778 * negative values for western longitudes). (double).
782 #define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
785 * GST_TAG_GEO_LOCATION_ELEVATION:
787 * geo elevation of where the media has been recorded or produced in meters
788 * according to WGS84 (zero is average sea level) (double).
792 #define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
796 * Name of the show, used for displaying (string)
800 #define GST_TAG_SHOW_NAME "show-name"
802 * GST_TAG_SHOW_SORTNAME
804 * Name of the show, used for sorting (string)
808 #define GST_TAG_SHOW_SORTNAME "show-sortname"
810 * GST_TAG_SHOW_EPISODE_NUMBER
812 * Number of the episode within a season/show (unsigned integer)
816 #define GST_TAG_SHOW_EPISODE_NUMBER "show-episode-number"
818 * GST_TAG_SHOW_SEASON_NUMBER
820 * Number of the season of a show/series (unsigned integer)
824 #define GST_TAG_SHOW_SEASON_NUMBER "show-season-number"
828 * The lyrics of the media (string)
832 #define GST_TAG_LYRICS "lyrics"
834 * GST_TAG_COMPOSER_SORTNAME
836 * The composer's name, used for sorting (string)
840 #define GST_TAG_COMPOSER_SORTNAME "composer-sortname"
844 * Groups together media that are related and spans multiple tracks. An
845 * example are multiple pieces of a concerto. (string)
849 #define GST_TAG_GROUPING "grouping"
853 #endif /* __GST_TAGLIST_H__ */