gsttaglist.h: Whoops, foreach function returns void. Also fix some constness.
[platform/upstream/gstreamer.git] / gst / gsttaglist.h
1 /* GStreamer
2  * Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
3  *
4  * gsttaglist.h: Header for tag support
5  *
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.
10  *
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.
15  *
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.
20  */
21
22
23 #ifndef __GST_TAGLIST_H__
24 #define __GST_TAGLIST_H__
25
26 #include <gst/gststructure.h>
27
28 G_BEGIN_DECLS
29
30 typedef enum {
31   GST_TAG_MERGE_UNDEFINED,
32   GST_TAG_MERGE_REPLACE_ALL,
33   GST_TAG_MERGE_REPLACE,
34   GST_TAG_MERGE_APPEND,
35   GST_TAG_MERGE_PREPEND,
36   GST_TAG_MERGE_KEEP,
37   GST_TAG_MERGE_KEEP_ALL,
38   /* add more */
39   GST_TAG_MERGE_COUNT
40 } GstTagMergeMode;
41
42 #define GST_TAG_MODE_IS_VALID(mode)     (((mode) > GST_TAG_MERGE_UNDEFINED) && ((mode) < GST_TAG_MERGE_COUNT))
43
44 typedef enum {
45   GST_TAG_FLAG_UNDEFINED,
46   GST_TAG_FLAG_META,
47   GST_TAG_FLAG_ENCODED,
48   GST_TAG_FLAG_DECODED,
49   GST_TAG_FLAG_COUNT
50 } GstTagFlag;
51
52 #define GST_TAG_FLAG_IS_VALID(flag)     (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
53
54 typedef GstStructure GstTagList;
55 #define GST_TAG_LIST(x)         ((GstTagList *) (x))
56 #define GST_IS_TAG_LIST(x)      (gst_is_tag_list (GST_TAG_LIST (x)))
57 #define GST_TYPE_TAG_LIST       (gst_tag_list_get_type ())
58
59 /**
60  * GstTagForeachFunc:
61  * @list: the #GstTagList
62  * @tag: a name of a tag in @list
63  * @user_data: user data
64  *
65  * A function that will be called in gst_tag_list_foreach(). The function may
66  * not modify the tag list.
67  */
68 typedef void (*GstTagForeachFunc) (const GstTagList *list,
69                                    const gchar * tag,
70                                    gpointer user_data);
71
72 typedef void            (* GstTagMergeFunc)     (GValue *dest, const GValue *src);
73
74 /* initialize tagging system */
75 void            _gst_tag_initialize             (void);
76 GType           gst_tag_list_get_type           (void);
77
78 void            gst_tag_register                (const gchar *          name,
79                                                  GstTagFlag             flag,
80                                                  GType                  type,
81                                                  const gchar *          nick,
82                                                  const gchar *          blurb,
83                                                  GstTagMergeFunc        func);
84 /* some default merging functions */
85 void            gst_tag_merge_use_first         (GValue *               dest,
86                                                  const GValue *         src);
87 void            gst_tag_merge_strings_with_comma (GValue *              dest,
88                                                  const GValue *         src);
89
90 /* basic tag support */
91 gboolean        gst_tag_exists                  (const gchar *          tag);
92 GType           gst_tag_get_type                (const gchar *          tag);
93 G_CONST_RETURN gchar *
94                 gst_tag_get_nick                (const gchar *          tag);
95 G_CONST_RETURN gchar *
96                 gst_tag_get_description         (const gchar *          tag);
97 GstTagFlag      gst_tag_get_flag                (const gchar *          tag);
98 gboolean        gst_tag_is_fixed                (const gchar *          tag);
99
100 /* tag lists */
101 GstTagList *    gst_tag_list_new                (void);
102 gboolean        gst_is_tag_list                 (gconstpointer          p);
103 GstTagList *    gst_tag_list_copy               (const GstTagList *     list);
104 void            gst_tag_list_insert             (GstTagList *           into,
105                                                  const GstTagList *     from,
106                                                  GstTagMergeMode        mode);
107 GstTagList *    gst_tag_list_merge              (const GstTagList *     list1,
108                                                  const GstTagList *     list2,
109                                                  GstTagMergeMode        mode);
110 void            gst_tag_list_free               (GstTagList *           list);
111 guint           gst_tag_list_get_tag_size       (const GstTagList *     list,
112                                                  const gchar *          tag);
113 void            gst_tag_list_add                (GstTagList *           list,
114                                                  GstTagMergeMode        mode,
115                                                  const gchar *          tag,
116                                                  ...);
117 void            gst_tag_list_add_values         (GstTagList *           list,
118                                                  GstTagMergeMode        mode,
119                                                  const gchar *          tag,
120                                                  ...);
121 void            gst_tag_list_add_valist         (GstTagList *           list,
122                                                  GstTagMergeMode        mode,
123                                                  const gchar *          tag,
124                                                  va_list                var_args);
125 void            gst_tag_list_add_valist_values  (GstTagList *           list,
126                                                  GstTagMergeMode        mode,
127                                                  const gchar *          tag,
128                                                  va_list                var_args);
129 void            gst_tag_list_remove_tag         (GstTagList *           list,
130                                                  const gchar *          tag);
131 void            gst_tag_list_foreach            (const GstTagList *     list,
132                                                  GstTagForeachFunc      func,
133                                                  gpointer               user_data);
134
135 G_CONST_RETURN GValue *
136                 gst_tag_list_get_value_index    (const GstTagList *     list,
137                                                  const gchar *          tag,
138                                                  guint                  index);
139 gboolean        gst_tag_list_copy_value         (GValue *               dest,
140                                                  const GstTagList *     list,
141                                                  const gchar *          tag);
142
143 /* simplifications (FIXME: do we want them?) */
144 gboolean        gst_tag_list_get_char           (const GstTagList *     list,
145                                                  const gchar *          tag,
146                                                  gchar *                value);
147 gboolean        gst_tag_list_get_char_index     (const GstTagList *     list,
148                                                  const gchar *          tag,
149                                                  guint                  index,
150                                                  gchar *                value);
151 gboolean        gst_tag_list_get_uchar          (const GstTagList *     list,
152                                                  const gchar *          tag,
153                                                  guchar *               value);
154 gboolean        gst_tag_list_get_uchar_index    (const GstTagList *     list,
155                                                  const gchar *          tag,
156                                                  guint                  index,
157                                                  guchar *               value);
158 gboolean        gst_tag_list_get_boolean        (const GstTagList *     list,
159                                                  const gchar *          tag,
160                                                  gboolean *             value);
161 gboolean        gst_tag_list_get_boolean_index  (const GstTagList *     list,
162                                                  const gchar *          tag,
163                                                  guint                  index,
164                                                  gboolean *             value);
165 gboolean        gst_tag_list_get_int            (const GstTagList *     list,
166                                                  const gchar *          tag,
167                                                  gint *                 value);
168 gboolean        gst_tag_list_get_int_index      (const GstTagList *     list,
169                                                  const gchar *          tag,
170                                                  guint                  index,
171                                                  gint *                 value);
172 gboolean        gst_tag_list_get_uint           (const GstTagList *     list,
173                                                  const gchar *          tag,
174                                                  guint *                value);
175 gboolean        gst_tag_list_get_uint_index     (const GstTagList *     list,
176                                                  const gchar *          tag,
177                                                  guint                  index,
178                                                  guint *                value);
179 gboolean        gst_tag_list_get_long           (const GstTagList *     list,
180                                                  const gchar *          tag,
181                                                  glong *                value);
182 gboolean        gst_tag_list_get_long_index     (const GstTagList *     list,
183                                                  const gchar *          tag,
184                                                  guint                  index,
185                                                  glong *                value);
186 gboolean        gst_tag_list_get_ulong          (const GstTagList *     list,
187                                                  const gchar *          tag,
188                                                  gulong *               value);
189 gboolean        gst_tag_list_get_ulong_index    (const GstTagList *     list,
190                                                  const gchar *          tag,
191                                                  guint                  index,
192                                                  gulong *               value);
193 gboolean        gst_tag_list_get_int64          (const GstTagList *     list,
194                                                  const gchar *          tag,
195                                                  gint64 *               value);
196 gboolean        gst_tag_list_get_int64_index    (const GstTagList *     list,
197                                                  const gchar *          tag,
198                                                  guint                  index,
199                                                  gint64 *               value);
200 gboolean        gst_tag_list_get_uint64         (const GstTagList *     list,
201                                                  const gchar *          tag,
202                                                  guint64 *              value);
203 gboolean        gst_tag_list_get_uint64_index   (const GstTagList *     list,
204                                                  const gchar *          tag,
205                                                  guint                  index,
206                                                  guint64 *              value);
207 gboolean        gst_tag_list_get_float          (const GstTagList *     list,
208                                                  const gchar *          tag,
209                                                  gfloat *               value);
210 gboolean        gst_tag_list_get_float_index    (const GstTagList *     list,
211                                                  const gchar *          tag,
212                                                  guint                  index,
213                                                  gfloat *               value);
214 gboolean        gst_tag_list_get_double         (const GstTagList *     list,
215                                                  const gchar *          tag,
216                                                  gdouble *              value);
217 gboolean        gst_tag_list_get_double_index   (const GstTagList *     list,
218                                                  const gchar *          tag,
219                                                  guint                  index,
220                                                  gdouble *              value);
221 gboolean        gst_tag_list_get_string         (const GstTagList *     list,
222                                                  const gchar *          tag,
223                                                  gchar **               value);
224 gboolean        gst_tag_list_get_string_index   (const GstTagList *     list,
225                                                  const gchar *          tag,
226                                                  guint                  index,
227                                                  gchar **               value);
228 gboolean        gst_tag_list_get_pointer        (const GstTagList *     list,
229                                                  const gchar *          tag,
230                                                  gpointer *             value);
231 gboolean        gst_tag_list_get_pointer_index  (const GstTagList *     list,
232                                                  const gchar *          tag,
233                                                  guint                  index,
234                                                  gpointer *             value);
235 gboolean        gst_tag_list_get_date           (const GstTagList     * list,
236                                                  const gchar          * tag,
237                                                  GDate               ** value);
238 gboolean        gst_tag_list_get_date_index     (const GstTagList     * list,
239                                                  const gchar          * tag,
240                                                  guint                  index,
241                                                  GDate               ** value);
242
243 /* GStreamer core tags (need to be discussed) */
244 /**
245  * GST_TAG_TITLE:
246  *
247  * commonly used title
248  */
249 #define GST_TAG_TITLE                   "title"
250 /**
251  * GST_TAG_ARTIST:
252  *
253  * person(s) responsible for the recording
254  */
255 #define GST_TAG_ARTIST                  "artist"
256 /**
257  * GST_TAG_ALBUM:
258  *
259  * album containing this data
260  */
261 #define GST_TAG_ALBUM                   "album"
262 /**
263  * GST_TAG_DATE:
264  *
265  * date the data was created (#GDate structure)
266  */
267 #define GST_TAG_DATE                    "date"
268 /**
269  * GST_TAG_GENRE:
270  *
271  * genre this data belongs to
272  */
273 #define GST_TAG_GENRE                   "genre"
274 /**
275  * GST_TAG_COMMENT:
276  *
277  * free text commenting the data
278  */
279 #define GST_TAG_COMMENT                 "comment"
280 /**
281  * GST_TAG_TRACK_NUMBER:
282  *
283  * track number inside a collection
284  */
285 #define GST_TAG_TRACK_NUMBER            "track-number"
286 /**
287  * GST_TAG_TRACK_COUNT:
288  *
289  * count of tracks inside collection this track belongs to
290  */
291 #define GST_TAG_TRACK_COUNT             "track-count"
292 /**
293  * GST_TAG_ALBUM_VOLUME_NUMBER:
294  *
295  * disc number inside a collection
296  */
297 #define GST_TAG_ALBUM_VOLUME_NUMBER     "album-disc-number"
298 /**
299  * GST_TAG_ALBUM_VOLUME_COUNT:
300  *
301  * count of discs inside collection this disc belongs to
302  */
303 #define GST_TAG_ALBUM_VOLUME_COUNT      "album-disc-count"
304 /**
305  * GST_TAG_LOCATION:
306  *
307  * original location of file as a URI
308  */
309 #define GST_TAG_LOCATION                "location"
310 /**
311  * GST_TAG_DESCRIPTION:
312  *
313  * short text describing the content of the data
314  */
315 #define GST_TAG_DESCRIPTION             "description"
316 /**
317  * GST_TAG_VERSION:
318  *
319  * version of this data
320  */
321 #define GST_TAG_VERSION                 "version"
322 /**
323  * GST_TAG_ISRC:
324  *
325  * International Standard Recording Code - see http://www.ifpi.org/isrc/
326  */
327 #define GST_TAG_ISRC                    "isrc"
328 /**
329  * GST_TAG_ORGANIZATION:
330  *
331  * organization
332  */
333 #define GST_TAG_ORGANIZATION            "organization"
334 /**
335  * GST_TAG_COPYRIGHT:
336  *
337  * copyright notice of the data
338  */
339 #define GST_TAG_COPYRIGHT               "copyright"
340 /**
341  * GST_TAG_CONTACT:
342  *
343  * contact information
344  */
345 #define GST_TAG_CONTACT                 "contact"
346 /**
347  * GST_TAG_LICENSE:
348  *
349  * license of data
350  */
351 #define GST_TAG_LICENSE                 "license"
352 /**
353  * GST_TAG_PERFORMER:
354  *
355  * person(s) performing
356  */
357 #define GST_TAG_PERFORMER               "performer"
358 /**
359  * GST_TAG_DURATION:
360  *
361  * length in GStreamer time units (nanoseconds)
362  */
363 #define GST_TAG_DURATION                "duration"
364 /**
365  * GST_TAG_CODEC:
366  *
367  * codec the data is stored in
368  */
369 #define GST_TAG_CODEC                   "codec"
370 /**
371  * GST_TAG_VIDEO_CODEC:
372  *
373  * codec the video data is stored in
374  */
375 #define GST_TAG_VIDEO_CODEC             "video-codec"
376 /**
377  * GST_TAG_AUDIO_CODEC:
378  *
379  * codec the audio data is stored in
380  */
381 #define GST_TAG_AUDIO_CODEC             "audio-codec"
382 /**
383  * GST_TAG_BITRATE:
384  *
385  * exact or average bitrate in bits/s
386  */
387 #define GST_TAG_BITRATE                 "bitrate"
388 /**
389  * GST_TAG_NOMINAL_BITRATE:
390  *
391  * nominal bitrate in bits/s
392  */
393 #define GST_TAG_NOMINAL_BITRATE         "nominal-bitrate"
394 /**
395  * GST_TAG_MINIMUM_BITRATE:
396  *
397  * minimum bitrate in bits/s
398  */
399 #define GST_TAG_MINIMUM_BITRATE         "minimum-bitrate"
400 /**
401  * GST_TAG_MAXIMUM_BITRATE:
402  *
403  * maximum bitrate in bits/s
404  */
405 #define GST_TAG_MAXIMUM_BITRATE         "maximum-bitrate"
406 /**
407  * GST_TAG_SERIAL:
408  *
409  * serial number of track
410  */
411 #define GST_TAG_SERIAL                  "serial"
412 /**
413  * GST_TAG_ENCODER:
414  *
415  * encoder used to encode this stream
416  */
417 #define GST_TAG_ENCODER                 "encoder"
418 /**
419  * GST_TAG_ENCODER_VERSION:
420  *
421  * version of the encoder used to encode this stream
422  */
423 #define GST_TAG_ENCODER_VERSION         "encoder-version"
424 /**
425  * GST_TAG_TRACK_GAIN:
426  *
427  * track gain in db
428  */
429 #define GST_TAG_TRACK_GAIN              "replaygain-track-gain"
430 /**
431  * GST_TAG_TRACK_PEAK:
432  *
433  * peak of the track
434  */
435 #define GST_TAG_TRACK_PEAK              "replaygain-track-peak"
436 /**
437  * GST_TAG_ALBUM_GAIN:
438  *
439  * album gain in db
440  */
441 #define GST_TAG_ALBUM_GAIN              "replaygain-album-gain"
442 /**
443  * GST_TAG_ALBUM_PEAK:
444  *
445  * peak of the album
446  */
447 #define GST_TAG_ALBUM_PEAK              "replaygain-album-peak"
448 /**
449  * GST_TAG_LANGUAGE_CODE:
450  *
451  * Language code (ISO-639-1)
452  */
453 #define GST_TAG_LANGUAGE_CODE           "language-code"
454
455 G_END_DECLS
456
457 #endif /* __GST_TAGLIST_H__ */