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_peek_string_index (const GstTagList * list,
351 const gchar ** value);
352 gboolean gst_tag_list_get_pointer (const GstTagList * list,
355 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
359 gboolean gst_tag_list_get_date (const GstTagList * list,
362 gboolean gst_tag_list_get_date_index (const GstTagList * list,
366 gboolean gst_tag_list_get_buffer (const GstTagList * list,
369 gboolean gst_tag_list_get_buffer_index (const GstTagList * list,
374 /* GStreamer core tags */
378 * commonly used title (string)
380 * The title as it should be displayed, e.g. 'The Doll House'
382 #define GST_TAG_TITLE "title"
384 * GST_TAG_TITLE_SORTNAME:
386 * commonly used title, as used for sorting (string)
388 * The title as it should be sorted, e.g. 'Doll House, The'
392 #define GST_TAG_TITLE_SORTNAME "title-sortname"
396 * person(s) responsible for the recording (string)
398 * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
399 * 'The Guitar Heroes'
401 #define GST_TAG_ARTIST "artist"
403 * GST_TAG_ARTIST_SORTNAME:
405 * person(s) responsible for the recording, as used for sorting (string)
407 * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
408 * 'Guitar Heroes, The'
412 /* FIXME 0.11: change to "artist-sortname" */
413 #define GST_TAG_ARTIST_SORTNAME "musicbrainz-sortname"
417 * album containing this data (string)
419 * The album name as it should be displayed, e.g. 'The Jazz Guitar'
421 #define GST_TAG_ALBUM "album"
423 * GST_TAG_ALBUM_SORTNAME:
425 * album containing this data, as used for sorting (string)
427 * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
431 #define GST_TAG_ALBUM_SORTNAME "album-sortname"
433 * GST_TAG_ALBUM_ARTIST:
435 * The artist of the entire album, as it should be displayed.
439 #define GST_TAG_ALBUM_ARTIST "album-artist"
441 * GST_TAG_ALBUM_ARTIST_SORTNAME:
443 * The artist of the entire album, as it should be sorted.
447 #define GST_TAG_ALBUM_ARTIST_SORTNAME "album-artist-sortname"
451 * person(s) who composed the recording (string)
455 #define GST_TAG_COMPOSER "composer"
459 * date the data was created (#GDate structure)
461 #define GST_TAG_DATE "date"
465 * genre this data belongs to (string)
467 #define GST_TAG_GENRE "genre"
471 * free text commenting the data (string)
473 #define GST_TAG_COMMENT "comment"
475 * GST_TAG_EXTENDED_COMMENT:
477 * key/value text commenting the data (string)
479 * Must be in the form of 'key=comment' or
480 * 'key[lc]=comment' where 'lc' is an ISO-639
483 * This tag is used for unknown Vorbis comment tags,
484 * unknown APE tags and certain ID3v2 comment fields.
488 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
490 * GST_TAG_TRACK_NUMBER:
492 * track number inside a collection (unsigned integer)
494 #define GST_TAG_TRACK_NUMBER "track-number"
496 * GST_TAG_TRACK_COUNT:
498 * count of tracks inside collection this track belongs to (unsigned integer)
500 #define GST_TAG_TRACK_COUNT "track-count"
502 * GST_TAG_ALBUM_VOLUME_NUMBER:
504 * disc number inside a collection (unsigned integer)
506 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
508 * GST_TAG_ALBUM_VOLUME_COUNT:
510 * count of discs inside collection this disc belongs to (unsigned integer)
512 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
516 * Origin of media as a URI (location, where the original of the file or stream
517 * is hosted) (string)
519 #define GST_TAG_LOCATION "location"
523 * Homepage for this media (i.e. artist or movie homepage) (string)
527 #define GST_TAG_HOMEPAGE "homepage"
529 * GST_TAG_DESCRIPTION:
531 * short text describing the content of the data (string)
533 #define GST_TAG_DESCRIPTION "description"
537 * version of this data (string)
539 #define GST_TAG_VERSION "version"
543 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
545 #define GST_TAG_ISRC "isrc"
547 * GST_TAG_ORGANIZATION:
549 * organization (string)
551 #define GST_TAG_ORGANIZATION "organization"
555 * copyright notice of the data (string)
557 #define GST_TAG_COPYRIGHT "copyright"
559 * GST_TAG_COPYRIGHT_URI:
561 * URI to location where copyright details can be found (string)
565 #define GST_TAG_COPYRIGHT_URI "copyright-uri"
569 * contact information (string)
571 #define GST_TAG_CONTACT "contact"
575 * license of data (string)
577 #define GST_TAG_LICENSE "license"
579 * GST_TAG_LICENSE_URI:
581 * URI to location where license details can be found (string)
585 #define GST_TAG_LICENSE_URI "license-uri"
589 * person(s) performing (string)
591 #define GST_TAG_PERFORMER "performer"
595 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
597 #define GST_TAG_DURATION "duration"
601 * codec the data is stored in (string)
603 #define GST_TAG_CODEC "codec"
605 * GST_TAG_VIDEO_CODEC:
607 * codec the video data is stored in (string)
609 #define GST_TAG_VIDEO_CODEC "video-codec"
611 * GST_TAG_AUDIO_CODEC:
613 * codec the audio data is stored in (string)
615 #define GST_TAG_AUDIO_CODEC "audio-codec"
617 * GST_TAG_SUBTITLE_CODEC:
619 * codec/format the subtitle data is stored in (string)
623 #define GST_TAG_SUBTITLE_CODEC "subtitle-codec"
625 * GST_TAG_CONTAINER_FORMAT:
627 * container format the data is stored in (string)
631 #define GST_TAG_CONTAINER_FORMAT "container-format"
635 * exact or average bitrate in bits/s (unsigned integer)
637 #define GST_TAG_BITRATE "bitrate"
639 * GST_TAG_NOMINAL_BITRATE:
641 * nominal bitrate in bits/s (unsigned integer)
643 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
645 * GST_TAG_MINIMUM_BITRATE:
647 * minimum bitrate in bits/s (unsigned integer)
649 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
651 * GST_TAG_MAXIMUM_BITRATE:
653 * maximum bitrate in bits/s (unsigned integer)
655 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
659 * serial number of track (unsigned integer)
661 #define GST_TAG_SERIAL "serial"
665 * encoder used to encode this stream (string)
667 #define GST_TAG_ENCODER "encoder"
669 * GST_TAG_ENCODER_VERSION:
671 * version of the encoder used to encode this stream (unsigned integer)
673 #define GST_TAG_ENCODER_VERSION "encoder-version"
675 * GST_TAG_TRACK_GAIN:
677 * track gain in db (double)
679 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
681 * GST_TAG_TRACK_PEAK:
683 * peak of the track (double)
685 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
687 * GST_TAG_ALBUM_GAIN:
689 * album gain in db (double)
691 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
693 * GST_TAG_ALBUM_PEAK:
695 * peak of the album (double)
697 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
699 * GST_TAG_REFERENCE_LEVEL:
701 * reference level of track and album gain values (double)
705 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
707 * GST_TAG_LANGUAGE_CODE:
709 * Language code (ISO-639-1) (string) of the content
711 #define GST_TAG_LANGUAGE_CODE "language-code"
715 * image (buffer) (buffer caps should specify the content type and preferably
716 * also set "image-type" field as #GstTagImageType)
720 #define GST_TAG_IMAGE "image"
722 * GST_TAG_PREVIEW_IMAGE:
724 * image that is meant for preview purposes, e.g. small icon-sized version
725 * (buffer) (buffer caps should specify the content type)
729 #define GST_TAG_PREVIEW_IMAGE "preview-image"
732 * GST_TAG_ATTACHMENT:
734 * generic file attachment (buffer) (buffer caps should specify the content
735 * type and if possible set "filename" to the file name of the
740 #define GST_TAG_ATTACHMENT "attachment"
743 * GST_TAG_BEATS_PER_MINUTE:
745 * number of beats per minute in audio (double)
749 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
754 * comma separated keywords describing the content (string).
758 #define GST_TAG_KEYWORDS "keywords"
761 * GST_TAG_GEO_LOCATION_NAME:
763 * human readable descriptive location of where the media has been recorded or
764 * produced. (string).
768 #define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
771 * GST_TAG_GEO_LOCATION_LATITUDE:
773 * geo latitude location of where the media has been recorded or produced in
774 * degrees according to WGS84 (zero at the equator, negative values for southern
775 * latitudes) (double).
779 #define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
782 * GST_TAG_GEO_LOCATION_LONGITUDE:
784 * geo longitude location of where the media has been recorded or produced in
785 * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
786 * negative values for western longitudes). (double).
790 #define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
793 * GST_TAG_GEO_LOCATION_ELEVATION:
795 * geo elevation of where the media has been recorded or produced in meters
796 * according to WGS84 (zero is average sea level) (double).
800 #define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
802 * GST_TAG_GEO_LOCATION_COUNTRY:
804 * The country (english name) where the media has been produced (string).
808 #define GST_TAG_GEO_LOCATION_COUNTRY "geo-location-country"
810 * GST_TAG_GEO_LOCATION_CITY:
812 * The city (english name) where the media has been produced (string).
816 #define GST_TAG_GEO_LOCATION_CITY "geo-location-city"
818 * GST_TAG_GEO_LOCATION_SUBLOCATION:
820 * A location 'smaller' than GST_TAG_GEO_LOCATION_CITY that specifies better
821 * where the media has been produced. (e.g. the neighborhood) (string).
823 * This tag has been added as this is how it is handled/named in XMP's
824 * Iptc4xmpcore schema.
828 #define GST_TAG_GEO_LOCATION_SUBLOCATION "geo-location-sublocation"
830 * GST_TAG_GEO_LOCATION_MOVEMENT_SPEED:
832 * Speed of the capturing device when performing the capture.
833 * Represented in m/s. (double)
835 * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
839 #define GST_TAG_GEO_LOCATION_MOVEMENT_SPEED "geo-location-movement-speed"
841 * GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION:
843 * Indicates the movement direction of the device performing the capture
844 * of a media. It is represented as degrees in floating point representation,
845 * 0 means the geographic north, and increases clockwise (double from 0 to 360)
847 * See also #GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION
851 #define GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION "geo-location-movement-direction"
853 * GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION:
855 * Indicates the direction the device is pointing to when capturing
856 * a media. It is represented as degrees in floating point representation,
857 * 0 means the geographic north, and increases clockwise (double from 0 to 360)
859 * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
863 #define GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION "geo-location-capture-direction"
867 * Name of the show, used for displaying (string)
871 #define GST_TAG_SHOW_NAME "show-name"
873 * GST_TAG_SHOW_SORTNAME:
875 * Name of the show, used for sorting (string)
879 #define GST_TAG_SHOW_SORTNAME "show-sortname"
881 * GST_TAG_SHOW_EPISODE_NUMBER:
883 * Number of the episode within a season/show (unsigned integer)
887 #define GST_TAG_SHOW_EPISODE_NUMBER "show-episode-number"
889 * GST_TAG_SHOW_SEASON_NUMBER:
891 * Number of the season of a show/series (unsigned integer)
895 #define GST_TAG_SHOW_SEASON_NUMBER "show-season-number"
899 * The lyrics of the media (string)
903 #define GST_TAG_LYRICS "lyrics"
905 * GST_TAG_COMPOSER_SORTNAME:
907 * The composer's name, used for sorting (string)
911 #define GST_TAG_COMPOSER_SORTNAME "composer-sortname"
915 * Groups together media that are related and spans multiple tracks. An
916 * example are multiple pieces of a concerto. (string)
920 #define GST_TAG_GROUPING "grouping"
922 * GST_TAG_USER_RATING:
924 * Rating attributed by a person (likely the application user).
925 * The higher the value, the more the user likes this media
926 * (unsigned int from 0 to 100)
930 #define GST_TAG_USER_RATING "user-rating"
932 * GST_TAG_DEVICE_MANUFACTURER:
934 * Manufacturer of the device used to create the media (string)
938 #define GST_TAG_DEVICE_MANUFACTURER "device-manufacturer"
940 * GST_TAG_DEVICE_MODEL:
942 * Model of the device used to create the media (string)
946 #define GST_TAG_DEVICE_MODEL "device-model"
948 * GST_TAG_IMAGE_ORIENTATION:
950 * Represents the 'Orientation' tag from EXIF. Defines how the image
951 * should be rotated and mirrored for display. (string)
953 * This tag has a predefined set of allowed values:
963 * The naming is adopted according to a possible transformation to perform
964 * on the image to fix its orientation, obviously equivalent operations will
965 * yield the same result.
967 * Rotations indicated by the values are in clockwise direction and
968 * 'flip' means an horizontal mirroring.
972 #define GST_TAG_IMAGE_ORIENTATION "image-orientation"
976 #endif /* __GST_TAGLIST_H__ */