| 1 |
/* gstreamermm - a C++ wrapper for gstreamer |
| 2 |
* |
| 3 |
* Copyright 2008 The gstreamermm Development Team |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the Free |
| 17 |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <gst/gst.h> |
| 21 |
#include <gstreamermm/structure.h> |
| 22 |
|
| 23 |
_DEFS(gstreamermm,gst) |
| 24 |
|
| 25 |
namespace Gst |
| 26 |
{ |
| 27 |
|
| 28 |
_WRAP_ENUM(TagMergeMode, GstTagMergeMode) |
| 29 |
_WRAP_ENUM(TagFlag, GstTagFlag) |
| 30 |
|
| 31 |
// When adding tags, make sure that they are added to this enum and then in the |
| 32 |
// ccg file in the correct order. Also make sure that the size of the array of |
| 33 |
// strings is updated in the declaration below and in the ccg file. |
| 34 |
// These correspond to the GST_TAG_* #defines in the C API. |
| 35 |
//TODO: Maybe do something like Glib::StockID instead? |
| 36 |
/** Identifiers for commonly-used tags. |
| 37 |
*/ |
| 38 |
enum Tag |
| 39 |
{ |
| 40 |
/** The commonly used title (string). |
| 41 |
* The title as it should be displayed, e.g. 'The Doll House'. |
| 42 |
*/ |
| 43 |
TAG_TITLE, |
| 44 |
|
| 45 |
/** The commonly used title, as used for sorting (string). |
| 46 |
* The title as it should be sorted, e.g. 'Doll House, The'. |
| 47 |
* |
| 48 |
* Since 0.10.15. |
| 49 |
*/ |
| 50 |
TAG_TITLE_SORTNAME, |
| 51 |
|
| 52 |
/** The person(s) responsible for the recording (string). |
| 53 |
* The artist name as it should be displayed, e.g. 'Jimi Hendrix' or 'The |
| 54 |
* Guitar Heroes'. |
| 55 |
*/ |
| 56 |
TAG_ARTIST, |
| 57 |
|
| 58 |
/** The person(s) responsible for the recording, as used for sorting (string). |
| 59 |
* The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or 'Guitar |
| 60 |
* Heroes, The'. |
| 61 |
* |
| 62 |
* Since 0.10.15. |
| 63 |
*/ |
| 64 |
TAG_ARTIST_SORTNAME, |
| 65 |
|
| 66 |
/** The album containing this data (string). |
| 67 |
* The album name as it should be displayed, e.g. 'The Jazz Guitar'. |
| 68 |
*/ |
| 69 |
TAG_ALBUM, |
| 70 |
|
| 71 |
/** The album containing this data, as used for sorting (string). |
| 72 |
* The album name as it should be sorted, e.g. 'Jazz Guitar, The'. |
| 73 |
* |
| 74 |
* Since 0.10.15. |
| 75 |
*/ |
| 76 |
TAG_ALBUM_SORTNAME, |
| 77 |
|
| 78 |
/** The date the data was created (GDate structure). |
| 79 |
*/ |
| 80 |
TAG_DATE, |
| 81 |
|
| 82 |
/** The genre this data belongs to (string). |
| 83 |
*/ |
| 84 |
TAG_GENRE, |
| 85 |
|
| 86 |
/** The free text commenting the data (string). |
| 87 |
*/ |
| 88 |
TAG_COMMENT, |
| 89 |
|
| 90 |
/** The Key/value text commenting the data (string). |
| 91 |
* Must be in the form of 'key=comment' or 'key[lc]=comment' where 'lc' is an |
| 92 |
* ISO-639 language code. |
| 93 |
* |
| 94 |
* This tag is used for unknown Vorbis comment tags, unknown APE tags and |
| 95 |
* certain ID3v2 comment fields. |
| 96 |
* |
| 97 |
* Since 0.10.10. |
| 98 |
*/ |
| 99 |
TAG_EXTENDED_COMMENT, |
| 100 |
|
| 101 |
/** The track number inside a collection (unsigned integer). |
| 102 |
*/ |
| 103 |
TAG_TRACK_NUMBER, |
| 104 |
|
| 105 |
/** The count of tracks inside collection this track belongs to (unsigned |
| 106 |
* integer). |
| 107 |
*/ |
| 108 |
TAG_TRACK_COUNT, |
| 109 |
|
| 110 |
/** The disc number inside a collection (unsigned integer). |
| 111 |
*/ |
| 112 |
TAG_ALBUM_VOLUME_NUMBER, |
| 113 |
|
| 114 |
/** The count of discs inside collection this disc belongs to (unsigned |
| 115 |
* integer). |
| 116 |
*/ |
| 117 |
TAG_ALBUM_VOLUME_COUNT, |
| 118 |
|
| 119 |
/** The original location of file as a URI (string). |
| 120 |
*/ |
| 121 |
TAG_LOCATION, |
| 122 |
|
| 123 |
/** The short text describing the content of the data (string). |
| 124 |
*/ |
| 125 |
TAG_DESCRIPTION, |
| 126 |
|
| 127 |
/** The version of this data (string). |
| 128 |
*/ |
| 129 |
TAG_VERSION, |
| 130 |
|
| 131 |
/** The International Standard Recording Code - see http://www.ifpi.org/isrc/ |
| 132 |
* (string). |
| 133 |
*/ |
| 134 |
TAG_ISRC, |
| 135 |
|
| 136 |
/** The organization (string). |
| 137 |
*/ |
| 138 |
TAG_ORGANIZATION, |
| 139 |
|
| 140 |
/** The copyright notice of the data (string). |
| 141 |
*/ |
| 142 |
TAG_COPYRIGHT, |
| 143 |
|
| 144 |
/** The URI to location where copyright details can be found (string). |
| 145 |
* Since 0.10.14. |
| 146 |
*/ |
| 147 |
TAG_COPYRIGHT_URI, |
| 148 |
|
| 149 |
/** The person(s) who composed the recording (string). |
| 150 |
* Since 0.10.15. |
| 151 |
*/ |
| 152 |
TAG_COMPOSER, |
| 153 |
|
| 154 |
/** The contact information (string). |
| 155 |
*/ |
| 156 |
TAG_CONTACT, |
| 157 |
|
| 158 |
/** The license of the data (string). |
| 159 |
*/ |
| 160 |
TAG_LICENSE, |
| 161 |
|
| 162 |
/** The URI to the location where license details can be found (string). |
| 163 |
* Since 0.10.14. |
| 164 |
*/ |
| 165 |
TAG_LICENSE_URI, |
| 166 |
|
| 167 |
/** The person(s) performing (string). |
| 168 |
*/ |
| 169 |
TAG_PERFORMER, |
| 170 |
|
| 171 |
/** The length in GStreamer time units (nanoseconds) (unsigned 64-bit |
| 172 |
* integer). |
| 173 |
*/ |
| 174 |
TAG_DURATION, |
| 175 |
|
| 176 |
/** The codec the data is stored in (string). |
| 177 |
*/ |
| 178 |
TAG_CODEC, |
| 179 |
|
| 180 |
/** The codec the video data is stored in (string). |
| 181 |
*/ |
| 182 |
TAG_VIDEO_CODEC, |
| 183 |
|
| 184 |
/** The codec the audio data is stored in (string). |
| 185 |
*/ |
| 186 |
TAG_AUDIO_CODEC, |
| 187 |
|
| 188 |
/** The exact or average bitrate in bits/s (unsigned integer). |
| 189 |
*/ |
| 190 |
TAG_BITRATE, |
| 191 |
|
| 192 |
/** The nominal bitrate in bits/s (unsigned integer). |
| 193 |
*/ |
| 194 |
TAG_NOMINAL_BITRATE, |
| 195 |
|
| 196 |
/** The minimum bitrate in bits/s (unsigned integer). |
| 197 |
*/ |
| 198 |
TAG_MINIMUM_BITRATE, |
| 199 |
|
| 200 |
/** The maximum bitrate in bits/s (unsigned integer). |
| 201 |
*/ |
| 202 |
TAG_MAXIMUM_BITRATE, |
| 203 |
|
| 204 |
/** The serial number of track (unsigned integer). |
| 205 |
*/ |
| 206 |
TAG_SERIAL, |
| 207 |
|
| 208 |
/** The encoder used to encode this stream (string). |
| 209 |
*/ |
| 210 |
TAG_ENCODER, |
| 211 |
|
| 212 |
/** The version of the encoder used to encode this stream (unsigned integer). |
| 213 |
*/ |
| 214 |
TAG_ENCODER_VERSION, |
| 215 |
|
| 216 |
/** The track gain in db (double). |
| 217 |
*/ |
| 218 |
TAG_TRACK_GAIN, |
| 219 |
|
| 220 |
/** The peak of the track (double). |
| 221 |
*/ |
| 222 |
TAG_TRACK_PEAK, |
| 223 |
|
| 224 |
/** The album gain in db (double). |
| 225 |
*/ |
| 226 |
TAG_ALBUM_GAIN, |
| 227 |
|
| 228 |
/** The peak of the album (double). |
| 229 |
*/ |
| 230 |
TAG_ALBUM_PEAK, |
| 231 |
|
| 232 |
/** The reference level of track and album gain values (double). |
| 233 |
* Since 0.10.12. |
| 234 |
*/ |
| 235 |
TAG_REFERENCE_LEVEL, |
| 236 |
|
| 237 |
/** The language code (ISO-639-1) (string) of the content. |
| 238 |
*/ |
| 239 |
TAG_LANGUAGE_CODE, |
| 240 |
|
| 241 |
/** The image (buffer) (buffer caps should specify the content type and |
| 242 |
* preferably also set "image-type" field as GstTagImageType). |
| 243 |
* Since 0.10.6 |
| 244 |
*/ |
| 245 |
TAG_IMAGE, |
| 246 |
|
| 247 |
/** The image that is meant for preview purposes, e.g.\ small icon-sized |
| 248 |
* version (buffer) (buffer caps should specify the content type). |
| 249 |
* Since 0.10.7. |
| 250 |
*/ |
| 251 |
TAG_PREVIEW_IMAGE, |
| 252 |
|
| 253 |
/** The generic file attachment (buffer) (buffer caps should specify the |
| 254 |
* content type and if possible set "filename" to the file name of the |
| 255 |
* attachment). |
| 256 |
* |
| 257 |
* Since 0.10.21. |
| 258 |
*/ |
| 259 |
TAG_ATTACHMENT, |
| 260 |
|
| 261 |
/** The number of beats per minute in audio (double). |
| 262 |
* Since 0.10.12. |
| 263 |
*/ |
| 264 |
TAG_BEATS_PER_MINUTE, |
| 265 |
|
| 266 |
/** The comma separated keywords describing the content (string). |
| 267 |
* |
| 268 |
* Since 0.10.21 |
| 269 |
*/ |
| 270 |
TAG_KEYWORDS, |
| 271 |
|
| 272 |
/** The human readable descriptive location of where the media has been |
| 273 |
* recorded or produced. (string). |
| 274 |
* |
| 275 |
* Since 0.10.21. |
| 276 |
*/ |
| 277 |
TAG_GEO_LOCATION_NAME, |
| 278 |
|
| 279 |
/** The geo latitude location of where the media has been recorded or produced |
| 280 |
* in degrees according to WGS84 (zero at the equator, negative values for |
| 281 |
* southern latitudes) (double). |
| 282 |
* |
| 283 |
* Since 0.10.21. |
| 284 |
*/ |
| 285 |
TAG_GEO_LOCATION_LATITUDE, |
| 286 |
|
| 287 |
/** The geo longitude location of where the media has been recorded or |
| 288 |
* produced in degrees according to WGS84 (zero at the prime meridian in |
| 289 |
* Greenwich/UK, negative values for western longitudes). (double). |
| 290 |
* |
| 291 |
* Since 0.10.21. |
| 292 |
*/ |
| 293 |
TAG_GEO_LOCATION_LONGITUDE, |
| 294 |
|
| 295 |
/** The geo elevation of where the media has been recorded or produced in |
| 296 |
* meters according to WGS84 (zero is average sea level) (double). |
| 297 |
* |
| 298 |
* Since 0.10.21. |
| 299 |
*/ |
| 300 |
TAG_GEO_LOCATION_ELEVATION |
| 301 |
}; |
| 302 |
|
| 303 |
/** An Output stream operator for the Gst::Tag enum (this will output a |
| 304 |
* string). |
| 305 |
*/ |
| 306 |
std::ostream& operator<<(std::ostream& stream, Tag tag); |
| 307 |
|
| 308 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 309 |
const char* gstreamermm_get_stock_tag(Tag tag); |
| 310 |
#endif |
| 311 |
|
| 312 |
/** A class tha represents a list of tags and values used to describe media |
| 313 |
* metadata. |
| 314 |
* Taglists form part of media streams and describe the content of a stream in |
| 315 |
* a non-technical way. Examples include the author of a song, the title of |
| 316 |
* that very same song or the album it is a part of. Tag reading is done |
| 317 |
* through a Gst::Bus. You can listen for Gst::MESSAGE_TAG messages and handle |
| 318 |
* them as you wish. |
| 319 |
* |
| 320 |
* Note, however, that the Gst::MESSAGE_TAG message may be fired multiple |
| 321 |
* times in the pipeline. It is the application's responsibility to put all |
| 322 |
* those tags together and display them to the user in a nice, coherent way. |
| 323 |
* Usually, using merge() is a good enough way of doing this; make sure to |
| 324 |
* empty the cache when loading a new song, or after every few minutes when |
| 325 |
* listening to internet radio. Also, make sure you use Gst::TAG_MERGE_PREPEND |
| 326 |
* as merging mode, so that a new title (which came in later) has a preference |
| 327 |
* over the old one for display. |
| 328 |
*/ |
| 329 |
class TagList |
| 330 |
{ |
| 331 |
_CUSTOM_STRUCT_PROTOTYPE |
| 332 |
_CLASS_BOXEDTYPE_EXTRA(TagList, GstTagList, gst_tag_list_new_empty, gst_tag_list_copy, gst_tag_list_free) |
| 333 |
_IGNORE(gst_tag_list_copy) |
| 334 |
|
| 335 |
public: |
| 336 |
/** Use this to discover if the TagList is a valid object. |
| 337 |
*/ |
| 338 |
operator bool() const; |
| 339 |
|
| 340 |
_WRAP_METHOD(static bool exists(const Glib::ustring& tag), gst_tag_exists) |
| 341 |
_WRAP_METHOD(static GType get_type(const Glib::ustring& tag), gst_tag_get_type) |
| 342 |
_WRAP_METHOD(static Glib::ustring get_nick(const Glib::ustring& tag), gst_tag_get_nick) |
| 343 |
_WRAP_METHOD(static Glib::ustring get_description(const Glib::ustring& tag), gst_tag_get_description) |
| 344 |
_WRAP_METHOD(static Gst::TagFlag get_flag(const Glib::ustring& tag), gst_tag_get_flag) |
| 345 |
_WRAP_METHOD(static bool is_fixed(const Glib::ustring& tag), gst_tag_is_fixed) |
| 346 |
_WRAP_METHOD(bool is_empty() const, gst_tag_list_is_empty) |
| 347 |
_WRAP_METHOD(void insert(const Gst::TagList& other, TagMergeMode mode = TAG_MERGE_PREPEND), gst_tag_list_insert) |
| 348 |
|
| 349 |
#m4 _CONVERSION(`GstTagList*',`Gst::TagList',`Glib::wrap_taglist($3)') |
| 350 |
_WRAP_METHOD(Gst::TagList merge(const Gst::TagList& other, TagMergeMode mode = TAG_MERGE_PREPEND), gst_tag_list_merge) |
| 351 |
|
| 352 |
_WRAP_METHOD(guint size(const Glib::ustring& tag) const, gst_tag_list_get_tag_size) |
| 353 |
|
| 354 |
/** Sets a GValue for the given @a tag using the specified mode. |
| 355 |
* |
| 356 |
* @param tag The tag name. |
| 357 |
* @param mode The mode to use. |
| 358 |
* @param value The Glib::Value<> to use. |
| 359 |
*/ |
| 360 |
void add_value(Tag tag, const Glib::ValueBase& value, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 361 |
|
| 362 |
/** Sets a GValue for the given @a tag using the specified mode. |
| 363 |
* |
| 364 |
* @param tag The tag name. |
| 365 |
* @param mode The mode to use. |
| 366 |
* @param value The Glib::Value<> to use. |
| 367 |
*/ |
| 368 |
void add_value(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 369 |
|
| 370 |
_IGNORE(gst_tag_list_add_value) |
| 371 |
|
| 372 |
/** Sets the value for the given tag to string @a data using the specified |
| 373 |
* mode. |
| 374 |
* |
| 375 |
* @param tag The tag name. |
| 376 |
* @param data A string to which the tag should be set to. |
| 377 |
* @param mode The merge mode to use. |
| 378 |
*/ |
| 379 |
void add(Tag tag, const char* data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 380 |
|
| 381 |
/** Sets the value for the given tag to string @a data using the specified |
| 382 |
* mode. |
| 383 |
* |
| 384 |
* @param tag The tag name. |
| 385 |
* @param data A string to which the tag should be set to. |
| 386 |
* @param mode The merge mode to use. |
| 387 |
*/ |
| 388 |
void add(const Glib::ustring& tag, const char* data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 389 |
|
| 390 |
/** Sets the value for the given tag using the specified mode. |
| 391 |
* |
| 392 |
* @param tag The tag name. |
| 393 |
* @param data A value which the tag should be set to (this can be any |
| 394 |
* supported C++ type). |
| 395 |
* @param mode The merge mode to use. |
| 396 |
*/ |
| 397 |
template <class DataType> |
| 398 |
void add(Tag tag, const DataType& data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 399 |
|
| 400 |
/** Sets the value for the given tag using the specified mode. |
| 401 |
* |
| 402 |
* @param tag The tag name. |
| 403 |
* @param data A value which the tag should be set to (this can be any |
| 404 |
* supported C++ type). |
| 405 |
* @param mode The merge mode to use. |
| 406 |
*/ |
| 407 |
template <class DataType> |
| 408 |
void add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 409 |
|
| 410 |
// Methods below are written as workaround for Glib::Date - it's not working with |
| 411 |
// with Glib::Value, because GValue with Glib::Date is invalid type for gstreamer functions. |
| 412 |
|
| 413 |
/** Sets the value for the given tag using the specified mode. |
| 414 |
* |
| 415 |
* @param tag The tag name. |
| 416 |
* @param date A date. |
| 417 |
* @param mode The merge mode to use. |
| 418 |
*/ |
| 419 |
void add(Tag tag, const Glib::Date& date, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 420 |
|
| 421 |
/** Sets the value for the given tag using the specified mode. |
| 422 |
* |
| 423 |
* @param tag The tag name. |
| 424 |
* @param date A date. |
| 425 |
* @param mode The merge mode to use. |
| 426 |
*/ |
| 427 |
void add(const Glib::ustring& tag, const Glib::Date& date, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 428 |
|
| 429 |
_IGNORE(gst_tag_list_add_valist, gst_tag_list_add_valist_values) |
| 430 |
|
| 431 |
#m4begin |
| 432 |
dnl See .ccg implementation for how this conversion works. |
| 433 |
_CONVERSION(`Tag', `const gchar*', `gstreamermm_get_stock_tag($3)') |
| 434 |
#m4end |
| 435 |
_WRAP_METHOD(void remove_tag(Tag tag), gst_tag_list_remove_tag) |
| 436 |
|
| 437 |
_WRAP_METHOD(void remove_tag(const Glib::ustring& tag), gst_tag_list_remove_tag) |
| 438 |
|
| 439 |
/** For example, |
| 440 |
* void on_foreach(const Glib::ustring& tag);. |
| 441 |
*/ |
| 442 |
typedef sigc::slot<void, const Glib::ustring&> SlotForeach; |
| 443 |
|
| 444 |
/** Calls the given slot for each tag inside the tag list. Note that if there |
| 445 |
* is no tag, the slot won't be called at all. |
| 446 |
* |
| 447 |
* @param slot Slot to be called for each tag. |
| 448 |
*/ |
| 449 |
void foreach(const SlotForeach& slot); |
| 450 |
_IGNORE(gst_tag_list_foreach) |
| 451 |
|
| 452 |
/** Copies the contents for the given tag into the value, merging multiple |
| 453 |
* values into one if multiple values are associated with the tag. |
| 454 |
* |
| 455 |
* @param dest An uninitialized Glib::ValueBase to copy into. |
| 456 |
* @param tag The tag to read out. |
| 457 |
* @return true, if a value was copied, false if the tag didn't exist in the |
| 458 |
* list. |
| 459 |
*/ |
| 460 |
bool get_value(Tag tag, Glib::ValueBase& dest) const; |
| 461 |
_IGNORE(gst_tag_list_copy_value) |
| 462 |
|
| 463 |
/** Copies the contents for the given tag into the value, merging multiple |
| 464 |
* values into one if multiple values are associated with the tag. |
| 465 |
* |
| 466 |
* @param dest An uninitialized Glib::ValueBase to copy into. |
| 467 |
* @param tag The tag to read out. |
| 468 |
* @return true, if a value was copied, false if the tag didn't exist in the |
| 469 |
* list. |
| 470 |
*/ |
| 471 |
bool get_value(const Glib::ustring& tag, Glib::ValueBase& dest) const; |
| 472 |
_IGNORE(gst_tag_list_copy_value) |
| 473 |
|
| 474 |
/** Gets the value that is at the given index for the given tag. |
| 475 |
* @param tag The tag to read out. |
| 476 |
* @param index Number of entry to read out. |
| 477 |
* @param dest The Glib::ValueBase to store the value in. |
| 478 |
* @return true if tag was available and had right number of entries, false |
| 479 |
* otherwise. |
| 480 |
*/ |
| 481 |
bool get_value(Tag tag, guint index, Glib::ValueBase& dest) const; |
| 482 |
_IGNORE(gst_tag_list_get_value_index) |
| 483 |
|
| 484 |
/** Gets the value that is at the given index for the given tag. |
| 485 |
* @param tag The tag to read out. |
| 486 |
* @param index Number of entry to read out. |
| 487 |
* @param dest The Glib::ValueBase to store the value in. |
| 488 |
* @return true if tag was available and had right number of entries, false |
| 489 |
* otherwise. |
| 490 |
*/ |
| 491 |
bool get_value(const Glib::ustring& tag, guint index, Glib::ValueBase& dest) const; |
| 492 |
_IGNORE(gst_tag_list_get_value_index) |
| 493 |
|
| 494 |
/** Copies the contents for the given tag into the value, merging multiple |
| 495 |
* values into one if multiple values are associated with the tag. |
| 496 |
* @param tag The tag to read out. |
| 497 |
* @param value Location for the result (this can be any supported C++ type). |
| 498 |
* @return true, if a value was copied, false if the tag didn't exist in the |
| 499 |
* given list. |
| 500 |
*/ |
| 501 |
template<class DataType> |
| 502 |
bool get(Tag tag, DataType& value) const; |
| 503 |
|
| 504 |
/** Copies the contents for the given tag into the value, merging multiple |
| 505 |
* values into one if multiple values are associated with the tag. |
| 506 |
* @param tag The tag to read out. |
| 507 |
* @param value Location for the result (this can be any supported C++ type). |
| 508 |
* @return true, if a value was copied, false if the tag didn't exist in the |
| 509 |
* given list. |
| 510 |
*/ |
| 511 |
template<class DataType> |
| 512 |
bool get(const Glib::ustring& tag, DataType& value) const; |
| 513 |
|
| 514 |
_IGNORE(gst_tag_list_get_boolean, |
| 515 |
gst_tag_list_get_int, |
| 516 |
gst_tag_list_get_uint, |
| 517 |
gst_tag_list_get_int64, |
| 518 |
gst_tag_list_get_uint64, |
| 519 |
gst_tag_list_get_float, |
| 520 |
gst_tag_list_get_double, |
| 521 |
gst_tag_list_get_string, |
| 522 |
gst_tag_list_get_pointer, |
| 523 |
gst_tag_list_get_date) |
| 524 |
|
| 525 |
/** Gets the value that is at the given index for the given tag. |
| 526 |
* @param tag The tag to read out. |
| 527 |
* @param index Number of entry to read out. |
| 528 |
* @param value Location for the result (this can be any supported C++ type). |
| 529 |
* @return true, if a value was copied, false if the tag didn't exist in the |
| 530 |
* given list. |
| 531 |
*/ |
| 532 |
template<class DataType> |
| 533 |
bool get(Tag tag, guint index, DataType& value) const; |
| 534 |
|
| 535 |
/** Gets the value that is at the given index for the given tag. |
| 536 |
* @param tag The tag to read out. |
| 537 |
* @param index Number of entry to read out. |
| 538 |
* @param value Location for the result (this can be any supported C++ type). |
| 539 |
* @return true, if a value was copied, false if the tag didn't exist in the |
| 540 |
* given list. |
| 541 |
*/ |
| 542 |
template<class DataType> |
| 543 |
bool get(const Glib::ustring& tag, guint index, DataType& value) const; |
| 544 |
|
| 545 |
_IGNORE(gst_tag_list_get_boolean_index, |
| 546 |
gst_tag_list_get_int_index, |
| 547 |
gst_tag_list_get_uint_index, |
| 548 |
gst_tag_list_get_int64_index, |
| 549 |
gst_tag_list_get_uint64_index, |
| 550 |
gst_tag_list_get_float_index, |
| 551 |
gst_tag_list_get_double_index, |
| 552 |
gst_tag_list_get_string_index, |
| 553 |
gst_tag_list_get_date_index, |
| 554 |
gst_tag_list_get_pointer_index) |
| 555 |
|
| 556 |
//Variable argument functions are ignored. |
| 557 |
_IGNORE(gst_tag_list_add, gst_tag_list_add_values) |
| 558 |
}; |
| 559 |
|
| 560 |
#ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 561 |
|
| 562 |
/***************************** Gst::TagList *****************************/ |
| 563 |
|
| 564 |
template <class DataType> |
| 565 |
void TagList::add(Tag tag, const DataType& data, TagMergeMode mode) |
| 566 |
{ |
| 567 |
typedef Glib::Value<DataType> ValueType; |
| 568 |
|
| 569 |
ValueType value; |
| 570 |
value.init(ValueType::value_type()); |
| 571 |
value.set(data); |
| 572 |
this->add_value(tag, value, mode); |
| 573 |
} |
| 574 |
|
| 575 |
template <class DataType> |
| 576 |
void TagList::add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode) |
| 577 |
{ |
| 578 |
typedef Glib::Value<DataType> ValueType; |
| 579 |
|
| 580 |
ValueType value; |
| 581 |
value.init(ValueType::value_type()); |
| 582 |
value.set(data); |
| 583 |
this->add_value(tag, value, mode); |
| 584 |
} |
| 585 |
|
| 586 |
template<class DataType> |
| 587 |
bool TagList::get(Tag tag, DataType& data) const |
| 588 |
{ |
| 589 |
Glib::Value<DataType> value; |
| 590 |
value.init(value.value_type()); |
| 591 |
const bool result = this->get_value(tag, value); |
| 592 |
|
| 593 |
if(result) |
| 594 |
data = value.get(); |
| 595 |
|
| 596 |
return result; |
| 597 |
} |
| 598 |
|
| 599 |
template<class DataType> |
| 600 |
bool TagList::get(const Glib::ustring& tag, DataType& data) const |
| 601 |
{ |
| 602 |
Glib::Value<DataType> value; |
| 603 |
value.init(value.value_type()); |
| 604 |
const bool result = this->get_value(tag, value); |
| 605 |
|
| 606 |
if(result) |
| 607 |
data = value.get(); |
| 608 |
|
| 609 |
return result; |
| 610 |
} |
| 611 |
|
| 612 |
template<class DataType> |
| 613 |
bool TagList::get(Tag tag, guint index, DataType& data) const |
| 614 |
{ |
| 615 |
Glib::Value<DataType> value; |
| 616 |
value.init(value.value_type()); |
| 617 |
bool result = this->get_value(tag, index, value); |
| 618 |
|
| 619 |
if(result) |
| 620 |
data = value.get(); |
| 621 |
|
| 622 |
return result; |
| 623 |
} |
| 624 |
|
| 625 |
template<class DataType> |
| 626 |
bool TagList::get(const Glib::ustring& tag, guint index, DataType& data) const |
| 627 |
{ |
| 628 |
Glib::Value<DataType> value; |
| 629 |
value.init(value.value_type()); |
| 630 |
bool result = this->get_value(tag, index, value); |
| 631 |
|
| 632 |
if(result) |
| 633 |
data = value.get(); |
| 634 |
|
| 635 |
return result; |
| 636 |
} |
| 637 |
|
| 638 |
|
| 639 |
#endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 640 |
|
| 641 |
} //namespace Gst |