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 _FOOL_GTK_DOC_
154 typedef struct _GstTagList GstTagList;
156 #ifdef IN_GOBJECT_INTROSPECTION
157 typedef struct _GstTagList GstTagList;
159 typedef GstStructure GstTagList;
163 #define GST_TAG_LIST(x) ((GstTagList *) (x))
164 #define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
165 #define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
169 * @list: the #GstTagList
170 * @tag: a name of a tag in @list
171 * @user_data: user data
173 * A function that will be called in gst_tag_list_foreach(). The function may
174 * not modify the tag list.
176 typedef void (*GstTagForeachFunc) (const GstTagList * list,
182 * @dest: the destination #GValue
183 * @src: the source #GValue
185 * A function for merging multiple values of a tag used when registering
188 typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
190 GType gst_tag_list_get_type (void);
192 /* tag registration */
193 void gst_tag_register (const gchar * name,
198 GstTagMergeFunc func);
200 /* some default merging functions */
201 void gst_tag_merge_use_first (GValue * dest, const GValue * src);
202 void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
204 /* basic tag support */
205 gboolean gst_tag_exists (const gchar * tag);
206 GType gst_tag_get_type (const gchar * tag);
207 G_CONST_RETURN gchar * gst_tag_get_nick (const gchar * tag);
208 G_CONST_RETURN gchar * gst_tag_get_description (const gchar * tag);
209 GstTagFlag gst_tag_get_flag (const gchar * tag);
210 gboolean gst_tag_is_fixed (const gchar * tag);
213 GstTagList * gst_tag_list_new (void);
214 GstTagList * gst_tag_list_new_full (const gchar * tag, ...);
215 GstTagList * gst_tag_list_new_full_valist (va_list var_args);
217 gboolean gst_is_tag_list (gconstpointer p);
218 GstTagList * gst_tag_list_copy (const GstTagList * list);
219 gboolean gst_tag_list_is_empty (const GstTagList * list);
220 void gst_tag_list_insert (GstTagList * into,
221 const GstTagList * from,
222 GstTagMergeMode mode);
223 GstTagList * gst_tag_list_merge (const GstTagList * list1,
224 const GstTagList * list2,
225 GstTagMergeMode mode);
226 void gst_tag_list_free (GstTagList * list);
227 guint gst_tag_list_get_tag_size (const GstTagList * list,
229 void gst_tag_list_add (GstTagList * list,
230 GstTagMergeMode mode,
232 ...) G_GNUC_NULL_TERMINATED;
233 void gst_tag_list_add_values (GstTagList * list,
234 GstTagMergeMode mode,
236 ...) G_GNUC_NULL_TERMINATED;
237 void gst_tag_list_add_valist (GstTagList * list,
238 GstTagMergeMode mode,
241 void gst_tag_list_add_valist_values (GstTagList * list,
242 GstTagMergeMode mode,
245 void gst_tag_list_add_value (GstTagList * list,
246 GstTagMergeMode mode,
248 const GValue * value);
249 void gst_tag_list_remove_tag (GstTagList * list,
251 void gst_tag_list_foreach (const GstTagList * list,
252 GstTagForeachFunc func,
255 G_CONST_RETURN GValue *
256 gst_tag_list_get_value_index (const GstTagList * list,
259 gboolean gst_tag_list_copy_value (GValue * dest,
260 const GstTagList * list,
263 /* simplifications (FIXME: do we want them?) */
264 gboolean gst_tag_list_get_char (const GstTagList * list,
267 gboolean gst_tag_list_get_char_index (const GstTagList * list,
271 gboolean gst_tag_list_get_uchar (const GstTagList * list,
274 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
278 gboolean gst_tag_list_get_boolean (const GstTagList * list,
281 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
285 gboolean gst_tag_list_get_int (const GstTagList * list,
288 gboolean gst_tag_list_get_int_index (const GstTagList * list,
292 gboolean gst_tag_list_get_uint (const GstTagList * list,
295 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
299 gboolean gst_tag_list_get_long (const GstTagList * list,
302 gboolean gst_tag_list_get_long_index (const GstTagList * list,
306 gboolean gst_tag_list_get_ulong (const GstTagList * list,
309 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
313 gboolean gst_tag_list_get_int64 (const GstTagList * list,
316 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
320 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
323 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
327 gboolean gst_tag_list_get_float (const GstTagList * list,
330 gboolean gst_tag_list_get_float_index (const GstTagList * list,
334 gboolean gst_tag_list_get_double (const GstTagList * list,
337 gboolean gst_tag_list_get_double_index (const GstTagList * list,
341 gboolean gst_tag_list_get_string (const GstTagList * list,
344 gboolean gst_tag_list_get_string_index (const GstTagList * list,
348 gboolean gst_tag_list_get_pointer (const GstTagList * list,
351 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
355 gboolean gst_tag_list_get_date (const GstTagList * list,
358 gboolean gst_tag_list_get_date_index (const GstTagList * list,
362 gboolean gst_tag_list_get_buffer (const GstTagList * list,
365 gboolean gst_tag_list_get_buffer_index (const GstTagList * list,
370 /* GStreamer core tags */
374 * commonly used title (string)
376 * The title as it should be displayed, e.g. 'The Doll House'
378 #define GST_TAG_TITLE "title"
380 * GST_TAG_TITLE_SORTNAME:
382 * commonly used title, as used for sorting (string)
384 * The title as it should be sorted, e.g. 'Doll House, The'
388 #define GST_TAG_TITLE_SORTNAME "title-sortname"
392 * person(s) responsible for the recording (string)
394 * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
395 * 'The Guitar Heroes'
397 #define GST_TAG_ARTIST "artist"
399 * GST_TAG_ARTIST_SORTNAME:
401 * person(s) responsible for the recording, as used for sorting (string)
403 * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
404 * 'Guitar Heroes, The'
408 /* FIXME 0.11: change to "artist-sortname" */
409 #define GST_TAG_ARTIST_SORTNAME "musicbrainz-sortname"
413 * album containing this data (string)
415 * The album name as it should be displayed, e.g. 'The Jazz Guitar'
417 #define GST_TAG_ALBUM "album"
419 * GST_TAG_ALBUM_SORTNAME:
421 * album containing this data, as used for sorting (string)
423 * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
427 #define GST_TAG_ALBUM_SORTNAME "album-sortname"
429 * GST_TAG_ALBUM_ARTIST
431 * The artist of the entire album, as it should be displayed.
435 #define GST_TAG_ALBUM_ARTIST "album-artist"
437 * GST_TAG_ALBUM_ARTIST_SORTNAME
439 * The artist of the entire album, as it should be sorted.
443 #define GST_TAG_ALBUM_ARTIST_SORTNAME "album-artist-sortname"
447 * person(s) who composed the recording (string)
451 #define GST_TAG_COMPOSER "composer"
455 * date the data was created (#GDate structure)
457 #define GST_TAG_DATE "date"
461 * genre this data belongs to (string)
463 #define GST_TAG_GENRE "genre"
467 * free text commenting the data (string)
469 #define GST_TAG_COMMENT "comment"
471 * GST_TAG_EXTENDED_COMMENT:
473 * key/value text commenting the data (string)
475 * Must be in the form of 'key=comment' or
476 * 'key[lc]=comment' where 'lc' is an ISO-639
479 * This tag is used for unknown Vorbis comment tags,
480 * unknown APE tags and certain ID3v2 comment fields.
484 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
486 * GST_TAG_TRACK_NUMBER:
488 * track number inside a collection (unsigned integer)
490 #define GST_TAG_TRACK_NUMBER "track-number"
492 * GST_TAG_TRACK_COUNT:
494 * count of tracks inside collection this track belongs to (unsigned integer)
496 #define GST_TAG_TRACK_COUNT "track-count"
498 * GST_TAG_ALBUM_VOLUME_NUMBER:
500 * disc number inside a collection (unsigned integer)
502 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
504 * GST_TAG_ALBUM_VOLUME_COUNT:
506 * count of discs inside collection this disc belongs to (unsigned integer)
508 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
512 * Origin of media as a URI (location, where the original of the file or stream
513 * is hosted) (string)
515 #define GST_TAG_LOCATION "location"
519 * Homepage for this media (i.e. artist or movie homepage) (string)
523 #define GST_TAG_HOMEPAGE "homepage"
525 * GST_TAG_DESCRIPTION:
527 * short text describing the content of the data (string)
529 #define GST_TAG_DESCRIPTION "description"
533 * version of this data (string)
535 #define GST_TAG_VERSION "version"
539 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
541 #define GST_TAG_ISRC "isrc"
543 * GST_TAG_ORGANIZATION:
545 * organization (string)
547 #define GST_TAG_ORGANIZATION "organization"
551 * copyright notice of the data (string)
553 #define GST_TAG_COPYRIGHT "copyright"
555 * GST_TAG_COPYRIGHT_URI:
557 * URI to location where copyright details can be found (string)
561 #define GST_TAG_COPYRIGHT_URI "copyright-uri"
565 * contact information (string)
567 #define GST_TAG_CONTACT "contact"
571 * license of data (string)
573 #define GST_TAG_LICENSE "license"
575 * GST_TAG_LICENSE_URI:
577 * URI to location where license details can be found (string)
581 #define GST_TAG_LICENSE_URI "license-uri"
585 * person(s) performing (string)
587 #define GST_TAG_PERFORMER "performer"
591 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
593 #define GST_TAG_DURATION "duration"
597 * codec the data is stored in (string)
599 #define GST_TAG_CODEC "codec"
601 * GST_TAG_VIDEO_CODEC:
603 * codec the video data is stored in (string)
605 #define GST_TAG_VIDEO_CODEC "video-codec"
607 * GST_TAG_AUDIO_CODEC:
609 * codec the audio data is stored in (string)
611 #define GST_TAG_AUDIO_CODEC "audio-codec"
613 * GST_TAG_SUBTITLE_CODEC:
615 * codec/format the subtitle data is stored in (string)
619 #define GST_TAG_SUBTITLE_CODEC "subtitle-codec"
621 * GST_TAG_CONTAINER_FORMAT:
623 * container format the data is stored in (string)
627 #define GST_TAG_CONTAINER_FORMAT "container-format"
631 * exact or average bitrate in bits/s (unsigned integer)
633 #define GST_TAG_BITRATE "bitrate"
635 * GST_TAG_NOMINAL_BITRATE:
637 * nominal bitrate in bits/s (unsigned integer)
639 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
641 * GST_TAG_MINIMUM_BITRATE:
643 * minimum bitrate in bits/s (unsigned integer)
645 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
647 * GST_TAG_MAXIMUM_BITRATE:
649 * maximum bitrate in bits/s (unsigned integer)
651 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
655 * serial number of track (unsigned integer)
657 #define GST_TAG_SERIAL "serial"
661 * encoder used to encode this stream (string)
663 #define GST_TAG_ENCODER "encoder"
665 * GST_TAG_ENCODER_VERSION:
667 * version of the encoder used to encode this stream (unsigned integer)
669 #define GST_TAG_ENCODER_VERSION "encoder-version"
671 * GST_TAG_TRACK_GAIN:
673 * track gain in db (double)
675 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
677 * GST_TAG_TRACK_PEAK:
679 * peak of the track (double)
681 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
683 * GST_TAG_ALBUM_GAIN:
685 * album gain in db (double)
687 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
689 * GST_TAG_ALBUM_PEAK:
691 * peak of the album (double)
693 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
695 * GST_TAG_REFERENCE_LEVEL:
697 * reference level of track and album gain values (double)
701 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
703 * GST_TAG_LANGUAGE_CODE:
705 * Language code (ISO-639-1) (string) of the content
707 #define GST_TAG_LANGUAGE_CODE "language-code"
711 * image (buffer) (buffer caps should specify the content type and preferably
712 * also set "image-type" field as #GstTagImageType)
716 #define GST_TAG_IMAGE "image"
718 * GST_TAG_PREVIEW_IMAGE:
720 * image that is meant for preview purposes, e.g. small icon-sized version
721 * (buffer) (buffer caps should specify the content type)
725 #define GST_TAG_PREVIEW_IMAGE "preview-image"
728 * GST_TAG_ATTACHMENT:
730 * generic file attachment (buffer) (buffer caps should specify the content
731 * type and if possible set "filename" to the file name of the
736 #define GST_TAG_ATTACHMENT "attachment"
739 * GST_TAG_BEATS_PER_MINUTE:
741 * number of beats per minute in audio (double)
745 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
750 * comma separated keywords describing the content (string).
754 #define GST_TAG_KEYWORDS "keywords"
757 * GST_TAG_GEO_LOCATION_NAME:
759 * human readable descriptive location of where the media has been recorded or
760 * produced. (string).
764 #define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
767 * GST_TAG_GEO_LOCATION_LATITUDE:
769 * geo latitude location of where the media has been recorded or produced in
770 * degrees according to WGS84 (zero at the equator, negative values for southern
771 * latitudes) (double).
775 #define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
778 * GST_TAG_GEO_LOCATION_LONGITUDE:
780 * geo longitude location of where the media has been recorded or produced in
781 * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
782 * negative values for western longitudes). (double).
786 #define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
789 * GST_TAG_GEO_LOCATION_ELEVATION:
791 * geo elevation of where the media has been recorded or produced in meters
792 * according to WGS84 (zero is average sea level) (double).
796 #define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
798 * GST_TAG_GEO_LOCATION_COUNTRY:
800 * The country (english name) where the media has been produced (string).
804 #define GST_TAG_GEO_LOCATION_COUNTRY "geo-location-country"
806 * GST_TAG_GEO_LOCATION_CITY:
808 * The city (english name) where the media has been produced (string).
812 #define GST_TAG_GEO_LOCATION_CITY "geo-location-city"
814 * GST_TAG_GEO_LOCATION_SUBLOCATION:
816 * A location 'smaller' than GST_TAG_GEO_LOCATION_CITY that specifies better
817 * where the media has been produced. (e.g. the neighborhood) (string).
819 * This tag has been added as this is how it is handled/named in XMP's
820 * Iptc4xmpcore schema.
824 #define GST_TAG_GEO_LOCATION_SUBLOCATION "geo-location-sublocation"
828 * Name of the show, used for displaying (string)
832 #define GST_TAG_SHOW_NAME "show-name"
834 * GST_TAG_SHOW_SORTNAME
836 * Name of the show, used for sorting (string)
840 #define GST_TAG_SHOW_SORTNAME "show-sortname"
842 * GST_TAG_SHOW_EPISODE_NUMBER
844 * Number of the episode within a season/show (unsigned integer)
848 #define GST_TAG_SHOW_EPISODE_NUMBER "show-episode-number"
850 * GST_TAG_SHOW_SEASON_NUMBER
852 * Number of the season of a show/series (unsigned integer)
856 #define GST_TAG_SHOW_SEASON_NUMBER "show-season-number"
860 * The lyrics of the media (string)
864 #define GST_TAG_LYRICS "lyrics"
866 * GST_TAG_COMPOSER_SORTNAME
868 * The composer's name, used for sorting (string)
872 #define GST_TAG_COMPOSER_SORTNAME "composer-sortname"
876 * Groups together media that are related and spans multiple tracks. An
877 * example are multiple pieces of a concerto. (string)
881 #define GST_TAG_GROUPING "grouping"
883 * GST_TAG_USER_RATING
885 * Rating attributed by a person (likely the application user).
886 * The higher the value, the more the user likes this media
887 * (unsigned int from 0 to 100)
891 #define GST_TAG_USER_RATING "user-rating"
895 #endif /* __GST_TAGLIST_H__ */