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
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.
45 GST_TAG_MERGE_UNDEFINED,
46 GST_TAG_MERGE_REPLACE_ALL,
47 GST_TAG_MERGE_REPLACE,
49 GST_TAG_MERGE_PREPEND,
51 GST_TAG_MERGE_KEEP_ALL,
56 #define GST_TAG_MODE_IS_VALID(mode) (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
60 * @GST_TAG_FLAG_UNDEFINED: undefined flag
61 * @GST_TAG_FLAG_META: tag is meta data
62 * @GST_TAG_FLAG_ENCODED: tag is encoded
63 * @GST_TAG_FLAG_DECODED: tag is decoded
64 * @GST_TAG_FLAG_COUNT: number of tag flags
66 * Extra tag flags used when registering tags.
69 GST_TAG_FLAG_UNDEFINED,
76 #define GST_TAG_FLAG_IS_VALID(flag) (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
81 * Opaque #GstTagList data structure.
83 typedef GstStructure GstTagList;
84 #define GST_TAG_LIST(x) ((GstTagList *) (x))
85 #define GST_IS_TAG_LIST(x) ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
86 #define GST_TYPE_TAG_LIST (gst_tag_list_get_type ())
90 * @list: the #GstTagList
91 * @tag: a name of a tag in @list
92 * @user_data: user data
94 * A function that will be called in gst_tag_list_foreach(). The function may
95 * not modify the tag list.
97 typedef void (*GstTagForeachFunc) (const GstTagList * list,
103 * @dest: the destination #GValue
104 * @src: the source #GValue
106 * A function for merging multiple values of a tag used when registering
109 typedef void (* GstTagMergeFunc) (GValue *dest, const GValue *src);
111 /* initialize tagging system */
112 void _gst_tag_initialize (void);
113 GType gst_tag_list_get_type (void);
115 void gst_tag_register (const gchar * name,
120 GstTagMergeFunc func);
122 /* some default merging functions */
123 void gst_tag_merge_use_first (GValue * dest, const GValue * src);
124 void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
126 /* basic tag support */
127 gboolean gst_tag_exists (const gchar * tag);
128 GType gst_tag_get_type (const gchar * tag);
129 G_CONST_RETURN gchar * gst_tag_get_nick (const gchar * tag);
130 G_CONST_RETURN gchar * gst_tag_get_description (const gchar * tag);
131 GstTagFlag gst_tag_get_flag (const gchar * tag);
132 gboolean gst_tag_is_fixed (const gchar * tag);
135 GstTagList * gst_tag_list_new (void);
136 gboolean gst_is_tag_list (gconstpointer p);
137 GstTagList * gst_tag_list_copy (const GstTagList * list);
138 gboolean gst_tag_list_is_empty (const GstTagList * list);
139 void gst_tag_list_insert (GstTagList * into,
140 const GstTagList * from,
141 GstTagMergeMode mode);
142 GstTagList * gst_tag_list_merge (const GstTagList * list1,
143 const GstTagList * list2,
144 GstTagMergeMode mode);
145 void gst_tag_list_free (GstTagList * list);
146 guint gst_tag_list_get_tag_size (const GstTagList * list,
148 void gst_tag_list_add (GstTagList * list,
149 GstTagMergeMode mode,
151 ...) G_GNUC_NULL_TERMINATED;
152 void gst_tag_list_add_values (GstTagList * list,
153 GstTagMergeMode mode,
155 ...) G_GNUC_NULL_TERMINATED;
156 void gst_tag_list_add_valist (GstTagList * list,
157 GstTagMergeMode mode,
160 void gst_tag_list_add_valist_values (GstTagList * list,
161 GstTagMergeMode mode,
164 void gst_tag_list_remove_tag (GstTagList * list,
166 void gst_tag_list_foreach (const GstTagList * list,
167 GstTagForeachFunc func,
170 G_CONST_RETURN GValue *
171 gst_tag_list_get_value_index (const GstTagList * list,
174 gboolean gst_tag_list_copy_value (GValue * dest,
175 const GstTagList * list,
178 /* simplifications (FIXME: do we want them?) */
179 gboolean gst_tag_list_get_char (const GstTagList * list,
182 gboolean gst_tag_list_get_char_index (const GstTagList * list,
186 gboolean gst_tag_list_get_uchar (const GstTagList * list,
189 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
193 gboolean gst_tag_list_get_boolean (const GstTagList * list,
196 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
200 gboolean gst_tag_list_get_int (const GstTagList * list,
203 gboolean gst_tag_list_get_int_index (const GstTagList * list,
207 gboolean gst_tag_list_get_uint (const GstTagList * list,
210 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
214 gboolean gst_tag_list_get_long (const GstTagList * list,
217 gboolean gst_tag_list_get_long_index (const GstTagList * list,
221 gboolean gst_tag_list_get_ulong (const GstTagList * list,
224 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
228 gboolean gst_tag_list_get_int64 (const GstTagList * list,
231 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
235 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
238 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
242 gboolean gst_tag_list_get_float (const GstTagList * list,
245 gboolean gst_tag_list_get_float_index (const GstTagList * list,
249 gboolean gst_tag_list_get_double (const GstTagList * list,
252 gboolean gst_tag_list_get_double_index (const GstTagList * list,
256 gboolean gst_tag_list_get_string (const GstTagList * list,
259 gboolean gst_tag_list_get_string_index (const GstTagList * list,
263 gboolean gst_tag_list_get_pointer (const GstTagList * list,
266 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
270 gboolean gst_tag_list_get_date (const GstTagList * list,
273 gboolean gst_tag_list_get_date_index (const GstTagList * list,
278 /* GStreamer core tags */
282 * commonly used title (string)
284 #define GST_TAG_TITLE "title"
288 * person(s) responsible for the recording (string)
290 #define GST_TAG_ARTIST "artist"
294 * album containing this data (string)
296 #define GST_TAG_ALBUM "album"
300 * date the data was created (#GDate structure)
302 #define GST_TAG_DATE "date"
306 * genre this data belongs to (string)
308 #define GST_TAG_GENRE "genre"
312 * free text commenting the data (string)
314 #define GST_TAG_COMMENT "comment"
316 * GST_TAG_EXTENDED_COMMENT:
318 * key/value text commenting the data (string)
320 * Must be in the form of 'key=comment' or
321 * 'key[lc]=comment' where 'lc' is an ISO-639
324 * This tag is used for unknown Vorbis comment tags,
325 * unknown APE tags and certain ID3v2 comment fields.
329 #define GST_TAG_EXTENDED_COMMENT "extended-comment"
331 * GST_TAG_TRACK_NUMBER:
333 * track number inside a collection (unsigned integer)
335 #define GST_TAG_TRACK_NUMBER "track-number"
337 * GST_TAG_TRACK_COUNT:
339 * count of tracks inside collection this track belongs to (unsigned integer)
341 #define GST_TAG_TRACK_COUNT "track-count"
343 * GST_TAG_ALBUM_VOLUME_NUMBER:
345 * disc number inside a collection (unsigned integer)
347 #define GST_TAG_ALBUM_VOLUME_NUMBER "album-disc-number"
349 * GST_TAG_ALBUM_VOLUME_COUNT:
351 * count of discs inside collection this disc belongs to (unsigned integer)
353 #define GST_TAG_ALBUM_VOLUME_COUNT "album-disc-count"
357 * original location of file as a URI (string)
359 #define GST_TAG_LOCATION "location"
361 * GST_TAG_DESCRIPTION:
363 * short text describing the content of the data (string)
365 #define GST_TAG_DESCRIPTION "description"
369 * version of this data (string)
371 #define GST_TAG_VERSION "version"
375 * International Standard Recording Code - see http://www.ifpi.org/isrc/ (string)
377 #define GST_TAG_ISRC "isrc"
379 * GST_TAG_ORGANIZATION:
381 * organization (string)
383 #define GST_TAG_ORGANIZATION "organization"
387 * copyright notice of the data (string)
389 #define GST_TAG_COPYRIGHT "copyright"
393 * contact information (string)
395 #define GST_TAG_CONTACT "contact"
399 * license of data (string)
401 #define GST_TAG_LICENSE "license"
405 * person(s) performing (string)
407 #define GST_TAG_PERFORMER "performer"
411 * length in GStreamer time units (nanoseconds) (unsigned 64-bit integer)
413 #define GST_TAG_DURATION "duration"
417 * codec the data is stored in (string)
419 #define GST_TAG_CODEC "codec"
421 * GST_TAG_VIDEO_CODEC:
423 * codec the video data is stored in (string)
425 #define GST_TAG_VIDEO_CODEC "video-codec"
427 * GST_TAG_AUDIO_CODEC:
429 * codec the audio data is stored in (string)
431 #define GST_TAG_AUDIO_CODEC "audio-codec"
435 * exact or average bitrate in bits/s (unsigned integer)
437 #define GST_TAG_BITRATE "bitrate"
439 * GST_TAG_NOMINAL_BITRATE:
441 * nominal bitrate in bits/s (unsigned integer)
443 #define GST_TAG_NOMINAL_BITRATE "nominal-bitrate"
445 * GST_TAG_MINIMUM_BITRATE:
447 * minimum bitrate in bits/s (unsigned integer)
449 #define GST_TAG_MINIMUM_BITRATE "minimum-bitrate"
451 * GST_TAG_MAXIMUM_BITRATE:
453 * maximum bitrate in bits/s (unsigned integer)
455 #define GST_TAG_MAXIMUM_BITRATE "maximum-bitrate"
459 * serial number of track (unsigned integer)
461 #define GST_TAG_SERIAL "serial"
465 * encoder used to encode this stream (string)
467 #define GST_TAG_ENCODER "encoder"
469 * GST_TAG_ENCODER_VERSION:
471 * version of the encoder used to encode this stream (unsigned integer)
473 #define GST_TAG_ENCODER_VERSION "encoder-version"
475 * GST_TAG_TRACK_GAIN:
477 * track gain in db (double)
479 #define GST_TAG_TRACK_GAIN "replaygain-track-gain"
481 * GST_TAG_TRACK_PEAK:
483 * peak of the track (double)
485 #define GST_TAG_TRACK_PEAK "replaygain-track-peak"
487 * GST_TAG_ALBUM_GAIN:
489 * album gain in db (double)
491 #define GST_TAG_ALBUM_GAIN "replaygain-album-gain"
493 * GST_TAG_ALBUM_PEAK:
495 * peak of the album (double)
497 #define GST_TAG_ALBUM_PEAK "replaygain-album-peak"
499 * GST_TAG_LANGUAGE_CODE:
501 * Language code (ISO-639-1) (string)
503 #define GST_TAG_LANGUAGE_CODE "language-code"
507 * image (buffer) (buffer caps should specify the content type)
511 #define GST_TAG_IMAGE "image"
513 * GST_TAG_PREVIEW_IMAGE:
515 * image that is meant for preview purposes (buffer)
516 * (buffer caps should specify the content type)
520 #define GST_TAG_PREVIEW_IMAGE "preview-image"
522 * GST_TAG_BEATS_PER_MINUTE:
524 * number of beats per minute in audio
528 #define GST_TAG_BEATS_PER_MINUTE "beats-per-minute"
532 #endif /* __GST_TAGLIST_H__ */