[gstreamermm] Gst::Caps: review Caps class.
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Gst::Caps: review Caps class.
- Date: Sat, 21 May 2016 15:09:46 +0000 (UTC)
commit 42fd1e17e0abee92cc80572775711b225f97d532
Author: Marcin Kolny <marcin kolny gmail com>
Date: Mon May 16 19:22:07 2016 +0200
Gst::Caps: review Caps class.
* gstreamer/src/audioringbuffer.hg: build fix.
* gstreamer/src/caps.{ccg|hg}:
* gstreamer/src/structure.{ccg|hg}: add release() method.
* tools/m4/convert_gst.m4: minors.
gstreamer/src/audioringbuffer.hg | 1 +
gstreamer/src/caps.ccg | 4 ++--
gstreamer/src/caps.hg | 17 +++++++++++------
gstreamer/src/structure.ccg | 7 +++++++
gstreamer/src/structure.hg | 11 +++++++++++
tools/m4/convert_gst.m4 | 3 +++
6 files changed, 35 insertions(+), 8 deletions(-)
---
diff --git a/gstreamer/src/audioringbuffer.hg b/gstreamer/src/audioringbuffer.hg
index af294cb..a278dbd 100644
--- a/gstreamer/src/audioringbuffer.hg
+++ b/gstreamer/src/audioringbuffer.hg
@@ -22,6 +22,7 @@
#include <gstreamermm/caps.h>
#include <gstreamermm/object.h>
#include <gstreamermm/format.h>
+#include <gstreamermm/clock.h>
#include <glibmm/arrayhandle.h>
#include <memory>
diff --git a/gstreamer/src/caps.ccg b/gstreamer/src/caps.ccg
index 1c9f2aa..93acf7e 100644
--- a/gstreamer/src/caps.ccg
+++ b/gstreamer/src/caps.ccg
@@ -1,6 +1,6 @@
/* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2016 The gstreamermm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,8 +17,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <gst/gst.h>
#include <gstreamermm/structure.h>
+#include <gstreamermm/capsfeatures.h>
namespace Gst
{
diff --git a/gstreamer/src/caps.hg b/gstreamer/src/caps.hg
index 593232b..a08ef43 100644
--- a/gstreamer/src/caps.hg
+++ b/gstreamer/src/caps.hg
@@ -1,6 +1,6 @@
/* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2016 The gstreamermm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,18 +17,20 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <gst/gst.h>
#include <gstreamermm/miniobject.h>
-#include <gstreamermm/structure.h>
-#include <gstreamermm/capsfeatures.h>
_DEFS(gstreamermm,gst)
+
namespace Gst
{
-
_WRAP_ENUM(CapsIntersectMode, GstCapsIntersectMode, NO_GTYPE)
+_WRAP_ENUM(CapsFlags, GstCapsFlags)
+
+class Structure;
+class CapsFeatures;
+
/** Structure describing sets of media formats.
* Caps (capabilities) are lightweight refcounted objects describing media types.
*
@@ -63,6 +65,9 @@ _WRAP_ENUM(CapsIntersectMode, GstCapsIntersectMode, NO_GTYPE)
* support one level of nesting. Using more levels will lead to unexpected
* behavior when using serialization features, such as Gst::Caps::to_string() or
* gst_value_serialize() and their counterparts.
+ *
+ * Last reviewed on 2016-05-16 (1.8.0)
+ *
*/
class Caps : public MiniObject
{
@@ -110,8 +115,8 @@ public:
* @param structure The Gst::Structure to append.
*/
void append_structure(const Structure& structure);
- _IGNORE(gst_caps_append_structure)
+ _WRAP_METHOD(void append_structure(Gst::Structure&& structure), gst_caps_append_structure)
/** Appends a structure to caps.
*
diff --git a/gstreamer/src/structure.ccg b/gstreamer/src/structure.ccg
index e7f6c52..5adf2c3 100644
--- a/gstreamer/src/structure.ccg
+++ b/gstreamer/src/structure.ccg
@@ -84,6 +84,13 @@ Structure::operator const void*() const
return gobject_ ? GINT_TO_POINTER(1) : nullptr;
}
+GstStructure* Structure::release() noexcept
+{
+ GstStructure *tmp = gobj();
+ gobject_ = nullptr;
+ return tmp;
+}
+
void Structure::get_field(const Glib::ustring& name, Glib::ValueBase& value) const
{
value.init(gst_structure_get_value(gobj(), name.c_str()));
diff --git a/gstreamer/src/structure.hg b/gstreamer/src/structure.hg
index 642dd86..8c7fc5e 100644
--- a/gstreamer/src/structure.hg
+++ b/gstreamer/src/structure.hg
@@ -86,6 +86,17 @@ public:
*/
operator const void*() const;
+ /** Release the ownership of underlying GstStructure instance.
+ *
+ * Gst::Structure's underlying instance is set to nullptr, therefore underlying
+ * object can't be accessed through this Gst::Structure anymore.
+ * @return an underlying instance of GstStructure object.
+ *
+ * Most users should not use release(). It can spoil the automatic destruction
+ * of the managed object.
+ */
+ GstStructure* release() noexcept;
+
_WRAP_METHOD(Glib::ustring get_name() const, gst_structure_get_name)
_WRAP_METHOD(bool has_name(const Glib::ustring& name) const, gst_structure_has_name)
_WRAP_METHOD(void set_name(const Glib::ustring& name), gst_structure_set_name)
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index d9f1449..d2c51c0 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -14,6 +14,7 @@ _CONV_ENUM(Gst,AudioFormat)
_CONV_ENUM(Gst,AudioFormatFlags)
_CONV_ENUM(Gst,AudioRingBufferFormatType)
_CONV_ENUM(Gst,BaseSrcFlags)
+_CONV_ENUM(Gst,CapsFlags)
_CONV_ENUM(Gst,CapsIntersectMode)
_CONV_ENUM(Gst,ClockEntryType)
_CONV_ENUM(Gst,ClockReturn)
@@ -299,6 +300,8 @@ _CONVERSION(`GstStructure*', `Gst::Structure', `Glib::wrap($3)')
_CONVERSION(`const Gst::Structure&',`const GstStructure*',`$3.gobj()')
_CONVERSION(`const GstStructure*',`Gst::Structure', `Glib::wrap($3, false)')
_CONVERSION(`const GstStructure*',`const Gst::Structure&', `Glib::wrap(const_cast<GstStructure*>($3),
false)')
+_CONVERSION(`Gst::Structure&&',`GstStructure*',`($3) ? $3.release() : nullptr')
+
dnl TagList
_CONVERSION(`const Gst::TagList&',`const GstTagList*',`$3.gobj()')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]