gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog backend/Makefile.am backend/sou...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog backend/Makefile.am backend/sou...
Date: Mon, 23 Jul 2007 22:07:59 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/07/23 22:07:59

Modified files:
        .              : ChangeLog 
        backend        : Makefile.am sound_handler.h 
                         sound_handler_gst.cpp sound_handler_sdl.cpp 
        libbase        : utility.cpp utility.h 
        server/asobj   : SoundMad.cpp 
Removed files:
        backend        : sound_handler.cpp 

Log message:
                * backend/: sound_handler.{cpp,h}, Makefile.am,
                  sound_handler_gst.cpp, sound_handler_sdl.cpp,
                  libbase/: utility.{cpp,h}, server/asobj/SoundMad.cpp:
                  Moved convert_raw_data from libgnashbackend
                  to libgnashbase. Should fix bug #20110.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3797&r2=1.3798
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/Makefile.am?cvsroot=gnash&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_gst.cpp?cvsroot=gnash&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler.cpp?cvsroot=gnash&r1=1.9&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/utility.cpp?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/utility.h?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SoundMad.cpp?cvsroot=gnash&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3797
retrieving revision 1.3798
diff -u -b -r1.3797 -r1.3798
--- ChangeLog   23 Jul 2007 21:19:35 -0000      1.3797
+++ ChangeLog   23 Jul 2007 22:07:58 -0000      1.3798
@@ -1,5 +1,13 @@
 2007-07-23 Sandro Santilli <address@hidden>
 
+       * backend/: sound_handler.{cpp,h}, Makefile.am,
+         sound_handler_gst.cpp, sound_handler_sdl.cpp,
+         libbase/: utility.{cpp,h}, server/asobj/SoundMad.cpp:
+         Moved convert_raw_data from libgnashbackend
+         to libgnashbase. Should fix bug #20110.
+
+2007-07-23 Sandro Santilli <address@hidden>
+
        * configure.ac: still create Makefile under cygnal
          subdirs, or 'dist' rule will fail.
 

Index: backend/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/backend/Makefile.am,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- backend/Makefile.am 20 Jul 2007 01:50:31 -0000      1.57
+++ backend/Makefile.am 23 Jul 2007 22:07:58 -0000      1.58
@@ -81,7 +81,7 @@
 lib_LTLIBRARIES = libgnashbackend.la
 
 # RENDER_SOURCES = render_handler_tri.cpp
-SOUND_SOURCES = sound_handler.cpp
+SOUND_SOURCES = 
 
 if USE_SOUND_GST
 SOUND_SOURCES += sound_handler_gst.cpp sound_handler_gst.h 

Index: backend/sound_handler.h
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- backend/sound_handler.h     8 Jul 2007 20:26:49 -0000       1.18
+++ backend/sound_handler.h     23 Jul 2007 22:07:58 -0000      1.19
@@ -18,7 +18,7 @@
 // 
 //
 
-/* $Id: sound_handler.h,v 1.18 2007/07/08 20:26:49 martinwguy Exp $ */
+/* $Id: sound_handler.h,v 1.19 2007/07/23 22:07:58 strk Exp $ */
 
 /// \page sound_handler_intro Sound handler introduction
 ///
@@ -254,41 +254,6 @@
        ///
        virtual void    detach_aux_streamer(void* udata) = 0;
 
-       /// VERY crude sample-rate and steroe conversion. Converts input data 
to 
-       /// output format.
-       //
-       /// @param adjusted_data
-       /// Where the converted data is placed.
-       ///
-       /// @param adjusted_size
-       /// The size of the converted data.
-       ///
-       /// @param data
-       /// Data that needs to be converted.
-       ///
-       /// @param sample_count
-       /// The datas current sample count.
-       /// 
-       /// @param sample_size
-       /// The datas current sample size.
-       ///
-       /// @param sample_rate
-       /// The datas current sample rate.
-       ///
-       /// @param stereo
-       /// Whether the current data is in stereo
-       ///
-       /// @param m_sample_rate
-       /// The samplerate we which to convert to.
-       ///
-       /// @param m_stereo
-       /// Do we want the output data to be in stereo?
-       ///
-       static void     convert_raw_data(int16_t** adjusted_data,
-                         int* adjusted_size, void* data, int sample_count,
-                         int sample_size, int sample_rate, bool stereo,
-                         int m_sample_rate, bool m_stereo);
-
        sound_handler()
                :
                _soundsStarted(0),

Index: backend/sound_handler_gst.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- backend/sound_handler_gst.cpp       2 Jul 2007 13:53:19 -0000       1.51
+++ backend/sound_handler_gst.cpp       23 Jul 2007 22:07:58 -0000      1.52
@@ -20,12 +20,14 @@
 // Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003
 // which has been donated to the Public Domain.
 
-/* $Id: sound_handler_gst.cpp,v 1.51 2007/07/02 13:53:19 tgc Exp $ */
+/* $Id: sound_handler_gst.cpp,v 1.52 2007/07/23 22:07:58 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include "utility.h" // for convert_raw_data
+
 // Assume people running --enable-media=gst know what they are doing
 // (HAVE_GST_GST_H seems broken atm, specifically when an older glib
 //  install is around)

Index: backend/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- backend/sound_handler_sdl.cpp       3 Jul 2007 04:31:59 -0000       1.73
+++ backend/sound_handler_sdl.cpp       23 Jul 2007 22:07:58 -0000      1.74
@@ -18,13 +18,14 @@
 // Based on sound_handler_sdl.cpp by Thatcher Ulrich http://tulrich.com 2003
 // which has been donated to the Public Domain.
 
-// $Id: sound_handler_sdl.cpp,v 1.73 2007/07/03 04:31:59 strk Exp $
+// $Id: sound_handler_sdl.cpp,v 1.74 2007/07/23 22:07:58 strk Exp $
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include "sound_handler_sdl.h"
+#include "utility.h" // for convert_raw_data
 
 #include "log.h"
 #include <cmath>
@@ -884,7 +885,7 @@
                                                int sample_count = outsize / 
((sounddata->stereo == true) ? 4 : 2);
 
                                                // Convert to needed samplerate
-                                               
handler->convert_raw_data(&adjusted_data, &adjusted_size, tmp_raw_buffer, 
sample_count, 0, 
+                                               
convert_raw_data(&adjusted_data, &adjusted_size, tmp_raw_buffer, sample_count, 
0, 
                                                                
sounddata->sample_rate, sounddata->stereo,
                                                                
handler->audioSpec.freq, (handler->audioSpec.channels == 2 ? true : false));
 

Index: libbase/utility.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/utility.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- libbase/utility.cpp 1 Jul 2007 10:54:10 -0000       1.15
+++ libbase/utility.cpp 23 Jul 2007 22:07:59 -0000      1.16
@@ -1,3 +1,4 @@
+// utility.cpp --      Various little utility functions, macros & typedefs.
 // 
 //   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
@@ -21,6 +22,10 @@
 #include "config.h"
 #endif
 
+#include <stdint.h> // for int16_t
+#include <cstring> // for memcpy
+
+
 #ifdef HAVE_DMALLOC
 
 #ifdef HAVE_MALLINFO
@@ -98,6 +103,138 @@
 }
 #endif // CAN_DUMP_MEMORY_STATS
 
+namespace gnash {
+
+// VERY crude sample-rate conversion.
+// Converts input data to output format.
+// sample_size
+void convert_raw_data(
+    int16_t** adjusted_data,
+    int* adjusted_size,
+    void* data,
+    int sample_count,  // A stereo pair counts as one
+    int /*sample_size*/,       // Should now always == 2
+    // sample_rate and stereo are those of the incoming sample
+    int sample_rate, 
+    bool stereo,
+    // m_sample_rate, m_stereo are the format we must convert to.
+    int m_sample_rate,
+    bool m_stereo)
+{
+    // simple hack to handle dup'ing mono to stereo
+    if ( !stereo && m_stereo)
+    {
+       sample_rate >>= 1;
+    }
+
+    // simple hack to lose half the samples to get mono from stereo
+    if ( stereo && !m_stereo)
+    {
+       sample_rate <<= 1;
+    }
+
+    // Brain-dead sample-rate conversion: duplicate or
+    // skip input samples an integral number of times.
+    int        inc = 1;        // increment
+    int        dup = 1;        // duplicate
+    if (sample_rate > m_sample_rate)
+    {
+       inc = sample_rate / m_sample_rate;
+    }
+    else if (sample_rate < m_sample_rate)
+    {
+       dup = m_sample_rate / sample_rate;
+    }
+
+    int        output_sample_count = (sample_count * dup * (stereo ? 2 : 1)) / 
inc;
+    int16_t*   out_data = new int16_t[output_sample_count];
+    *adjusted_data = out_data;
+    *adjusted_size = output_sample_count * sizeof(int16_t); // in bytes
+
+    // Either inc > 1 (decimate the audio)
+    // or dup > 1 (repeat samples)
+    // or both == 1 (no transformation required)
+    if (inc == 1 && dup == 1)
+    {
+           // No tranformation required
+           memcpy(out_data, data, output_sample_count * sizeof(int16_t));
+    }
+    else if (inc > 1)
+    {
+       // Downsample by skipping samples from the input
+       int16_t*        in = (int16_t*) data;
+       for (int i = output_sample_count; i > 0; i--)
+       {
+           *out_data++ = *in;
+           in += inc;
+       }
+    }
+    else if (dup > 1)
+    {
+       // Upsample by duplicating input samples in the output.
+
+       // The straight sample-replication code handles mono-to-stereo (sort of)
+       // and upsampling of mono but would make a botch of stereo-to-stereo
+       // upsampling, giving the left sample in both channels
+       // then the right sample in both channels alternately.
+       // So for stereo-stereo transforms we have a stereo routine.
+
+       int16_t*        in = (int16_t*) data;
+
+       if (stereo && m_stereo) {
+           // Stereo-to-stereo upsampling: Replicate pairs of samples
+           for (int i = output_sample_count / dup / 2; i > 0; i--)
+           {
+               for (int j = dup; j > 0; j--)
+               {
+                       out_data[0] = in[0];
+                       out_data[1] = in[1];
+                       out_data += 2;
+               }
+               in += 2;
+           }
+       } else {
+
+           // Linear upsampling, either to increase a sample rate
+           // or to convert a mono file to stereo or both:
+           // replicate each sample several times.
+           switch (dup)
+           {
+           case 2:
+               for (int i = output_sample_count / dup; i > 0; i--)
+               {
+                   *out_data++ = *in;
+                   *out_data++ = *in;
+                   in++;
+               }
+               break;
+           case 4:
+               for (int i = output_sample_count / dup; i > 0; i--)
+               {
+                   *out_data++ = *in;
+                   *out_data++ = *in;
+                   *out_data++ = *in;
+                   *out_data++ = *in;
+                   in++;
+               }
+               break;
+           default:
+               for (int i = output_sample_count / dup; i > 0; i--)
+               {
+                   for (int j = dup; j > 0; j--)
+                   {
+                           *out_data++ = *in;
+                   }
+                   in++;
+               }
+               break;
+           }
+       }
+    }
+}
+
+} // namespace gnash 
+
 // Local Variables:
 // mode: C++
 // indent-tabs-mode: t

Index: libbase/utility.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/utility.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- libbase/utility.h   10 Jul 2007 15:41:25 -0000      1.24
+++ libbase/utility.h   23 Jul 2007 22:07:59 -0000      1.25
@@ -1,9 +1,21 @@
-// utility.h   -- by Thatcher Ulrich <address@hidden>
-
-// This source code has been donated to the Public Domain.  Do
-// whatever you want with it.
+// utility.h --        Various little utility functions, macros & typedefs.
+// 
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program 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 General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-// Various little utility functions, macros & typedefs.
 
 
 #ifndef UTILITY_H
@@ -194,6 +206,44 @@
        return typeName;
 }
 
+namespace gnash {
+
+/// VERY crude sample-rate and steroe conversion. Converts input data to 
+/// output format.
+//
+/// @param adjusted_data
+/// Where the converted data is placed.
+///
+/// @param adjusted_size
+/// The size of the converted data.
+///
+/// @param data
+/// Data that needs to be converted.
+///
+/// @param sample_count
+/// The datas current sample count.
+/// 
+/// @param sample_size
+/// The datas current sample size.
+///
+/// @param sample_rate
+/// The datas current sample rate.
+///
+/// @param stereo
+/// Whether the current data is in stereo
+///
+/// @param m_sample_rate
+/// The samplerate we which to convert to.
+///
+/// @param m_stereo
+/// Do we want the output data to be in stereo?
+///
+void   convert_raw_data(int16_t** adjusted_data,
+                 int* adjusted_size, void* data, int sample_count,
+                 int sample_size, int sample_rate, bool stereo,
+                 int m_sample_rate, bool m_stereo);
+} // namespace gnash 
+
 #endif // UTILITY_H
 
 

Index: server/asobj/SoundMad.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SoundMad.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/asobj/SoundMad.cpp   1 Jul 2007 10:54:31 -0000       1.10
+++ server/asobj/SoundMad.cpp   23 Jul 2007 22:07:59 -0000      1.11
@@ -29,6 +29,7 @@
 #include "fn_call.h"
 #include "GnashException.h"
 #include "builtin_function.h"
+#include "utility.h" // for convert_raw_data
 
 #include <string>
 
@@ -262,7 +263,7 @@
                                        int sample_count = outsize / 
((so->frame.header.mode) ? 4 : 2);
 
                                        // Convert to needed samplerate
-                                       s->convert_raw_data(&adjusted_data, 
&adjusted_size, tmp_raw_buffer, sample_count, 2, 
+                                       convert_raw_data(&adjusted_data, 
&adjusted_size, tmp_raw_buffer, sample_count, 2, 
                                                        
so->frame.header.samplerate, so->frame.header.mode,
                                                        44100, true/*stereo*/);
 

Index: backend/sound_handler.cpp
===================================================================
RCS file: backend/sound_handler.cpp
diff -N backend/sound_handler.cpp
--- backend/sound_handler.cpp   1 Jul 2007 10:53:48 -0000       1.9
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,163 +0,0 @@
-// 
-//   Copyright (C) 2007 Free Software Foundation, Inc.
-// 
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 3 of the License, or
-// (at your option) any later version.
-// 
-// This program 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 General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-
-#include "sound_handler.h"
-
-#include <cstring>
-
-namespace gnash {
-
-// VERY crude sample-rate conversion.
-// Converts input data to output format.
-// sample_size
-
-void sound_handler::convert_raw_data(
-    int16_t** adjusted_data,
-    int* adjusted_size,
-    void* data,
-    int sample_count,  // A stereo pair counts as one
-    int /*sample_size*/,       // Should now always == 2
-    // sample_rate and stereo are those of the incoming sample
-    int sample_rate, 
-    bool stereo,
-    // m_sample_rate, m_stereo are the format we must convert to.
-    int m_sample_rate,
-    bool m_stereo)
-{
-    // simple hack to handle dup'ing mono to stereo
-    if ( !stereo && m_stereo)
-    {
-       sample_rate >>= 1;
-    }
-
-    // simple hack to lose half the samples to get mono from stereo
-    if ( stereo && !m_stereo)
-    {
-       sample_rate <<= 1;
-    }
-
-    // Brain-dead sample-rate conversion: duplicate or
-    // skip input samples an integral number of times.
-    int        inc = 1;        // increment
-    int        dup = 1;        // duplicate
-    if (sample_rate > m_sample_rate)
-    {
-       inc = sample_rate / m_sample_rate;
-    }
-    else if (sample_rate < m_sample_rate)
-    {
-       dup = m_sample_rate / sample_rate;
-    }
-
-    int        output_sample_count = (sample_count * dup * (stereo ? 2 : 1)) / 
inc;
-    int16_t*   out_data = new int16_t[output_sample_count];
-    *adjusted_data = out_data;
-    *adjusted_size = output_sample_count * sizeof(int16_t); // in bytes
-
-    // Either inc > 1 (decimate the audio)
-    // or dup > 1 (repeat samples)
-    // or both == 1 (no transformation required)
-    if (inc == 1 && dup == 1)
-    {
-           // No tranformation required
-           memcpy(out_data, data, output_sample_count * sizeof(int16_t));
-    }
-    else if (inc > 1)
-    {
-       // Downsample by skipping samples from the input
-       int16_t*        in = (int16_t*) data;
-       for (int i = output_sample_count; i > 0; i--)
-       {
-           *out_data++ = *in;
-           in += inc;
-       }
-    }
-    else if (dup > 1)
-    {
-       // Upsample by duplicating input samples in the output.
-
-       // The straight sample-replication code handles mono-to-stereo (sort of)
-       // and upsampling of mono but would make a botch of stereo-to-stereo
-       // upsampling, giving the left sample in both channels
-       // then the right sample in both channels alternately.
-       // So for stereo-stereo transforms we have a stereo routine.
-
-       int16_t*        in = (int16_t*) data;
-
-       if (stereo && m_stereo) {
-           // Stereo-to-stereo upsampling: Replicate pairs of samples
-           for (int i = output_sample_count / dup / 2; i > 0; i--)
-           {
-               for (int j = dup; j > 0; j--)
-               {
-                       out_data[0] = in[0];
-                       out_data[1] = in[1];
-                       out_data += 2;
-               }
-               in += 2;
-           }
-       } else {
-
-           // Linear upsampling, either to increase a sample rate
-           // or to convert a mono file to stereo or both:
-           // replicate each sample several times.
-           switch (dup)
-           {
-           case 2:
-               for (int i = output_sample_count / dup; i > 0; i--)
-               {
-                   *out_data++ = *in;
-                   *out_data++ = *in;
-                   in++;
-               }
-               break;
-           case 4:
-               for (int i = output_sample_count / dup; i > 0; i--)
-               {
-                   *out_data++ = *in;
-                   *out_data++ = *in;
-                   *out_data++ = *in;
-                   *out_data++ = *in;
-                   in++;
-               }
-               break;
-           default:
-               for (int i = output_sample_count / dup; i > 0; i--)
-               {
-                   for (int j = dup; j > 0; j--)
-                   {
-                           *out_data++ = *in;
-                   }
-                   in++;
-               }
-               break;
-           }
-       }
-    }
-}
-
-
-} // namespace gnash
-
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 8 
-// tab-width: 8
-// indent-tabs-mode: t
-// End:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]