[gstreamermm] Gst::Caps: added methods interrelated with Gst::CapsFeatures class
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Gst::Caps: added methods interrelated with Gst::CapsFeatures class
- Date: Fri, 21 Nov 2014 13:11:04 +0000 (UTC)
commit c5446f4796400c409c30e10f8dbacb0e4701cca9
Author: Marcin Kolny <marcin kolny flytronic pl>
Date: Fri Nov 21 14:08:57 2014 +0100
Gst::Caps: added methods interrelated with Gst::CapsFeatures class
* gstreamer/src/caps.{ccg|hg}: wrapped following methods:
gst_caps_append_structure_full, gst_caps_merge_structure_full,
gst_caps_get_features, gst_caps_set_features.
gstreamer/src/caps.ccg | 33 +++++++++++++++++++++++++++++++--
gstreamer/src/caps.hg | 38 +++++++++++++++++++++++++++++++++++++-
2 files changed, 68 insertions(+), 3 deletions(-)
---
diff --git a/gstreamer/src/caps.ccg b/gstreamer/src/caps.ccg
index eef5a72..9ba242c 100644
--- a/gstreamer/src/caps.ccg
+++ b/gstreamer/src/caps.ccg
@@ -71,13 +71,30 @@ void Caps::append_structure(const Structure& structure)
gst_caps_append_structure(gobj(), copy);
}
-Glib::RefPtr<Caps> Caps::merge_structure(Structure& structure)
+void Caps::append_structure(const Structure& structure, const CapsFeatures& features)
{
- //We take a copy because gst_caps_append_structure() wants to take ownership:
+ //We take a copy because gst_caps_append_structure_full() wants to take ownership:
+ GstStructure* copy_structure = gst_structure_copy(structure.gobj());
+ GstCapsFeatures* copy_features = gst_caps_features_copy(features.gobj());
+ gst_caps_append_structure_full(gobj(), copy_structure, copy_features);
+}
+
+
+Glib::RefPtr<Caps> Caps::merge_structure(const Structure& structure)
+{
+ //We take a copy because gst_caps_merge_structure() wants to take ownership:
GstStructure* copy = gst_structure_copy(structure.gobj());
return Glib::wrap(gst_caps_merge_structure(gobj(), copy), true);
}
+Glib::RefPtr<Caps> Caps::merge_structure(const Structure& structure, const CapsFeatures& features)
+{
+ //We take a copy because gst_caps_merge_structure_full() wants to take ownership:
+ GstStructure* copy_structure = gst_structure_copy(structure.gobj());
+ GstCapsFeatures* copy_features = gst_caps_features_copy(features.gobj());
+ return Glib::wrap(gst_caps_merge_structure_full(gobj(), copy_structure, copy_features), true);
+}
+
//TODO: Want to return RefPtr to Caps but using RefPtr in expressions such
// as 'caps->set_simple(name1, value1)->set_simple(name2, value2)' a
// causes gstreamer Structure immutability warnings because the Caps is
@@ -127,5 +144,17 @@ void Caps::append(Glib::RefPtr<Gst::Caps>& caps)
gst_caps_append(gobj(), c_caps);
}
+CapsFeatures Caps::get_features(guint index) const
+{
+ GstCapsFeatures* features = gst_caps_get_features(gobj(), index);
+ return CapsFeatures(features, true);
+}
+
+void Caps::set_features(guint index, const CapsFeatures& features)
+{
+ GstCapsFeatures* copy = gst_caps_features_copy(features.gobj());
+ gst_caps_set_features(gobj(), index, copy);
+}
+
} //namespace Gst
diff --git a/gstreamer/src/caps.hg b/gstreamer/src/caps.hg
index 80477c3..5acdb5c 100644
--- a/gstreamer/src/caps.hg
+++ b/gstreamer/src/caps.hg
@@ -20,6 +20,7 @@
#include <gst/gst.h>
#include <gstreamermm/miniobject.h>
#include <gstreamermm/structure.h>
+#include <gstreamermm/capsfeatures.h>
_DEFS(gstreamermm,gst)
@@ -123,13 +124,30 @@ public:
void append_structure(const Structure& structure);
_IGNORE(gst_caps_append_structure)
+
+ /** Appends a structure to caps.
+ *
+ * @param structure The Gst::Structure to append.
+ * @param features The Gst::CapsFeatures to append.
+ */
+ void append_structure(const Structure& structure, const CapsFeatures& features);
+ _IGNORE(gst_caps_append_structure_full)
+
/** Appends a structure to caps if its not already expressed by caps.
*
* @param structure The Gst::Structure to merge.
*/
- Glib::RefPtr<Gst::Caps> merge_structure(Structure& structure);
+ Glib::RefPtr<Gst::Caps> merge_structure(const Structure& structure);
_IGNORE(gst_caps_merge_structure)
+ /** Appends a structure to caps if its not already expressed by caps.
+ *
+ * @param structure The Gst::Structure to merge.
+ * @param features The Gst::CapsFeatures to merge.
+ */
+ Glib::RefPtr<Gst::Caps> merge_structure(const Structure& structure, const CapsFeatures& features);
+ _IGNORE(gst_caps_merge_structure_full)
+
#m4 _CONVERSION(`GstStructure*', `const Structure', `Glib::wrap($3, true)')
/** Finds the structure in caps that has the index @a idx, and returns it.
*
@@ -227,6 +245,24 @@ public:
*/
Glib::RefPtr<Gst::Caps> create_writable();
_WRAP_METHOD(Glib::RefPtr<Gst::Caps> truncate(), gst_caps_truncate)
+
+ /**
+ * Finds the features in caps that has the index index , and returns it.
+ *
+ * @param index the index of the structure.
+ * @return The new Gst::CapsFeatures corresponding to index.
+ */
+ CapsFeatures get_features(guint index) const;
+ _IGNORE(gst_caps_get_features)
+
+ /**
+ * Sets the Gst::CapsFeatures for the structure at index.
+ *
+ * @param index The index of the structure.
+ * @param features The Gst::CapsFeatures to set.
+ */
+ void set_features(guint index, const CapsFeatures& features);
+ _IGNORE(gst_caps_set_features)
};
/******************************* Gst::Caps *******************************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]