00001
00002
00003 #ifndef _GSTREAMERMM_CAPS_H
00004 #define _GSTREAMERMM_CAPS_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 <gst/gstcaps.h>
00031 #include <gstreamermm/structure.h>
00032 #include <gstreamermm/structurevalue.h>
00033 #include <libxml++/nodes/node.h>
00034
00035
00036 namespace Gst
00037 {
00038
00039 struct Structure;
00040
00067 class Caps
00068 {
00069 public:
00070 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00071 typedef Caps CppObjectType;
00072 typedef GstCaps BaseObjectType;
00073 #endif
00074
00075 static Glib::RefPtr<Caps> create();
00076
00077
00078 void reference() const;
00079 void unreference() const;
00080
00082 GstCaps* gobj();
00083
00085 const GstCaps* gobj() const;
00086
00088 GstCaps* gobj_copy() const;
00089
00090 protected:
00091
00092 Caps();
00093 void operator delete(void*, size_t);
00094
00095 private:
00096
00097 Caps(const Caps&);
00098 Caps& operator=(const Caps&);
00099
00100
00101 public:
00102 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00103 static GType get_type() G_GNUC_CONST;
00104 #endif
00105
00106 public:
00112 static Glib::RefPtr<Caps> create_any();
00113
00119 static Glib::RefPtr<Caps> create_simple(const Glib::ustring& media_type);
00120
00127 static Glib::RefPtr<Caps> create(const Structure& first_struct);
00128
00129
00134 static Glib::RefPtr<Caps> create_from_string(const Glib::ustring& string);
00135
00136
00147 Glib::RefPtr<Caps> copy() const;
00148
00154 Glib::RefPtr<Caps> copy_nth(guint nth) const;
00155
00161 void append(const Glib::RefPtr<Caps>& caps);
00162
00171 void merge(const Glib::RefPtr<Caps>& caps);
00172
00177 void append_structure(const Structure& structure);
00178
00179
00184 void merge_structure(const Structure& structure);
00185
00186
00192 Structure get_structure(guint idx) const;
00193
00194
00199 void remove_structure(guint idx);
00200
00204 guint size() const;
00205
00214 void set_simple(const Glib::ustring& name, const Glib::ValueBase& value);
00215
00216
00226 template <class DataType>
00227 void set_simple(const Glib::ustring& name, const DataType& data);
00228
00229
00233 bool is_any() const;
00234
00238 bool empty() const;
00239
00245 bool is_fixed() const;
00246
00255 bool equals(const Glib::RefPtr<Caps>& other_caps) const;
00256
00262 bool equals_fixed(const Glib::RefPtr<Caps>& other_caps) const;
00263
00270 bool is_always_compatible(const Glib::RefPtr<Caps>& other_caps) const;
00271
00278 bool is_subset(const Glib::RefPtr<Caps>& superset_caps) const;
00279
00280
00281
00287 Glib::RefPtr<Caps> get_intersect(const Glib::RefPtr<Caps>& other_caps) const;
00288
00289
00290
00296 Glib::RefPtr<Caps> get_union(const Glib::RefPtr<Caps>& other_caps) const;
00297
00298
00299
00305 Glib::RefPtr<Caps> get_normal() const;
00306
00307
00314 bool simplify();
00315
00320 xmlpp::Node* save(xmlpp::Node* parent) const;
00321
00322
00327 static Glib::RefPtr<Caps> load(xmlpp::Node* parent);
00328
00329
00340 Glib::ustring to_string() const;
00341
00342
00349 Glib::RefPtr<Caps> get_difference(const Glib::RefPtr<const Caps>& subtrahend_caps) const;
00350
00354 Glib::RefPtr<Caps> make_writable();
00355
00359 void truncate();
00360
00361
00362 };
00363
00364 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00365
00366
00367
00368 template <class DataType>
00369 void Caps::set_simple(const Glib::ustring& name, const DataType& data)
00370 {
00371 typedef typename Gst::StructureValue<DataType> type_cppdata;
00372 typedef typename type_cppdata::ValueType ValueType;
00373
00374 ValueType value;
00375 value.init(ValueType::value_type());
00376 value.set(data);
00377 this->set_simple(name, (Glib::ValueBase)(value));
00378 }
00379
00380 #endif
00381
00382 }
00383
00384 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00385 namespace Glib
00386 {
00387
00388 template <>
00389 class Value< Glib::RefPtr<Gst::Caps> > : public ValueBase_Boxed
00390 {
00391 public:
00392 static GType value_type() { return Gst::Caps::get_type(); }
00393 void set(const Glib::RefPtr<Gst::Caps>& caps) { set_boxed(caps->gobj()); }
00394 Glib::RefPtr<Gst::Caps> get() { return Glib::RefPtr<Gst::Caps>(reinterpret_cast<Gst::Caps*>(get_boxed())); }
00395 };
00396
00397 }
00398 #endif
00399
00400
00401 namespace Glib
00402 {
00403
00412 Glib::RefPtr<Gst::Caps> wrap(GstCaps* object, bool take_copy = false);
00413
00414 }
00415
00416
00417 #endif
00418