*.h: Revert indentation changes.
[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 #include <gst/gstevent.h>
28
29 G_BEGIN_DECLS typedef enum
30 {
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 }
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 {
47   GST_TAG_FLAG_UNDEFINED,
48   GST_TAG_FLAG_META,
49   GST_TAG_FLAG_ENCODED,
50   GST_TAG_FLAG_DECODED,
51   GST_TAG_FLAG_COUNT
52 }
53 GstTagFlag;
54
55 #define GST_TAG_FLAG_IS_VALID(flag)     (((flag) > GST_TAG_FLAG_UNDEFINED) && ((flag) < GST_TAG_FLAG_COUNT))
56
57 typedef GstStructure GstTagList;
58
59 #define GST_TAG_LIST(x)         ((GstTagList *) (x))
60 #define GST_IS_TAG_LIST(x)      (gst_is_tag_list (GST_TAG_LIST (x)))
61 #define GST_TYPE_TAG_LIST       (gst_tag_list_get_type ())
62
63 typedef void (*GstTagForeachFunc) (const GstTagList * list, const gchar * tag,
64     gpointer user_data);
65 typedef void (*GstTagMergeFunc) (GValue * dest, const GValue * src);
66
67 /* initialize tagging system */
68 void _gst_tag_initialize (void);
69 GType gst_tag_list_get_type (void);
70
71 void gst_tag_register (gchar * name,
72     GstTagFlag flag,
73     GType type, gchar * nick, gchar * blurb, GstTagMergeFunc func);
74 /* some default merging functions */
75 void gst_tag_merge_use_first (GValue * dest, const GValue * src);
76 void gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src);
77
78 /* basic tag support */
79 gboolean gst_tag_exists (const gchar * tag);
80 GType gst_tag_get_type (const gchar * tag);
81 G_CONST_RETURN gchar *gst_tag_get_nick (const gchar * tag);
82 G_CONST_RETURN gchar *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, GstTagMergeMode mode);
92 GstTagList *gst_tag_list_merge (const GstTagList * list1,
93     const GstTagList * list2, GstTagMergeMode mode);
94 void gst_tag_list_free (GstTagList * list);
95 guint gst_tag_list_get_tag_size (const GstTagList * list, const gchar * tag);
96 void gst_tag_list_add (GstTagList * list,
97     GstTagMergeMode mode, const gchar * tag, ...);
98 void gst_tag_list_add_values (GstTagList * list,
99     GstTagMergeMode mode, const gchar * tag, ...);
100 void gst_tag_list_add_valist (GstTagList * list,
101     GstTagMergeMode mode, const gchar * tag, va_list var_args);
102 void gst_tag_list_add_valist_values (GstTagList * list,
103     GstTagMergeMode mode, const gchar * tag, va_list var_args);
104 void gst_tag_list_remove_tag (GstTagList * list, const gchar * tag);
105 void gst_tag_list_foreach (GstTagList * list,
106     GstTagForeachFunc func, gpointer user_data);
107
108 G_CONST_RETURN GValue *gst_tag_list_get_value_index (const GstTagList * list,
109     const gchar * tag, guint index);
110 gboolean gst_tag_list_copy_value (GValue * dest,
111     const GstTagList * list, const gchar * tag);
112
113 /* simplifications (FIXME: do we want them?) */
114 gboolean gst_tag_list_get_char (const GstTagList * list,
115     const gchar * tag, gchar * value);
116 gboolean gst_tag_list_get_char_index (const GstTagList * list,
117     const gchar * tag, guint index, gchar * value);
118 gboolean gst_tag_list_get_uchar (const GstTagList * list,
119     const gchar * tag, guchar * value);
120 gboolean gst_tag_list_get_uchar_index (const GstTagList * list,
121     const gchar * tag, guint index, guchar * value);
122 gboolean gst_tag_list_get_boolean (const GstTagList * list,
123     const gchar * tag, gboolean * value);
124 gboolean gst_tag_list_get_boolean_index (const GstTagList * list,
125     const gchar * tag, guint index, gboolean * value);
126 gboolean gst_tag_list_get_int (const GstTagList * list,
127     const gchar * tag, gint * value);
128 gboolean gst_tag_list_get_int_index (const GstTagList * list,
129     const gchar * tag, guint index, gint * value);
130 gboolean gst_tag_list_get_uint (const GstTagList * list,
131     const gchar * tag, guint * value);
132 gboolean gst_tag_list_get_uint_index (const GstTagList * list,
133     const gchar * tag, guint index, guint * value);
134 gboolean gst_tag_list_get_long (const GstTagList * list,
135     const gchar * tag, glong * value);
136 gboolean gst_tag_list_get_long_index (const GstTagList * list,
137     const gchar * tag, guint index, glong * value);
138 gboolean gst_tag_list_get_ulong (const GstTagList * list,
139     const gchar * tag, gulong * value);
140 gboolean gst_tag_list_get_ulong_index (const GstTagList * list,
141     const gchar * tag, guint index, gulong * value);
142 gboolean gst_tag_list_get_int64 (const GstTagList * list,
143     const gchar * tag, gint64 * value);
144 gboolean gst_tag_list_get_int64_index (const GstTagList * list,
145     const gchar * tag, guint index, gint64 * value);
146 gboolean gst_tag_list_get_uint64 (const GstTagList * list,
147     const gchar * tag, guint64 * value);
148 gboolean gst_tag_list_get_uint64_index (const GstTagList * list,
149     const gchar * tag, guint index, guint64 * value);
150 gboolean gst_tag_list_get_float (const GstTagList * list,
151     const gchar * tag, gfloat * value);
152 gboolean gst_tag_list_get_float_index (const GstTagList * list,
153     const gchar * tag, guint index, gfloat * value);
154 gboolean gst_tag_list_get_double (const GstTagList * list,
155     const gchar * tag, gdouble * value);
156 gboolean gst_tag_list_get_double_index (const GstTagList * list,
157     const gchar * tag, guint index, gdouble * value);
158 gboolean gst_tag_list_get_string (const GstTagList * list,
159     const gchar * tag, gchar ** value);
160 gboolean gst_tag_list_get_string_index (const GstTagList * list,
161     const gchar * tag, guint index, gchar ** value);
162 gboolean gst_tag_list_get_pointer (const GstTagList * list,
163     const gchar * tag, gpointer * value);
164 gboolean gst_tag_list_get_pointer_index (const GstTagList * list,
165     const gchar * tag, guint index, gpointer * value);
166
167 /* tag events */
168 GstEvent *gst_event_new_tag (GstTagList * list);
169 GstTagList *gst_event_tag_get_list (GstEvent * tag_event);
170
171
172 /* GStreamer core tags (need to be discussed) */
173 #define GST_TAG_TITLE                   "title"
174 #define GST_TAG_ARTIST                  "artist"
175 #define GST_TAG_ALBUM                   "album"
176 #define GST_TAG_DATE                    "date"
177 #define GST_TAG_GENRE                   "genre"
178 #define GST_TAG_COMMENT                 "comment"
179 #define GST_TAG_TRACK_NUMBER            "track-number"
180 #define GST_TAG_TRACK_COUNT             "track-count"
181 #define GST_TAG_ALBUM_VOLUME_NUMBER     "album-disc-number"
182 #define GST_TAG_ALBUM_VOLUME_COUNT      "album-disc-count"
183 #define GST_TAG_LOCATION                "location"
184 #define GST_TAG_DESCRIPTION             "description"
185 #define GST_TAG_VERSION                 "version"
186 #define GST_TAG_ISRC                    "isrc"
187 #define GST_TAG_ORGANIZATION            "organization"
188 #define GST_TAG_COPYRIGHT               "copyright"
189 #define GST_TAG_CONTACT                 "contact"
190 #define GST_TAG_LICENSE                 "license"
191 #define GST_TAG_PERFORMER               "performer"
192 #define GST_TAG_DURATION                "duration"
193 #define GST_TAG_CODEC                   "codec"
194 #define GST_TAG_VIDEO_CODEC             "video-codec"
195 #define GST_TAG_AUDIO_CODEC             "audio-codec"
196 #define GST_TAG_BITRATE                 "bitrate"
197 #define GST_TAG_NOMINAL_BITRATE         "nominal-bitrate"
198 #define GST_TAG_MINIMUM_BITRATE         "minimum-bitrate"
199 #define GST_TAG_MAXIMUM_BITRATE         "maximum-bitrate"
200 #define GST_TAG_SERIAL                  "serial"
201 #define GST_TAG_ENCODER                 "encoder"
202 #define GST_TAG_ENCODER_VERSION         "encoder-version"
203 #define GST_TAG_TRACK_GAIN              "replaygain-track-gain"
204 #define GST_TAG_TRACK_PEAK              "replaygain-track-peak"
205 #define GST_TAG_ALBUM_GAIN              "replaygain-album-gain"
206 #define GST_TAG_ALBUM_PEAK              "replaygain-album-peak"
207
208 G_END_DECLS
209 #endif /* __GST_EVENT_H__ */