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 <libxml++/nodes/node.h>
00033
00034
00035 namespace Gst
00036 {
00037
00038 struct Structure;
00039
00066 class Caps
00067 {
00068 public:
00069 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00070 typedef Caps CppObjectType;
00071 typedef GstCaps BaseObjectType;
00072 #endif
00073
00074 static Glib::RefPtr<Caps> create();
00075
00076
00077 void reference() const;
00078 void unreference() const;
00079
00081 GstCaps* gobj();
00082
00084 const GstCaps* gobj() const;
00085
00087 GstCaps* gobj_copy() const;
00088
00089 protected:
00090
00091 Caps();
00092 void operator delete(void*, size_t);
00093
00094 private:
00095
00096 Caps(const Caps&);
00097 Caps& operator=(const Caps&);
00098
00099
00100 public:
00101 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00102 static GType get_type() G_GNUC_CONST;
00103 #endif
00104
00105 public:
00111 static Glib::RefPtr<Gst::Caps> create_any();
00112
00118 static Glib::RefPtr<Gst::Caps> create_simple(const Glib::ustring& media_type);
00119
00126 static Glib::RefPtr<Gst::Caps> create(const Structure& first_struct);
00127
00128
00133 static Glib::RefPtr<Gst::Caps> create_from_string(const Glib::ustring& string);
00134
00135
00146 Glib::RefPtr<Gst::Caps> copy() const;
00147
00153 Glib::RefPtr<Gst::Caps> copy_nth(guint nth) const;
00154
00160 void append(const Glib::RefPtr<Gst::Caps>& caps);
00161
00170 void merge(const Glib::RefPtr<Gst::Caps>& caps);
00171
00176 void append_structure(const Structure& structure);
00177
00178
00183 void merge_structure(const Structure& structure);
00184
00185
00191 Structure get_structure(guint idx) const;
00192
00193
00198 void remove_structure(guint idx);
00199
00203 guint size() const;
00204
00213 void set_simple(const Glib::ustring& name, const Glib::ValueBase& value);
00214
00215
00225 template <class DataType>
00226 void set_simple(const Glib::ustring& name, const DataType& data);
00227
00234 void set_simple(const Glib::ustring& name, const char* data);
00235
00236
00240 bool is_any() const;
00241
00245 bool empty() const;
00246
00252 bool is_fixed() const;
00253
00262 bool equals(const Glib::RefPtr<Gst::Caps>& other_caps) const;
00263
00269 bool equals_fixed(const Glib::RefPtr<Gst::Caps>& other_caps) const;
00270
00277 bool is_always_compatible(const Glib::RefPtr<Gst::Caps>& other_caps) const;
00278
00285 bool is_subset(const Glib::RefPtr<Gst::Caps>& superset_caps) const;
00286
00287
00288
00294 Glib::RefPtr<Gst::Caps> get_intersect(const Glib::RefPtr<Gst::Caps>& other_caps) const;
00295
00296
00297
00303 Glib::RefPtr<Gst::Caps> get_union(const Glib::RefPtr<Gst::Caps>& other_caps) const;
00304
00305
00306
00312 Glib::RefPtr<Gst::Caps> get_normal() const;
00313
00314
00321 bool simplify();
00322
00327 xmlpp::Node* save(xmlpp::Node* parent) const;
00328
00329
00334 static Glib::RefPtr<Gst::Caps> load(xmlpp::Node* parent);
00335
00336
00347 Glib::ustring to_string() const;
00348
00349
00356 Glib::RefPtr<Gst::Caps> get_difference(const Glib::RefPtr<const Gst::Caps>& subtrahend_caps) const;
00357
00361 Glib::RefPtr<Gst::Caps> make_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