[gstreamermm: 144/167] implemented Mr Cumming's advices - part 2



commit 4d4e9290dd8cdb1e28767940f3dc24d68c35df23
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Tue Aug 6 16:01:40 2013 +0200

    implemented Mr Cumming's advices - part 2

 gstreamer/src/buffer.hg  |    5 ++---
 gstreamer/src/sample.ccg |    8 +++++++-
 gstreamer/src/sample.hg  |    4 +++-
 tools/m4/convert_gst.m4  |    3 +++
 4 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/gstreamer/src/buffer.hg b/gstreamer/src/buffer.hg
index c5cc22f..101079c 100644
--- a/gstreamer/src/buffer.hg
+++ b/gstreamer/src/buffer.hg
@@ -88,10 +88,9 @@ public:
    */
   _MEMBER_GET(duration, duration, ClockTime, GstClockTime)
 
-#m4 _CONVERSION(`Glib::RefPtr<Gst::MapInfo>', `GstMapInfo*', `$3->gobj()')
-  _WRAP_METHOD(bool map(Glib::RefPtr<Gst::MapInfo> info, MapFlags flags), gst_buffer_map);
+  _WRAP_METHOD(bool map(const Glib::RefPtr<Gst::MapInfo>& info, MapFlags flags), gst_buffer_map);
 
-  _WRAP_METHOD(void unmap(Glib::RefPtr<Gst::MapInfo> info), gst_buffer_unmap);
+  _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/sample.ccg b/gstreamer/src/sample.ccg
index d9a37a7..7452c44 100644
--- a/gstreamer/src/sample.ccg
+++ b/gstreamer/src/sample.ccg
@@ -31,6 +31,12 @@ namespace Gst
 {
 Glib::RefPtr<Gst::Buffer> Sample::get_buffer()
 {
-    return Glib::wrap(gst_sample_get_buffer(gobj()), true);
+  return Glib::wrap(gst_sample_get_buffer(gobj()), true);
 }
+
+Glib::RefPtr<const Gst::Buffer> Sample::get_buffer() const
+{
+    return const_cast<Sample*>(this)->get_buffer();
+}
+
 }
diff --git a/gstreamer/src/sample.hg b/gstreamer/src/sample.hg
index 6d6b2e7..116cf34 100644
--- a/gstreamer/src/sample.hg
+++ b/gstreamer/src/sample.hg
@@ -36,7 +36,7 @@ _DEFS(gstreamermm,gst)
 namespace Gst
 {
 
-/*
+/**
  * A Gst::Sample is a small object containing data, a type, timing and
  * extra arbitrary information.
  */
@@ -49,8 +49,10 @@ class Sample : public MiniObject
           Glib::RefPtr<const Gst::Segment> segment, Glib::RefPtr<Gst::Structure> info);
 
 public:
+  Glib::RefPtr<const Gst::Buffer> get_buffer() const;
   Glib::RefPtr<Gst::Buffer> get_buffer();
   _WRAP_METHOD(Glib::RefPtr<Gst::Caps> get_caps(), gst_sample_get_caps)
+  _WRAP_METHOD(Glib::RefPtr<const Gst::Caps> get_caps() const, gst_sample_get_caps, constversion)
 
 };
 
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 36cf0ae..a6a83e4 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -137,6 +137,9 @@ _CONVERSION(`GstIterator*',`Gst::Iterator<Gst::Pad>',`Gst::Iterator<Gst::Pad>($3
 _CONVERSION(`GstIterator*',`Gst::Iterator<const Gst::Pad>',`Gst::Iterator<const Gst::Pad>($3)')
 _CONVERSION(`GstIterator*',`Gst::IteratorBasic<const Gst::QueryTypeDefinition>',`Gst::IteratorBasic<const 
Gst::QueryTypeDefinition>($3)')
 
+dnl MapInfo
+_CONVERSION(`const Glib::RefPtr<Gst::MapInfo>&', `GstMapInfo*', `$3->gobj()')
+
 dnl Memory
 _CONVERSION(`GstMemory*',`Glib::RefPtr<Gst::Memory>',`Glib::wrap($3)')
 _CONVERSION(`Glib::RefPtr<Gst::Memory>&',`GstMemory*', `Glib::unwrap($3)')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]