- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# taglist.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // Generated by gtkmmproc -- DO NOT MODIFY!
    00003 #ifndef _GSTREAMERMM_TAGLIST_H
    00004 #define _GSTREAMERMM_TAGLIST_H
    00005
    00006
    00007 #include <glibmm.h>
    00008
    00009 /* gstreamermm - a C++ wrapper for gstreamer
    00010  *
    00011  * Copyright 2008 The gstreamermm Development Team
    00012  *
    00013  * This library is free software; you can redistribute it and/or
    00014  * modify it under the terms of the GNU Lesser General Public
    00015  * License as published by the Free Software Foundation; either
    00016  * version 2.1 of the License, or (at your option) any later version.
    00017  *
    00018  * This library is distributed in the hope that it will be useful,
    00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00021  * Lesser General Public License for more details.
    00022  *
    00023  * You should have received a copy of the GNU Lesser General Public
    00024  * License along with this library; if not, write to the Free
    00025  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    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 } // namespace Gst
    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 } // namespace Glib
    00066 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    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 } // namespace Gst
    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 } // namespace Glib
    00099 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00100
    00101
    00102 namespace Gst
    00103 {
    00104
    00105
    00106 // When adding tags, make sure that they are added to this enum and then in the
    00107 // ccg file in the correct order.  Also make sure that the size of the array of
    00108 // strings is updated in the declaration below and in the ccg file.
    00109 // These correspond to the GST_TAG_* #defines in the C API.
    00110 //TODO: Maybe do something like Glib::StockID instead?
    00113 enum Tag
    00114 {
    00118 TAG_TITLE,
    00119
    00125 TAG_TITLE_SORTNAME,
    00126
    00131 TAG_ARTIST,
    00132
    00139 TAG_ARTIST_SORTNAME,
    00140
    00144 TAG_ALBUM,
    00145
    00151 TAG_ALBUM_SORTNAME,
    00152
    00155 TAG_DATE,
    00156
    00159 TAG_GENRE,
    00160
    00163 TAG_COMMENT,
    00164
    00174 TAG_EXTENDED_COMMENT,
    00175
    00178 TAG_TRACK_NUMBER,
    00179
    00182 TAG_TRACK_COUNT,
    00183
    00186 TAG_ALBUM_VOLUME_NUMBER,
    00187
    00190 TAG_ALBUM_VOLUME_COUNT,
    00191
    00194 TAG_LOCATION,
    00195
    00198 TAG_DESCRIPTION,
    00199
    00202 TAG_VERSION,
    00203
    00207 TAG_ISRC,
    00208
    00211 TAG_ORGANIZATION,
    00212
    00215 TAG_COPYRIGHT,
    00216
    00220 TAG_COPYRIGHT_URI,
    00221
    00225 TAG_COMPOSER,
    00226
    00229 TAG_CONTACT,
    00230
    00233 TAG_LICENSE,
    00234
    00238 TAG_LICENSE_URI,
    00239
    00242 TAG_PERFORMER,
    00243
    00246 TAG_DURATION,
    00247
    00250 TAG_CODEC,
    00251
    00254 TAG_VIDEO_CODEC,
    00255
    00258 TAG_AUDIO_CODEC,
    00259
    00262 TAG_BITRATE,
    00263
    00266 TAG_NOMINAL_BITRATE,
    00267
    00270 TAG_MINIMUM_BITRATE,
    00271
    00274 TAG_MAXIMUM_BITRATE,
    00275
    00278 TAG_SERIAL,
    00279
    00282 TAG_ENCODER,
    00283
    00286 TAG_ENCODER_VERSION,
    00287
    00290 TAG_TRACK_GAIN,
    00291
    00294 TAG_TRACK_PEAK,
    00295
    00298 TAG_ALBUM_GAIN,
    00299
    00302 TAG_ALBUM_PEAK,
    00303
    00307 TAG_REFERENCE_LEVEL,
    00308
    00311 TAG_LANGUAGE_CODE,
    00312
    00317 TAG_IMAGE,
    00318
    00323 TAG_PREVIEW_IMAGE,
    00324
    00330 TAG_ATTACHMENT,
    00331
    00335 TAG_BEATS_PER_MINUTE,
    00336
    00341 TAG_KEYWORDS,
    00342
    00348 TAG_GEO_LOCATION_NAME,
    00349
    00356 TAG_GEO_LOCATION_LATITUDE,
    00357
    00364 TAG_GEO_LOCATION_LONGITUDE,
    00365
    00371 TAG_GEO_LOCATION_ELEVATION
    00372 };
    00373
    00376 std::ostream& operator<<(std::ostream& stream, Tag tag);
    00377
    00378 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00379 extern const char* _tag_strings[];
    00380 #endif
    00381
    00398 class TagList : public Structure
    00399 {
    00400   public:
    00401 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00402   typedef TagList CppObjectType;
    00403   typedef GstTagList BaseObjectType;
    00404
    00405   static GType get_type() G_GNUC_CONST;
    00406 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00407
    00408   TagList();
    00409
    00410   explicit TagList(GstTagList* gobject, bool make_a_copy = true);
    00411
    00412   TagList(const TagList& other);
    00413   TagList& operator=(const TagList& other);
    00414
    00415   ~TagList();
    00416
    00417   void swap(TagList& other);
    00418
    00420   GstTagList*       gobj()       { return gobject_; }
    00421
    00423   const GstTagList* gobj() const { return gobject_; }
    00424
    00426   GstTagList* gobj_copy() const;
    00427
    00428 protected:
    00429   GstTagList* gobject_;
    00430
    00431 private:
    00432
    00433
    00434 public:
    00435
    00440   static bool exists(const Glib::ustring& tag);
    00441
    00446   static GType get_type(const Glib::ustring& tag);
    00447
    00452   static Glib::ustring get_nick(const Glib::ustring& tag);
    00453
    00458   static Glib::ustring get_description(const Glib::ustring& tag);
    00459
    00464   static TagFlag get_flag(const Glib::ustring& tag);
    00465
    00471   static bool is_fixed(const Glib::ustring& tag);
    00472
    00478   bool is_empty() const;
    00479
    00484   void insert(const Gst::TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND);
    00485
    00492   Gst::TagList merge(const Gst::TagList& other, TagMergeMode mode=TAG_MERGE_PREPEND);
    00493
    00498   guint size(const Glib::ustring& tag) const;
    00499
    00506   void add_value(Tag tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
    00507
    00514   void add_value(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode=TAG_MERGE_PREPEND);
    00515
    00516
    00517   //TODO: Doesn't this conflict with the template? murrayc.
    00518   //
    00519   //It doesn't seem so.  The taglist test (test-taglist) uses it when adding a
    00520   //title and an artist tag (lines 35, 36).  The test wont compile without it
    00521   //and declaring the template before this doesn't seem to make the compiler
    00522   //select the template over this method. I could be wrong. Jose.
    00530   void add(Tag tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
    00531
    00539   void add(const Glib::ustring& tag, const char* data, TagMergeMode mode=TAG_MERGE_PREPEND);
    00540
    00548   template <class DataType>
    00549   void add(Tag tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
    00550
    00558   template <class DataType>
    00559   void add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode=TAG_MERGE_PREPEND);
    00560
    00561
    00565   void remove_tag(Tag tag);
    00566
    00567
    00571   void remove_tag(const Glib::ustring& tag);
    00572
    00576   typedef sigc::slot<void, const Glib::ustring&> SlotForeach;
    00577
    00583   void foreach(const SlotForeach& slot);
    00584
    00585
    00594   bool get_value(Tag tag, Glib::ValueBase& dest) const;
    00595
    00596
    00605   bool get_value(const Glib::ustring& tag, Glib::ValueBase& dest) const;
    00606
    00607
    00615   bool get_value(Tag tag, guint index, Glib::ValueBase& dest) const;
    00616
    00617
    00625   bool get_value(const Glib::ustring& tag, guint index, Glib::ValueBase& dest) const;
    00626
    00627
    00635   template<class DataType>
    00636   bool get(Tag tag, DataType& value) const;
    00637
    00645   template<class DataType>
    00646   bool get(const Glib::ustring& tag, DataType& value) const;
    00647
    00648
    00656   template<class DataType>
    00657   bool get(Tag tag, guint index, DataType& value) const;
    00658
    00666   template<class DataType>
    00667   bool get(const Glib::ustring& tag, guint index, DataType& value) const;
    00668
    00669
    00670   //Variable argument functions are ignored.
    00671
    00672
    00673 };
    00674
    00675 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00676
    00677 /***************************** Gst::TagList *****************************/
    00678
    00679 template <class DataType>
    00680 void TagList::add(Tag tag, const DataType& data, TagMergeMode mode)
    00681 {
    00682   typedef Glib::Value<DataType> ValueType;
    00683
    00684   ValueType value;
    00685   value.init(ValueType::value_type());
    00686   value.set(data);
    00687   this->add_value(tag, value, mode);
    00688 }
    00689
    00690 template <class DataType>
    00691 void TagList::add(const Glib::ustring& tag, const DataType& data, TagMergeMode mode)
    00692 {
    00693   typedef Glib::Value<DataType> ValueType;
    00694
    00695   ValueType value;
    00696   value.init(ValueType::value_type());
    00697   value.set(data);
    00698   this->add_value(tag, value, mode);
    00699 }
    00700
    00701 template<class DataType>
    00702 bool TagList::get(Tag tag, DataType& data) const
    00703 {
    00704   Glib::Value<DataType> value;
    00705   const bool result = this->get_value(tag, value);
    00706
    00707   if(result)
    00708     data = value.get();
    00709
    00710   return result;
    00711 }
    00712
    00713 template<class DataType>
    00714 bool TagList::get(const Glib::ustring& tag, DataType& data) const
    00715 {
    00716   Glib::Value<DataType> value;
    00717   const bool result = this->get_value(tag, value);
    00718
    00719   if(result)
    00720     data = value.get();
    00721
    00722   return result;
    00723 }
    00724
    00725 template<class DataType>
    00726 bool TagList::get(Tag tag, guint index, DataType& data) const
    00727 {
    00728   Glib::Value<DataType> value;
    00729   bool result = this->get_value(tag, index, value);
    00730
    00731   if(result)
    00732     data = value.get();
    00733
    00734   return result;
    00735 }
    00736
    00737 template<class DataType>
    00738 bool TagList::get(const Glib::ustring& tag, guint index, DataType& data) const
    00739 {
    00740   Glib::Value<DataType> value;
    00741   bool result = this->get_value(tag, index, value);
    00742
    00743   if(result)
    00744     data = value.get();
    00745
    00746   return result;
    00747 }
    00748
    00749 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00750
    00751 } //namespace Gst
    00752
    00753
    00754 namespace Gst
    00755 {
    00756
    00761 inline void swap(TagList& lhs, TagList& rhs)
    00762   { lhs.swap(rhs); }
    00763
    00764 } // namespace Gst
    00765
    00766 namespace Glib
    00767 {
    00768
    00778 Gst::TagList wrap(GstTagList* object, int dummy, bool take_copy = false);
    00779
    00780 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00781 template <>
    00782 class Value<Gst::TagList> : public Glib::Value_Boxed<Gst::TagList>
    00783 {};
    00784 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00785
    00786 } // namespace Glib
    00787
    00788
    00789 #endif /* _GSTREAMERMM_TAGLIST_H */
    00790