[gstreamermm: 6/167] fixed audiofilter class



commit be17c253cb3b51642452b8b06356605c5915a7dd
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Wed Jul 24 10:10:08 2013 +0200

    fixed audiofilter class

 gstreamer/src/audiofilter.ccg |    2 +-
 gstreamer/src/audiofilter.hg  |    3 +-
 gstreamer/src/audioformat.ccg |   38 ++++++++++++++++++++++++++
 gstreamer/src/audioformat.hg  |   35 ++++++++++++++++++++++--
 gstreamer/src/audioinfo.hg    |   58 +++++++++++++++++++++++++++++++++++++++++
 gstreamer/src/filelist.am     |    1 +
 tools/m4/convert_gst.m4       |    2 +
 7 files changed, 134 insertions(+), 5 deletions(-)
---
diff --git a/gstreamer/src/audiofilter.ccg b/gstreamer/src/audiofilter.ccg
index bbc1f20..ee02734 100644
--- a/gstreamer/src/audiofilter.ccg
+++ b/gstreamer/src/audiofilter.ccg
@@ -24,7 +24,7 @@ _PINCLUDE(gstreamermm/private/basetransform_p.h)
 namespace Gst
 {
 
-gboolean AudioFilter_Class::setup_vfunc_callback(GstAudioFilter* self, GstAudioInfo* info)
+gboolean AudioFilter_Class::setup_vfunc_callback(GstAudioFilter* self, const GstAudioInfo* info)
 {
   Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
diff --git a/gstreamer/src/audiofilter.hg b/gstreamer/src/audiofilter.hg
index 36e5314..303abc3 100644
--- a/gstreamer/src/audiofilter.hg
+++ b/gstreamer/src/audiofilter.hg
@@ -19,6 +19,7 @@
 
 #include <gstreamermm/basetransform.h>
 #include <gstreamermm/audioringbuffer.h>
+#include <gstreamermm/audioinfo.h>
 
 _DEFS(gstreamermm,gst)
 
@@ -55,7 +56,7 @@ protected:
   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
   klass->setup = &setup_vfunc_callback;
   _SECTION(SECTION_PH_VFUNCS)
-  static gboolean setup_vfunc_callback(GstAudioFilter* self, GstAudioInfo* info);
+  static gboolean setup_vfunc_callback(GstAudioFilter* self, const GstAudioInfo* info);
   _POP()
 #m4end
 };
diff --git a/gstreamer/src/audioformat.ccg b/gstreamer/src/audioformat.ccg
index e69de29..1d6f9ef 100644
--- a/gstreamer/src/audioformat.ccg
+++ b/gstreamer/src/audioformat.ccg
@@ -0,0 +1,38 @@
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008-2009 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.
+ */
+
+#include <gstreamermm/handle_error.h>
+
+namespace Gst
+{
+
+AudioFormatInfo::AudioFormatInfo()
+: m_info(g_try_new(GstAudioFormatInfo, 1)),
+  take_ownership(true)
+{
+  // Handle possible memory allocation failure.
+  if(!m_info)
+  {
+    gstreamermm_handle_error(
+      "Failed to allocate a new Gst::AudioFormatInfo.");
+    return;
+  }
+}
+
+}
diff --git a/gstreamer/src/audioformat.hg b/gstreamer/src/audioformat.hg
index d5ccead..2d657af 100644
--- a/gstreamer/src/audioformat.hg
+++ b/gstreamer/src/audioformat.hg
@@ -17,6 +17,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <gst/audio/audio-format.h>
+
 _DEFS(gstreamermm,gst)
 
 namespace Gst
@@ -38,10 +40,9 @@ public:
   AudioFormatInfo();
 
   AudioFormatInfo(Gst::AudioFormat format = Gst::AUDIO_FORMAT_UNKNOWN,
-    const gchar* name = NULL, const gchar* description = NULL,
+    std::string name = "", std::string description = "",
     Gst::AudioFormatFlags flags = Gst::AUDIO_FORMAT_FLAG_INTEGER,
-    gint endianness = 0, gint width = 0, gint depth = 0,
-    guint8 silence[8] = {0});
+    gint endianness = 0, gint width = 0, gint depth = 0);
 
   explicit AudioFormatInfo(GstAudioFormatInfo& castitem,
     bool take_ownership = false);
@@ -51,5 +52,33 @@ public:
   AudioFormatInfo& operator=(const AudioFormatInfo& other);
 
   virtual ~AudioFormatInfo();
+
+  /// Gets the underlying gobject.
+  GstAudioFormatInfo* gobj() { return m_info; };
+
+  /// Gets the underlying gobject.
+  const GstAudioFormatInfo* gobj() const { return m_info; };
+
+  _MEMBER_GET(format, format, AudioFormat, GstAudioFormat)
+
+  _MEMBER_SET(format, format, AudioFormat, GstAudioFormat)
+
+  _MEMBER_GET(name, name, std::string, const char*)
+
+  _MEMBER_SET(name, name, std::string, const char*)
+
+  _MEMBER_GET(description, description, std::string, const char*)
+
+  _MEMBER_SET(description, description, std::string, const char*)
+
+  _MEMBER_GET(flags, flags, AudioFormatFlags, GstAudioFormatFlags)
+
+  _MEMBER_SET(flags, flags, AudioFormatFlags, GstAudioFormatFlags)
+
+protected:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+  GstAudioFormatInfo* m_info;
+  bool take_ownership;
+#endif
 };
 } //namespace Gst
diff --git a/gstreamer/src/audioinfo.ccg b/gstreamer/src/audioinfo.ccg
new file mode 100644
index 0000000..e69de29
diff --git a/gstreamer/src/audioinfo.hg b/gstreamer/src/audioinfo.hg
new file mode 100644
index 0000000..d2c2626
--- /dev/null
+++ b/gstreamer/src/audioinfo.hg
@@ -0,0 +1,58 @@
+/* gstreamermm - a C++ wrapper for gstreamer
+ *
+ * Copyright 2008-2009 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * 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.
+ */
+
+#include <gstreamermm/audioformat.h>
+#include <gst/audio/audio-info.h>
+
+_DEFS(gstreamermm,gst)
+
+namespace Gst
+{
+
+    _WRAP_ENUM(AudioFlags, GstAudioFlags)
+    _WRAP_ENUM(AudioLayout, GstAudioLayout)
+
+/**
+ * Information for an audio format.
+ */
+class AudioInfo : public Gst::AudioFormatInfo
+{
+    _CLASS_GENERIC(AudioInfo, GstAudioInfo)
+public:
+  explicit AudioInfo(const GstAudioInfo& castitem,
+    bool take_ownership = false);
+
+  AudioInfo(const AudioInfo& other);
+
+  virtual ~AudioInfo();
+
+  /// Gets the underlying gobject.
+  GstAudioInfo* gobj() { return m_info; };
+
+  /// Gets the underlying gobject.
+  const GstAudioInfo* gobj() const { return m_info; };
+
+protected:
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+  GstAudioInfo* m_info;
+  bool take_ownership;
+#endif
+};
+
+}
diff --git a/gstreamer/src/filelist.am b/gstreamer/src/filelist.am
index 75f14da..d5c3408 100644
--- a/gstreamer/src/filelist.am
+++ b/gstreamer/src/filelist.am
@@ -89,6 +89,7 @@ files_hg  =                     \
         audioclock.hg           \
         audiofilter.hg          \
         audioformat.hg          \
+        audioinfo.hg            \
         audioringbuffer.hg      \
         audiosink.hg            \
         audiosrc.hg             \
diff --git a/tools/m4/convert_gst.m4 b/tools/m4/convert_gst.m4
index 1fc7a79..a9ee76c 100644
--- a/tools/m4/convert_gst.m4
+++ b/tools/m4/convert_gst.m4
@@ -8,6 +8,8 @@ _CONV_ENUM(Gst,AudioBaseSrcSlaveMethod)
 _CONV_ENUM(Gst,BufferCopyFlags)
 _CONV_ENUM(Gst,BufferFlag)
 _CONV_ENUM(Gst,BufferFormat)
+_CONV_ENUM(Gst,AudioFormat)
+_CONV_ENUM(Gst,AudioFormatFlags)
 _CONV_ENUM(Gst,AudioRingBufferFormatType)
 _CONV_ENUM(Gst,CapsIntersectMode)
 _CONV_ENUM(Gst,ClockEntryType)


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