00001
00002
00003 #ifndef _GSTREAMERMM_TAGLIST_H
00004 #define _GSTREAMERMM_TAGLIST_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <gst/gsttaglist.h>
00029 #include <gstreamermm/structure.h>
00030
00031 namespace Gst
00032 {
00033
00039 enum TagMergeMode
00040 {
00041 TAG_MERGE_UNDEFINED,
00042 TAG_MERGE_REPLACE_ALL,
00043 TAG_MERGE_REPLACE,
00044 TAG_MERGE_APPEND,
00045 TAG_MERGE_PREPEND,
00046 TAG_MERGE_KEEP,
00047 TAG_MERGE_KEEP_ALL,
00048 TAG_MERGE_COUNT
00049 };
00050
00051 }
00052
00053
00054 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00055 namespace Glib
00056 {
00057
00058 template <>
00059 class Value<Gst::TagMergeMode> : public Glib::Value_Enum<Gst::TagMergeMode>
00060 {
00061 public:
00062 static GType value_type() G_GNUC_CONST;
00063 };
00064
00065 }
00066 #endif
00067
00068
00069 namespace Gst
00070 {
00071
00075 enum TagFlag
00076 {
00077 TAG_FLAG_UNDEFINED,
00078 TAG_FLAG_META,
00079 TAG_FLAG_ENCODED,
00080 TAG_FLAG_DECODED,
00081 TAG_FLAG_COUNT
00082 };
00083
00084 }
00085
00086
00087 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00088 namespace Glib
00089 {
00090
00091 template <>
00092 class Value<Gst::TagFlag> : public Glib::Value_Enum<Gst::TagFlag>
00093 {
00094 public:
00095 static GType value_type() G_GNUC_CONST;
00096 };
00097
00098 }
00099 #endif
00100
00101
00102 namespace Gst
00103 {
00104
00105
00106 namespace Tag
00107 {
00108
00112 const Glib::ustring TITLE = GST_TAG_TITLE;
00113
00119 const Glib::ustring TITLE_SORTNAME = GST_TAG_TITLE_SORTNAME;
00120
00125 const Glib::ustring ARTIST = GST_TAG_ARTIST;
00126
00133 const Glib::ustring ARTIST_SORTNAME = GST_TAG_ARTIST_SORTNAME;
00134
00138 const Glib::ustring ALBUM = GST_TAG_ALBUM;
00139
00145 const Glib::ustring ALBUM_SORTNAME = GST_TAG_ALBUM_SORTNAME;
00146
00149 const Glib::ustring DATE = GST_TAG_DATE;
00150
00153 const Glib::ustring GENRE = GST_TAG_GENRE;
00154
00157 const Glib::ustring COMMENT = GST_TAG_COMMENT;
00158
00168 const Glib::ustring EXTENDED_COMMENT = GST_TAG_EXTENDED_COMMENT;
00169
00172 const Glib::ustring TRACK_NUMBER = GST_TAG_TRACK_NUMBER;
00173
00176 const Glib::ustring TRACK_COUNT = GST_TAG_TRACK_COUNT;
00177
00180 const Glib::ustring ALBUM_VOLUME_NUMBER = GST_TAG_ALBUM_VOLUME_NUMBER;
00181
00184 const Glib::ustring ALBUM_VOLUME_COUNT = GST_TAG_ALBUM_VOLUME_COUNT;
00185
00188 const Glib::ustring LOCATION = GST_TAG_LOCATION;
00189
00192 const Glib::ustring DESCRIPTION = GST_TAG_DESCRIPTION;
00193
00196 const Glib::ustring VERSION = GST_TAG_VERSION;
00197
00201 const Glib::ustring ISRC = GST_TAG_ISRC;
00202
00205 const Glib::ustring ORGANIZATION = GST_TAG_ORGANIZATION;
00206
00209 const Glib::ustring COPYRIGHT = GST_TAG_COPYRIGHT;
00210
00214 const Glib::ustring COPYRIGHT_URI = GST_TAG_COPYRIGHT_URI;
00215
00219 const Glib::ustring COMPOSER = GST_TAG_COMPOSER;
00220
00223 const Glib::ustring CONTACT = GST_TAG_CONTACT;
00224
00227 const Glib::ustring LICENSE = GST_TAG_LICENSE;
00228
00232 const Glib::ustring LICENSE_URI = GST_TAG_LICENSE_URI;
00233
00236 const Glib::ustring PERFORMER = GST_TAG_PERFORMER;
00237
00240 const Glib::ustring DURATION = GST_TAG_DURATION;
00241
00244 const Glib::ustring CODEC = GST_TAG_CODEC;
00245
00248 const Glib::ustring VIDEO_CODEC = GST_TAG_VIDEO_CODEC;
00249
00252 const Glib::ustring AUDIO_CODEC = GST_TAG_AUDIO_CODEC;
00253
00256 const Glib::ustring BITRATE = GST_TAG_BITRATE;
00257
00260 const Glib::ustring NOMINAL_BITRATE = GST_TAG_NOMINAL_BITRATE;
00261
00264 const Glib::ustring MINIMUM_BITRATE = GST_TAG_MINIMUM_BITRATE;
00265
00268 const Glib::ustring MAXIMUM_BITRATE = GST_TAG_MAXIMUM_BITRATE;
00269
00272 const Glib::ustring SERIAL = GST_TAG_SERIAL;
00273
00276 const Glib::ustring ENCODER = GST_TAG_ENCODER;
00277
00280 const Glib::ustring ENCODER_VERSION = GST_TAG_ENCODER_VERSION;
00281
00284 const Glib::ustring TRACK_GAIN = GST_TAG_TRACK_GAIN;
00285
00288 const Glib::ustring TRACK_PEAK = GST_TAG_TRACK_PEAK;
00289
00292 const Glib::ustring ALBUM_GAIN = GST_TAG_ALBUM_GAIN;
00293
00296 const Glib::ustring ALBUM_PEAK = GST_TAG_ALBUM_PEAK;
00297
00301 const Glib::ustring REFERENCE_LEVEL = GST_TAG_REFERENCE_LEVEL;
00302
00305 const Glib::ustring LANGUAGE_CODE = GST_TAG_LANGUAGE_CODE;
00306
00311 const Glib::ustring IMAGE = GST_TAG_IMAGE;
00312
00317 const Glib::ustring PREVIEW_IMAGE = GST_TAG_PREVIEW_IMAGE;
00318
00322 const Glib::ustring BEATS_PER_MINUTE = GST_TAG_BEATS_PER_MINUTE;
00323
00324 }
00325
00342 class TagList : public Structure
00343 {
00344 public:
00345 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00346 typedef TagList CppObjectType;
00347 typedef GstTagList BaseObjectType;
00348
00349 static GType get_type() G_GNUC_CONST;
00350 #endif
00351
00352 TagList();
00353
00354 explicit TagList(GstTagList* gobject, bool make_a_copy = true);
00355
00356 TagList(const TagList& other);
00357 TagList& operator=(const TagList& other);
00358
00359 ~TagList();
00360
00361 void swap(TagList& other);
00362
00364 GstTagList* gobj() { return gobject_; }
00365
00367 const GstTagList* gobj() const { return gobject_; }
00368
00370 GstTagList* gobj_copy() const;
00371
00372 protected:
00373 GstTagList* gobject_;
00374
00375 private:
00376
00377
00378 public:
00379
00384 static bool exists(const Glib::ustring& tag);
00385
00390 static GType get_type(const Glib::ustring& tag);
00391
00396 static Glib::ustring get_nick(const Glib::ustring& tag);
00397
00402 static Glib::ustring get_description(const Glib::ustring& tag);
00403
00408 static TagFlag get_flag(const Glib::ustring& tag);
00409
00415 static bool is_fixed(const Glib::ustring& tag);
00416
00422 bool is_empty() const;
00423
00428 void insert(const Gst::TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND);
00429
00436 Gst::TagList merge(const Gst::TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND);
00437
00442 guint size(const Glib::ustring& tag) const;
00443
00450 void add(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
00451
00459 void add(const Glib::ustring& tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
00460
00468 template <class DataType>
00469 void add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
00470
00471
00475 void remove_tag(const Glib::ustring& tag);
00476
00480 typedef sigc::slot<void, const Glib::ustring&> SlotForeach;
00481
00487 void foreach(const SlotForeach& slot);
00488
00489
00498 bool get(const Glib::ustring& tag, Glib::ValueBase& dest) const;
00499
00500
00509 bool get(const Glib::ustring& tag, guint index, Glib::ValueBase& dest) const;
00510
00511
00519 template<class DataType>
00520 bool get(const Glib::ustring& tag, DataType& value) const;
00521
00522
00530 template<class DataType>
00531 bool get(const Glib::ustring& tag, guint index, DataType& value) const;
00532
00533
00534
00535
00536
00537 };
00538
00539 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00540
00541
00542
00543 template <class DataType>
00544 void TagList::add(const Glib::ustring& tag, const DataType& data,
00545 TagMergeMode mode)
00546 {
00547 typedef Glib::Value<DataType> ValueType;
00548
00549 ValueType value;
00550 value.init(ValueType::value_type());
00551 value.set(data);
00552 this->add(tag, (Glib::ValueBase) value, mode);
00553 }
00554
00555 template<class DataType>
00556 bool TagList::get(const Glib::ustring& tag, DataType& data) const
00557 {
00558 Glib::Value<DataType> value;
00559 bool result = this->get(tag, (Glib::ValueBase&) value);
00560
00561 if (result)
00562 data = value.get();
00563
00564 return result;
00565 }
00566
00567 template<class DataType>
00568 bool TagList::get(const Glib::ustring& tag, guint index, DataType& data) const
00569 {
00570 Glib::Value<DataType> value;
00571 bool result = this->get(tag, index, (Glib::ValueBase&) value);
00572
00573 if (result)
00574 data = value.get();
00575
00576 return result;
00577 }
00578
00579 #endif
00580
00581 }
00582
00583
00584 namespace Gst
00585 {
00586
00591 inline void swap(TagList& lhs, TagList& rhs)
00592 { lhs.swap(rhs); }
00593
00594 }
00595
00596 namespace Glib
00597 {
00598
00608 Gst::TagList wrap(GstTagList* object, int dummy, bool take_copy = false);
00609
00610 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00611 template <>
00612 class Value<Gst::TagList> : public Glib::Value_Boxed<Gst::TagList>
00613 {};
00614 #endif
00615
00616 }
00617
00618
00619 #endif
00620