[gstreamermm] Gst::Allocator: minor improvements
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] Gst::Allocator: minor improvements
- Date: Sat, 23 Apr 2016 18:26:24 +0000 (UTC)
commit 7ea1811b4fa0663ac9ea69bbfe013627dcae3734
Author: Marcin Kolny <marcin kolny gmail com>
Date: Fri Apr 22 10:59:28 2016 +0200
Gst::Allocator: minor improvements
* gstreamer/src/allocator.hg: slightly change API.
* tests/test-allocator.cc: update tests.
* tools/m4/convert_gst.m4: update conversion definitions.
gstreamer/src/allocator.hg | 8 ++++++--
tests/test-allocator.cc | 2 +-
tools/m4/convert_gst.m4 | 6 +++---
3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gstreamer/src/allocator.hg b/gstreamer/src/allocator.hg
index 69b9d6f..c9fce30 100644
--- a/gstreamer/src/allocator.hg
+++ b/gstreamer/src/allocator.hg
@@ -15,6 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Last reviewed on 2016-04-22 (1.8.0)
*/
#include <gstreamermm/memory.h>
@@ -26,6 +28,8 @@ namespace Gst
class Object;
+/** Parameters to control the allocation of memory.
+ */
class AllocationParams
{
_CLASS_BOXEDTYPE(AllocationParams, GstAllocationParams, NONE, gst_allocation_params_copy,
gst_allocation_params_free)
@@ -70,7 +74,7 @@ public:
_WRAP_METHOD(static Glib::RefPtr<Gst::Allocator> find(const Glib::ustring& name), gst_allocator_find)
_WRAP_METHOD(static void register_allocator(const Glib::ustring& name, Glib::RefPtr<Gst::Allocator>&&
allocator), gst_allocator_register)
_WRAP_METHOD(void free(Glib::RefPtr<Gst::Memory>&& memory), gst_allocator_free)
- _WRAP_METHOD(Glib::RefPtr<Gst::Memory> alloc(gsize size, Gst::AllocationParams params),
gst_allocator_alloc)
+ _WRAP_METHOD(Glib::RefPtr<Gst::Memory> alloc(gsize size, const Gst::AllocationParams& params{?}),
gst_allocator_alloc)
_WRAP_METHOD_DOCS_ONLY(gst_allocator_set_default)
void set_default();
@@ -82,7 +86,7 @@ public:
*/
static Glib::RefPtr<Gst::Allocator> get_default_allocator();
- _WRAP_VFUNC(Glib::RefPtr<Gst::Memory> alloc(gsize size, Gst::AllocationParams params), "alloc",
refreturn_ctype)
+ _WRAP_VFUNC(Glib::RefPtr<Gst::Memory> alloc(gsize size, const Gst::AllocationParams& params), "alloc",
refreturn_ctype)
// This vfunc is hand-coded because it takes reference to a memory.
// In generally, arguments are passed to a function by copy, so
diff --git a/tests/test-allocator.cc b/tests/test-allocator.cc
index e21adcc..ca21356 100644
--- a/tests/test-allocator.cc
+++ b/tests/test-allocator.cc
@@ -55,7 +55,7 @@ public:
{
}
- virtual Glib::RefPtr<Gst::Memory> alloc_vfunc(gsize size, AllocationParams params)
+ Glib::RefPtr<Gst::Memory> alloc_vfunc(gsize size, const AllocationParams& params) override
{
Glib::RefPtr<Gst::Memory> r = the_allocator->alloc(size, params);
r->gobj()->allocator = gobj(); // pretend that it was us who allocated this memory
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index d66798c..73038c1 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -80,11 +80,11 @@ _CONV_GLIB_ENUM(ThreadPriority)
dnl ############### gstreamermm Class Conversions ######################
dnl AllocationParams
-_CONVERSION(`Gst::AllocationParams', `GstAllocationParams*', `$3.gobj()')
-_CONVERSION(`GstAllocationParams*', `Gst::AllocationParams', `Gst::AllocationParams($3, true)')
+_CONVERSION(`const Gst::AllocationParams&', `GstAllocationParams*',
`const_cast<GstAllocationParams*>($3.gobj())')
+_CONVERSION(`GstAllocationParams*', `const Gst::AllocationParams&', `Gst::AllocationParams($3, true)')
dnl Allocator
-_CONVERSION(`const Glib::RefPtr<Gst::Allocator>&',`GstAllocator*', `Glib::unwrap($3)')
+_CONVERSION(`const Glib::RefPtr<Gst::Allocator>&',`GstAllocator*',
`const_cast<GstAllocator*>(Glib::unwrap($3))')
_CONVERSION(`Glib::RefPtr<Gst::Allocator>&&',`GstAllocator*',`($3) ? $3.release()->gobj() : nullptr');
_CONVERSION(`GstAllocator*', `Glib::RefPtr<Gst::Allocator>', `Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]