00001
00002
00003 #ifndef _GSTREAMERMM_STRUCTURE_H
00004 #define _GSTREAMERMM_STRUCTURE_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 <gstreamermm/clock.h>
00031 #include <gstreamermm/enums.h>
00032 #include <gstreamermm/value.h>
00033
00034
00035 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00036 extern "C" { typedef struct _GstStructure GstStructure; }
00037 #endif
00038
00039 namespace Gst
00040 {
00041
00057 class Structure
00058 {
00059 public:
00060 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00061 typedef Structure CppObjectType;
00062 typedef GstStructure BaseObjectType;
00063
00064 static GType get_type() G_GNUC_CONST;
00065 #endif
00066
00067 Structure();
00068
00069 explicit Structure(GstStructure* gobject, bool make_a_copy = false, bool destroy = true);
00070
00071 Structure(const Structure& other);
00072 Structure& operator=(const Structure& other);
00073
00074 ~Structure();
00075
00076 void swap(Structure& other);
00077
00079 GstStructure* gobj() { return gobject_; }
00080
00082 const GstStructure* gobj() const { return gobject_; }
00083
00085 GstStructure* gobj_copy() const;
00086
00092 void set_destroy(bool destroy);
00093
00094 protected:
00095 GstStructure* gobject_;
00096
00097 private:
00098 bool destroy;
00099
00100 private:
00101
00102
00103 public:
00109 typedef sigc::slot<bool, const Glib::QueryQuark&, const Glib::ValueBase&> SlotForeach;
00110
00116 typedef sigc::slot<bool, const Glib::QueryQuark&, Glib::ValueBase&> SlotMap;
00117
00118 public:
00119 Structure(const Glib::ustring& name);
00120
00121
00125 Glib::ustring get_name() const;
00126
00131 bool has_name(const Glib::ustring& name) const;
00132
00138 void set_name(const Glib::ustring& name);
00139
00143 Glib::QueryQuark get_name_id() const;
00144
00150 void get_field(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00151
00165 Structure& set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value);
00166
00174 Structure& remove_field(const Glib::ustring& fieldname);
00175
00176
00179 void remove_all_fields();
00180
00187 GType get_field_type(const Glib::ustring& fieldname) const;
00188
00196 bool foreach(const SlotForeach& slot);
00197
00198
00202 int size() const;
00203
00208 bool has_field(const Glib::ustring& fieldname) const;
00209
00215 bool has_field(const Glib::ustring& fieldname, GType type) const;
00216
00226 bool get_boolean(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00227
00237 bool get_int(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00238
00248 bool get_uint(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00249
00259 bool get_fourcc(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00260
00270 bool get_double(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00271
00281 bool get_string(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00282
00292 bool get_date(const Glib::ustring& fieldname, Glib::Date& value) const;
00293
00304 bool get_clock_time(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00305
00315 bool get_enum(const Glib::ustring& fieldname, GType enumtype, Glib::ValueBase& value) const;
00316
00327 bool get_fraction(const Glib::ustring& fieldname, Gst::Fraction& fraction) const;
00328
00337 bool map_in_place(const SlotMap& slot);
00338
00339
00344 Glib::ustring nth_field_name(guint index) const;
00345
00350 Glib::ustring to_string() const;
00351
00352 static Structure create_from_string(const Glib::ustring& the_string);
00353
00354
00355 };
00356
00357 }
00358
00359
00360 namespace Gst
00361 {
00362
00367 inline void swap(Structure& lhs, Structure& rhs)
00368 { lhs.swap(rhs); }
00369
00370 }
00371
00372 namespace Glib
00373 {
00374
00384 Gst::Structure wrap(GstStructure* object, bool take_copy = false, bool destroy = true);
00385
00386 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00387 template <>
00388 class Value<Gst::Structure> : public Glib::Value_Boxed<Gst::Structure>
00389 {};
00390 #endif
00391
00392 }
00393
00394
00395 #endif
00396