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 = 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
00087 protected:
00088 GstStructure* gobject_;
00089
00090 private:
00091
00092 public:
00093
00097 explicit Structure(const Glib::ustring& name);
00098
00105 static Structure create_from_string(const Glib::ustring& the_string);
00106
00109 operator bool() const;
00110
00111
00115 Glib::ustring get_name() const;
00116
00121 bool has_name(const Glib::ustring& name) const;
00122
00128 void set_name(const Glib::ustring& name);
00129
00133 Glib::QueryQuark get_name_id() const;
00134
00140 void get_field(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00141
00154 void set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value);
00155
00163 void set_field(const Glib::ustring& fieldname, bool value);
00164
00172 void set_field(const Glib::ustring& fieldname, int value);
00173
00181 void set_field(const Glib::ustring& fieldname, guint value);
00182
00194 void set_field(const Glib::ustring& fieldname, const Fourcc& value);
00195
00203 void set_field(const Glib::ustring& fieldname, double value);
00204
00205
00213 void set_field(const Glib::ustring& fieldname, const std::string& value);
00214
00222 void set_field(const Glib::ustring& fieldname, const char* value);
00223
00234 void set_field(const Glib::ustring& fieldname, const Glib::Date& value);
00235
00243 void set_field(const Glib::ustring& fieldname, const ClockTime& value);
00244
00261 void set_field(const Glib::ustring& fieldname, GType enumtype, int value);
00262
00273 void set_field(const Glib::ustring& fieldname, const Gst::Fraction& value);
00274
00286 void set_field(const Glib::ustring& fieldname, const Gst::IntRange& value);
00287
00299 void set_field(const Glib::ustring& fieldname, const Gst::DoubleRange& value);
00300
00312 void set_field(const Glib::ustring& fieldname, const Gst::FractionRange& value);
00313
00314
00315 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00316
00317 static void _set_gstructure_field(GstStructure* cstructure, const Glib::ustring& fieldname, const Glib::ValueBase& value);
00318 #endif
00319
00325 void remove_field(const Glib::ustring& fieldname);
00326
00327
00330 void remove_all_fields();
00331
00338 GType get_field_type(const Glib::ustring& fieldname) const;
00339
00340
00341
00347 typedef sigc::slot<bool, const Glib::QueryQuark&, const Glib::ValueBase&> SlotForeach;
00348
00356 bool foreach(const SlotForeach& slot);
00357
00358
00362 int size() const;
00363
00368 bool has_field(const Glib::ustring& fieldname) const;
00369
00375 bool has_field(const Glib::ustring& fieldname, GType type) const;
00376
00387 bool get_field(const Glib::ustring& fieldname, bool& value) const;
00388
00389
00400 bool get_field(const Glib::ustring& fieldname, int& value) const;
00401
00402
00413 bool get_field(const Glib::ustring& fieldname, guint& value) const;
00414
00415
00426 bool get_field(const Glib::ustring& fieldname, Fourcc& value) const;
00427
00428
00439 bool get_field(const Glib::ustring& fieldname, double& value) const;
00440
00441
00452 bool get_field(const Glib::ustring& fieldname, Glib::ustring& value) const;
00453
00464 bool get_field(const Glib::ustring& fieldname, std::string& value) const;
00465
00466
00477 bool get_field(const Glib::ustring& fieldname, Glib::Date& value) const;
00478
00479
00490 bool get_field(const Glib::ustring& fieldname, ClockTime& value) const;
00491
00492
00512 bool get_field(const Glib::ustring& fieldname, GType enumtype, int& value) const;
00513
00514
00525 bool get_field(const Glib::ustring& fieldname, Gst::Fraction& value) const;
00526
00527
00538 bool get_field(const Glib::ustring& fieldname, Gst::IntRange& value) const;
00539
00550 bool get_field(const Glib::ustring& fieldname, Gst::DoubleRange& value) const;
00551
00562 bool get_field(const Glib::ustring& fieldname, Gst::FractionRange& value) const;
00563
00569 typedef sigc::slot<bool, const Glib::QueryQuark&, Glib::ValueBase&> SlotMap;
00570
00579 bool map_in_place(const SlotMap& slot);
00580
00581
00586 Glib::ustring get_nth_field_name(guint index) const;
00587
00592 Glib::ustring to_string() const;
00593
00594
00595 };
00596
00597 }
00598
00599
00600 namespace Gst
00601 {
00602
00607 inline void swap(Structure& lhs, Structure& rhs)
00608 { lhs.swap(rhs); }
00609
00610 }
00611
00612 namespace Glib
00613 {
00614
00623 Gst::Structure wrap(GstStructure* object, bool take_copy = false);
00624
00625 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00626 template <>
00627 class Value<Gst::Structure> : public Glib::Value_Boxed<Gst::Structure>
00628 {};
00629 #endif
00630
00631 }
00632
00633
00634 #endif
00635