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 #include <gstreamermm/clock.h>
00029 #include <gstreamermm/enums.h>
00030 #include <gstreamermm/value.h>
00031
00032
00033 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00034 extern "C" { typedef struct _GstStructure GstStructure; }
00035 #endif
00036
00037 namespace Gst
00038 {
00039
00055 class Structure
00056 {
00057 public:
00058 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00059 typedef Structure CppObjectType;
00060 typedef GstStructure BaseObjectType;
00061
00062 static GType get_type() G_GNUC_CONST;
00063 #endif
00064
00065 Structure();
00066
00067 explicit Structure(GstStructure* gobject, bool make_a_copy = true);
00068
00069 Structure(const Structure& other);
00070 Structure& operator=(const Structure& other);
00071
00072 ~Structure();
00073
00074 void swap(Structure& other);
00075
00077 GstStructure* gobj() { return gobject_; }
00078
00080 const GstStructure* gobj() const { return gobject_; }
00081
00083 GstStructure* gobj_copy() const;
00084
00085 protected:
00086 GstStructure* gobject_;
00087
00088 private:
00089
00090
00091 public:
00095 explicit Structure(const Glib::ustring& name);
00096
00103 static Structure create_from_string(const Glib::ustring& the_string);
00104
00105
00108 operator bool() const;
00109
00110
00114 Glib::ustring get_name() const;
00115
00120 bool has_name(const Glib::ustring& name) const;
00121
00127 void set_name(const Glib::ustring& name);
00128
00132 Glib::QueryQuark get_name_id() const;
00133
00139 void get_field(const Glib::ustring& fieldname, Glib::ValueBase& value) const;
00140
00141
00142
00143
00144
00157 void set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value);
00158
00159
00167 void set_field(const Glib::ustring& fieldname, bool value);
00168
00176 void set_field(const Glib::ustring& fieldname, int value);
00177
00185 void set_field(const Glib::ustring& fieldname, guint value);
00186
00198 void set_field(const Glib::ustring& fieldname, const Fourcc& value);
00199
00207 void set_field(const Glib::ustring& fieldname, double value);
00208
00209
00217 void set_field(const Glib::ustring& fieldname, const std::string& value);
00218
00226 void set_field(const Glib::ustring& fieldname, const char* value);
00227
00238 void set_field(const Glib::ustring& fieldname, const Glib::Date& value);
00239
00247 void set_field(const Glib::ustring& fieldname, const ClockTime& value);
00248
00265 void set_field(const Glib::ustring& fieldname, GType enumtype, int value);
00266
00277 void set_field(const Glib::ustring& fieldname, const Gst::Fraction& value);
00278
00290 void set_field(const Glib::ustring& fieldname, const Gst::IntRange& value);
00291
00303 void set_field(const Glib::ustring& fieldname, const Gst::DoubleRange& value);
00304
00316 void set_field(const Glib::ustring& fieldname, const Gst::FractionRange& value);
00317
00318
00319 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00320
00321 static void _set_gstructure_field(GstStructure* cstructure, const Glib::ustring& fieldname, const Glib::ValueBase& value);
00322 #endif
00323
00329 void remove_field(const Glib::ustring& fieldname);
00330
00331
00334 void remove_all_fields();
00335
00342 GType get_field_type(const Glib::ustring& fieldname) const;
00343
00349 typedef sigc::slot<bool, const Glib::ustring&, const Glib::ValueBase&> SlotForeach;
00350
00358 bool foreach(const SlotForeach& slot);
00359
00360
00364 int size() const;
00365
00370 bool has_field(const Glib::ustring& fieldname) const;
00371
00377 bool has_field(const Glib::ustring& fieldname, GType type) const;
00378
00389 bool get_field(const Glib::ustring& fieldname, bool& value) const;
00390
00391
00402 bool get_field(const Glib::ustring& fieldname, int& value) const;
00403
00404
00415 bool get_field(const Glib::ustring& fieldname, guint& value) const;
00416
00417
00428 bool get_field(const Glib::ustring& fieldname, Fourcc& value) const;
00429
00430
00441 bool get_field(const Glib::ustring& fieldname, double& value) const;
00442
00443
00454 bool get_field(const Glib::ustring& fieldname, Glib::ustring& value) const;
00455
00466 bool get_field(const Glib::ustring& fieldname, std::string& value) const;
00467
00468
00479 bool get_field(const Glib::ustring& fieldname, Glib::Date& value) const;
00480
00481
00492 bool get_field(const Glib::ustring& fieldname, ClockTime& value) const;
00493
00494
00514 bool get_field(const Glib::ustring& fieldname, GType enumtype, int& value) const;
00515
00516
00527 bool get_field(const Glib::ustring& fieldname, Gst::Fraction& value) const;
00528
00529
00540 bool get_field(const Glib::ustring& fieldname, Gst::IntRange& value) const;
00541
00552 bool get_field(const Glib::ustring& fieldname, Gst::DoubleRange& value) const;
00553
00564 bool get_field(const Glib::ustring& fieldname, Gst::FractionRange& value) const;
00565
00571 typedef sigc::slot<bool, const Glib::ustring&, Glib::ValueBase&> SlotMap;
00572
00581 bool map_in_place(const SlotMap& slot);
00582
00583
00588 Glib::ustring get_nth_field_name(guint index) const;
00589
00600 Glib::ustring to_string() const;
00601
00608 bool fixate_field_nearest_int(const Glib::ustring& name, int target);
00609
00616 bool fixate_field_nearest_double(const Glib::ustring& name, double target);
00617
00625 bool fixate_nearest_fraction(const Glib::ustring& name, const Gst::Fraction& target);
00626
00627
00634 bool fixate_field_boolean(const Glib::ustring& name, bool target);
00635
00636
00637
00638
00639 };
00640
00641 }
00642
00643
00644 namespace Gst
00645 {
00646
00651 inline void swap(Structure& lhs, Structure& rhs)
00652 { lhs.swap(rhs); }
00653
00654 }
00655
00656 namespace Glib
00657 {
00658
00667 Gst::Structure wrap(GstStructure* object, bool take_copy = false);
00668
00669 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00670 template <>
00671 class Value<Gst::Structure> : public Glib::Value_Boxed<Gst::Structure>
00672 {};
00673 #endif
00674
00675 }
00676
00677
00678 #endif
00679