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/gstdatetime.h>
27 #include <gst/gstbuffer.h>
28 #include <gst/gststructure.h>
29 #include <gst/glib-compat.h>
35 * @GST_TAG_MERGE_UNDEFINED: undefined merge mode
36 * @GST_TAG_MERGE_REPLACE_ALL: replace all tags (clear list and append)
37 * @GST_TAG_MERGE_REPLACE: replace tags
38 * @GST_TAG_MERGE_APPEND: append tags
39 * @GST_TAG_MERGE_PREPEND: prepend tags
40 * @GST_TAG_MERGE_KEEP: keep existing tags
41 * @GST_TAG_MERGE_KEEP_ALL: keep all existing tags
42 * @GST_TAG_MERGE_COUNT: the number of merge modes
44 * The different tag merging modes are basically replace, overwrite and append,
45 * but they can be seen from two directions. Given two taglists: (A) the tags
46 * already in the element and (B) the ones that are supplied to the element (
47 * e.g. via gst_tag_setter_merge_tags() / gst_tag_setter_add_tags() or a
48 * %GST_EVENT_TAG), how are these tags merged?
49 * In the table below this is shown for the cases that a tag exists in the list
50 * (A) or does not exists (!A) and combinations thereof.
52 * <table frame="all" colsep="1" rowsep="1">
53 * <title>merge mode</title>
54 * <tgroup cols='5' align='left'>
57 * <entry>merge mode</entry>
58 * <entry>A + B</entry>
59 * <entry>A + !B</entry>
60 * <entry>!A + B</entry>
61 * <entry>!A + !B</entry>
66 * <entry>REPLACE_ALL</entry>
73 * <entry>REPLACE</entry>
80 * <entry>APPEND</entry>
87 * <entry>PREPEND</entry>
101 * <entry>KEEP_ALL</entry>
112 GST_TAG_MERGE_UNDEFINED,
113 GST_TAG_MERGE_REPLACE_ALL,
114 GST_TAG_MERGE_REPLACE,
115 GST_TAG_MERGE_APPEND,
116 GST_TAG_MERGE_PREPEND,
118 GST_TAG_MERGE_KEEP_ALL,
123 #define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
127 * @GST_TAG_FLAG_UNDEFINED: undefined flag
128 * @GST_TAG_FLAG_META: tag is meta data
129 * @GST_TAG_FLAG_ENCODED: tag is encoded
130 * @GST_TAG_FLAG_DECODED: tag is decoded
131 * @GST_TAG_FLAG_COUNT: number of tag flags
133 * Extra tag flags used when registering tags.
136 GST_TAG_FLAG_UNDEFINED,
138 GST_TAG_FLAG_ENCODED,
139 GST_TAG_FLAG_DECODED,
143 #define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
145 /* FIXME 0.11: Don't typedef GstTagList to be a GstStructure, they're
146 * internally the same but not from an API point of view.
152 * Opaque #GstTagList data structure.
154 #ifdef _FOOL_GTK_DOC_
155 typedef struct _GstTagList GstTagList;
157 #ifdef IN_GOBJECT_INTROSPECTION
158 typedef struct _GstTagList GstTagList;
160 typedef GstStructure GstTagList;
164 #define GST_TAG_LIST(x) ((GstTagList *) (x))
165 #define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
166 #define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
170 * @list: the #GstTagList
171 * @tag: a name of a tag in @list
172 * @user_data: user data
174 * A function that will be called in gst_tag_list_foreach(). The function may
175 * not modify the tag list.
177 typedef void (*GstTagForeachFunc) (const GstTagList * list,
183 * @dest: the destination #GValue
184 * @src: the source #GValue
186 * A function for merging multiple values of a tag used when registering
189 typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
191 GType gst_tag_list_get_type (void);
193 /* tag registration */
194 void gst_tag_register (const gchar * name,
199 GstTagMergeFunc func);
201 /* some default merging functions */
202 void gst_tag_merge_use_first (GValue * dest, const GValue * src);
203 void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
205 /* basic tag support */
206 gboolean gst_tag_exists (const gchar * tag);
207 GType gst_tag_get_type (const gchar * tag);
208 G_CONST_RETURN gchar * gst_tag_get_nick (const gchar * tag);
209 G_CONST_RETURN gchar * gst_tag_get_description (const gchar * tag);
210 GstTagFlag gst_tag_get_flag (const gchar * tag);
211 gboolean gst_tag_is_fixed (const gchar * tag);
214 GstTagList * gst_tag_list_new (void);
215 GstTagList * gst_tag_list_new_full (const gchar * tag, ...);
216 GstTagList * gst_tag_list_new_full_valist (va_list var_args);
218 gboolean gst_is_tag_list (gconstpointer p);
219 GstTagList * gst_tag_list_copy (const GstTagList * list);
220 gboolean gst_tag_list_is_empty (const GstTagList * list);
221 void gst_tag_list_insert (GstTagList * into,
222 const GstTagList * from,
223 GstTagMergeMode mode);
224 GstTagList * gst_tag_list_merge (const GstTagList * list1,
225 const GstTagList * list2,
226 GstTagMergeMode mode);
227 void gst_tag_list_free (GstTagList * list);
228 guint gst_tag_list_get_tag_size (const GstTagList * list,
230 void gst_tag_list_add (GstTagList * list,
231 GstTagMergeMode mode,
233 ...) G_GNUC_NULL_TERMINATED;
234 void gst_tag_list_add_values (GstTagList * list,
235 GstTagMergeMode mode,
237 ...) G_GNUC_NULL_TERMINATED;
238 void gst_tag_list_add_valist (GstTagList * list,
239 GstTagMergeMode mode,
242 void gst_tag_list_add_valist_values (GstTagList * list,
243 GstTagMergeMode mode,
246 void gst_tag_list_add_value (GstTagList * list,
247 GstTagMergeMode mode,
249 const GValue * value);
250 void gst_tag_list_remove_tag (GstTagList * list,
252 void gst_tag_list_foreach (const GstTagList * list,
253 GstTagForeachFunc func,
256 G_CONST_RETURN GValue *
257 gst_tag_list_get_value_index (const GstTagList * list,
260 gboolean gst_tag_list_copy_value (GValue * dest,
261 const GstTagList * list,
264 /* simplifications (FIXME: do we want them?) */
265 gboolean gst_tag_list_get_char (const GstTagList * list,
268 gboolean gst_tag_list_get_char_index (const GstTagList * list,
272 gboolean gst_tag_list_get_uchar (const GstTagList * list,
275 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
279 gboolean gst_tag_list_get_boolean (const GstTagList * list,
282 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
286 gboolean gst_tag_list_get_int (const GstTagList * list,
289 gboolean gst_tag_list_get_int_index (const GstTagList * list,
293 gboolean gst_tag_list_get_uint (const GstTagList * list,
296 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
300 gboolean gst_tag_list_get_long (const GstTagList * list,
303 gboolean gst_tag_list_get_long_index (const GstTagList * list,
307 gboolean gst_tag_list_get_ulong (const GstTagList * list,
310 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
314 gboolean gst_tag_list_get_int64 (const GstTagList * list,
317 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
321 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
324 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
328 gboolean gst_tag_list_get_float (const GstTagList * list,
331 gboolean gst_tag_list_get_float_index (const GstTagList * list,
335 gboolean gst_tag_list_get_double (const GstTagList * list,
338 gboolean gst_tag_list_get_double_index (const GstTagList * list,
342 gboolean gst_tag_list_get_string (const GstTagList * list,
345 gboolean gst_tag_list_get_string_index (const GstTagList * list,
349 gboolean gst_tag_list_peek_string_index (const GstTagList * list,
352 const gchar ** value);
353 gboolean gst_tag_list_get_pointer (const GstTagList * list,
356 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
360 gboolean gst_tag_list_get_date (const GstTagList * list,
363 gboolean gst_tag_list_get_date_index (const GstTagList * list,
367 gboolean gst_tag_list_get_date_time (const GstTagList * list,
369 GstDateTime ** value);
370 gboolean gst_tag_list_get_date_time_index (const GstTagList * list,
373 GstDateTime ** value);
374 gboolean gst_tag_list_get_buffer (const GstTagList * list,
377 gboolean gst_tag_list_get_buffer_index (const GstTagList * list,
382 /* GStreamer core tags */
386 * commonly used title (string)
388 * The title as it should be displayed, e.g. 'The Doll House'
390 #define GST_TAG_TITLE "title"
392 * GST_TAG_TITLE_SORTNAME:
394 * commonly used title, as used for sorting (string)
396 * The title as it should be sorted, e.g. 'Doll House, The'
400 #define GST_TAG_TITLE_SORTNAME "title-sortname"
404 * person(s) responsible for the recording (string)
406 * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
407 * 'The Guitar Heroes'
409 #define GST_TAG_ARTIST "artist"
411 * GST_TAG_ARTIST_SORTNAME:
413 * person(s) responsible for the recording, as used for sorting (string)
415 * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
416 * 'Guitar Heroes, The'
420 /* FIXME 0.11: change to "artist-sortname" */
421 #define GST_TAG_ARTIST_SORTNAME "musicbrainz-sortname"
425 * album containing this data (string)
427 * The album name as it should be displayed, e.g. 'The Jazz Guitar'
429 #define GST_TAG_ALBUM "album"
431 * GST_TAG_ALBUM_SORTNAME:
433 * album containing this data, as used for sorting (string)
435 * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
439 #define GST_TAG_ALBUM_SORTNAME "album-sortname"
441 * GST_TAG_ALBUM_ARTIST:
443 * The artist of the entire album, as it should be displayed.
447 #define GST_TAG_ALBUM_ARTIST "album-artist"
449 * GST_TAG_ALBUM_ARTIST_SORTNAME:
451 * The artist of the entire album, as it should be sorted.
455 #define GST_TAG_ALBUM_ARTIST_SORTNAME "album-artist-sortname"
459 * person(s) who composed the recording (string)
463 #define GST_TAG_COMPOSER "composer"
467 * date the data was created (#GDate structure)
469 #define GST_TAG_DATE "date"
473 * genre this data belongs to (string)
475 #define GST_TAG_GENRE "genre"
479 * free text commenting the data (string)
481 #define GST_TAG_COMMENT "comment"
483 * GST_TAG_EXTENDED_COMMENT:
485 * key/value text commenting the data (string)
487 * Must be in the form of 'key=comment' or
488 * 'key[lc]=comment' where 'lc' is an ISO-639
491 * This tag is used for unknown Vorbis comment tags,
492 * unknown APE tags and certain ID3v2 comment fields.
496 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
498 * GST_TAG_TRACK_NUMBER:
500 * track number inside a collection (unsigned integer)
502 #define GST_TAG_TRACK_NUMBER "track-number"
504 * GST_TAG_TRACK_COUNT:
506 * count of tracks inside collection this track belongs to (unsigned integer)
508 #define GST_TAG_TRACK_COUNT "track-count"
510 * GST_TAG_ALBUM_VOLUME_NUMBER:
512 * disc number inside a collection (unsigned integer)
514 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
516 * GST_TAG_ALBUM_VOLUME_COUNT:
518 * count of discs inside collection this disc belongs to (unsigned integer)
520 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
524 * Origin of media as a URI (location, where the original of the file or stream
525 * is hosted) (string)
527 #define GST_TAG_LOCATION "location"
531 * Homepage for this media (i.e. artist or movie homepage) (string)
535 #define GST_TAG_HOMEPAGE "homepage"
537 * GST_TAG_DESCRIPTION:
539 * short text describing the content of the data (string)
541 #define GST_TAG_DESCRIPTION "description"
545 * version of this data (string)
547 #define GST_TAG_VERSION "version"
551 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
553 #define GST_TAG_ISRC "isrc"
555 * GST_TAG_ORGANIZATION:
557 * organization (string)
559 #define GST_TAG_ORGANIZATION "organization"
563 * copyright notice of the data (string)
565 #define GST_TAG_COPYRIGHT "copyright"
567 * GST_TAG_COPYRIGHT_URI:
569 * URI to location where copyright details can be found (string)
573 #define GST_TAG_COPYRIGHT_URI "copyright-uri"
577 * contact information (string)
579 #define GST_TAG_CONTACT "contact"
583 * license of data (string)
585 #define GST_TAG_LICENSE "license"
587 * GST_TAG_LICENSE_URI:
589 * URI to location where license details can be found (string)
593 #define GST_TAG_LICENSE_URI "license-uri"
597 * person(s) performing (string)
599 #define GST_TAG_PERFORMER "performer"
603 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
605 #define GST_TAG_DURATION "duration"
609 * codec the data is stored in (string)
611 #define GST_TAG_CODEC "codec"
613 * GST_TAG_VIDEO_CODEC:
615 * codec the video data is stored in (string)
617 #define GST_TAG_VIDEO_CODEC "video-codec"
619 * GST_TAG_AUDIO_CODEC:
621 * codec the audio data is stored in (string)
623 #define GST_TAG_AUDIO_CODEC "audio-codec"
625 * GST_TAG_SUBTITLE_CODEC:
627 * codec/format the subtitle data is stored in (string)
631 #define GST_TAG_SUBTITLE_CODEC "subtitle-codec"
633 * GST_TAG_CONTAINER_FORMAT:
635 * container format the data is stored in (string)
639 #define GST_TAG_CONTAINER_FORMAT "container-format"
643 * exact or average bitrate in bits/s (unsigned integer)
645 #define GST_TAG_BITRATE "bitrate"
647 * GST_TAG_NOMINAL_BITRATE:
649 * nominal bitrate in bits/s (unsigned integer)
651 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
653 * GST_TAG_MINIMUM_BITRATE:
655 * minimum bitrate in bits/s (unsigned integer)
657 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
659 * GST_TAG_MAXIMUM_BITRATE:
661 * maximum bitrate in bits/s (unsigned integer)
663 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
667 * serial number of track (unsigned integer)
669 #define GST_TAG_SERIAL "serial"
673 * encoder used to encode this stream (string)
675 #define GST_TAG_ENCODER "encoder"
677 * GST_TAG_ENCODER_VERSION:
679 * version of the encoder used to encode this stream (unsigned integer)
681 #define GST_TAG_ENCODER_VERSION "encoder-version"
683 * GST_TAG_TRACK_GAIN:
685 * track gain in db (double)
687 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
689 * GST_TAG_TRACK_PEAK:
691 * peak of the track (double)
693 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
695 * GST_TAG_ALBUM_GAIN:
697 * album gain in db (double)
699 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
701 * GST_TAG_ALBUM_PEAK:
703 * peak of the album (double)
705 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
707 * GST_TAG_REFERENCE_LEVEL:
709 * reference level of track and album gain values (double)
713 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
715 * GST_TAG_LANGUAGE_CODE:
717 * Language code (ISO-639-1) (string) of the content
719 #define GST_TAG_LANGUAGE_CODE "language-code"
723 * image (buffer) (buffer caps should specify the content type and preferably
724 * also set "image-type" field as #GstTagImageType)
728 #define GST_TAG_IMAGE "image"
730 * GST_TAG_PREVIEW_IMAGE:
732 * image that is meant for preview purposes, e.g. small icon-sized version
733 * (buffer) (buffer caps should specify the content type)
737 #define GST_TAG_PREVIEW_IMAGE "preview-image"
740 * GST_TAG_ATTACHMENT:
742 * generic file attachment (buffer) (buffer caps should specify the content
743 * type and if possible set "filename" to the file name of the
748 #define GST_TAG_ATTACHMENT "attachment"
751 * GST_TAG_BEATS_PER_MINUTE:
753 * number of beats per minute in audio (double)
757 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
762 * comma separated keywords describing the content (string).
766 #define GST_TAG_KEYWORDS "keywords"
769 * GST_TAG_GEO_LOCATION_NAME:
771 * human readable descriptive location of where the media has been recorded or
772 * produced. (string).
776 #define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
779 * GST_TAG_GEO_LOCATION_LATITUDE:
781 * geo latitude location of where the media has been recorded or produced in
782 * degrees according to WGS84 (zero at the equator, negative values for southern
783 * latitudes) (double).
787 #define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
790 * GST_TAG_GEO_LOCATION_LONGITUDE:
792 * geo longitude location of where the media has been recorded or produced in
793 * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
794 * negative values for western longitudes). (double).
798 #define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
801 * GST_TAG_GEO_LOCATION_ELEVATION:
803 * geo elevation of where the media has been recorded or produced in meters
804 * according to WGS84 (zero is average sea level) (double).
808 #define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
810 * GST_TAG_GEO_LOCATION_COUNTRY:
812 * The country (english name) where the media has been produced (string).
816 #define GST_TAG_GEO_LOCATION_COUNTRY "geo-location-country"
818 * GST_TAG_GEO_LOCATION_CITY:
820 * The city (english name) where the media has been produced (string).
824 #define GST_TAG_GEO_LOCATION_CITY "geo-location-city"
826 * GST_TAG_GEO_LOCATION_SUBLOCATION:
828 * A location 'smaller' than GST_TAG_GEO_LOCATION_CITY that specifies better
829 * where the media has been produced. (e.g. the neighborhood) (string).
831 * This tag has been added as this is how it is handled/named in XMP's
832 * Iptc4xmpcore schema.
836 #define GST_TAG_GEO_LOCATION_SUBLOCATION "geo-location-sublocation"
838 * GST_TAG_GEO_LOCATION_MOVEMENT_SPEED:
840 * Speed of the capturing device when performing the capture.
841 * Represented in m/s. (double)
843 * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
847 #define GST_TAG_GEO_LOCATION_MOVEMENT_SPEED "geo-location-movement-speed"
849 * GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION:
851 * Indicates the movement direction of the device performing the capture
852 * of a media. It is represented as degrees in floating point representation,
853 * 0 means the geographic north, and increases clockwise (double from 0 to 360)
855 * See also #GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION
859 #define GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION "geo-location-movement-direction"
861 * GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION:
863 * Indicates the direction the device is pointing to when capturing
864 * a media. It is represented as degrees in floating point representation,
865 * 0 means the geographic north, and increases clockwise (double from 0 to 360)
867 * See also #GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION
871 #define GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION "geo-location-capture-direction"
875 * Name of the show, used for displaying (string)
879 #define GST_TAG_SHOW_NAME "show-name"
881 * GST_TAG_SHOW_SORTNAME:
883 * Name of the show, used for sorting (string)
887 #define GST_TAG_SHOW_SORTNAME "show-sortname"
889 * GST_TAG_SHOW_EPISODE_NUMBER:
891 * Number of the episode within a season/show (unsigned integer)
895 #define GST_TAG_SHOW_EPISODE_NUMBER "show-episode-number"
897 * GST_TAG_SHOW_SEASON_NUMBER:
899 * Number of the season of a show/series (unsigned integer)
903 #define GST_TAG_SHOW_SEASON_NUMBER "show-season-number"
907 * The lyrics of the media (string)
911 #define GST_TAG_LYRICS "lyrics"
913 * GST_TAG_COMPOSER_SORTNAME:
915 * The composer's name, used for sorting (string)
919 #define GST_TAG_COMPOSER_SORTNAME "composer-sortname"
923 * Groups together media that are related and spans multiple tracks. An
924 * example are multiple pieces of a concerto. (string)
928 #define GST_TAG_GROUPING "grouping"
930 * GST_TAG_USER_RATING:
932 * Rating attributed by a person (likely the application user).
933 * The higher the value, the more the user likes this media
934 * (unsigned int from 0 to 100)
938 #define GST_TAG_USER_RATING "user-rating"
940 * GST_TAG_DEVICE_MANUFACTURER:
942 * Manufacturer of the device used to create the media (string)
946 #define GST_TAG_DEVICE_MANUFACTURER "device-manufacturer"
948 * GST_TAG_DEVICE_MODEL:
950 * Model of the device used to create the media (string)
954 #define GST_TAG_DEVICE_MODEL "device-model"
956 * GST_TAG_IMAGE_ORIENTATION:
958 * Represents the 'Orientation' tag from EXIF. Defines how the image
959 * should be rotated and mirrored for display. (string)
961 * This tag has a predefined set of allowed values:
971 * The naming is adopted according to a possible transformation to perform
972 * on the image to fix its orientation, obviously equivalent operations will
973 * yield the same result.
975 * Rotations indicated by the values are in clockwise direction and
976 * 'flip' means an horizontal mirroring.
980 #define GST_TAG_IMAGE_ORIENTATION "image-orientation"
984 #endif /* __GST_TAGLIST_H__ */