fix doc build fix autogen
[platform/upstream/gstreamer.git] / gst / gsttag.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 #include <gst/gstevent.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 #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 #define GST_TAG_FLAG_IS_VALID(flag)     (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
52
53 typedef GstStructure GstTagList;
54 #define GST_TAG_LIST(x)         ((GstTagList *) (x))
55 #define GST_IS_TAG_LIST(x)      (gst_is_tag_list (GST_TAG_LIST (x)))
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
63 void            gst_tag_register                (gchar *                name,
64                                                  GstTagFlag             flag,
65                                                  GType                  type,
66                                                  gchar *                nick,
67                                                  gchar *                blurb,
68                                                  GstTagMergeFunc        func);
69 /* some default merging functions */
70 void            gst_tag_merge_use_first         (GValue *               dest,
71                                                  const GValue *         values);
72 void            gst_tag_merge_strings_with_comma (GValue *              dest,
73                                                  const GValue *         values);
74
75 /* basic tag support */
76 gboolean        gst_tag_exists                  (const gchar *          tag);
77 GType           gst_tag_get_type                (const gchar *          tag);
78 G_CONST_RETURN gchar *
79                 gst_tag_get_nick                (const gchar *          tag);
80 G_CONST_RETURN gchar *
81                 gst_tag_get_description         (const gchar *          tag);
82 gboolean        gst_tag_is_fixed                (const gchar *          tag);
83
84 /* tag lists */
85 GstTagList *    gst_tag_list_new                (void);
86 gboolean        gst_is_tag_list                 (gconstpointer          p);
87 GstTagList *    gst_tag_list_copy               (const GstTagList *     list);
88 void            gst_tag_list_insert             (GstTagList *           into,
89                                                  const GstTagList *     from,
90                                                  GstTagMergeMode        mode);
91 GstTagList *    gst_tag_list_merge              (const GstTagList *     list1,
92                                                  const GstTagList *     list2,
93                                                  GstTagMergeMode        mode);
94 void            gst_tag_list_free               (GstTagList *           list);
95 guint           gst_tag_list_get_tag_size       (const GstTagList *     list,
96                                                  const gchar *          tag);
97 void            gst_tag_list_add                (GstTagList *           list,
98                                                  GstTagMergeMode        mode,
99                                                  const gchar *          tag,
100                                                  ...);
101 void            gst_tag_list_add_values         (GstTagList *           list,
102                                                  GstTagMergeMode        mode,
103                                                  const gchar *          tag,
104                                                  ...);
105 void            gst_tag_list_add_valist         (GstTagList *           list,
106                                                  GstTagMergeMode        mode,
107                                                  const gchar *          tag,
108                                                  va_list                var_args);
109 void            gst_tag_list_add_valist_values  (GstTagList *           list,
110                                                  GstTagMergeMode        mode,
111                                                  const gchar *          tag,
112                                                  va_list                var_args);
113 void            gst_tag_list_remove_tag         (GstTagList *           list,
114                                                  const gchar *          tag);
115 void            gst_tag_list_foreach            (GstTagList *           list,
116                                                  GstTagForeachFunc      func,
117                                                  gpointer               user_data);
118
119 G_CONST_RETURN GValue *
120                 gst_tag_list_get_value_index    (const GstTagList *     list,
121                                                  const gchar *          tag,
122                                                  guint                  index);
123 gboolean        gst_tag_list_copy_value         (GValue *               dest,
124                                                  const GstTagList *     list,
125                                                  const gchar *          tag);
126
127 /* simplifications (FIXME: do we want them?) */
128 gboolean        gst_tag_list_get_char           (const GstTagList *     list,
129                                                  const gchar *          tag,
130                                                  gchar *                value);
131 gboolean        gst_tag_list_get_char_index     (const GstTagList *     list,
132                                                  const gchar *          tag,
133                                                  guint                  index,
134                                                  gchar *                value);
135 gboolean        gst_tag_list_get_uchar          (const GstTagList *     list,
136                                                  const gchar *          tag,
137                                                  guchar *               value);
138 gboolean        gst_tag_list_get_uchar_index    (const GstTagList *     list,
139                                                  const gchar *          tag,
140                                                  guint                  index,
141                                                  guchar *               value);
142 gboolean        gst_tag_list_get_boolean        (const GstTagList *     list,
143                                                  const gchar *          tag,
144                                                  gboolean *             value);
145 gboolean        gst_tag_list_get_boolean_index  (const GstTagList *     list,
146                                                  const gchar *          tag,
147                                                  guint                  index,
148                                                  gboolean *             value);
149 gboolean        gst_tag_list_get_int            (const GstTagList *     list,
150                                                  const gchar *          tag,
151                                                  gint *                 value);
152 gboolean        gst_tag_list_get_int_index      (const GstTagList *     list,
153                                                  const gchar *          tag,
154                                                  guint                  index,
155                                                  gint *                 value);
156 gboolean        gst_tag_list_get_uint           (const GstTagList *     list,
157                                                  const gchar *          tag,
158                                                  guint *                value);
159 gboolean        gst_tag_list_get_uint_index     (const GstTagList *     list,
160                                                  const gchar *          tag,
161                                                  guint                  index,
162                                                  guint *                value);
163 gboolean        gst_tag_list_get_long           (const GstTagList *     list,
164                                                  const gchar *          tag,
165                                                  glong *                value);
166 gboolean        gst_tag_list_get_long_index     (const GstTagList *     list,
167                                                  const gchar *          tag,
168                                                  guint                  index,
169                                                  glong *                value);
170 gboolean        gst_tag_list_get_ulong          (const GstTagList *     list,
171                                                  const gchar *          tag,
172                                                  gulong *               value);
173 gboolean        gst_tag_list_get_ulong_index    (const GstTagList *     list,
174                                                  const gchar *          tag,
175                                                  guint                  index,
176                                                  gulong *               value);
177 gboolean        gst_tag_list_get_int64          (const GstTagList *     list,
178                                                  const gchar *          tag,
179                                                  gint64 *               value);
180 gboolean        gst_tag_list_get_int64_index    (const GstTagList *     list,
181                                                  const gchar *          tag,
182                                                  guint                  index,
183                                                  gint64 *               value);
184 gboolean        gst_tag_list_get_uint64         (const GstTagList *     list,
185                                                  const gchar *          tag,
186                                                  guint64 *              value);
187 gboolean        gst_tag_list_get_uint64_index   (const GstTagList *     list,
188                                                  const gchar *          tag,
189                                                  guint                  index,
190                                                  guint64 *              value);
191 gboolean        gst_tag_list_get_float          (const GstTagList *     list,
192                                                  const gchar *          tag,
193                                                  gfloat *               value);
194 gboolean        gst_tag_list_get_float_index    (const GstTagList *     list,
195                                                  const gchar *          tag,
196                                                  guint                  index,
197                                                  gfloat *               value);
198 gboolean        gst_tag_list_get_double         (const GstTagList *     list,
199                                                  const gchar *          tag,
200                                                  gdouble *              value);
201 gboolean        gst_tag_list_get_double_index   (const GstTagList *     list,
202                                                  const gchar *          tag,
203                                                  guint                  index,
204                                                  gdouble *              value);
205 gboolean        gst_tag_list_get_string         (const GstTagList *     list,
206                                                  const gchar *          tag,
207                                                  gchar **               value);
208 gboolean        gst_tag_list_get_string_index   (const GstTagList *     list,
209                                                  const gchar *          tag,
210                                                  guint                  index,
211                                                  gchar **               value);
212 gboolean        gst_tag_list_get_pointer        (const GstTagList *     list,
213                                                  const gchar *          tag,
214                                                  gpointer *             value);
215 gboolean        gst_tag_list_get_pointer_index  (const GstTagList *     list,
216                                                  const gchar *          tag,
217                                                  guint                  index,
218                                                  gpointer *             value);
219
220 /* tag events */
221 GstEvent *      gst_event_new_tag               (GstTagList *           list);
222 GstTagList *    gst_event_tag_get_list          (GstEvent *             tag_event);
223
224
225 /* GStreamer core tags (need to be discussed) */
226 #define GST_TAG_TITLE                   "title"
227 #define GST_TAG_ARTIST                  "artist"
228 #define GST_TAG_ALBUM                   "album"
229 #define GST_TAG_DATE                    "date"
230 #define GST_TAG_GENRE                   "genre"
231 #define GST_TAG_COMMENT                 "comment"
232 #define GST_TAG_TRACK_NUMBER            "track-number"
233 #define GST_TAG_TRACK_COUNT             "track-count"
234 #define GST_TAG_LOCATION                "location"
235 #define GST_TAG_DESCRIPTION             "description"
236 #define GST_TAG_VERSION                 "version"
237 #define GST_TAG_ISRC                    "isrc"
238 #define GST_TAG_ORGANIZATION            "organization"
239 #define GST_TAG_COPYRIGHT               "copyright"
240 #define GST_TAG_CONTACT                 "contact"
241 #define GST_TAG_LICENSE                 "license"
242 #define GST_TAG_PERFORMER               "performer"
243 #define GST_TAG_DURATION                "duration"
244 #define GST_TAG_CODEC                   "codec"
245 #define GST_TAG_BITRATE                 "bitrate"
246 #define GST_TAG_NOMINAL_BITRATE         "nominal-bitrate"
247 #define GST_TAG_MINIMUM_BITRATE         "minimum-bitrate"
248 #define GST_TAG_MAXIMUM_BITRATE         "maximum-bitrate"
249 #define GST_TAG_SERIAL                  "serial"
250 #define GST_TAG_ENCODER_VERSION         "encoder-version"
251 #define GST_TAG_TRACK_GAIN              "replaygain-track-gain"
252 #define GST_TAG_TRACK_PEAK              "replaygain-track-peak"
253 #define GST_TAG_ALBUM_GAIN              "replaygain-album-gain"
254 #define GST_TAG_ALBUM_PEAK              "replaygain-album-peak"
255
256
257 G_END_DECLS
258
259 #endif /* __GST_EVENT_H__ */