[gstreamermm] RingBufferSpec: Use _MEMBER_[GET|SET] macros for accessing members.
- From: José Alburquerque <jaalburqu src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gstreamermm] RingBufferSpec: Use _MEMBER_[GET|SET] macros for accessing members.
- Date: Wed, 23 Dec 2009 00:36:07 +0000 (UTC)
commit 0bec6ff86b17109a1695d9197f7daa47cce60cf0
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Tue Dec 22 19:28:57 2009 -0500
RingBufferSpec: Use _MEMBER_[GET|SET] macros for accessing members.
* gstreamer/src/ringbuffer.ccg:
* gstreamer/src/ringbuffer.hg (RingBufferSpec): Use _MEMBER_[GET|SET]
macros for setting and getting members where possible instead of
handwriting the methods. This works because RingBufferSpec implements
gobj() methods.
* tools/m4/convert_gst.m4: Added GstBufferFormat and
GstBufferFormatType enum conversions.
ChangeLog | 12 +++
gstreamer/src/ringbuffer.ccg | 168 ------------------------------------------
gstreamer/src/ringbuffer.hg | 67 +++++++++--------
tools/m4/convert_gst.m4 | 3 +
4 files changed, 51 insertions(+), 199 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 98eda47..ab98d53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2009-12-22 José Alburquerque <jaalburqu svn gnome org>
+ RingBufferSpec: Use _MEMBER_[GET|SET] macros for accessing members.
+
+ * gstreamer/src/ringbuffer.ccg:
+ * gstreamer/src/ringbuffer.hg (RingBufferSpec): Use _MEMBER_[GET|SET]
+ macros for setting and getting members where possible instead of
+ handwriting the methods. This works because RingBufferSpec implements
+ gobj() methods.
+ * tools/m4/convert_gst.m4: Added GstBufferFormat and
+ GstBufferFormatType enum conversions.
+
+2009-12-22 José Alburquerque <jaalburqu svn gnome org>
+
Pad: Make constructors handle errors as in GhostPad.
* gstreamer/src/pad.ccg (Pad): Corrected casting in _CONSTRUCT macros
diff --git a/gstreamer/src/ringbuffer.ccg b/gstreamer/src/ringbuffer.ccg
index 97df2d4..7e1aac1 100644
--- a/gstreamer/src/ringbuffer.ccg
+++ b/gstreamer/src/ringbuffer.ccg
@@ -21,10 +21,6 @@
#include <gstreamermm/handle_error.h>
_PINCLUDE(gstreamermm/private/object_p.h)
-// This constant is obtained from the "silence_sample" member in the
-// GstRingBufferSpec structure definition.
-#define GSTREAMERMM_RING_BUFFER_SPEC_SILENCE_SAMPLE 32
-
namespace
{
@@ -193,170 +189,6 @@ const GstRingBufferSpec* RingBufferSpec::gobj() const
return m_spec;
}
-Glib::RefPtr<Gst::Caps> RingBufferSpec::qet_caps()
-{
- return Glib::wrap(m_spec->caps);
-}
-
-void RingBufferSpec::set_caps(const Glib::RefPtr<Gst::Caps>& caps)
-{
- // Unrefence possible previous caps.
- if(m_spec->caps)
- gst_caps_unref(m_spec->caps);
-
- m_spec->caps = Glib::unwrap(caps);
-
- // Keep a copy of the new caps (it will be unreferenced in the destructor).
- if(m_spec->caps)
- gst_caps_ref(m_spec->caps);
-}
-
-Gst::BufferFormatType RingBufferSpec::qet_type()
-{
- return static_cast<Gst::BufferFormatType>(m_spec->type);
-}
-
-void RingBufferSpec::set_type(Gst::BufferFormatType type)
-{
- m_spec->type = static_cast<GstBufferFormatType>(type);
-}
-
-Gst::BufferFormat RingBufferSpec::qet_format()
-{
- return static_cast<Gst::BufferFormat>(m_spec->format);
-}
-
-void RingBufferSpec::set_format(Gst::BufferFormat format)
-{
- m_spec->format = static_cast<GstBufferFormat>(format);
-}
-
-bool RingBufferSpec::qet_sign()
-{
- return static_cast<bool>(m_spec->sign);
-}
-
-void RingBufferSpec::set_sign(bool sign)
-{
- m_spec->sign = static_cast<gboolean>(sign);
-}
-
-bool RingBufferSpec::qet_bigend()
-{
- return static_cast<bool>(m_spec->bigend);
-}
-
-void RingBufferSpec::set_bigend(bool bigend)
-{
- m_spec->sign = static_cast<gboolean>(bigend);
-}
-
-int RingBufferSpec::qet_width()
-{
- return m_spec->width;
-}
-
-void RingBufferSpec::set_width(int width)
-{
- m_spec->width = width;
-}
-
-int RingBufferSpec::qet_depth()
-{
- return m_spec->depth;
-}
-
-void RingBufferSpec::set_depth(int depth)
-{
- m_spec->depth = depth;
-}
-
-int RingBufferSpec::qet_rate()
-{
- return m_spec->rate;
-}
-
-void RingBufferSpec::set_rate(int rate)
-{
- m_spec->rate = rate;
-}
-
-int RingBufferSpec::qet_channels()
-{
- return m_spec->channels;
-}
-
-void RingBufferSpec::set_channels(int channels)
-{
- m_spec->channels = channels;
-}
-
-guint64 RingBufferSpec::qet_latency_time()
-{
- return m_spec->latency_time;
-}
-
-void RingBufferSpec::set_latency_time(guint64 latency_time)
-{
- m_spec->latency_time = latency_time;
-}
-
-guint64 RingBufferSpec::qet_buffer_time()
-{
- return m_spec->buffer_time;
-}
-
-void RingBufferSpec::set_buffer_time(guint64 buffer_time)
-{
- m_spec->buffer_time = buffer_time;
-}
-
-int RingBufferSpec::qet_segsize()
-{
- return m_spec->segsize;
-}
-
-void RingBufferSpec::set_segsize(int segsize)
-{
- m_spec->segsize = segsize;
-}
-
-int RingBufferSpec::qet_segtotal()
-{
- return m_spec->segtotal;
-}
-
-void RingBufferSpec::set_segtotal(int segtotal)
-{
- m_spec->segtotal = segtotal;
-}
-
-int RingBufferSpec::qet_seglatency()
-{
- return m_spec->seglatency;
-}
-
-void RingBufferSpec::set_seglatency(int seglatency)
-{
- m_spec->seglatency = seglatency;
-}
-
-int RingBufferSpec::qet_bytes_per_sample()
-{
- return m_spec->bytes_per_sample;
-}
-
-void RingBufferSpec::set_bytes_per_sample(int bytes_per_sample)
-{
- m_spec->bytes_per_sample = bytes_per_sample;
-}
-
-Glib::ArrayHandle<guint8> RingBufferSpec::get_silence_sample()
-{
- return Glib::ArrayHandle<guint8>(m_spec->silence_sample,
- GSTREAMERMM_RING_BUFFER_SPEC_SILENCE_SAMPLE, Glib::OWNERSHIP_NONE);
-}
-
void RingBufferSpec::set_silence_sample(const Glib::ArrayHandle<guint8>& silence_sample)
{
std::copy(silence_sample.data(),
diff --git a/gstreamer/src/ringbuffer.hg b/gstreamer/src/ringbuffer.hg
index b4c47cb..8ee69d8 100644
--- a/gstreamer/src/ringbuffer.hg
+++ b/gstreamer/src/ringbuffer.hg
@@ -106,131 +106,136 @@ public:
const GstRingBufferSpec* gobj() const;
/** Get the caps of the buffer (in). */
- Glib::RefPtr<Gst::Caps> qet_caps();
+ _MEMBER_GET_GOBJECT(caps, caps, Gst::Caps, GstCaps*)
/** Set the caps of the buffer (in). */
- void set_caps(const Glib::RefPtr<Gst::Caps>& caps);
+ _MEMBER_SET_GOBJECT(caps, caps, Gst::Caps, GstCaps*)
/** Get the sample type (in/out).
*/
- Gst::BufferFormatType qet_type();
+ _MEMBER_GET(type, type, Gst::BufferFormatType, GstBufferFormatType)
/** Set the sample type (in/out).
*/
- void set_type(Gst::BufferFormatType type);
+ _MEMBER_SET(type, type, Gst::BufferFormatType, GstBufferFormatType)
/** Get the sample format (in/out).
*/
- Gst::BufferFormat qet_format();
+ _MEMBER_GET(format, format, Gst::BufferFormat, GstBufferFormat)
/** Set the sample format (in/out).
*/
- void set_format(Gst::BufferFormat format);
+ _MEMBER_SET(format, format, Gst::BufferFormat, GstBufferFormat)
/** Get the sample sign (in/out).
*/
- bool qet_sign();
+ _MEMBER_GET(sign, sign, bool, gboolean)
/** Set the sample sign (in/out).
*/
- void set_sign(bool sign);
+ _MEMBER_SET(sign, sign, bool, gboolean)
/** Get the endianness of the samples (in/out).
*/
- bool qet_bigend();
+ _MEMBER_GET(bigend, bigend, bool, gboolean)
/** Set the endianness of the samples (in/out).
*/
- void set_bigend(bool bigend);
+ _MEMBER_SET(bigend, bigend, bool, gboolean)
/** Get the width of the samples (in/out).
*/
- int qet_width();
+ _MEMBER_GET(width, width, int, gint)
/** Set the width of the samples (in/out).
*/
- void set_width(int width);
+ _MEMBER_SET(width, width, int, gint)
/** Get the depth of the samples (in/out).
*/
- int qet_depth();
+ _MEMBER_GET(depth, depth, int, gint)
/** Set the depth of the samples (in/out).
*/
- void set_depth(int depth);
+ _MEMBER_SET(depth, depth, int, gint)
/** Get the samplerate (in/out).
*/
- int qet_rate();
+ _MEMBER_GET(rate, rate, int, gint)
/** Set the samplerate (in/out).
*/
- void set_rate(int rate);
+ _MEMBER_SET(rate, rate, int, gint)
/** Get the number of channels (in/out).
*/
- int qet_channels();
+ _MEMBER_GET(channels, channels, int, gint)
/** Set the number of channels (in/out).
*/
- void set_channels(int channels);
+ _MEMBER_SET(channels, channels, int, gint)
/** Get the latency in microseconds (in/out).
*/
- guint64 qet_latency_time();
+ _MEMBER_GET(latency_time, latency_time, guint64, guint64)
/** Set the latency in microseconds (in/out).
*/
- void set_latency_time(guint64 latency_time);
+ _MEMBER_SET(latency_time, latency_time, guint64, guint64)
/** Get the total buffer size in microseconds (in/out).
*/
- guint64 qet_buffer_time();
+ _MEMBER_GET(buffer_time, buffer_time, guint64, guint64)
/** Set the total buffer size in microseconds (in/out).
*/
- void set_buffer_time(guint64 buffer_time);
+ _MEMBER_SET(buffer_time, buffer_time, guint64, guint64)
/** Get the size of one segment in bytes (in/out).
*/
- int qet_segsize();
+ _MEMBER_GET(segsize, segsize, int, gint)
/** Set the size of one segment in bytes (in/out).
*/
- void set_segsize(int segsize);
+ _MEMBER_SET(segsize, segsize, int, gint)
/** Get the total number of segments (in/out).
*/
- int qet_segtotal();
+ _MEMBER_GET(segtotal, segtotal, int, gint)
/** Set the total number of segments (in/out).
*/
- void set_segtotal(int segtotal);
+ _MEMBER_SET(segtotal, segtotal, int, gint)
/** Get the number of segments queued in the lower level device, defaults to
* segtotal (in/out).
*/
- int qet_seglatency();
+ _MEMBER_GET(seglatency, seglatency, int, gint)
/** Set the number of segments queued in the lower level device, defaults to
* segtotal (in/out).
*/
- void set_seglatency(int seglatency);
+ _MEMBER_SET(seglatency, seglatency, int, gint)
/** Get the number of bytes of one sample (out). This is set by the call to
* Gst::RingBuffer::acquire().
*/
- int qet_bytes_per_sample();
+ _MEMBER_GET(bytes_per_sample, bytes_per_sample, int, gint)
/** Set the number of bytes of one sample (out). This is set by the call to
* Gst::RingBuffer::acquire() and should probably not be set.
*/
- void set_bytes_per_sample(int bytes_per_sample);
+ _MEMBER_SET(bytes_per_sample, bytes_per_sample, int, gint)
+// This constant is obtained from the "silence_sample" member in the
+// GstRingBufferSpec structure definition.
+#define GSTREAMERMM_RING_BUFFER_SPEC_SILENCE_SAMPLE 32
+
+#m4 _CONVERSION(`guint8*', `Glib::ArrayHandle<guint8>', `Glib::ArrayHandle<guint8>($3, GSTREAMERMM_RING_BUFFER_SPEC_SILENCE_SAMPLE, Glib::OWNERSHIP_NONE)')
/** Get the bytes representing one sample of silence (out). This is set by
* the call to Gst::RingBuffer::acquire().
*/
- Glib::ArrayHandle<guint8> get_silence_sample();
+ _MEMBER_GET(silence_sample, silence_sample, Glib::ArrayHandle<guint8>, guint8*)
/** Sets the bytes representing one sample of silence (out). This is set by
* the call to Gst::RingBuffer::acquire() and probably should not be set.
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index f7f4d53..d949bcb 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -7,6 +7,8 @@ _CONV_ENUM(Gst,BaseAudioSinkSlaveMethod)
_CONV_ENUM(Gst,BaseAudioSrcSlaveMethod)
_CONV_ENUM(Gst,BufferCopyFlags)
_CONV_ENUM(Gst,BufferFlag)
+_CONV_ENUM(Gst,BufferFormat)
+_CONV_ENUM(Gst,BufferFormatType)
_CONV_ENUM(Gst,ClockEntryType)
_CONV_ENUM(Gst,ClockReturn)
_CONV_ENUM(Gst,ClockTime)
@@ -58,6 +60,7 @@ _CONVERSION(`GstBus*',`Glib::RefPtr<Gst::Bus>',`Glib::wrap($3)')
dnl Caps
_CONVERSION(`GstCaps*',`Glib::RefPtr<Gst::Caps>',`Glib::wrap($3)')
+_CONVERSION(`GstCaps*',`Glib::RefPtr<const Gst::Caps>',`Glib::wrap($3)')
_CONVERSION(`Glib::RefPtr<Gst::Caps>',`GstCaps*',`Glib::unwrap($3)')
_CONVERSION(`const Glib::RefPtr<Gst::Caps>&',`GstCaps*', `Glib::unwrap($3)')
_CONVERSION(`const Glib::RefPtr<const Gst::Caps>&',`GstCaps*', `const_cast<$2>(Glib::unwrap($3))')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]