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.
44 * Given two taglists: A - the one that are supplied to
45 * gst_tag_setter_merge_tags() or gst_tag_setter_add_tags() and B - the tags
46 * already in the element, how are the tags merged? In the table below this is
47 * shown for the cases that a tag exists in the list (A) or does not exists (!A)
48 * and combination thereof.
50 * <table frame="all" colsep="1" rowsep="1">
51 * <title>merge mode</title>
52 * <tgroup cols='5' align='left'>
55 * <entry>merge mode</entry>
56 * <entry>A + B</entry>
57 * <entry>A + !B</entry>
58 * <entry>!A + B</entry>
59 * <entry>!A + !B</entry>
64 * <entry>REPLACE_ALL</entry>
71 * <entry>REPLACE</entry>
78 * <entry>APPEND</entry>
85 * <entry>PREPEND</entry>
99 * <entry>KEEP_ALL</entry>
110 GST_TAG_MERGE_UNDEFINED,
111 GST_TAG_MERGE_REPLACE_ALL,
112 GST_TAG_MERGE_REPLACE,
113 GST_TAG_MERGE_APPEND,
114 GST_TAG_MERGE_PREPEND,
116 GST_TAG_MERGE_KEEP_ALL,
121 #define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
125 * @GST_TAG_FLAG_UNDEFINED: undefined flag
126 * @GST_TAG_FLAG_META: tag is meta data
127 * @GST_TAG_FLAG_ENCODED: tag is encoded
128 * @GST_TAG_FLAG_DECODED: tag is decoded
129 * @GST_TAG_FLAG_COUNT: number of tag flags
131 * Extra tag flags used when registering tags.
134 GST_TAG_FLAG_UNDEFINED,
136 GST_TAG_FLAG_ENCODED,
137 GST_TAG_FLAG_DECODED,
141 #define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
146 * Opaque #GstTagList data structure.
148 typedef GstStructure GstTagList;
149 #define GST_TAG_LIST(x) ((GstTagList *) (x))
150 #define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
151 #define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
155 * @list: the #GstTagList
156 * @tag: a name of a tag in @list
157 * @user_data: user data
159 * A function that will be called in gst_tag_list_foreach(). The function may
160 * not modify the tag list.
162 typedef void (*GstTagForeachFunc) (const GstTagList * list,
168 * @dest: the destination #GValue
169 * @src: the source #GValue
171 * A function for merging multiple values of a tag used when registering
174 typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
176 /* initialize tagging system */
177 void _gst_tag_initialize (void);
178 GType gst_tag_list_get_type (void);
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,
343 /* GStreamer core tags */
347 * commonly used title (string)
349 #define GST_TAG_TITLE "title"
353 * person(s) responsible for the recording (string)
355 #define GST_TAG_ARTIST "artist"
359 * album containing this data (string)
361 #define GST_TAG_ALBUM "album"
365 * date the data was created (#GDate structure)
367 #define GST_TAG_DATE "date"
371 * genre this data belongs to (string)
373 #define GST_TAG_GENRE "genre"
377 * free text commenting the data (string)
379 #define GST_TAG_COMMENT "comment"
381 * GST_TAG_EXTENDED_COMMENT:
383 * key/value text commenting the data (string)
385 * Must be in the form of 'key=comment' or
386 * 'key[lc]=comment' where 'lc' is an ISO-639
389 * This tag is used for unknown Vorbis comment tags,
390 * unknown APE tags and certain ID3v2 comment fields.
394 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
396 * GST_TAG_TRACK_NUMBER:
398 * track number inside a collection (unsigned integer)
400 #define GST_TAG_TRACK_NUMBER "track-number"
402 * GST_TAG_TRACK_COUNT:
404 * count of tracks inside collection this track belongs to (unsigned integer)
406 #define GST_TAG_TRACK_COUNT "track-count"
408 * GST_TAG_ALBUM_VOLUME_NUMBER:
410 * disc number inside a collection (unsigned integer)
412 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
414 * GST_TAG_ALBUM_VOLUME_COUNT:
416 * count of discs inside collection this disc belongs to (unsigned integer)
418 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
422 * original location of file as a URI (string)
424 #define GST_TAG_LOCATION "location"
426 * GST_TAG_DESCRIPTION:
428 * short text describing the content of the data (string)
430 #define GST_TAG_DESCRIPTION "description"
434 * version of this data (string)
436 #define GST_TAG_VERSION "version"
440 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
442 #define GST_TAG_ISRC "isrc"
444 * GST_TAG_ORGANIZATION:
446 * organization (string)
448 #define GST_TAG_ORGANIZATION "organization"
452 * copyright notice of the data (string)
454 #define GST_TAG_COPYRIGHT "copyright"
458 * contact information (string)
460 #define GST_TAG_CONTACT "contact"
464 * license of data (string)
466 #define GST_TAG_LICENSE "license"
470 * person(s) performing (string)
472 #define GST_TAG_PERFORMER "performer"
476 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
478 #define GST_TAG_DURATION "duration"
482 * codec the data is stored in (string)
484 #define GST_TAG_CODEC "codec"
486 * GST_TAG_VIDEO_CODEC:
488 * codec the video data is stored in (string)
490 #define GST_TAG_VIDEO_CODEC "video-codec"
492 * GST_TAG_AUDIO_CODEC:
494 * codec the audio data is stored in (string)
496 #define GST_TAG_AUDIO_CODEC "audio-codec"
500 * exact or average bitrate in bits/s (unsigned integer)
502 #define GST_TAG_BITRATE "bitrate"
504 * GST_TAG_NOMINAL_BITRATE:
506 * nominal bitrate in bits/s (unsigned integer)
508 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
510 * GST_TAG_MINIMUM_BITRATE:
512 * minimum bitrate in bits/s (unsigned integer)
514 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
516 * GST_TAG_MAXIMUM_BITRATE:
518 * maximum bitrate in bits/s (unsigned integer)
520 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
524 * serial number of track (unsigned integer)
526 #define GST_TAG_SERIAL "serial"
530 * encoder used to encode this stream (string)
532 #define GST_TAG_ENCODER "encoder"
534 * GST_TAG_ENCODER_VERSION:
536 * version of the encoder used to encode this stream (unsigned integer)
538 #define GST_TAG_ENCODER_VERSION "encoder-version"
540 * GST_TAG_TRACK_GAIN:
542 * track gain in db (double)
544 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
546 * GST_TAG_TRACK_PEAK:
548 * peak of the track (double)
550 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
552 * GST_TAG_ALBUM_GAIN:
554 * album gain in db (double)
556 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
558 * GST_TAG_ALBUM_PEAK:
560 * peak of the album (double)
562 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
564 * GST_TAG_REFERENCE_LEVEL:
566 * reference level of track and album gain values (double)
570 #define GST_TAG_REFERENCE_LEVEL "replaygain-reference-level"
572 * GST_TAG_LANGUAGE_CODE:
574 * Language code (ISO-639-1) (string)
576 #define GST_TAG_LANGUAGE_CODE "language-code"
580 * image (buffer) (buffer caps should specify the content type)
584 #define GST_TAG_IMAGE "image"
586 * GST_TAG_PREVIEW_IMAGE:
588 * image that is meant for preview purposes (buffer)
589 * (buffer caps should specify the content type)
593 #define GST_TAG_PREVIEW_IMAGE "preview-image"
595 * GST_TAG_BEATS_PER_MINUTE:
597 * number of beats per minute in audio (double)
601 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
605 #endif /* __GST_TAGLIST_H__ */