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