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 gboolean gst_is_tag_list (gconstpointer p);
202 GstTagList * gst_tag_list_copy (const GstTagList * list);
203 gboolean gst_tag_list_is_empty (const GstTagList * list);
204 void gst_tag_list_insert (GstTagList * into,
205 const GstTagList * from,
206 GstTagMergeMode mode);
207 GstTagList * gst_tag_list_merge (const GstTagList * list1,
208 const GstTagList * list2,
209 GstTagMergeMode mode);
210 void gst_tag_list_free (GstTagList * list);
211 guint gst_tag_list_get_tag_size (const GstTagList * list,
213 void gst_tag_list_add (GstTagList * list,
214 GstTagMergeMode mode,
216 ...) G_GNUC_NULL_TERMINATED;
217 void gst_tag_list_add_values (GstTagList * list,
218 GstTagMergeMode mode,
220 ...) G_GNUC_NULL_TERMINATED;
221 void gst_tag_list_add_valist (GstTagList * list,
222 GstTagMergeMode mode,
225 void gst_tag_list_add_valist_values (GstTagList * list,
226 GstTagMergeMode mode,
229 void gst_tag_list_remove_tag (GstTagList * list,
231 void gst_tag_list_foreach (const GstTagList * list,
232 GstTagForeachFunc func,
235 G_CONST_RETURN GValue *
236 gst_tag_list_get_value_index (const GstTagList * list,
239 gboolean gst_tag_list_copy_value (GValue * dest,
240 const GstTagList * list,
243 /* simplifications (FIXME: do we want them?) */
244 gboolean gst_tag_list_get_char (const GstTagList * list,
247 gboolean gst_tag_list_get_char_index (const GstTagList * list,
251 gboolean gst_tag_list_get_uchar (const GstTagList * list,
254 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
258 gboolean gst_tag_list_get_boolean (const GstTagList * list,
261 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
265 gboolean gst_tag_list_get_int (const GstTagList * list,
268 gboolean gst_tag_list_get_int_index (const GstTagList * list,
272 gboolean gst_tag_list_get_uint (const GstTagList * list,
275 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
279 gboolean gst_tag_list_get_long (const GstTagList * list,
282 gboolean gst_tag_list_get_long_index (const GstTagList * list,
286 gboolean gst_tag_list_get_ulong (const GstTagList * list,
289 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
293 gboolean gst_tag_list_get_int64 (const GstTagList * list,
296 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
300 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
303 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
307 gboolean gst_tag_list_get_float (const GstTagList * list,
310 gboolean gst_tag_list_get_float_index (const GstTagList * list,
314 gboolean gst_tag_list_get_double (const GstTagList * list,
317 gboolean gst_tag_list_get_double_index (const GstTagList * list,
321 gboolean gst_tag_list_get_string (const GstTagList * list,
324 gboolean gst_tag_list_get_string_index (const GstTagList * list,
328 gboolean gst_tag_list_get_pointer (const GstTagList * list,
331 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
335 gboolean gst_tag_list_get_date (const GstTagList * list,
338 gboolean gst_tag_list_get_date_index (const GstTagList * list,
342 gboolean gst_tag_list_get_buffer (const GstTagList * list,
345 gboolean gst_tag_list_get_buffer_index (const GstTagList * list,
350 /* GStreamer core tags */
354 * commonly used title (string)
356 * The title as it should be displayed, e.g. 'The Doll House'
358 #define GST_TAG_TITLE "title"
360 * GST_TAG_TITLE_SORTNAME:
362 * commonly used title, as used for sorting (string)
364 * The title as it should be sorted, e.g. 'Doll House, The'
368 #define GST_TAG_TITLE_SORTNAME "title-sortname"
372 * person(s) responsible for the recording (string)
374 * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
375 * 'The Guitar Heroes'
377 #define GST_TAG_ARTIST "artist"
379 * GST_TAG_ARTIST_SORTNAME:
381 * person(s) responsible for the recording, as used for sorting (string)
383 * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
384 * 'Guitar Heroes, The'
388 /* FIXME 0.11: change to "artist-sortname" */
389 #define GST_TAG_ARTIST_SORTNAME "musicbrainz-sortname"
393 * album containing this data (string)
395 * The album name as it should be displayed, e.g. 'The Jazz Guitar'
397 #define GST_TAG_ALBUM "album"
399 * GST_TAG_ALBUM_SORTNAME:
401 * album containing this data, as used for sorting (string)
403 * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
407 #define GST_TAG_ALBUM_SORTNAME "album-sortname"
411 * person(s) who composed the recording (string)
415 #define GST_TAG_COMPOSER "composer"
419 * date the data was created (#GDate structure)
421 #define GST_TAG_DATE "date"
425 * genre this data belongs to (string)
427 #define GST_TAG_GENRE "genre"
431 * free text commenting the data (string)
433 #define GST_TAG_COMMENT "comment"
435 * GST_TAG_EXTENDED_COMMENT:
437 * key/value text commenting the data (string)
439 * Must be in the form of 'key=comment' or
440 * 'key[lc]=comment' where 'lc' is an ISO-639
443 * This tag is used for unknown Vorbis comment tags,
444 * unknown APE tags and certain ID3v2 comment fields.
448 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
450 * GST_TAG_TRACK_NUMBER:
452 * track number inside a collection (unsigned integer)
454 #define GST_TAG_TRACK_NUMBER "track-number"
456 * GST_TAG_TRACK_COUNT:
458 * count of tracks inside collection this track belongs to (unsigned integer)
460 #define GST_TAG_TRACK_COUNT "track-count"
462 * GST_TAG_ALBUM_VOLUME_NUMBER:
464 * disc number inside a collection (unsigned integer)
466 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
468 * GST_TAG_ALBUM_VOLUME_COUNT:
470 * count of discs inside collection this disc belongs to (unsigned integer)
472 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
476 * Origin of media as a URI (location, where the original of the file or stream
477 * is hosted) (string)
479 #define GST_TAG_LOCATION "location"
483 * Homepage for this media (i.e. artist or movie homepage) (string)
487 #define GST_TAG_HOMEPAGE "homepage"
489 * GST_TAG_DESCRIPTION:
491 * short text describing the content of the data (string)
493 #define GST_TAG_DESCRIPTION "description"
497 * version of this data (string)
499 #define GST_TAG_VERSION "version"
503 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
505 #define GST_TAG_ISRC "isrc"
507 * GST_TAG_ORGANIZATION:
509 * organization (string)
511 #define GST_TAG_ORGANIZATION "organization"
515 * copyright notice of the data (string)
517 #define GST_TAG_COPYRIGHT "copyright"
519 * GST_TAG_COPYRIGHT_URI:
521 * URI to location where copyright details can be found (string)
525 #define GST_TAG_COPYRIGHT_URI "copyright-uri"
529 * contact information (string)
531 #define GST_TAG_CONTACT "contact"
535 * license of data (string)
537 #define GST_TAG_LICENSE "license"
539 * GST_TAG_LICENSE_URI:
541 * URI to location where license details can be found (string)
545 #define GST_TAG_LICENSE_URI "license-uri"
549 * person(s) performing (string)
551 #define GST_TAG_PERFORMER "performer"
555 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
557 #define GST_TAG_DURATION "duration"
561 * codec the data is stored in (string)
563 #define GST_TAG_CODEC "codec"
565 * GST_TAG_VIDEO_CODEC:
567 * codec the video data is stored in (string)
569 #define GST_TAG_VIDEO_CODEC "video-codec"
571 * GST_TAG_AUDIO_CODEC:
573 * codec the audio data is stored in (string)
575 #define GST_TAG_AUDIO_CODEC "audio-codec"
577 * GST_TAG_SUBTITLE_CODEC:
579 * codec/format the subtitle data is stored in (string)
583 #define GST_TAG_SUBTITLE_CODEC "subtitle-codec"
585 * GST_TAG_CONTAINER_FORMAT:
587 * container format the data is stored in (string)
591 #define GST_TAG_CONTAINER_FORMAT "container-format"
595 * exact or average bitrate in bits/s (unsigned integer)
597 #define GST_TAG_BITRATE "bitrate"
599 * GST_TAG_NOMINAL_BITRATE:
601 * nominal bitrate in bits/s (unsigned integer)
603 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
605 * GST_TAG_MINIMUM_BITRATE:
607 * minimum bitrate in bits/s (unsigned integer)
609 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
611 * GST_TAG_MAXIMUM_BITRATE:
613 * maximum bitrate in bits/s (unsigned integer)
615 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
619 * serial number of track (unsigned integer)
621 #define GST_TAG_SERIAL "serial"
625 * encoder used to encode this stream (string)
627 #define GST_TAG_ENCODER "encoder"
629 * GST_TAG_ENCODER_VERSION:
631 * version of the encoder used to encode this stream (unsigned integer)
633 #define GST_TAG_ENCODER_VERSION "encoder-version"
635 * GST_TAG_TRACK_GAIN:
637 * track gain in db (double)
639 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
641 * GST_TAG_TRACK_PEAK:
643 * peak of the track (double)
645 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
647 * GST_TAG_ALBUM_GAIN:
649 * album gain in db (double)
651 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
653 * GST_TAG_ALBUM_PEAK:
655 * peak of the album (double)
657 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
659 * GST_TAG_REFERENCE_LEVEL:
661 * reference level of track and album gain values (double)
665 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
667 * GST_TAG_LANGUAGE_CODE:
669 * Language code (ISO-639-1) (string) of the content
671 #define GST_TAG_LANGUAGE_CODE "language-code"
675 * image (buffer) (buffer caps should specify the content type and preferably
676 * also set "image-type" field as #GstTagImageType)
680 #define GST_TAG_IMAGE "image"
682 * GST_TAG_PREVIEW_IMAGE:
684 * image that is meant for preview purposes, e.g. small icon-sized version
685 * (buffer) (buffer caps should specify the content type)
689 #define GST_TAG_PREVIEW_IMAGE "preview-image"
692 * GST_TAG_ATTACHMENT:
694 * generic file attachment (buffer) (buffer caps should specify the content
695 * type and if possible set "filename" to the file name of the
700 #define GST_TAG_ATTACHMENT "attachment"
703 * GST_TAG_BEATS_PER_MINUTE:
705 * number of beats per minute in audio (double)
709 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
714 * comma separated keywords describing the content (string).
718 #define GST_TAG_KEYWORDS "keywords"
721 * GST_TAG_GEO_LOCATION_NAME:
723 * human readable descriptive location of where the media has been recorded or
724 * produced. (string).
728 #define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
731 * GST_TAG_GEO_LOCATION_LATITUDE:
733 * geo latitude location of where the media has been recorded or produced in
734 * degrees according to WGS84 (zero at the equator, negative values for southern
735 * latitudes) (double).
739 #define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
742 * GST_TAG_GEO_LOCATION_LONGITUDE:
744 * geo longitude location of where the media has been recorded or produced in
745 * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
746 * negative values for western longitudes). (double).
750 #define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
753 * GST_TAG_GEO_LOCATION_ELEVATION:
755 * geo elevation of where the media has been recorded or produced in meters
756 * according to WGS84 (zero is average sea level) (double).
760 #define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
764 #endif /* __GST_TAGLIST_H__ */