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/gststructure.h>
27 #include <gst/glib-compat.h>
33 * @GST_TAG_MERGE_UNDEFINED: undefined merge mode
34 * @GST_TAG_MERGE_REPLACE_ALL: replace all tags (clear list and append)
35 * @GST_TAG_MERGE_REPLACE: replace tags
36 * @GST_TAG_MERGE_APPEND: append tags
37 * @GST_TAG_MERGE_PREPEND: prepend tags
38 * @GST_TAG_MERGE_KEEP: keep existing tags
39 * @GST_TAG_MERGE_KEEP_ALL: keep all existing tags
40 * @GST_TAG_MERGE_COUNT: the number of merge modes
42 * The different tag merging modes are basically replace, overwrite and append,
43 * but they can be seen from two directions. Given two taglists: (A) the tags
44 * already in the element and (B) the ones that are supplied to
45 * gst_tag_setter_merge_tags() or gst_tag_setter_add_tags(), how are these tags
46 * merged? In the table below this is shown for the cases that a tag exists in
47 * the list (A) or does not exists (!A) and combinations thereof.
49 * <table frame="all" colsep="1" rowsep="1">
50 * <title>merge mode</title>
51 * <tgroup cols='5' align='left'>
54 * <entry>merge mode</entry>
55 * <entry>A + B</entry>
56 * <entry>A + !B</entry>
57 * <entry>!A + B</entry>
58 * <entry>!A + !B</entry>
63 * <entry>REPLACE_ALL</entry>
70 * <entry>REPLACE</entry>
77 * <entry>APPEND</entry>
84 * <entry>PREPEND</entry>
98 * <entry>KEEP_ALL</entry>
109 GST_TAG_MERGE_UNDEFINED,
110 GST_TAG_MERGE_REPLACE_ALL,
111 GST_TAG_MERGE_REPLACE,
112 GST_TAG_MERGE_APPEND,
113 GST_TAG_MERGE_PREPEND,
115 GST_TAG_MERGE_KEEP_ALL,
120 #define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
124 * @GST_TAG_FLAG_UNDEFINED: undefined flag
125 * @GST_TAG_FLAG_META: tag is meta data
126 * @GST_TAG_FLAG_ENCODED: tag is encoded
127 * @GST_TAG_FLAG_DECODED: tag is decoded
128 * @GST_TAG_FLAG_COUNT: number of tag flags
130 * Extra tag flags used when registering tags.
133 GST_TAG_FLAG_UNDEFINED,
135 GST_TAG_FLAG_ENCODED,
136 GST_TAG_FLAG_DECODED,
140 #define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
145 * Opaque #GstTagList data structure.
147 typedef GstStructure GstTagList;
148 #define GST_TAG_LIST(x) ((GstTagList *) (x))
149 #define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
150 #define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
154 * @list: the #GstTagList
155 * @tag: a name of a tag in @list
156 * @user_data: user data
158 * A function that will be called in gst_tag_list_foreach(). The function may
159 * not modify the tag list.
161 typedef void (*GstTagForeachFunc) (const GstTagList * list,
167 * @dest: the destination #GValue
168 * @src: the source #GValue
170 * A function for merging multiple values of a tag used when registering
173 typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
175 GType gst_tag_list_get_type (void);
177 /* tag registration */
178 void gst_tag_register (const gchar * name,
183 GstTagMergeFunc func);
185 /* some default merging functions */
186 void gst_tag_merge_use_first (GValue * dest, const GValue * src);
187 void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
189 /* basic tag support */
190 gboolean gst_tag_exists (const gchar * tag);
191 GType gst_tag_get_type (const gchar * tag);
192 G_CONST_RETURN gchar * gst_tag_get_nick (const gchar * tag);
193 G_CONST_RETURN gchar * gst_tag_get_description (const gchar * tag);
194 GstTagFlag gst_tag_get_flag (const gchar * tag);
195 gboolean gst_tag_is_fixed (const gchar * tag);
198 GstTagList * gst_tag_list_new (void);
199 gboolean gst_is_tag_list (gconstpointer p);
200 GstTagList * gst_tag_list_copy (const GstTagList * list);
201 gboolean gst_tag_list_is_empty (const GstTagList * list);
202 void gst_tag_list_insert (GstTagList * into,
203 const GstTagList * from,
204 GstTagMergeMode mode);
205 GstTagList * gst_tag_list_merge (const GstTagList * list1,
206 const GstTagList * list2,
207 GstTagMergeMode mode);
208 void gst_tag_list_free (GstTagList * list);
209 guint gst_tag_list_get_tag_size (const GstTagList * list,
211 void gst_tag_list_add (GstTagList * list,
212 GstTagMergeMode mode,
214 ...) G_GNUC_NULL_TERMINATED;
215 void gst_tag_list_add_values (GstTagList * list,
216 GstTagMergeMode mode,
218 ...) G_GNUC_NULL_TERMINATED;
219 void gst_tag_list_add_valist (GstTagList * list,
220 GstTagMergeMode mode,
223 void gst_tag_list_add_valist_values (GstTagList * list,
224 GstTagMergeMode mode,
227 void gst_tag_list_remove_tag (GstTagList * list,
229 void gst_tag_list_foreach (const GstTagList * list,
230 GstTagForeachFunc func,
233 G_CONST_RETURN GValue *
234 gst_tag_list_get_value_index (const GstTagList * list,
237 gboolean gst_tag_list_copy_value (GValue * dest,
238 const GstTagList * list,
241 /* simplifications (FIXME: do we want them?) */
242 gboolean gst_tag_list_get_char (const GstTagList * list,
245 gboolean gst_tag_list_get_char_index (const GstTagList * list,
249 gboolean gst_tag_list_get_uchar (const GstTagList * list,
252 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
256 gboolean gst_tag_list_get_boolean (const GstTagList * list,
259 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
263 gboolean gst_tag_list_get_int (const GstTagList * list,
266 gboolean gst_tag_list_get_int_index (const GstTagList * list,
270 gboolean gst_tag_list_get_uint (const GstTagList * list,
273 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
277 gboolean gst_tag_list_get_long (const GstTagList * list,
280 gboolean gst_tag_list_get_long_index (const GstTagList * list,
284 gboolean gst_tag_list_get_ulong (const GstTagList * list,
287 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
291 gboolean gst_tag_list_get_int64 (const GstTagList * list,
294 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
298 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
301 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
305 gboolean gst_tag_list_get_float (const GstTagList * list,
308 gboolean gst_tag_list_get_float_index (const GstTagList * list,
312 gboolean gst_tag_list_get_double (const GstTagList * list,
315 gboolean gst_tag_list_get_double_index (const GstTagList * list,
319 gboolean gst_tag_list_get_string (const GstTagList * list,
322 gboolean gst_tag_list_get_string_index (const GstTagList * list,
326 gboolean gst_tag_list_get_pointer (const GstTagList * list,
329 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
333 gboolean gst_tag_list_get_date (const GstTagList * list,
336 gboolean gst_tag_list_get_date_index (const GstTagList * list,
341 /* GStreamer core tags */
345 * commonly used title (string)
347 * The title as it should be displayed, e.g. 'The Doll House'
349 #define GST_TAG_TITLE "title"
351 * GST_TAG_TITLE_SORTNAME:
353 * commonly used title, as used for sorting (string)
355 * The title as it should be sorted, e.g. 'Doll House, The'
359 #define GST_TAG_TITLE_SORTNAME "title-sortname"
363 * person(s) responsible for the recording (string)
365 * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or
366 * 'The Guitar Heroes'
368 #define GST_TAG_ARTIST "artist"
370 * GST_TAG_ARTIST_SORTNAME:
372 * person(s) responsible for the recording, as used for sorting (string)
374 * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or
375 * 'Guitar Heroes, The'
379 /* FIXME 0.11: change to "artist-sortname" */
380 #define GST_TAG_ARTIST_SORTNAME "musicbrainz-sortname"
384 * album containing this data (string)
386 * The album name as it should be displayed, e.g. 'The Jazz Guitar'
388 #define GST_TAG_ALBUM "album"
390 * GST_TAG_ALBUM_SORTNAME:
392 * album containing this data, as used for sorting (string)
394 * The album name as it should be sorted, e.g. 'Jazz Guitar, The'
398 #define GST_TAG_ALBUM_SORTNAME "album-sortname"
402 * person(s) who composed the recording (string)
406 #define GST_TAG_COMPOSER "composer"
410 * date the data was created (#GDate structure)
412 #define GST_TAG_DATE "date"
416 * genre this data belongs to (string)
418 #define GST_TAG_GENRE "genre"
422 * free text commenting the data (string)
424 #define GST_TAG_COMMENT "comment"
426 * GST_TAG_EXTENDED_COMMENT:
428 * key/value text commenting the data (string)
430 * Must be in the form of 'key=comment' or
431 * 'key[lc]=comment' where 'lc' is an ISO-639
434 * This tag is used for unknown Vorbis comment tags,
435 * unknown APE tags and certain ID3v2 comment fields.
439 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
441 * GST_TAG_TRACK_NUMBER:
443 * track number inside a collection (unsigned integer)
445 #define GST_TAG_TRACK_NUMBER "track-number"
447 * GST_TAG_TRACK_COUNT:
449 * count of tracks inside collection this track belongs to (unsigned integer)
451 #define GST_TAG_TRACK_COUNT "track-count"
453 * GST_TAG_ALBUM_VOLUME_NUMBER:
455 * disc number inside a collection (unsigned integer)
457 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
459 * GST_TAG_ALBUM_VOLUME_COUNT:
461 * count of discs inside collection this disc belongs to (unsigned integer)
463 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
467 * Origin of media as a URI (location, where the original of the file or stream
468 * is hosted) (string)
470 #define GST_TAG_LOCATION "location"
472 * GST_TAG_DESCRIPTION:
474 * short text describing the content of the data (string)
476 #define GST_TAG_DESCRIPTION "description"
480 * version of this data (string)
482 #define GST_TAG_VERSION "version"
486 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
488 #define GST_TAG_ISRC "isrc"
490 * GST_TAG_ORGANIZATION:
492 * organization (string)
494 #define GST_TAG_ORGANIZATION "organization"
498 * copyright notice of the data (string)
500 #define GST_TAG_COPYRIGHT "copyright"
502 * GST_TAG_COPYRIGHT_URI:
504 * URI to location where copyright details can be found (string)
508 #define GST_TAG_COPYRIGHT_URI "copyright-uri"
512 * contact information (string)
514 #define GST_TAG_CONTACT "contact"
518 * license of data (string)
520 #define GST_TAG_LICENSE "license"
522 * GST_TAG_LICENSE_URI:
524 * URI to location where license details can be found (string)
528 #define GST_TAG_LICENSE_URI "license-uri"
532 * person(s) performing (string)
534 #define GST_TAG_PERFORMER "performer"
538 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
540 #define GST_TAG_DURATION "duration"
544 * codec the data is stored in (string)
546 #define GST_TAG_CODEC "codec"
548 * GST_TAG_VIDEO_CODEC:
550 * codec the video data is stored in (string)
552 #define GST_TAG_VIDEO_CODEC "video-codec"
554 * GST_TAG_AUDIO_CODEC:
556 * codec the audio data is stored in (string)
558 #define GST_TAG_AUDIO_CODEC "audio-codec"
562 * exact or average bitrate in bits/s (unsigned integer)
564 #define GST_TAG_BITRATE "bitrate"
566 * GST_TAG_NOMINAL_BITRATE:
568 * nominal bitrate in bits/s (unsigned integer)
570 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
572 * GST_TAG_MINIMUM_BITRATE:
574 * minimum bitrate in bits/s (unsigned integer)
576 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
578 * GST_TAG_MAXIMUM_BITRATE:
580 * maximum bitrate in bits/s (unsigned integer)
582 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
586 * serial number of track (unsigned integer)
588 #define GST_TAG_SERIAL "serial"
592 * encoder used to encode this stream (string)
594 #define GST_TAG_ENCODER "encoder"
596 * GST_TAG_ENCODER_VERSION:
598 * version of the encoder used to encode this stream (unsigned integer)
600 #define GST_TAG_ENCODER_VERSION "encoder-version"
602 * GST_TAG_TRACK_GAIN:
604 * track gain in db (double)
606 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
608 * GST_TAG_TRACK_PEAK:
610 * peak of the track (double)
612 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
614 * GST_TAG_ALBUM_GAIN:
616 * album gain in db (double)
618 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
620 * GST_TAG_ALBUM_PEAK:
622 * peak of the album (double)
624 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
626 * GST_TAG_REFERENCE_LEVEL:
628 * reference level of track and album gain values (double)
632 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
634 * GST_TAG_LANGUAGE_CODE:
636 * Language code (ISO-639-1) (string) of the content
638 #define GST_TAG_LANGUAGE_CODE "language-code"
642 * image (buffer) (buffer caps should specify the content type and preferably
643 * also set "image-type" field as #GstTagImageType)
647 #define GST_TAG_IMAGE "image"
649 * GST_TAG_PREVIEW_IMAGE:
651 * image that is meant for preview purposes, e.g. small icon-sized version
652 * (buffer) (buffer caps should specify the content type)
656 #define GST_TAG_PREVIEW_IMAGE "preview-image"
659 * GST_TAG_ATTACHMENT:
661 * generic file attachment (buffer) (buffer caps should specify the content
662 * type and if possible set "filename" to the file name of the
667 #define GST_TAG_ATTACHMENT "attachment"
670 * GST_TAG_BEATS_PER_MINUTE:
672 * number of beats per minute in audio (double)
676 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
681 * comma separated keywords describing the content (string).
685 #define GST_TAG_KEYWORDS "keywords"
688 * GST_TAG_GEO_LOCATION_NAME:
690 * human readable descriptive location of where the media has been recorded or
691 * produced. (string).
695 #define GST_TAG_GEO_LOCATION_NAME "geo-location-name"
698 * GST_TAG_GEO_LOCATION_LATITUDE:
700 * geo latitude location of where the media has been recorded or produced in
701 * degrees according to WGS84 (zero at the equator, negative values for southern
702 * latitudes) (double).
706 #define GST_TAG_GEO_LOCATION_LATITUDE "geo-location-latitude"
709 * GST_TAG_GEO_LOCATION_LONGITUDE:
711 * geo longitude location of where the media has been recorded or produced in
712 * degrees according to WGS84 (zero at the prime meridian in Greenwich/UK,
713 * negative values for western longitudes). (double).
717 #define GST_TAG_GEO_LOCATION_LONGITUDE "geo-location-longitude"
720 * GST_TAG_GEO_LOCATION_ELEVATION:
722 * geo elevation of where the media has been recorded or produced in meters
723 * according to WGS84 (zero is average sea level) (double).
727 #define GST_TAG_GEO_LOCATION_ELEVATION "geo-location-elevation"
731 #endif /* __GST_TAGLIST_H__ */