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
00029
00030 #include <gst/gsttaglist.h>
00031 #include <gstreamermm/structure.h>
00032 #include <gstreamermm/structurevalue.h>
00033
00034 namespace Gst
00035 {
00036
00042 enum TagMergeMode
00043 {
00044 TAG_MERGE_UNDEFINED,
00045 TAG_MERGE_REPLACE_ALL,
00046 TAG_MERGE_REPLACE,
00047 TAG_MERGE_APPEND,
00048 TAG_MERGE_PREPEND,
00049 TAG_MERGE_KEEP,
00050 TAG_MERGE_KEEP_ALL,
00051 TAG_MERGE_COUNT
00052 };
00053
00054 }
00055
00056
00057 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00058 namespace Glib
00059 {
00060
00061 template <>
00062 class Value<Gst::TagMergeMode> : public Glib::Value_Enum<Gst::TagMergeMode>
00063 {
00064 public:
00065 static GType value_type() G_GNUC_CONST;
00066 };
00067
00068 }
00069 #endif
00070
00071
00072 namespace Gst
00073 {
00074
00078 enum TagFlag
00079 {
00080 TAG_FLAG_UNDEFINED,
00081 TAG_FLAG_META,
00082 TAG_FLAG_ENCODED,
00083 TAG_FLAG_DECODED,
00084 TAG_FLAG_COUNT
00085 };
00086
00087 }
00088
00089
00090 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00091 namespace Glib
00092 {
00093
00094 template <>
00095 class Value<Gst::TagFlag> : public Glib::Value_Enum<Gst::TagFlag>
00096 {
00097 public:
00098 static GType value_type() G_GNUC_CONST;
00099 };
00100
00101 }
00102 #endif
00103
00104
00105 namespace Gst
00106 {
00107
00108
00112 const Glib::ustring TAG_TITLE = GST_TAG_TITLE;
00113
00119 const Glib::ustring TAG_TITLE_SORTNAME = GST_TAG_TITLE_SORTNAME;
00120
00125 const Glib::ustring TAG_ARTIST = GST_TAG_ARTIST;
00126
00133 const Glib::ustring TAG_ARTIST_SORTNAME = GST_TAG_ARTIST_SORTNAME;
00134
00138 const Glib::ustring TAG_ALBUM = GST_TAG_ALBUM;
00139
00145 const Glib::ustring TAG_ALBUM_SORTNAME = GST_TAG_ALBUM_SORTNAME;
00146
00149 const Glib::ustring TAG_DATE = GST_TAG_DATE;
00150
00153 const Glib::ustring TAG_GENRE = GST_TAG_GENRE;
00154
00157 const Glib::ustring TAG_COMMENT = GST_TAG_COMMENT;
00158
00168 const Glib::ustring TAG_EXTENDED_COMMENT = GST_TAG_EXTENDED_COMMENT;
00169
00172 const Glib::ustring TAG_TRACK_NUMBER = GST_TAG_TRACK_NUMBER;
00173
00176 const Glib::ustring TAG_TRACK_COUNT = GST_TAG_TRACK_COUNT;
00177
00180 const Glib::ustring TAG_ALBUM_VOLUME_NUMBER = GST_TAG_ALBUM_VOLUME_NUMBER;
00181
00184 const Glib::ustring TAG_ALBUM_VOLUME_COUNT = GST_TAG_ALBUM_VOLUME_COUNT;
00185
00188 const Glib::ustring TAG_LOCATION = GST_TAG_LOCATION;
00189
00192 const Glib::ustring TAG_DESCRIPTION = GST_TAG_DESCRIPTION;
00193
00196 const Glib::ustring TAG_VERSION = GST_TAG_VERSION;
00197
00201 const Glib::ustring TAG_ISRC = GST_TAG_ISRC;
00202
00205 const Glib::ustring TAG_ORGANIZATION = GST_TAG_ORGANIZATION;
00206
00209 const Glib::ustring TAG_COPYRIGHT = GST_TAG_COPYRIGHT;
00210
00214 const Glib::ustring TAG_COPYRIGHT_URI = GST_TAG_COPYRIGHT_URI;
00215
00219 const Glib::ustring TAG_COMPOSER = GST_TAG_COMPOSER;
00220
00223 const Glib::ustring TAG_CONTACT = GST_TAG_CONTACT;
00224
00227 const Glib::ustring TAG_LICENSE = GST_TAG_LICENSE;
00228
00232 const Glib::ustring TAG_LICENSE_URI = GST_TAG_LICENSE_URI;
00233
00236 const Glib::ustring TAG_PERFORMER = GST_TAG_PERFORMER;
00237
00240 const Glib::ustring TAG_DURATION = GST_TAG_DURATION;
00241
00244 const Glib::ustring TAG_CODEC = GST_TAG_CODEC;
00245
00248 const Glib::ustring TAG_VIDEO_CODEC = GST_TAG_VIDEO_CODEC;
00249
00252 const Glib::ustring TAG_AUDIO_CODEC = GST_TAG_AUDIO_CODEC;
00253
00256 const Glib::ustring TAG_BITRATE = GST_TAG_BITRATE;
00257
00260 const Glib::ustring TAG_NOMINAL_BITRATE = GST_TAG_NOMINAL_BITRATE;
00261
00264 const Glib::ustring TAG_MINIMUM_BITRATE = GST_TAG_MINIMUM_BITRATE;
00265
00268 const Glib::ustring TAG_MAXIMUM_BITRATE = GST_TAG_MAXIMUM_BITRATE;
00269
00272 const Glib::ustring TAG_SERIAL = GST_TAG_SERIAL;
00273
00276 const Glib::ustring TAG_ENCODER = GST_TAG_ENCODER;
00277
00280 const Glib::ustring TAG_ENCODER_VERSION = GST_TAG_ENCODER_VERSION;
00281
00284 const Glib::ustring TAG_TRACK_GAIN = GST_TAG_TRACK_GAIN;
00285
00288 const Glib::ustring TAG_TRACK_PEAK = GST_TAG_TRACK_PEAK;
00289
00292 const Glib::ustring TAG_ALBUM_GAIN = GST_TAG_ALBUM_GAIN;
00293
00296 const Glib::ustring TAG_ALBUM_PEAK = GST_TAG_ALBUM_PEAK;
00297
00301 const Glib::ustring TAG_REFERENCE_LEVEL = GST_TAG_REFERENCE_LEVEL;
00302
00305 const Glib::ustring TAG_LANGUAGE_CODE = GST_TAG_LANGUAGE_CODE;
00306
00311 const Glib::ustring TAG_IMAGE = GST_TAG_IMAGE;
00312
00317 const Glib::ustring TAG_PREVIEW_IMAGE = GST_TAG_PREVIEW_IMAGE;
00318
00322 const Glib::ustring TAG_BEATS_PER_MINUTE = GST_TAG_BEATS_PER_MINUTE;
00323
00340 class TagList : public Structure
00341 {
00342 public:
00343 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00344 typedef TagList CppObjectType;
00345 typedef GstTagList BaseObjectType;
00346
00347 static GType get_type() G_GNUC_CONST;
00348 #endif
00349
00350 TagList();
00351
00352 explicit TagList(GstTagList* gobject, bool make_a_copy = true);
00353
00354 TagList(const TagList& other);
00355 TagList& operator=(const TagList& other);
00356
00357 ~TagList();
00358
00359 void swap(TagList& other);
00360
00362 GstTagList* gobj() { return gobject_; }
00363
00365 const GstTagList* gobj() const { return gobject_; }
00366
00368 GstTagList* gobj_copy() const;
00369
00370 protected:
00371 GstTagList* gobject_;
00372
00373 private:
00374
00375
00376 public:
00377
00382 static bool exists(const Glib::ustring& tag);
00383
00388 static GType get_type(const Glib::ustring& tag);
00389
00394 static Glib::ustring get_nick(const Glib::ustring& tag);
00395
00400 static Glib::ustring get_description(const Glib::ustring& tag);
00401
00406 static TagFlag get_flag(const Glib::ustring& tag);
00407
00413 static bool is_fixed(const Glib::ustring& tag);
00414
00420 bool is_empty() const;
00421
00426 void insert(const TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND);
00427
00434 TagList merge(const TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND);
00435
00440 guint get_tag_size(const Glib::ustring& tag) const;
00441
00448 void add(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
00449
00457 void add(const Glib::ustring& tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
00458
00466 template <class DataType>
00467 void add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
00468
00469
00473 void remove_tag(const Glib::ustring& tag);
00474
00478 typedef sigc::slot<void, const Glib::ustring&> SlotForeach;
00479
00485 void foreach(const SlotForeach& slot);
00486
00495 bool get(const Glib::ustring& tag, guint index, Glib::ValueBase& value);
00496
00504 bool get(const Glib::ustring& tag, char& value);
00505
00513 bool get(const Glib::ustring& tag, guint index, char& value);
00514
00522 bool get(const Glib::ustring& tag, guchar& value);
00523
00531 bool get(const Glib::ustring& tag, guint index, guchar& value);
00532
00540 bool get(const Glib::ustring& tag, bool& value);
00541
00549 bool get(const Glib::ustring& tag, guint index, bool& value);
00550
00558 bool get(const Glib::ustring& tag, int& value);
00559
00567 bool get(const Glib::ustring& tag, guint index, int& value);
00568
00576 bool get(const Glib::ustring& tag, guint& value);
00577
00585 bool get(const Glib::ustring& tag, guint index, guint& value);
00586
00594 bool get(const Glib::ustring& tag, long& value);
00595
00603 bool get(const Glib::ustring& tag, guint index, long& value);
00604
00612 bool get(const Glib::ustring& tag, gulong& value);
00613
00621 bool get(const Glib::ustring& tag, guint index, gulong& value);
00622
00630 bool get(const Glib::ustring& tag, float& value);
00631
00639 bool get(const Glib::ustring& tag, guint index, float& value);
00640
00648 bool get(const Glib::ustring& tag, double& value);
00649
00657 bool get(const Glib::ustring& tag, guint index, double& value);
00658
00672 bool get(const Glib::ustring& tag, Glib::ustring& value);
00673
00685 bool get(const Glib::ustring& tag, guint index, Glib::ustring& value);
00686
00694 bool get(const Glib::ustring& tag, Glib::Date& value);
00695
00703 bool get(const Glib::ustring& tag, guint index, Glib::Date& value);
00704
00705
00706 };
00707
00708 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00709
00710
00711
00712 template <class DataType>
00713 void TagList::add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode)
00714 {
00715 typedef typename Gst::StructureValue<DataType> type_cppdata;
00716 typedef typename type_cppdata::ValueType ValueType;
00717
00718 ValueType value;
00719 value.init(ValueType::value_type());
00720 value.set(data);
00721 this->add(tag, (Glib::ValueBase) value, mode);
00722 }
00723
00724 #endif
00725
00726
00727 }
00728
00729
00730 namespace Gst
00731 {
00732
00737 inline void swap(TagList& lhs, TagList& rhs)
00738 { lhs.swap(rhs); }
00739
00740 }
00741
00742 namespace Glib
00743 {
00744
00754 Gst::TagList wrap(GstTagList* object, bool take_copy = false, bool dummy = false);
00755
00756 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00757 template <>
00758 class Value<Gst::TagList> : public Glib::Value_Boxed<Gst::TagList>
00759 {};
00760 #endif
00761
00762 }
00763
00764
00765 #endif
00766