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
00093 public:
00097 explicit Structure(const Glib::ustring& name);
00098
00105 static Structure create_from_string(const Glib::ustring& the_string);
00106
00107
00110 operator bool() const;
00111
00112
00116 Glib::ustring get_name() const;
00117
00122 bool has_name(const Glib::ustring& name) const;
00123
00129 void set_name(const Glib::ustring& name);
00130
00134 Glib::QueryQuark get_name_id() const;
00135
00141 void get_field(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00142
00143
00156 void set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value);
00157
00158
00166 void set_field(const Glib::ustring& fieldname, bool value);
00167
00175 void set_field(const Glib::ustring& fieldname, int value);
00176
00184 void set_field(const Glib::ustring& fieldname, guint value);
00185
00197 void set_field(const Glib::ustring& fieldname, const Fourcc& value);
00198
00206 void set_field(const Glib::ustring& fieldname, double value);
00207
00208
00216 void set_field(const Glib::ustring& fieldname, const std::string& value);
00217
00225 void set_field(const Glib::ustring& fieldname, const char* value);
00226
00237 void set_field(const Glib::ustring& fieldname, const Glib::Date& value);
00238
00246 void set_field(const Glib::ustring& fieldname, const ClockTime& value);
00247
00264 void set_field(const Glib::ustring& fieldname, GType enumtype, int value);
00265
00276 void set_field(const Glib::ustring& fieldname, const Gst::Fraction& value);
00277
00289 void set_field(const Glib::ustring& fieldname, const Gst::IntRange& value);
00290
00302 void set_field(const Glib::ustring& fieldname, const Gst::DoubleRange& value);
00303
00315 void set_field(const Glib::ustring& fieldname, const Gst::FractionRange& value);
00316
00317
00318 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00319
00320 static void _set_gstructure_field(GstStructure* cstructure, const Glib::ustring& fieldname, const Glib::ValueBase& value);
00321 #endif
00322
00328 void remove_field(const Glib::ustring& fieldname);
00329
00330
00333 void remove_all_fields();
00334
00341 GType get_field_type(const Glib::ustring& fieldname) const;
00342
00343
00344
00350 typedef sigc::slot<bool, const Glib::QueryQuark&, const Glib::ValueBase&> SlotForeach;
00351
00359 bool foreach(const SlotForeach& slot);
00360
00361
00365 int size() const;
00366
00371 bool has_field(const Glib::ustring& fieldname) const;
00372
00378 bool has_field(const Glib::ustring& fieldname, GType type) const;
00379
00390 bool get_field(const Glib::ustring& fieldname, bool& value) const;
00391
00392
00403 bool get_field(const Glib::ustring& fieldname, int& value) const;
00404
00405
00416 bool get_field(const Glib::ustring& fieldname, guint& value) const;
00417
00418
00429 bool get_field(const Glib::ustring& fieldname, Fourcc& value) const;
00430
00431
00442 bool get_field(const Glib::ustring& fieldname, double& value) const;
00443
00444
00455 bool get_field(const Glib::ustring& fieldname, Glib::ustring& value) const;
00456
00467 bool get_field(const Glib::ustring& fieldname, std::string& value) const;
00468
00469
00480 bool get_field(const Glib::ustring& fieldname, Glib::Date& value) const;
00481
00482
00493 bool get_field(const Glib::ustring& fieldname, ClockTime& value) const;
00494
00495
00515 bool get_field(const Glib::ustring& fieldname, GType enumtype, int& value) const;
00516
00517
00528 bool get_field(const Glib::ustring& fieldname, Gst::Fraction& value) const;
00529
00530
00541 bool get_field(const Glib::ustring& fieldname, Gst::IntRange& value) const;
00542
00553 bool get_field(const Glib::ustring& fieldname, Gst::DoubleRange& value) const;
00554
00565 bool get_field(const Glib::ustring& fieldname, Gst::FractionRange& value) const;
00566
00572 typedef sigc::slot<bool, const Glib::QueryQuark&, Glib::ValueBase&> SlotMap;
00573
00582 bool map_in_place(const SlotMap& slot);
00583
00584
00589 Glib::ustring get_nth_field_name(guint index) const;
00590
00595 Glib::ustring to_string() const;
00596
00603 bool fixate_field_nearest_int(const Glib::ustring& name, int target);
00604
00611 bool fixate_field_nearest_double(const Glib::ustring& name, double target);
00612
00620 bool fixate_nearest_fraction(const Glib::ustring& name, const Gst::Fraction& target);
00621
00622
00629 bool fixate_field_boolean(const Glib::ustring& name, bool target);
00630
00631
00632
00633
00634 };
00635
00636 }
00637
00638
00639 namespace Gst
00640 {
00641
00646 inline void swap(Structure& lhs, Structure& rhs)
00647 { lhs.swap(rhs); }
00648
00649 }
00650
00651 namespace Glib
00652 {
00653
00662 Gst::Structure wrap(GstStructure* object, bool take_copy = false);
00663
00664 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00665 template <>
00666 class Value<Gst::Structure> : public Glib::Value_Boxed<Gst::Structure>
00667 {};
00668 #endif
00669
00670 }
00671
00672
00673 #endif
00674