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 #include <gst/gstcaps.h>
00029 #include <gstreamermm/structure.h>
00030 #include <libxml++/nodes/node.h>
00031
00032
00033 namespace Gst
00034 {
00035
00036 struct Structure;
00037
00064 class Caps
00065 {
00066 public:
00067 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00068 typedef Caps CppObjectType;
00069 typedef GstCaps BaseObjectType;
00070 #endif
00071
00072 static Glib::RefPtr<Caps> create();
00073
00074
00075 void reference() const;
00076 void unreference() const;
00077
00079 GstCaps* gobj();
00080
00082 const GstCaps* gobj() const;
00083
00085 GstCaps* gobj_copy() const;
00086
00087 protected:
00088
00089 Caps();
00090 void operator delete(void*, size_t);
00091
00092 private:
00093
00094 Caps(const Caps&);
00095 Caps& operator=(const Caps&);
00096
00097
00098 public:
00099 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00100 static GType get_type() G_GNUC_CONST;
00101 #endif
00102
00103 public:
00109 static Glib::RefPtr<Gst::Caps> create_any();
00110
00116 static Glib::RefPtr<Gst::Caps> create_simple(const Glib::ustring& media_type);
00117
00124 static Glib::RefPtr<Gst::Caps> create(const Structure& first_struct);
00125
00126
00131 static Glib::RefPtr<Gst::Caps> create_from_string(const Glib::ustring& string);
00132
00133
00144 Glib::RefPtr<Gst::Caps> copy() const;
00145
00151 Glib::RefPtr<Gst::Caps> copy_nth(guint nth) const;
00152
00158 void append(const Glib::RefPtr<Gst::Caps>& caps);
00159
00168 void merge(const Glib::RefPtr<Gst::Caps>& caps);
00169
00174 void append_structure(const Structure& structure);
00175
00176
00181 void merge_structure(Structure& structure);
00182
00183
00189 const Structure get_structure(guint idx) const;
00190
00191
00196 void remove_structure(guint idx);
00197
00201 guint size() const;
00202
00211 void set_simple(const Glib::ustring& name, const Glib::ValueBase& value);
00212
00213
00223 template <class DataType>
00224 void set_simple(const Glib::ustring& name, const DataType& data);
00225
00232 void set_simple(const Glib::ustring& name, const char* data);
00233
00234
00238 bool is_any() const;
00239
00243 bool empty() const;
00244
00250 bool is_fixed() const;
00251
00260 bool equals(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
00261
00267 bool equals_fixed(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
00268
00275 bool is_always_compatible(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
00276
00283 bool is_subset(const Glib::RefPtr<const Gst::Caps>& superset_caps) const;
00284
00285
00286
00292 Glib::RefPtr<Gst::Caps> get_intersect(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
00293
00294
00295
00301 Glib::RefPtr<Gst::Caps> get_union(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
00302
00303
00304
00310 Glib::RefPtr<Gst::Caps> get_normal() const;
00311
00312
00319 bool simplify();
00320
00325 xmlpp::Node* save(xmlpp::Node* parent) const;
00326
00327
00332 static Glib::RefPtr<Gst::Caps> load(xmlpp::Node* parent);
00333
00334
00345 Glib::ustring to_string() const;
00346
00347
00348
00355 Glib::RefPtr<Gst::Caps> get_difference(const Glib::RefPtr<const Gst::Caps>& subtrahend_caps) const;
00356
00357
00361 Glib::RefPtr<Gst::Caps> create_writable();
00362
00366 void truncate();
00367
00368
00369 };
00370
00371 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00372
00373
00374
00375 template <class DataType>
00376 void Caps::set_simple(const Glib::ustring& name, const DataType& data)
00377 {
00378 typedef Glib::Value<DataType> ValueType;
00379
00380 ValueType value;
00381 value.init(ValueType::value_type());
00382 value.set(data);
00383 this->set_simple(name, (Glib::ValueBase)(value));
00384 }
00385
00386 #endif
00387
00388 }
00389
00390 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00391 namespace Glib
00392 {
00393
00394 template <>
00395 class Value< Glib::RefPtr<Gst::Caps> > : public ValueBase_Boxed
00396 {
00397 public:
00398 static GType value_type() { return Gst::Caps::get_type(); }
00399 void set(const Glib::RefPtr<Gst::Caps>& caps) { set_boxed(caps->gobj()); }
00400 Glib::RefPtr<Gst::Caps> get() { return Glib::RefPtr<Gst::Caps>(reinterpret_cast<Gst::Caps*>(get_boxed())); }
00401 };
00402
00403 }
00404 #endif
00405
00406
00407 namespace Glib
00408 {
00409
00418 Glib::RefPtr<Gst::Caps> wrap(GstCaps* object, bool take_copy = false);
00419
00420 }
00421
00422
00423 #endif
00424