[gstreamermm] Gst::Buffer: wrap new methods, polish code
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Gst::Buffer: wrap new methods, polish code
- Date: Wed, 26 Aug 2015 13:43:01 +0000 (UTC)
commit cb2fb4f1a81475bf7789891fbf864d88ceef1327
Author: Marcin Kolny <marcin kolny gmail com>
Date: Wed Aug 26 13:32:38 2015 +0000
Gst::Buffer: wrap new methods, polish code
* gstreamer/src/buffer.{ccg|hg}: wrap gst_buffer_{copy_deep|
is_all_memory_writable}(), remove unused includes.
* gstreamer/src/gst_extra_objects.def: add GstBuffer to extra-object
file.
gstreamer/src/buffer.ccg | 11 +-------
gstreamer/src/buffer.hg | 45 +++++++++++++++++----------------
gstreamer/src/gst_extra_objects.defs | 6 ++++
3 files changed, 30 insertions(+), 32 deletions(-)
---
diff --git a/gstreamer/src/buffer.ccg b/gstreamer/src/buffer.ccg
index 38f26a6..fcf3d13 100644
--- a/gstreamer/src/buffer.ccg
+++ b/gstreamer/src/buffer.ccg
@@ -1,6 +1,6 @@
/* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2015 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,19 +17,10 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <stdexcept>
-#include <gst/gst.h>
-
_PINCLUDE(gstreamermm/private/miniobject_p.h)
namespace Gst
{
-
-Glib::RefPtr<Gst::Buffer> Buffer::copy() const
-{
- return Glib::wrap(gst_buffer_copy(gobj()), false);
-}
-
Glib::RefPtr<Gst::Buffer> Buffer::create(guint size)
{
return Glib::wrap(gst_buffer_new_allocate(nullptr, size, nullptr));
diff --git a/gstreamer/src/buffer.hg b/gstreamer/src/buffer.hg
index 0da0c7e..abf94e4 100644
--- a/gstreamer/src/buffer.hg
+++ b/gstreamer/src/buffer.hg
@@ -1,6 +1,6 @@
/* gstreamermm - a C++ wrapper for gstreamer
*
- * Copyright 2008 The gstreamermm Development Team
+ * Copyright 2008-2015 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,11 +17,9 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <gst/gst.h>
#include <gstreamermm/miniobject.h>
#include <gstreamermm/clock.h>
#include <gstreamermm/memory.h>
-#include <gstreamermm/mapinfo.h>
_DEFS(gstreamermm,gst)
@@ -31,6 +29,8 @@ namespace Gst
_WRAP_ENUM(BufferFlags, GstBufferFlags)
_WRAP_ENUM(BufferCopyFlags, GstBufferCopyFlags)
+class Memory;
+
/**
* SECTION:gstbuffer
* @short_description: Data-passing buffer type
@@ -97,12 +97,9 @@ class Buffer : public MiniObject
_IGNORE(gst_buffer_ref, gst_buffer_unref)
public:
- /** Create a copy of the given buffer. This will also make a newly allocated
- * copy of the data the source buffer contains.
- * @return The Gst::Buffer copy.
- */
- Glib::RefPtr<Gst::Buffer> copy() const;
- _IGNORE(gst_buffer_copy)
+ _WRAP_METHOD(Glib::RefPtr<Gst::Buffer> copy() const, gst_buffer_copy)
+
+ _WRAP_METHOD(Glib::RefPtr<Gst::Buffer> copy_deep() const, gst_buffer_copy_deep)
_WRAP_METHOD(static void copy_into(const Glib::RefPtr<Gst::Buffer>& destination_buffer, const
Glib::RefPtr<Gst::Buffer>& source_buffer, BufferCopyFlags flags, gsize offset, gsize size),
gst_buffer_copy_into)
@@ -119,7 +116,7 @@ public:
_WRAP_METHOD(Glib::RefPtr<Gst::Memory> get_memory(guint idx) const, gst_buffer_get_memory)
- _WRAP_METHOD(gsize get_size () const, gst_buffer_get_size)
+ _WRAP_METHOD(gsize get_size() const, gst_buffer_get_size)
_WRAP_METHOD(gsize get_sizes(gsize& offset, gsize& max_size) const, gst_buffer_get_sizes)
@@ -141,12 +138,6 @@ public:
_WRAP_METHOD(gsize fill(gsize offset, gconstpointer src, gsize size), gst_buffer_fill)
- Glib::RefPtr<Gst::Buffer> append_region(Glib::RefPtr<Gst::Buffer>&& buf, gssize offset, gssize size);
- _IGNORE(gst_buffer_append_region)
-
- Glib::RefPtr<Gst::Buffer> append(Glib::RefPtr<Gst::Buffer>&& buf);
- _IGNORE(gst_buffer_append)
-
_WRAP_METHOD(void replace_memory_range(guint idx, gint length, Glib::RefPtr<Gst::Memory>&& mem),
gst_buffer_replace_memory_range)
_WRAP_METHOD(Glib::RefPtr<Gst::Memory> get_memory_range(guint idx, gint length),
gst_buffer_get_memory_range)
@@ -175,6 +166,22 @@ public:
_WRAP_METHOD(int memcmp(gsize offset, gconstpointer mem, gsize size), gst_buffer_memcmp)
+ _WRAP_METHOD(bool is_all_memory_writable() const, gst_buffer_is_all_memory_writable)
+
+ _WRAP_METHOD(bool is_memory_range_writable(guint idx, gint length) const,
gst_buffer_is_memory_range_writable)
+
+ _WRAP_METHOD(bool map(const Glib::RefPtr<Gst::MapInfo>& info, MapFlags flags), gst_buffer_map)
+
+ _WRAP_METHOD(bool map_range(guint idx, gint length, const Glib::RefPtr<Gst::MapInfo>& info, MapFlags
flags), gst_buffer_map_range)
+
+ _WRAP_METHOD(void unmap(const Glib::RefPtr<Gst::MapInfo>& info), gst_buffer_unmap)
+
+ Glib::RefPtr<Gst::Buffer> append_region(Glib::RefPtr<Gst::Buffer>&& buf, gssize offset, gssize size);
+ _IGNORE(gst_buffer_append_region)
+
+ Glib::RefPtr<Gst::Buffer> append(Glib::RefPtr<Gst::Buffer>&& buf);
+ _IGNORE(gst_buffer_append)
+
_MEMBER_GET(pts, pts, ClockTime, GstClockTime)
_MEMBER_SET(pts, pts, ClockTime, GstClockTime)
@@ -187,12 +194,6 @@ public:
*/
_MEMBER_GET(duration, duration, ClockTime, GstClockTime)
_MEMBER_SET(duration, duration, ClockTime, GstClockTime)
-
- _WRAP_METHOD(bool map(const Glib::RefPtr<Gst::MapInfo>& info, MapFlags flags), gst_buffer_map)
-
- _WRAP_METHOD(bool map_range(guint idx, gint length, const Glib::RefPtr<Gst::MapInfo>& info, MapFlags
flags), gst_buffer_map_range)
-
- _WRAP_METHOD(void unmap(const Glib::RefPtr<Gst::MapInfo>& info), gst_buffer_unmap)
/** Get the offset of this buffer.
* @return The offset in the source file of the beginning of this buffer.
*/
diff --git a/gstreamer/src/gst_extra_objects.defs b/gstreamer/src/gst_extra_objects.defs
index 3d62e97..8a32fec 100644
--- a/gstreamer/src/gst_extra_objects.defs
+++ b/gstreamer/src/gst_extra_objects.defs
@@ -6,6 +6,12 @@
; that are mentioned in documentation text.
; (DocsParser.pm:substitute_function(), which uses GtkDefs.pm:lookup_object().)
+(define-object Buffer
+ (in-module "Gst")
+ (c-name "GstBuffer")
+ (gtype-id "GST_TYPE_BUFFER")
+)
+
(define-object BufferList
(in-module "Gst")
(c-name "GstBufferList")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]