| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_TAGLIST_H |
| 3 | #define _GSTREAMERMM_TAGLIST_H |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2008 The gstreamermm Development Team |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <gst/gst.h> |
| 29 | #include <gstreamermm/structure.h> |
| 30 | |
| 31 | |
| 32 | namespace Gst |
| 33 | { |
| 34 | |
| 35 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 36 | |
| 37 | /** |
| 38 | * @var TagMergeMode TAG_MERGE_UNDEFINED |
| 39 | * Undefined merge mode. |
| 40 | * |
| 41 | * @var TagMergeMode TAG_MERGE_REPLACE_ALL |
| 42 | * Replace all tags (clear list and append). |
| 43 | * |
| 44 | * @var TagMergeMode TAG_MERGE_REPLACE |
| 45 | * Replace tags. |
| 46 | * |
| 47 | * @var TagMergeMode TAG_MERGE_APPEND |
| 48 | * Append tags. |
| 49 | * |
| 50 | * @var TagMergeMode TAG_MERGE_PREPEND |
| 51 | * Prepend tags. |
| 52 | * |
| 53 | * @var TagMergeMode TAG_MERGE_KEEP |
| 54 | * Keep existing tags. |
| 55 | * |
| 56 | * @var TagMergeMode TAG_MERGE_KEEP_ALL |
| 57 | * Keep all existing tags. |
| 58 | * |
| 59 | * @var TagMergeMode TAG_MERGE_COUNT |
| 60 | * The number of merge modes. |
| 61 | * |
| 62 | * @enum TagMergeMode |
| 63 | * |
| 64 | * The different tag merging modes are basically replace, overwrite and append, |
| 65 | * but they can be seen from two directions. Given two taglists: (A) the tags |
| 66 | * already in the element and (B) the ones that are supplied to the element ( |
| 67 | * e.g. via gst_tag_setter_merge_tags() / gst_tag_setter_add_tags() or a |
| 68 | * Gst::EVENT_TAG), how are these tags merged? |
| 69 | * In the table below this is shown for the cases that a tag exists in the list |
| 70 | * (A) or does not exists (!A) and combinations thereof. |
| 71 | * |
| 72 | * <table frame="all" colsep="1" rowsep="1"> |
| 73 | * <title>merge mode</title> |
| 74 | * <tgroup cols='5' align='left'> |
| 75 | * <thead> |
| 76 | * <row> |
| 77 | * <entry>merge mode</entry> |
| 78 | * <entry>A + B</entry> |
| 79 | * <entry>A + !B</entry> |
| 80 | * <entry>!A + B</entry> |
| 81 | * <entry>!A + !B</entry> |
| 82 | * </row> |
| 83 | * </thead> |
| 84 | * <tbody> |
| 85 | * <row> |
| 86 | * <entry>REPLACE_ALL</entry> |
| 87 | * <entry>B</entry> |
| 88 | * <entry>-</entry> |
| 89 | * <entry>B</entry> |
| 90 | * <entry>-</entry> |
| 91 | * </row> |
| 92 | * <row> |
| 93 | * <entry>REPLACE</entry> |
| 94 | * <entry>B</entry> |
| 95 | * <entry>A</entry> |
| 96 | * <entry>B</entry> |
| 97 | * <entry>-</entry> |
| 98 | * </row> |
| 99 | * <row> |
| 100 | * <entry>APPEND</entry> |
| 101 | * <entry>A, B</entry> |
| 102 | * <entry>A</entry> |
| 103 | * <entry>B</entry> |
| 104 | * <entry>-</entry> |
| 105 | * </row> |
| 106 | * <row> |
| 107 | * <entry>PREPEND</entry> |
| 108 | * <entry>B, A</entry> |
| 109 | * <entry>A</entry> |
| 110 | * <entry>B</entry> |
| 111 | * <entry>-</entry> |
| 112 | * </row> |
| 113 | * <row> |
| 114 | * <entry>KEEP</entry> |
| 115 | * <entry>A</entry> |
| 116 | * <entry>A</entry> |
| 117 | * <entry>B</entry> |
| 118 | * <entry>-</entry> |
| 119 | * </row> |
| 120 | * <row> |
| 121 | * <entry>KEEP_ALL</entry> |
| 122 | * <entry>A</entry> |
| 123 | * <entry>A</entry> |
| 124 | * <entry>-</entry> |
| 125 | * <entry>-</entry> |
| 126 | * </row> |
| 127 | * </tbody> |
| 128 | * </tgroup> |
| 129 | * </table> |
| 130 | * |
| 131 | * @ingroup gstreamermmEnums |
| 132 | */ |
| 133 | enum TagMergeMode |
| 134 | { |
| 135 | TAG_MERGE_UNDEFINED, |
| 136 | TAG_MERGE_REPLACE_ALL, |
| 137 | TAG_MERGE_REPLACE, |
| 138 | TAG_MERGE_APPEND, |
| 139 | TAG_MERGE_PREPEND, |
| 140 | TAG_MERGE_KEEP, |
| 141 | TAG_MERGE_KEEP_ALL, |
| 142 | TAG_MERGE_COUNT |
| 143 | }; |
| 144 | |
| 145 | } // namespace Gst |
| 146 | |
| 147 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 148 | namespace Glib |
| 149 | { |
| 150 | |
| 151 | template <> |
| 152 | class Value<Gst::TagMergeMode> : public Glib::Value_Enum<Gst::TagMergeMode> |
| 153 | { |
| 154 | public: |
| 155 | static GType value_type() G_GNUC_CONST; |
| 156 | }; |
| 157 | |
| 158 | } // namespace Glib |
| 159 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 160 | |
| 161 | namespace Gst |
| 162 | { |
| 163 | |
| 164 | /** |
| 165 | * @var TagFlag TAG_FLAG_UNDEFINED |
| 166 | * Undefined flag. |
| 167 | * |
| 168 | * @var TagFlag TAG_FLAG_META |
| 169 | * Tag is meta data. |
| 170 | * |
| 171 | * @var TagFlag TAG_FLAG_ENCODED |
| 172 | * Tag is encoded. |
| 173 | * |
| 174 | * @var TagFlag TAG_FLAG_DECODED |
| 175 | * Tag is decoded. |
| 176 | * |
| 177 | * @var TagFlag TAG_FLAG_COUNT |
| 178 | * Number of tag flags. |
| 179 | * |
| 180 | * @enum TagFlag |
| 181 | * |
| 182 | * Extra tag flags used when registering tags. |
| 183 | * |
| 184 | * @ingroup gstreamermmEnums |
| 185 | */ |
| 186 | enum TagFlag |
| 187 | { |
| 188 | TAG_FLAG_UNDEFINED, |
| 189 | TAG_FLAG_META, |
| 190 | TAG_FLAG_ENCODED, |
| 191 | TAG_FLAG_DECODED, |
| 192 | TAG_FLAG_COUNT |
| 193 | }; |
| 194 | |
| 195 | } // namespace Gst |
| 196 | |
| 197 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 198 | namespace Glib |
| 199 | { |
| 200 | |
| 201 | template <> |
| 202 | class Value<Gst::TagFlag> : public Glib::Value_Enum<Gst::TagFlag> |
| 203 | { |
| 204 | public: |
| 205 | static GType value_type() G_GNUC_CONST; |
| 206 | }; |
| 207 | |
| 208 | } // namespace Glib |
| 209 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 210 | |
| 211 | namespace Gst |
| 212 | { |
| 213 | |
| 214 | |
| 215 | // When adding tags, make sure that they are added to this enum and then in the |
| 216 | // ccg file in the correct order. Also make sure that the size of the array of |
| 217 | // strings is updated in the declaration below and in the ccg file. |
| 218 | // These correspond to the GST_TAG_* #defines in the C API. |
| 219 | //TODO: Maybe do something like Glib::StockID instead? |
| 220 | /** Identifiers for commonly-used tags. |
| 221 | */ |
| 222 | enum Tag |
| 223 | { |
| 224 | /** The commonly used title (string). |
| 225 | * The title as it should be displayed, e.g. 'The Doll House'. |
| 226 | */ |
| 227 | TAG_TITLE, |
| 228 | |
| 229 | /** The commonly used title, as used for sorting (string). |
| 230 | * The title as it should be sorted, e.g. 'Doll House, The'. |
| 231 | * |
| 232 | * Since 0.10.15. |
| 233 | */ |
| 234 | TAG_TITLE_SORTNAME, |
| 235 | |
| 236 | /** The person(s) responsible for the recording (string). |
| 237 | * The artist name as it should be displayed, e.g. 'Jimi Hendrix' or 'The |
| 238 | * Guitar Heroes'. |
| 239 | */ |
| 240 | TAG_ARTIST, |
| 241 | |
| 242 | /** The person(s) responsible for the recording, as used for sorting (string). |
| 243 | * The artist name as it should be sorted, e.g. 'Hendrix, Jimi' or 'Guitar |
| 244 | * Heroes, The'. |
| 245 | * |
| 246 | * Since 0.10.15. |
| 247 | */ |
| 248 | TAG_ARTIST_SORTNAME, |
| 249 | |
| 250 | /** The album containing this data (string). |
| 251 | * The album name as it should be displayed, e.g. 'The Jazz Guitar'. |
| 252 | */ |
| 253 | TAG_ALBUM, |
| 254 | |
| 255 | /** The album containing this data, as used for sorting (string). |
| 256 | * The album name as it should be sorted, e.g. 'Jazz Guitar, The'. |
| 257 | * |
| 258 | * Since 0.10.15. |
| 259 | */ |
| 260 | TAG_ALBUM_SORTNAME, |
| 261 | |
| 262 | /** The date the data was created (GDate structure). |
| 263 | */ |
| 264 | TAG_DATE, |
| 265 | |
| 266 | /** The genre this data belongs to (string). |
| 267 | */ |
| 268 | TAG_GENRE, |
| 269 | |
| 270 | /** The free text commenting the data (string). |
| 271 | */ |
| 272 | TAG_COMMENT, |
| 273 | |
| 274 | /** The Key/value text commenting the data (string). |
| 275 | * Must be in the form of 'key=comment' or 'key[lc]=comment' where 'lc' is an |
| 276 | * ISO-639 language code. |
| 277 | * |
| 278 | * This tag is used for unknown Vorbis comment tags, unknown APE tags and |
| 279 | * certain ID3v2 comment fields. |
| 280 | * |
| 281 | * Since 0.10.10. |
| 282 | */ |
| 283 | TAG_EXTENDED_COMMENT, |
| 284 | |
| 285 | /** The track number inside a collection (unsigned integer). |
| 286 | */ |
| 287 | TAG_TRACK_NUMBER, |
| 288 | |
| 289 | /** The count of tracks inside collection this track belongs to (unsigned |
| 290 | * integer). |
| 291 | */ |
| 292 | TAG_TRACK_COUNT, |
| 293 | |
| 294 | /** The disc number inside a collection (unsigned integer). |
| 295 | */ |
| 296 | TAG_ALBUM_VOLUME_NUMBER, |
| 297 | |
| 298 | /** The count of discs inside collection this disc belongs to (unsigned |
| 299 | * integer). |
| 300 | */ |
| 301 | TAG_ALBUM_VOLUME_COUNT, |
| 302 | |
| 303 | /** The original location of file as a URI (string). |
| 304 | */ |
| 305 | TAG_LOCATION, |
| 306 | |
| 307 | /** The short text describing the content of the data (string). |
| 308 | */ |
| 309 | TAG_DESCRIPTION, |
| 310 | |
| 311 | /** The version of this data (string). |
| 312 | */ |
| 313 | TAG_VERSION, |
| 314 | |
| 315 | /** The International Standard Recording Code - see http://www.ifpi.org/isrc/ |
| 316 | * (string). |
| 317 | */ |
| 318 | TAG_ISRC, |
| 319 | |
| 320 | /** The organization (string). |
| 321 | */ |
| 322 | TAG_ORGANIZATION, |
| 323 | |
| 324 | /** The copyright notice of the data (string). |
| 325 | */ |
| 326 | TAG_COPYRIGHT, |
| 327 | |
| 328 | /** The URI to location where copyright details can be found (string). |
| 329 | * Since 0.10.14. |
| 330 | */ |
| 331 | TAG_COPYRIGHT_URI, |
| 332 | |
| 333 | /** The person(s) who composed the recording (string). |
| 334 | * Since 0.10.15. |
| 335 | */ |
| 336 | TAG_COMPOSER, |
| 337 | |
| 338 | /** The contact information (string). |
| 339 | */ |
| 340 | TAG_CONTACT, |
| 341 | |
| 342 | /** The license of the data (string). |
| 343 | */ |
| 344 | TAG_LICENSE, |
| 345 | |
| 346 | /** The URI to the location where license details can be found (string). |
| 347 | * Since 0.10.14. |
| 348 | */ |
| 349 | TAG_LICENSE_URI, |
| 350 | |
| 351 | /** The person(s) performing (string). |
| 352 | */ |
| 353 | TAG_PERFORMER, |
| 354 | |
| 355 | /** The length in GStreamer time units (nanoseconds) (unsigned 64-bit |
| 356 | * integer). |
| 357 | */ |
| 358 | TAG_DURATION, |
| 359 | |
| 360 | /** The codec the data is stored in (string). |
| 361 | */ |
| 362 | TAG_CODEC, |
| 363 | |
| 364 | /** The codec the video data is stored in (string). |
| 365 | */ |
| 366 | TAG_VIDEO_CODEC, |
| 367 | |
| 368 | /** The codec the audio data is stored in (string). |
| 369 | */ |
| 370 | TAG_AUDIO_CODEC, |
| 371 | |
| 372 | /** The exact or average bitrate in bits/s (unsigned integer). |
| 373 | */ |
| 374 | TAG_BITRATE, |
| 375 | |
| 376 | /** The nominal bitrate in bits/s (unsigned integer). |
| 377 | */ |
| 378 | TAG_NOMINAL_BITRATE, |
| 379 | |
| 380 | /** The minimum bitrate in bits/s (unsigned integer). |
| 381 | */ |
| 382 | TAG_MINIMUM_BITRATE, |
| 383 | |
| 384 | /** The maximum bitrate in bits/s (unsigned integer). |
| 385 | */ |
| 386 | TAG_MAXIMUM_BITRATE, |
| 387 | |
| 388 | /** The serial number of track (unsigned integer). |
| 389 | */ |
| 390 | TAG_SERIAL, |
| 391 | |
| 392 | /** The encoder used to encode this stream (string). |
| 393 | */ |
| 394 | TAG_ENCODER, |
| 395 | |
| 396 | /** The version of the encoder used to encode this stream (unsigned integer). |
| 397 | */ |
| 398 | TAG_ENCODER_VERSION, |
| 399 | |
| 400 | /** The track gain in db (double). |
| 401 | */ |
| 402 | TAG_TRACK_GAIN, |
| 403 | |
| 404 | /** The peak of the track (double). |
| 405 | */ |
| 406 | TAG_TRACK_PEAK, |
| 407 | |
| 408 | /** The album gain in db (double). |
| 409 | */ |
| 410 | TAG_ALBUM_GAIN, |
| 411 | |
| 412 | /** The peak of the album (double). |
| 413 | */ |
| 414 | TAG_ALBUM_PEAK, |
| 415 | |
| 416 | /** The reference level of track and album gain values (double). |
| 417 | * Since 0.10.12. |
| 418 | */ |
| 419 | TAG_REFERENCE_LEVEL, |
| 420 | |
| 421 | /** The language code (ISO-639-1) (string) of the content. |
| 422 | */ |
| 423 | TAG_LANGUAGE_CODE, |
| 424 | |
| 425 | /** The image (buffer) (buffer caps should specify the content type and |
| 426 | * preferably also set "image-type" field as GstTagImageType). |
| 427 | * Since 0.10.6 |
| 428 | */ |
| 429 | TAG_IMAGE, |
| 430 | |
| 431 | /** The image that is meant for preview purposes, e.g.\ small icon-sized |
| 432 | * version (buffer) (buffer caps should specify the content type). |
| 433 | * Since 0.10.7. |
| 434 | */ |
| 435 | TAG_PREVIEW_IMAGE, |
| 436 | |
| 437 | /** The generic file attachment (buffer) (buffer caps should specify the |
| 438 | * content type and if possible set "filename" to the file name of the |
| 439 | * attachment). |
| 440 | * |
| 441 | * Since 0.10.21. |
| 442 | */ |
| 443 | TAG_ATTACHMENT, |
| 444 | |
| 445 | /** The number of beats per minute in audio (double). |
| 446 | * Since 0.10.12. |
| 447 | */ |
| 448 | TAG_BEATS_PER_MINUTE, |
| 449 | |
| 450 | /** The comma separated keywords describing the content (string). |
| 451 | * |
| 452 | * Since 0.10.21 |
| 453 | */ |
| 454 | TAG_KEYWORDS, |
| 455 | |
| 456 | /** The human readable descriptive location of where the media has been |
| 457 | * recorded or produced. (string). |
| 458 | * |
| 459 | * Since 0.10.21. |
| 460 | */ |
| 461 | TAG_GEO_LOCATION_NAME, |
| 462 | |
| 463 | /** The geo latitude location of where the media has been recorded or produced |
| 464 | * in degrees according to WGS84 (zero at the equator, negative values for |
| 465 | * southern latitudes) (double). |
| 466 | * |
| 467 | * Since 0.10.21. |
| 468 | */ |
| 469 | TAG_GEO_LOCATION_LATITUDE, |
| 470 | |
| 471 | /** The geo longitude location of where the media has been recorded or |
| 472 | * produced in degrees according to WGS84 (zero at the prime meridian in |
| 473 | * Greenwich/UK, negative values for western longitudes). (double). |
| 474 | * |
| 475 | * Since 0.10.21. |
| 476 | */ |
| 477 | TAG_GEO_LOCATION_LONGITUDE, |
| 478 | |
| 479 | /** The geo elevation of where the media has been recorded or produced in |
| 480 | * meters according to WGS84 (zero is average sea level) (double). |
| 481 | * |
| 482 | * Since 0.10.21. |
| 483 | */ |
| 484 | TAG_GEO_LOCATION_ELEVATION |
| 485 | }; |
| 486 | |
| 487 | /** An Output stream operator for the Gst::Tag enum (this will output a |
| 488 | * string). |
| 489 | */ |
| 490 | std::ostream& operator<<(std::ostream& stream, Tag tag); |
| 491 | |
| 492 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 493 | const char* gstreamermm_get_stock_tag(Tag tag); |
| 494 | #endif |
| 495 | |
| 496 | /** A class tha represents a list of tags and values used to describe media |
| 497 | * metadata. |
| 498 | * Taglists form part of media streams and describe the content of a stream in |
| 499 | * a non-technical way. Examples include the author of a song, the title of |
| 500 | * that very same song or the album it is a part of. Tag reading is done |
| 501 | * through a Gst::Bus. You can listen for Gst::MESSAGE_TAG messages and handle |
| 502 | * them as you wish. |
| 503 | * |
| 504 | * Note, however, that the Gst::MESSAGE_TAG message may be fired multiple |
| 505 | * times in the pipeline. It is the application's responsibility to put all |
| 506 | * those tags together and display them to the user in a nice, coherent way. |
| 507 | * Usually, using merge() is a good enough way of doing this; make sure to |
| 508 | * empty the cache when loading a new song, or after every few minutes when |
| 509 | * listening to internet radio. Also, make sure you use Gst::TAG_MERGE_PREPEND |
| 510 | * as merging mode, so that a new title (which came in later) has a preference |
| 511 | * over the old one for display. |
| 512 | */ |
| 513 | class TagList |
| 514 | { |
| 515 | |
| 516 | public: |
| 517 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 518 | typedef TagList CppObjectType; |
| 519 | typedef GstTagList BaseObjectType; |
| 520 | |
| 521 | static GType get_type() G_GNUC_CONST; |
| 522 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 523 | |
| 524 | TagList(); |
| 525 | |
| 526 | explicit TagList(GstTagList* gobject, bool make_a_copy = true); |
| 527 | |
| 528 | TagList(const TagList& other); |
| 529 | TagList& operator=(const TagList& other); |
| 530 | |
| 531 | ~TagList(); |
| 532 | |
| 533 | void swap(TagList& other); |
| 534 | |
| 535 | ///Provides access to the underlying C instance. |
| 536 | GstTagList* gobj() { return gobject_; } |
| 537 | |
| 538 | ///Provides access to the underlying C instance. |
| 539 | const GstTagList* gobj() const { return gobject_; } |
| 540 | |
| 541 | ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. |
| 542 | GstTagList* gobj_copy() const; |
| 543 | |
| 544 | protected: |
| 545 | GstTagList* gobject_; |
| 546 | |
| 547 | private: |
| 548 | |
| 549 | |
| 550 | public: |
| 551 | /** Use this to discover if the TagList is a valid object. |
| 552 | */ |
| 553 | operator bool() const; |
| 554 | |
| 555 | |
| 556 | /** Checks if the given type is already registered. |
| 557 | * |
| 558 | * @param tag Name of the tag. |
| 559 | * @return <tt>true</tt> if the type is already registered. |
| 560 | */ |
| 561 | static bool exists(const Glib::ustring& tag); |
| 562 | |
| 563 | /** Gets the Type used for this tag. |
| 564 | * |
| 565 | * @param tag The tag. |
| 566 | * @return The Type of this tag. |
| 567 | */ |
| 568 | static GType get_type(const Glib::ustring& tag); |
| 569 | |
| 570 | /** Returns the human-readable name of this tag, You must not change or free |
| 571 | * this string. |
| 572 | * |
| 573 | * @param tag The tag. |
| 574 | * @return The human-readable name of this tag. |
| 575 | */ |
| 576 | static Glib::ustring get_nick(const Glib::ustring& tag); |
| 577 | |
| 578 | /** Returns the human-readable description of this tag, You must not change or |
| 579 | * free this string. |
| 580 | * |
| 581 | * @param tag The tag. |
| 582 | * @return The human-readable description of this tag. |
| 583 | */ |
| 584 | static Glib::ustring get_description(const Glib::ustring& tag); |
| 585 | |
| 586 | /** Gets the flag of @a tag. |
| 587 | * |
| 588 | * @param tag The tag. |
| 589 | * @return The flag of this tag. |
| 590 | */ |
| 591 | static Gst::TagFlag get_flag(const Glib::ustring& tag); |
| 592 | |
| 593 | /** Checks if the given tag is fixed. A fixed tag can only contain one value. |
| 594 | * Unfixed tags can contain lists of values. |
| 595 | * |
| 596 | * @param tag Tag to check. |
| 597 | * @return <tt>true</tt>, if the given tag is fixed. |
| 598 | */ |
| 599 | static bool is_fixed(const Glib::ustring& tag); |
| 600 | |
| 601 | /** Checks if the given taglist is empty. |
| 602 | * |
| 603 | * @return <tt>true</tt> if the taglist is empty, otherwise <tt>false</tt>. |
| 604 | */ |
| 605 | bool is_empty() const; |
| 606 | |
| 607 | /** Inserts the tags of the @a other list into the first list using the given mode. |
| 608 | * |
| 609 | * @param other List to merge from. |
| 610 | * @param mode The mode to use. |
| 611 | */ |
| 612 | void insert(const Gst::TagList& other, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 613 | |
| 614 | |
| 615 | /** Merges the two given lists into a new list. If one of the lists is <tt>nullptr</tt>, a |
| 616 | * copy of the other is returned. If both lists are <tt>nullptr</tt>, <tt>nullptr</tt> is returned. |
| 617 | * |
| 618 | * Free-function: gst_tag_list_unref |
| 619 | * |
| 620 | * @param other Second list to merge. |
| 621 | * @param mode The mode to use. |
| 622 | * @return The new list. |
| 623 | */ |
| 624 | Gst::TagList merge(const Gst::TagList& other, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 625 | |
| 626 | |
| 627 | /** Checks how many value are stored in this tag list for the given tag. |
| 628 | * |
| 629 | * @param tag The tag to query. |
| 630 | * @return The number of tags stored. |
| 631 | */ |
| 632 | guint size(const Glib::ustring& tag) const; |
| 633 | |
| 634 | /** Sets a GValue for the given @a tag using the specified mode. |
| 635 | * |
| 636 | * @param tag The tag name. |
| 637 | * @param mode The mode to use. |
| 638 | * @param value The Glib::Value<> to use. |
| 639 | */ |
| 640 | void add_value(Tag tag, const Glib::ValueBase& value, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 641 | |
| 642 | /** Sets a GValue for the given @a tag using the specified mode. |
| 643 | * |
| 644 | * @param tag The tag name. |
| 645 | * @param mode The mode to use. |
| 646 | * @param value The Glib::Value<> to use. |
| 647 | */ |
| 648 | void add_value(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 649 | |
| 650 | |
| 651 | /** Sets the value for the given tag to string @a data using the specified |
| 652 | * mode. |
| 653 | * |
| 654 | * @param tag The tag name. |
| 655 | * @param data A string to which the tag should be set to. |
| 656 | * @param mode The merge mode to use. |
| 657 | */ |
| 658 | void add(Tag tag, const char* data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 659 | |
| 660 | /** Sets the value for the given tag to string @a data using the specified |
| 661 | * mode. |
| 662 | * |
| 663 | * @param tag The tag name. |
| 664 | * @param data A string to which the tag should be set to. |
| 665 | * @param mode The merge mode to use. |
| 666 | */ |
| 667 | void add(const Glib::ustring& tag, const char* data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 668 | |
| 669 | /** Sets the value for the given tag using the specified mode. |
| 670 | * |
| 671 | * @param tag The tag name. |
| 672 | * @param data A value which the tag should be set to (this can be any |
| 673 | * supported C++ type). |
| 674 | * @param mode The merge mode to use. |
| 675 | */ |
| 676 | template <class DataType> |
| 677 | void add(Tag tag, const DataType& data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 678 | |
| 679 | /** Sets the value for the given tag using the specified mode. |
| 680 | * |
| 681 | * @param tag The tag name. |
| 682 | * @param data A value which the tag should be set to (this can be any |
| 683 | * supported C++ type). |
| 684 | * @param mode The merge mode to use. |
| 685 | */ |
| 686 | template <class DataType> |
| 687 | void add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 688 | |
| 689 | // Methods below are written as workaround for Glib::Date - it's not working with |
| 690 | // with Glib::Value, because GValue with Glib::Date is invalid type for gstreamer functions. |
| 691 | |
| 692 | /** Sets the value for the given tag using the specified mode. |
| 693 | * |
| 694 | * @param tag The tag name. |
| 695 | * @param date A date. |
| 696 | * @param mode The merge mode to use. |
| 697 | */ |
| 698 | void add(Tag tag, const Glib::Date& date, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 699 | |
| 700 | /** Sets the value for the given tag using the specified mode. |
| 701 | * |
| 702 | * @param tag The tag name. |
| 703 | * @param date A date. |
| 704 | * @param mode The merge mode to use. |
| 705 | */ |
| 706 | void add(const Glib::ustring& tag, const Glib::Date& date, TagMergeMode mode = TAG_MERGE_PREPEND); |
| 707 | |
| 708 | |
| 709 | /** Removes the given tag from the taglist. |
| 710 | * |
| 711 | * @param tag Tag to remove. |
| 712 | */ |
| 713 | void remove_tag(Tag tag); |
| 714 | |
| 715 | |
| 716 | /** Removes the given tag from the taglist. |
| 717 | * |
| 718 | * @param tag Tag to remove. |
| 719 | */ |
| 720 | void remove_tag(const Glib::ustring& tag); |
| 721 | |
| 722 | /** For example, |
| 723 | * void on_foreach(const Glib::ustring& tag);. |
| 724 | */ |
| 725 | typedef sigc::slot<void, const Glib::ustring&> SlotForeach; |
| 726 | |
| 727 | /** Calls the given slot for each tag inside the tag list. Note that if there |
| 728 | * is no tag, the slot won't be called at all. |
| 729 | * |
| 730 | * @param slot Slot to be called for each tag. |
| 731 | */ |
| 732 | void foreach(const SlotForeach& slot); |
| 733 | |
| 734 | |
| 735 | /** Copies the contents for the given tag into the value, merging multiple |
| 736 | * values into one if multiple values are associated with the tag. |
| 737 | * |
| 738 | * @param dest An uninitialized Glib::ValueBase to copy into. |
| 739 | * @param tag The tag to read out. |
| 740 | * @return true, if a value was copied, false if the tag didn't exist in the |
| 741 | * list. |
| 742 | */ |
| 743 | bool get_value(Tag tag, Glib::ValueBase& dest) const; |
| 744 | |
| 745 | |
| 746 | /** Copies the contents for the given tag into the value, merging multiple |
| 747 | * values into one if multiple values are associated with the tag. |
| 748 | * |
| 749 | * @param dest An uninitialized Glib::ValueBase to copy into. |
| 750 | * @param tag The tag to read out. |
| 751 | * @return true, if a value was copied, false if the tag didn't exist in the |
| 752 | * list. |
| 753 | */ |
| 754 | bool get_value(const Glib::ustring& tag, Glib::ValueBase& dest) const; |
| 755 | |
| 756 | |
| 757 | /** Gets the value that is at the given index for the given tag. |
| 758 | * @param tag The tag to read out. |
| 759 | * @param index Number of entry to read out. |
| 760 | * @param dest The Glib::ValueBase to store the value in. |
| 761 | * @return true if tag was available and had right number of entries, false |
| 762 | * otherwise. |
| 763 | */ |
| 764 | bool get_value(Tag tag, guint index, Glib::ValueBase& dest) const; |
| 765 | |
| 766 | |
| 767 | /** Gets the value that is at the given index for the given tag. |
| 768 | * @param tag The tag to read out. |
| 769 | * @param index Number of entry to read out. |
| 770 | * @param dest The Glib::ValueBase to store the value in. |
| 771 | * @return true if tag was available and had right number of entries, false |
| 772 | * otherwise. |
| 773 | */ |
| 774 | bool get_value(const Glib::ustring& tag, guint index, Glib::ValueBase& dest) const; |
| 775 | |
| 776 | |
| 777 | /** Copies the contents for the given tag into the value, merging multiple |
| 778 | * values into one if multiple values are associated with the tag. |
| 779 | * @param tag The tag to read out. |
| 780 | * @param value Location for the result (this can be any supported C++ type). |
| 781 | * @return true, if a value was copied, false if the tag didn't exist in the |
| 782 | * given list. |
| 783 | */ |
| 784 | template<class DataType> |
| 785 | bool get(Tag tag, DataType& value) const; |
| 786 | |
| 787 | /** Copies the contents for the given tag into the value, merging multiple |
| 788 | * values into one if multiple values are associated with the tag. |
| 789 | * @param tag The tag to read out. |
| 790 | * @param value Location for the result (this can be any supported C++ type). |
| 791 | * @return true, if a value was copied, false if the tag didn't exist in the |
| 792 | * given list. |
| 793 | */ |
| 794 | template<class DataType> |
| 795 | bool get(const Glib::ustring& tag, DataType& value) const; |
| 796 | |
| 797 | |
| 798 | /** Gets the value that is at the given index for the given tag. |
| 799 | * @param tag The tag to read out. |
| 800 | * @param index Number of entry to read out. |
| 801 | * @param value Location for the result (this can be any supported C++ type). |
| 802 | * @return true, if a value was copied, false if the tag didn't exist in the |
| 803 | * given list. |
| 804 | */ |
| 805 | template<class DataType> |
| 806 | bool get(Tag tag, guint index, DataType& value) const; |
| 807 | |
| 808 | /** Gets the value that is at the given index for the given tag. |
| 809 | * @param tag The tag to read out. |
| 810 | * @param index Number of entry to read out. |
| 811 | * @param value Location for the result (this can be any supported C++ type). |
| 812 | * @return true, if a value was copied, false if the tag didn't exist in the |
| 813 | * given list. |
| 814 | */ |
| 815 | template<class DataType> |
| 816 | bool get(const Glib::ustring& tag, guint index, DataType& value) const; |
| 817 | |
| 818 | |
| 819 | //Variable argument functions are ignored. |
| 820 | |
| 821 | |
| 822 | }; |
| 823 | |
| 824 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 825 | |
| 826 | /***************************** Gst::TagList *****************************/ |
| 827 | |
| 828 | template <class DataType> |
| 829 | void TagList::add(Tag tag, const DataType& data, TagMergeMode mode) |
| 830 | { |
| 831 | typedef Glib::Value<DataType> ValueType; |
| 832 | |
| 833 | ValueType value; |
| 834 | value.init(ValueType::value_type()); |
| 835 | value.set(data); |
| 836 | this->add_value(tag, value, mode); |
| 837 | } |
| 838 | |
| 839 | template <class DataType> |
| 840 | void TagList::add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode) |
| 841 | { |
| 842 | typedef Glib::Value<DataType> ValueType; |
| 843 | |
| 844 | ValueType value; |
| 845 | value.init(ValueType::value_type()); |
| 846 | value.set(data); |
| 847 | this->add_value(tag, value, mode); |
| 848 | } |
| 849 | |
| 850 | template<class DataType> |
| 851 | bool TagList::get(Tag tag, DataType& data) const |
| 852 | { |
| 853 | Glib::Value<DataType> value; |
| 854 | value.init(value.value_type()); |
| 855 | const bool result = this->get_value(tag, value); |
| 856 | |
| 857 | if(result) |
| 858 | data = value.get(); |
| 859 | |
| 860 | return result; |
| 861 | } |
| 862 | |
| 863 | template<class DataType> |
| 864 | bool TagList::get(const Glib::ustring& tag, DataType& data) const |
| 865 | { |
| 866 | Glib::Value<DataType> value; |
| 867 | value.init(value.value_type()); |
| 868 | const bool result = this->get_value(tag, value); |
| 869 | |
| 870 | if(result) |
| 871 | data = value.get(); |
| 872 | |
| 873 | return result; |
| 874 | } |
| 875 | |
| 876 | template<class DataType> |
| 877 | bool TagList::get(Tag tag, guint index, DataType& data) const |
| 878 | { |
| 879 | Glib::Value<DataType> value; |
| 880 | value.init(value.value_type()); |
| 881 | bool result = this->get_value(tag, index, value); |
| 882 | |
| 883 | if(result) |
| 884 | data = value.get(); |
| 885 | |
| 886 | return result; |
| 887 | } |
| 888 | |
| 889 | template<class DataType> |
| 890 | bool TagList::get(const Glib::ustring& tag, guint index, DataType& data) const |
| 891 | { |
| 892 | Glib::Value<DataType> value; |
| 893 | value.init(value.value_type()); |
| 894 | bool result = this->get_value(tag, index, value); |
| 895 | |
| 896 | if(result) |
| 897 | data = value.get(); |
| 898 | |
| 899 | return result; |
| 900 | } |
| 901 | |
| 902 | |
| 903 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 904 | |
| 905 | } //namespace Gst |
| 906 | |
| 907 | |
| 908 | namespace Gst |
| 909 | { |
| 910 | |
| 911 | /** @relates Gst::TagList |
| 912 | * @param lhs The left-hand side |
| 913 | * @param rhs The right-hand side |
| 914 | */ |
| 915 | inline void swap(TagList& lhs, TagList& rhs) |
| 916 | { lhs.swap(rhs); } |
| 917 | |
| 918 | } // namespace Gst |
| 919 | |
| 920 | namespace Glib |
| 921 | { |
| 922 | |
| 923 | /** A Glib::wrap() method for this object. The method has a non-standard name because otherwise it would collide with the wrap method for Gst::Structure because both Gst::TagList and Gst::Structure wrap the same underlying C type. |
| 924 | * |
| 925 | * @param object The C instance. |
| 926 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 927 | * @result A C++ instance that wraps this C instance. |
| 928 | * |
| 929 | * @relates Gst::TagList |
| 930 | */ |
| 931 | Gst::TagList wrap_taglist(GstTagList* object, bool take_copy = false); |
| 932 | |
| 933 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 934 | template <> |
| 935 | class Value<Gst::TagList> : public Glib::Value_Boxed<Gst::TagList> |
| 936 | {}; |
| 937 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 938 | |
| 939 | } // namespace Glib |
| 940 | |
| 941 | |
| 942 | #endif /* _GSTREAMERMM_TAGLIST_H */ |
| 943 |