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