[gstreamermm: 8/167] removed unnecessary functions, fixed commit-callback method



commit 9aa60e24aaee000771fb99c947a35f2ed32ba4e7
Author: Marcin Kolny at Flytronic <marcin kolny flytronic pl>
Date:   Wed Jul 24 11:57:39 2013 +0200

    removed unnecessary functions, fixed commit-callback method

 gstreamer/src/audioringbuffer.ccg |   33 +++------------------------------
 gstreamer/src/audioringbuffer.hg  |   12 ------------
 2 files changed, 3 insertions(+), 42 deletions(-)
---
diff --git a/gstreamer/src/audioringbuffer.ccg b/gstreamer/src/audioringbuffer.ccg
index 0ae1851..3574ee6 100644
--- a/gstreamer/src/audioringbuffer.ccg
+++ b/gstreamer/src/audioringbuffer.ccg
@@ -126,8 +126,6 @@ AudioRingBufferSpec::AudioRingBufferSpec(const AudioRingBufferSpec& other)
   m_spec->segsize = other.m_spec->segsize;
   m_spec->segtotal = other.m_spec->segtotal;
   m_spec->seglatency = other.m_spec->seglatency;
-
-  std::copy(other.m_spec->silence_sample, other.m_spec->silence_sample + 
GSTREAMERMM_RING_BUFFER_SPEC_SILENCE_SAMPLE, m_spec->silence_sample);
 }
 
 AudioRingBufferSpec& AudioRingBufferSpec::operator=(const AudioRingBufferSpec& other)
@@ -159,26 +157,6 @@ void AudioRingBufferSpec::swap(AudioRingBufferSpec& other)
   other.take_ownership = take_temp;
 }
 
-void AudioRingBufferSpec::set_silence_sample(const Glib::ArrayHandle<guint8>& silence_sample)
-{
-  std::copy(silence_sample.data(),
-    silence_sample.data() + GSTREAMERMM_RING_BUFFER_SPEC_SILENCE_SAMPLE,
-    m_spec->silence_sample);
-}
-
-void AudioRingBuffer::set_fill_slot(const SlotFill& slot)
-{
-  // The slot is dynamically allocated because according to the
-  // gst_audio_ring_buffer_set_callback() docs, the slot may be called several
-  // times.
-  // A copy is hence created to avoid losing the slot.  The copy is kept in an
-  // auto_ptr<> so that is released upon the ring buffer's destruction.
-  m_slot.reset(new SlotFill(slot));
-
-  gst_audio_ring_buffer_set_callback(gobj(), &AudioRingBuffer_Fill_gstreamermm_callback,
-    m_slot.get());
-}
-
 bool AudioRingBuffer::prepare_read(int& segment, std::vector<guint8>& readptr,
   int& len)
 {
@@ -264,15 +242,10 @@ guint AudioRingBuffer_Class::commit_vfunc_callback(GstAudioRingBuffer* self, gui
     {
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
       {
-        // This formula is obtained from the definition of the data_end
-        // variable in the default_commit() function of the C API
-        // gstringbuffer.c file.
-        size_t data_length = (self->spec.bytes_per_sample * in_samples);
-
         // Declare the ArrayHandle for the C++ vfunc.
-        Glib::ArrayHandle<guchar> cpp_data(data, data_length, Glib::OWNERSHIP_NONE);
+        Glib::ArrayHandle<guchar> cpp_data(data, self->size, Glib::OWNERSHIP_NONE);
         // Call the virtual member method, which derived classes might override.
-        return obj->commit_vfunc(*(sample), Glib::ArrayHandler<guint8>::array_to_vector(data, data_length, 
Glib::OWNERSHIP_NONE), in_samples, out_samples, *(accum));
+        return obj->commit_vfunc(*(sample), Glib::ArrayHandler<guint8>::array_to_vector(data, self->size, 
Glib::OWNERSHIP_NONE), in_samples, out_samples, *(accum));
       }
       catch(...)
       {
@@ -300,7 +273,7 @@ guint Gst::AudioRingBuffer::commit_vfunc(guint64& sample, const std::vector<guin
   );
 
   if(base && base->commit)
-    return 
(*base->commit)(gobj(),&sample,Glib::ArrayHandler<guint8>::vector_to_array(data).data(),,in_samples,out_samples,&accum);
+    return 
(*base->commit)(gobj(),&sample,Glib::ArrayHandler<guint8>::vector_to_array(data).data(),in_samples,out_samples,&accum);
 
   typedef guint RType;
   return RType();
diff --git a/gstreamer/src/audioringbuffer.hg b/gstreamer/src/audioringbuffer.hg
index 227255e..bee70d0 100644
--- a/gstreamer/src/audioringbuffer.hg
+++ b/gstreamer/src/audioringbuffer.hg
@@ -160,20 +160,8 @@ public:
    */
   _MEMBER_SET(seglatency, seglatency, int, gint)
 
-// This constant is obtained from the "silence_sample" member in the
-// GstAudioRingBufferSpec 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::AudioRingBuffer::acquire().
-   */
-  _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::AudioRingBuffer::acquire() and probably should not be set.
-   */
-  void set_silence_sample(const Glib::ArrayHandle<guint8>& silence_sample);
 
 protected:
 #ifndef DOXYGEN_SHOULD_SKIP_THIS


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