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