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
00154 void set_field(const Glib::ustring& fieldname, const Glib::ValueBase& value);
00155
00156
00164 void set_field(const Glib::ustring& fieldname, bool value);
00165
00173 void set_field(const Glib::ustring& fieldname, int value);
00174
00182 void set_field(const Glib::ustring& fieldname, guint value);
00183
00195 void set_field(const Glib::ustring& fieldname, const Fourcc& value);
00196
00204 void set_field(const Glib::ustring& fieldname, double value);
00205
00206
00214 void set_field(const Glib::ustring& fieldname, const std::string& value);
00215
00223 void set_field(const Glib::ustring& fieldname, const char* value);
00224
00235 void set_field(const Glib::ustring& fieldname, const Glib::Date& value);
00236
00244 void set_field(const Glib::ustring& fieldname, const ClockTime& value);
00245
00262 void set_field(const Glib::ustring& fieldname, GType enumtype, int value);
00263
00274 void set_field(const Glib::ustring& fieldname, const Gst::Fraction& value);
00275
00287 void set_field(const Glib::ustring& fieldname, const Gst::IntRange& value);
00288
00300 void set_field(const Glib::ustring& fieldname, const Gst::DoubleRange& value);
00301
00313 void set_field(const Glib::ustring& fieldname, const Gst::FractionRange& value);
00314
00315
00316 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00317
00318 static void _set_gstructure_field(GstStructure* cstructure, const Glib::ustring& fieldname, const Glib::ValueBase& value);
00319 #endif
00320
00326 void remove_field(const Glib::ustring& fieldname);
00327
00328
00331 void remove_all_fields();
00332
00339 GType get_field_type(const Glib::ustring& fieldname) const;
00340
00341
00342
00348 typedef sigc::slot<bool, const Glib::QueryQuark&, const Glib::ValueBase&> SlotForeach;
00349
00357 bool foreach(const SlotForeach& slot);
00358
00359
00363 int size() const;
00364
00369 bool has_field(const Glib::ustring& fieldname) const;
00370
00376 bool has_field(const Glib::ustring& fieldname, GType type) const;
00377
00388 bool get_field(const Glib::ustring& fieldname, bool& value) const;
00389
00390
00401 bool get_field(const Glib::ustring& fieldname, int& value) const;
00402
00403
00414 bool get_field(const Glib::ustring& fieldname, guint& value) const;
00415
00416
00427 bool get_field(const Glib::ustring& fieldname, Fourcc& value) const;
00428
00429
00440 bool get_field(const Glib::ustring& fieldname, double& value) const;
00441
00442
00453 bool get_field(const Glib::ustring& fieldname, Glib::ustring& value) const;
00454
00465 bool get_field(const Glib::ustring& fieldname, std::string& value) const;
00466
00467
00478 bool get_field(const Glib::ustring& fieldname, Glib::Date& value) const;
00479
00480
00491 bool get_field(const Glib::ustring& fieldname, ClockTime& value) const;
00492
00493
00513 bool get_field(const Glib::ustring& fieldname, GType enumtype, int& value) const;
00514
00515
00526 bool get_field(const Glib::ustring& fieldname, Gst::Fraction& value) const;
00527
00528
00539 bool get_field(const Glib::ustring& fieldname, Gst::IntRange& value) const;
00540
00551 bool get_field(const Glib::ustring& fieldname, Gst::DoubleRange& value) const;
00552
00563 bool get_field(const Glib::ustring& fieldname, Gst::FractionRange& value) const;
00564
00570 typedef sigc::slot<bool, const Glib::QueryQuark&, Glib::ValueBase&> SlotMap;
00571
00580 bool map_in_place(const SlotMap& slot);
00581
00582
00587 Glib::ustring get_nth_field_name(guint index) const;
00588
00593 Glib::ustring to_string() const;
00594
00601 bool fixate_field_nearest_int(const Glib::ustring& name, int target);
00602
00609 bool fixate_field_nearest_double(const Glib::ustring& name, double target);
00610
00618 bool fixate_nearest_fraction(const Glib::ustring& name, const Gst::Fraction& target);
00619
00620
00627 bool fixate_field_boolean(const Glib::ustring& name, bool target);
00628
00629
00630
00631
00632 };
00633
00634 }
00635
00636
00637 namespace Gst
00638 {
00639
00644 inline void swap(Structure& lhs, Structure& rhs)
00645 { lhs.swap(rhs); }
00646
00647 }
00648
00649 namespace Glib
00650 {
00651
00660 Gst::Structure wrap(GstStructure* object, bool take_copy = false);
00661
00662 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00663 template <>
00664 class Value<Gst::Structure> : public Glib::Value_Boxed<Gst::Structure>
00665 {};
00666 #endif
00667
00668 }
00669
00670
00671 #endif
00672