gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9821: Remove all mad code finally.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9821: Remove all mad code finally.
Date: Tue, 23 Sep 2008 16:49:55 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9821
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2008-09-23 16:49:55 +0200
message:
  Remove all mad code finally.
removed:
  libcore/asobj/SoundMad.cpp
  libcore/asobj/SoundMad.h
modified:
  Makefile.am
  configure.ac
  gui/Makefile.am
  libcore/asobj/Makefile.am
  libcore/asobj/Sound.cpp
  libmedia/Makefile.am
  libmedia/ffmpeg/sound_handler_sdl.cpp
  testsuite/MovieTester.cpp
  utilities/Makefile.am
    ------------------------------------------------------------
    revno: 9820.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2008-09-23 16:12:03 +0200
    message:
      Drop deprecated libmad support.
    modified:
      Makefile.am
      configure.ac
      gui/Makefile.am
      libcore/asobj/Makefile.am
      utilities/Makefile.am
    ------------------------------------------------------------
    revno: 9820.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Tue 2008-09-23 16:13:56 +0200
    message:
      Drop inactive mad support.
    modified:
      libmedia/Makefile.am
=== modified file 'Makefile.am'
--- a/Makefile.am       2008-09-11 22:51:32 +0000
+++ b/Makefile.am       2008-09-23 14:12:03 +0000
@@ -222,10 +222,6 @@
        @echo "MYSQL_CFLAGS is $(MYSQL_CFLAGS)"
        @echo "MYSQL_LIBS is $(MYSQL_LIBS)"
 endif
-if USE_MAD_ENGINE
-       @echo " MAD_CFLAGS is $(MAD_CFLAGS)"
-       @echo " MAD_LIBS is $(MAD_LIBS)"
-endif
        @echo " PTHREAD_CFLAGS is $(PTHREAD_CFLAGS)"
        @echo " PTHREAD_LIBS is $(PTHREAD_LIBS)"
        @echo " CURL_CFLAGS is $(CURL_CFLAGS)"

=== modified file 'configure.ac'
--- a/configure.ac      2008-09-22 15:30:00 +0000
+++ b/configure.ac      2008-09-23 14:12:03 +0000
@@ -1596,7 +1596,7 @@
 dnl currently unused
 dnl GNASH_PKG_FIND(ogg, [ogg.h], [decode ogg streams], ogg_stream_init)
 
-if test x$build_sdl = xyes -o x"$media_handler" = xffmpeg -o x"$media_handler" 
= xmad; then
+if test x$build_sdl = xyes -o x"$media_handler" = xffmpeg; then
   GNASH_PATH_SDL
 fi
 
@@ -1763,7 +1763,6 @@
   fi
   GNASH_PKG_FIND(gstreamer, [gst/gst.h], [gstreamer library], gst_init, [0.10])
   if test x"${media_handler_specified}" = xfalse; then
-    # If the library is not found, or its version is not ok, we'll try mad
     if test x"$GSTREAMER_LIBS" = x; then
        AC_MSG_WARN([No appropriate gstreamer library found, will try using 
ffmpeg.])
        media_handler=ffmpeg
@@ -1782,19 +1781,6 @@
   fi
 fi
 
-#if test x"$media_handler" = x"mad"; then
-#  dnl Will set MAD_LIBS and MAD_CFLAGS.
-#  dnl Handles --with-mad-incl and --with-mad-lib
-#  GNASH_PKG_FIND(mad, [mad.h], [mad library], mad_copyright)
-#  if test x"${media_handler_specified}" = xfalse; then
-#    # If the library is not found, we'll disable media handling
-#    if test x"${ac_cv_path_mad_lib}" = x ; then
-#      AC_MSG_WARN([No libmad found, disabling media handling.])
-#      media_handler=none
-#    fi
-#  fi
-#fi
-
 if test x"$media_handler" = x"gst"; then
   AC_MSG_CHECKING([for modern pbutils])
   save_cflags=$CFLAGS
@@ -1842,17 +1828,11 @@
 
 AM_CONDITIONAL(HAVE_CAIRO, [test x"${CAIRO_LIBS}" != x])
 
-dnl I'm kinda lazy, get rid of this later... //Markus
-AM_CONDITIONAL(HAVE_MAD, test x"$media_handler" = xmad)
-
 AM_CONDITIONAL(USE_SOUND_GST, test x$media_handler = xgst)
-AM_CONDITIONAL(USE_SOUND_SDL, test x"$media_handler" = xmad -o 
x"$media_handler" = xffmpeg)
+AM_CONDITIONAL(USE_SOUND_SDL, test x"$media_handler" = xffmpeg)
 AM_CONDITIONAL(USE_FFMPEG_ENGINE, test x"$media_handler" = xffmpeg)
-AM_CONDITIONAL(USE_MAD_ENGINE, test x"$media_handler" = xmad)
 AM_CONDITIONAL(HAVE_OPENGL, test x"${OPENGL_LIBS}" != x)
 
-dnl AM_CONDITIONAL(HAVE_FFMPEG, [test x"${FFMPEG_LIBS}" != x])
-
 case "${media_handler}" in
   gst) AC_DEFINE([SOUND_GST],  [1], [Use GSTREAMER for media handling]) ;;
   ffmpeg) AC_DEFINE([SOUND_SDL],  [1], [Use SDL for sound handling]) ;;
@@ -2299,7 +2279,7 @@
 echo "        GUI toolkits supported: ${SUPPORTED_GUIS}"
 echo "        Renderers supported: ${add_renderer}"
 echo "        Media handler: "$media_handler
-if test x"$media_handler" = xffmpeg -o x"$media_handler" = xmad; then
+if test x"$media_handler" = xffmpeg; then
 echo "        Using SDL for sound handling"
 fi
 echo "        Using $with_shm mode for shared memory"
@@ -2591,24 +2571,6 @@
   fi
 fi
 
-  if test x"$media_handler" = x"mad"; then
-    echo "        MP3 support enabled through libmad"
-    if test x"$MAD_LIBS" != x; then
-      if test x"$MAD_CFLAGS" != x; then
-        echo "        MAD flags are: $MAD_CFLAGS"
-      else
-        echo "        MAD flags are: default include path"
-      fi
-      echo "        MAD libs are: $MAD_LIBS"
-    else
-      echo "        ERROR: No libmad development package installed!" >&3
-      echo "               You can install it from http://mad.sourceforge.net"; 
>&3
-      echo "               or .deb users: apt-get install libmad0-dev" >&3
-      echo "               or .rpm users: yum install libmad" >&3
-      echo "               or reconfigure using --enable-media=ffmpeg" >&3
-    fi
-  fi
-
   if test x"$media_handler" = x"ffmpeg"; then
     if test x"$FFMPEG_LIBS" != x; then
       echo "        MP3 and video support enabled through ffmpeg"
@@ -2703,7 +2665,6 @@
 need_sdl=false
 test x$build_sdl = xyes                        && need_sdl=true
 test x"$media_handler" = x"ffmpeg"     && need_sdl=true
-test x"$media_handler" = x"mad"                && need_sdl=true
 
 if $need_sdl; then
   if test x"$SDL_LIBS" != x; then
@@ -2716,7 +2677,7 @@
     echo "               or .rpm users: yum install SDL-devel" >&3
     test x$build_sdl = xyes &&
        echo "               or select a different GUI with --enable-gui= " >&3
-    test x"$media_handler" = x"ffmpeg" -o x"$media_handler" = x"mad" &&
+    test x"$media_handler" = x"ffmpeg" &&
        echo "               or use --enable-media=gst" >&3
   fi
 fi

=== modified file 'gui/Makefile.am'
--- a/gui/Makefile.am   2008-07-22 21:24:49 +0000
+++ b/gui/Makefile.am   2008-09-23 14:12:03 +0000
@@ -136,11 +136,6 @@
 AM_CPPFLAGS += $(FFMPEG_CFLAGS) 
 endif
 
-if USE_MAD_ENGINE
-AM_LDFLAGS += $(MAD_LIBS)
-AM_CPPFLAGS += $(MAD_CFLAGS)
-endif
-
 if USE_SOUND_GST
 AM_CPPFLAGS += $(GSTREAMER_CFLAGS)
 AM_LDFLAGS += $(GSTREAMER_LIBS) 

=== modified file 'libcore/asobj/Makefile.am'
--- a/libcore/asobj/Makefile.am 2008-09-19 08:48:00 +0000
+++ b/libcore/asobj/Makefile.am 2008-09-23 14:49:55 +0000
@@ -136,7 +136,6 @@
        Sound.h \
        SoundFfmpeg.h \
        SoundGst.h \
-       SoundMad.h \
        Stage.h \
        System_as.h \
        TextFormat.h \
@@ -198,12 +197,6 @@
 libgnashasobjs_la_LIBADD += $(GSTREAMER_LIBS)
 endif
 
-if USE_MAD_ENGINE
-libgnashasobjs_la_SOURCES += SoundMad.cpp
-AM_CPPFLAGS += $(MAD_CFLAGS)
-libgnashasobjs_la_LIBADD += $(MAD_LIBS)
-endif
-
 #libgnashasobjs_la_LDFLAGS = -release $(VERSION) -no-undefined -export-dynamic
 
 # Rebuild with GCC 4.x Mudflap support

=== modified file 'libcore/asobj/Sound.cpp'
--- a/libcore/asobj/Sound.cpp   2008-09-20 10:06:49 +0000
+++ b/libcore/asobj/Sound.cpp   2008-09-23 14:49:55 +0000
@@ -34,13 +34,10 @@
 #include "VM.h"
 
 #ifdef SOUND_GST
-#include "SoundGst.h"
+# include "SoundGst.h"
 #elif defined(USE_FFMPEG)
-#include "SoundFfmpeg.h"
-#elif defined(USE_MAD)
-#include "SoundMad.h"
+# include "SoundFfmpeg.h"
 #endif
-
 #include <string>
 
 namespace gnash {
@@ -285,8 +282,6 @@
        sound_obj = new SoundGst();
 #elif defined(USE_FFMPEG)
        sound_obj = new SoundFfmpeg();
-#elif defined(USE_MAD)
-       sound_obj = new SoundMad();
 #else
        sound_obj = new Sound();
 #endif

=== removed file 'libcore/asobj/SoundMad.cpp'
--- a/libcore/asobj/SoundMad.cpp        2008-06-09 17:12:54 +0000
+++ b/libcore/asobj/SoundMad.cpp        1970-01-01 00:00:00 +0000
@@ -1,455 +0,0 @@
-// SoundMad.cpp:  Play sounds using libmad (MP3 audio decoder), for Gnash.
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008 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
-//
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
-#include "log.h"
-#include "SoundMad.h"
-#include "sound_definition.h" // for sound_sample
-#include "movie_definition.h"
-#include "sprite_instance.h"
-#include "fn_call.h"
-#include "GnashException.h"
-#include "builtin_function.h"
-#include "utility.h" // for convert_raw_data
-
-#include <string>
-
-namespace gnash {
-
-int 
-SoundMad::readPacket(boost::uint8_t* buf, int buf_size)
-{
-
-       size_t ret = connection->read(static_cast<void*>(buf), buf_size);
-       inputPos += ret;
-       return ret;
-
-}
-
-int 
-SoundMad::seekMedia(int offset, int whence){
-
-       // Offset is absolute new position in the file
-       if (whence == SEEK_SET) {
-               connection->seek(offset);
-               inputPos = offset;
-
-       // New position is offset + old position
-       } else if (whence == SEEK_CUR) {
-               connection->seek(inputPos + offset);
-               inputPos = inputPos + offset;
-
-       //      // New position is offset + end of file
-       } else if (whence == SEEK_END) {
-               // This is (most likely) a streamed file, so we can't seek to 
the end!
-               // Instead we seek to 50.000 bytes... seems to work fine...
-               connection->seek(50000);
-               inputPos = 50000;
-               
-       }
-
-       return inputPos;
-}
-
-
-void
-SoundMad::setupDecoder(SoundMad* so)
-{
-
-       boost::intrusive_ptr<NetConnection> nc = so->connection;
-       assert(nc);
-
-       // Pass stuff from/to the NetConnection object.
-       assert(so);
-       if ( !nc->openConnection(so->externalURL) ) {
-               log_error(_("Gnash could not open audio url: %s"), 
so->externalURL.c_str());
-               delete so->lock;
-               return;
-       }
-
-       so->inputPos = 0;
-
-       // Init the mad decoder
-       mad_stream_init(&so->stream);
-       mad_frame_init(&so->frame);
-       mad_synth_init(&so->synth);
-
-       // Decode a single frame to decode the header
-
-       // Fetch data from the file
-       so->seekMedia(0, SEEK_SET);
-       boost::uint8_t* buf = new boost::uint8_t[1024];
-       int bufSize = so->readPacket(buf, 1024);
-
-       // Setup the mad decoder
-       mad_stream_buffer(&so->stream, buf, bufSize);
-
-       int ret;
-
-       int loops = 0;
-       while(true) {
-
-               ret = mad_frame_decode(&so->frame, &so->stream);
-               loops++;
-               
-               // There is always some junk in front of the data, 
-               // so we continue until we get past it.
-               if (ret && so->stream.error == MAD_ERROR_LOSTSYNC) continue;
-               
-               // Error handling is done by relooping (max. 8 times) and just 
hooping that it will work...
-               if (loops > 8) break;
-               if (ret == -1 && so->stream.error != MAD_ERROR_BUFLEN && 
MAD_RECOVERABLE(so->stream.error)) {
-                       log_error(_("Recoverable error while decoding MP3, MAD 
error: %s"), mad_stream_errorstr (&so->stream));
-                       continue;
-               }
-               break;
-       }
-       so->bitrate = so->frame.header.bitrate;
-
-       so->seekMedia(0, SEEK_SET);
-       delete [] buf;
-
-       // By deleting this lock we allow start() to start playback
-       delete so->lock;
-       return;
-}
-
-// audio callback is running in sound handler thread
-bool SoundMad::getAudio(void* owner, boost::uint8_t* stream, int len)
-{
-       SoundMad* so = static_cast<SoundMad*>(owner);
-
-       unsigned int pos = 0;
-
-       // First use the data left over from last time
-       if (so->leftOverSize > 0) {
-
-               // If we have enough "leftover" data to fill the buffer,
-               // we don't bother to decode some new.
-               if (so->leftOverSize >= len) {
-                       memcpy(stream, so->leftOverData, len);
-                       int rest = so->leftOverSize - len;
-                       if (rest < 1) {
-                               delete[] so->leftOverData;
-                               so->leftOverSize = 0;
-                       } else {
-                               boost::uint8_t* buf = new boost::uint8_t[rest];
-                               memcpy(stream, so->leftOverData+len, rest);
-                               delete[] so->leftOverData;
-                               so->leftOverData = buf;
-                               so->leftOverSize -= len;
-                       }       
-                       return true;
-               } else {
-                       memcpy(stream, so->leftOverData, so->leftOverSize);
-                       pos += so->leftOverSize;
-                       so->leftOverSize = 0;
-                       delete[] so->leftOverData;
-               }
-       }
-
-       boost::uint8_t* buf = new boost::uint8_t[8192];
-       int bufSize = so->readPacket(buf, 8192);
-       int orgBufSize = bufSize;
-
-       bool loop = true;
-       boost::uint8_t* ptr = new boost::uint8_t[8192];
-
-       bool ret = true;
-       media::sound_handler* s = get_sound_handler();
-       if (bufSize > 0) {
-               if (s) {
-                       // temp raw buffer
-                       boost::uint8_t* tmp_raw_buffer;
-                       unsigned int tmp_raw_buffer_size;
-                       int outsize = 0;
-                       while (loop) {
-                       // Decode audio
-
-                               // Setup the mad decoder
-                               mad_stream_buffer(&so->stream, 
buf+(orgBufSize-bufSize), bufSize);
-
-                               int ret;
-                               const unsigned char* old_next_frame = 
so->stream.next_frame;
-                               int loops = 0;
-                               while(true) {
-
-                                       ret = mad_frame_decode(&so->frame, 
&so->stream);
-                                       loops++;
-                                       
-                                       // There is always some junk in front 
of the data, 
-                                       // so we continue until we get past it.
-                                       if (ret && so->stream.error == 
MAD_ERROR_LOSTSYNC) continue;
-                                       
-                                       // Error handling is done by relooping 
(max. 8 times) and just hooping that it will work...
-                                       if (loops > 8) break;
-                                       if (ret == -1 && so->stream.error != 
MAD_ERROR_BUFLEN && MAD_RECOVERABLE(so->stream.error)) {
-                                               log_error(_("Recoverable error 
while decoding MP3, MAD error: %s"), mad_stream_errorstr (&so->stream));
-                                               continue;
-                                       }
-                                       
-                                       break;
-                               }
-
-                               if (ret == -1 && so->stream.error != 
MAD_ERROR_BUFLEN) {
-                                       log_error(_("Unrecoverable error while 
decoding MP3, MAD error: %s"), mad_stream_errorstr (&so->stream));
-                                       bufSize = 0;
-                                       loop = false;
-                               } else if (ret == -1 && so->stream.error == 
MAD_ERROR_BUFLEN) {
-                                       // the buffer is empty, no more to 
decode!
-                                       bufSize = 0;
-                                       loop = false;
-                               } else {
-                                       bufSize -= so->stream.next_frame - 
old_next_frame;
-                               }
-
-                               mad_synth_frame (&so->synth, &so->frame);
-                               
-                               outsize = so->synth.pcm.length * 
((so->frame.header.mode) ? 4 : 2);
-
-                               tmp_raw_buffer = new boost::uint8_t[outsize];
-                               int sample;
-                               
-                               boost::int16_t* dst = 
reinterpret_cast<boost::int16_t*>(tmp_raw_buffer);
-
-                               // transfer the decoded samples into the 
sound-struct, and do some
-                               // scaling while we're at it.
-                               for(int f = 0; f < so->synth.pcm.length; f++)
-                               {
-                                       for (int e = 0; e < 
((so->frame.header.mode) ? 2 : 1); e++){ // channels (stereo/mono)
-
-                                               mad_fixed_t mad_sample = 
so->synth.pcm.samples[e][f];
-
-                                               // round
-                                               mad_sample += (1L << 
(MAD_F_FRACBITS - 16));
-
-                                               // clip
-                                               if (mad_sample >= MAD_F_ONE) 
mad_sample = MAD_F_ONE - 1;
-                                               else if (mad_sample < 
-MAD_F_ONE) mad_sample = -MAD_F_ONE;
-
-                                               // quantize
-                                               sample = mad_sample >> 
(MAD_F_FRACBITS + 1 - 16);
-
-                                               if ( sample != 
static_cast<boost::int16_t>(sample) ) sample = sample < 0 ? -32768 : 32767;
-
-                                               *dst++ = sample;
-                                       }
-                               }
-
-                               // If we need to convert samplerate or/and from 
mono to stereo...
-                               if (outsize > 0 && (so->frame.header.samplerate 
!= 44100 || !so->frame.header.mode)) {
-
-                                       boost::int16_t* adjusted_data = 0;
-                                       int     adjusted_size = 0;
-                                       int sample_count = outsize / 
((so->frame.header.mode) ? 4 : 2);
-
-                                       // Convert to needed samplerate
-                                       convert_raw_data(&adjusted_data, 
&adjusted_size, tmp_raw_buffer, sample_count, 2, 
-                                                       
so->frame.header.samplerate, so->frame.header.mode,
-                                                       44100, true/*stereo*/);
-
-                                       // Hopefully this won't happen
-                                       if (!adjusted_data) {
-                                               log_error(_("Error in sound 
sample convertion"));
-                                               continue;
-                                       }
-
-                                       // Move the new data to the sound-struct
-                                       delete[] tmp_raw_buffer;
-                                       tmp_raw_buffer = 
reinterpret_cast<boost::uint8_t*>(adjusted_data);
-                                       tmp_raw_buffer_size = adjusted_size;
-
-                               } else {
-                                       tmp_raw_buffer_size = outsize;
-                               }
-
-
-
-
-                               // Copy the data to buffer
-                               // If the decoded data isn't enough to fill the 
buffer, we put the decoded
-                               // data into the buffer, and continues decoding.
-                               if (tmp_raw_buffer_size <= len-pos) {
-                                       memcpy(stream+pos, tmp_raw_buffer, 
tmp_raw_buffer_size);
-                                       pos += tmp_raw_buffer_size;
-                               } else {
-                               // If we can fill the buffer, and still have 
"leftovers", we save them
-                               // and use them later.
-                                       int rest = len-pos;
-                                       so->leftOverSize = tmp_raw_buffer_size 
- rest;
-                                       memcpy(stream+pos, tmp_raw_buffer, 
rest);
-                                       so->leftOverData = new 
boost::uint8_t[so->leftOverSize];
-                                       memcpy(so->leftOverData, 
(tmp_raw_buffer)+rest, so->leftOverSize);
-                                       loop = false;
-                                       pos += rest;
-                               }
-                               delete[] tmp_raw_buffer;
-                       } // while               
-               } // (s) 
-       } else { // bufSize > 0
-               // If we should loop we make sure we do.
-               if (so->remainingLoops != 0) {
-                       so->remainingLoops--;
-
-                       // Seek to begining of file
-                       so->seekMedia(0, SEEK_SET);
-               } else {
-                        // Stops playback by returning false which makes the 
soundhandler
-                        // detach this sound.
-                        ret = false;
-                        so->isAttached = false;
-               }
-       }
-       so->seekMedia(-bufSize, SEEK_CUR);
-       delete[] ptr;
-       return ret;
-}
-
-SoundMad::~SoundMad() {
-       if (leftOverData && leftOverSize) delete[] leftOverData;
-
-       if (isAttached) {
-               mad_synth_finish(&synth);
-               mad_frame_finish(&frame);
-               mad_stream_finish(&stream);
-
-               media::sound_handler* s = get_sound_handler();
-               if (s) {
-                       s->detach_aux_streamer(this);
-               }
-       }
-
-}
-
-void
-SoundMad::loadSound(std::string file, bool streaming)
-{
-       leftOverData = NULL;
-       leftOverSize = 0;
-       remainingLoops = 0;
-
-       if (connection) {
-               log_error(_("This sound already has a connection?  (We try to 
handle this by overriding the old one...)"));
-       }
-       externalURL = file;
-
-       connection = new NetConnection();
-
-       externalSound = true;
-       isStreaming = streaming;
-
-       lock = new boost::mutex::scoped_lock(setupMutex);
-
-       // To avoid blocking while connecting, we use a thread.
-       setupThread = new boost::thread(boost::bind(SoundMad::setupDecoder, 
this));
-
-}
-
-void
-SoundMad::start(int offset, int loops)
-{
-       boost::mutex::scoped_lock lock(setupMutex);
-
-       if (externalSound) {
-               seekMedia((bitrate*offset)/8, SEEK_SET);
-
-               // Save how many loops to do
-               if (loops > 0) {
-                       remainingLoops = loops;
-               }
-       }
-
-       // Start sound
-       media::sound_handler* s = get_sound_handler();
-       if (s) {
-               if (externalSound) {
-                       if (1)
-                       {
-                               s->attach_aux_streamer(getAudio, (void*) this);
-                               isAttached = true;
-                       } 
-               } else {
-               s->play_sound(soundId, loops, offset, 0, NULL);
-           }
-       }
-}
-
-void
-SoundMad::stop(int si)
-{
-       // stop the sound
-       media::sound_handler* s = get_sound_handler();
-       if (s != NULL)
-       {
-           if (si < 0) {
-               if (externalSound) {
-                       s->detach_aux_streamer(this);
-               } else {
-                               s->stop_sound(soundId);
-                       }
-               } else {
-                       s->stop_sound(si);
-               }
-       }
-}
-
-unsigned int
-SoundMad::getDuration()
-{
-       // If this is a event sound get the info from the soundhandler
-       if (!externalSound) {
-               media::sound_handler* s = get_sound_handler();
-               if (s) {                
-               return (s->get_duration(soundId));
-           } else {
-               return 0; // just in case
-               }
-       }
-
-       // Return the duration of the file in milliseconds
-/*     if (formatCtx && audioIndex) {
-               return static_cast<unsigned int>(formatCtx->duration * 1000);
-       } else {
-               return 0;
-       }*/
-       return 0;
-}
-
-unsigned int
-SoundMad::getPosition()
-{
-
-       // If this is a event sound get the info from the soundhandler
-       if (!externalSound) {
-               media::sound_handler* s = get_sound_handler();
-               if (s) {
-                       return s->tell(soundId);        
-           } else {
-               return 0; // just in case
-               }
-       }
-
-       // Return the position in the file in milliseconds
-       return inputPos/bitrate/8*1000;
-}
-
-} // end of gnash namespace

=== removed file 'libcore/asobj/SoundMad.h'
--- a/libcore/asobj/SoundMad.h  2008-03-26 21:34:20 +0000
+++ b/libcore/asobj/SoundMad.h  1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007, 2008 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
-//
-
-#ifndef __SOUNDMAD_H__
-#define __SOUNDMAD_H__
-
-#include "impl.h"
-#include "as_object.h"
-#include "NetConnection.h"
-#include "Sound.h" // for inheritance
-#include <boost/thread/thread.hpp>
-#include <boost/bind.hpp> 
-#include <boost/thread/mutex.hpp>
-
-#include <mad.h>
-
-namespace gnash {
-
-// Forward declarations
-class fn_call;
-  
-class SoundMad : public Sound {
-public:
-       SoundMad()
-               :
-               inputPos(0),
-               setupThread(NULL),
-               lock(NULL), 
-               bitrate(0),
-               leftOverData(NULL),
-               leftOverSize(0),
-               isAttached(false),
-               remainingLoops(0)
-       {}
-       ~SoundMad();
-
-       void loadSound(std::string file, bool streaming);
-       void start(int offset, int loops);
-       void stop(int si);
-       unsigned int getDuration();
-       unsigned int getPosition();
-
-       static void setupDecoder(SoundMad* so);
-       static bool getAudio(void *owner, boost::uint8_t *stream, int len);
-private:
-
-       long inputPos;
-
-       boost::thread *setupThread;
-       boost::mutex setupMutex;
-       boost::mutex::scoped_lock *lock;
-
-       // bitrate in bps
-       unsigned long bitrate;
-
-       int readPacket(boost::uint8_t* buf, int buf_size);
-       int seekMedia(int offset, int whence);
-
-       /// mad stuff
-       mad_stream      stream;
-       mad_frame       frame;
-       mad_synth       synth;
-
-       // If the decoded data doesn't fit the buffer we put the leftovers here
-       boost::uint8_t* leftOverData;
-       int leftOverSize;
-
-       // Are this sound attached to the soundhandler?
-       bool isAttached;
-
-       int remainingLoops;
-};
-
-
-} // end of gnash namespace
-
-// __ASSOUND_H__
-#endif
-

=== modified file 'libmedia/Makefile.am'
--- a/libmedia/Makefile.am      2008-09-22 16:56:45 +0000
+++ b/libmedia/Makefile.am      2008-09-23 14:13:56 +0000
@@ -157,24 +157,6 @@
                $(SDL_CFLAGS)
 endif
 
-# if USE_MAD_ENGINE
-#    libgnashmedia_la_SOURCES += \
-#              ffmpeg/MediaDecoderSdl.cpp \
-#              ffmpeg/AudioDecoderMad.cpp \
-#              ffmpeg/sound_handler_sdl.cpp
-# 
-#    noinst_HEADERS += \
-#              ffmpeg/MediaDecoderSdl.h \
-#              ffmpeg/AudioDecoderMad.h \
-#              ffmpeg/sound_handler_sdl.h
-# 
-#    libgnashmedia_la_LIBADD += \
-#              $(MAD_LIBS) 
-# 
-#    libgnashmedia_la_CPPFLAGS += \
-#              $(MAD_CFLAGS)
-# endif
-
 libgnashmedia_la_LDFLAGS = -release $(VERSION)
 
 #libltdlc_la_CPPFLAGS = $(LTDLINCL)

=== modified file 'libmedia/ffmpeg/sound_handler_sdl.cpp'
--- a/libmedia/ffmpeg/sound_handler_sdl.cpp     2008-09-15 14:17:20 +0000
+++ b/libmedia/ffmpeg/sound_handler_sdl.cpp     2008-09-23 14:49:55 +0000
@@ -34,10 +34,6 @@
 #include "AudioDecoderFfmpeg.h"
 #endif
 
-#ifdef USE_MAD
-#include "AudioDecoderMad.h"
-#endif
-
 #include "log.h"
 #include <cmath>
 #include <vector>
@@ -179,12 +175,6 @@
        switch (sounddata->soundinfo->getFormat())
        {
        case AUDIO_CODEC_MP3:
-#ifndef USE_FFMPEG
-#ifndef USE_MAD
-               log_error(_("gnash has not been compiled to handle mp3 audio"));
-               return -1;
-#endif
-#endif
                sounddata->append(reinterpret_cast<boost::uint8_t*>(data), 
data_bytes);
                break;
 
@@ -297,17 +287,6 @@
 
                break;
        case AUDIO_CODEC_MP3:
-#ifdef USE_MAD
-               sound->decoder = new AudioDecoderMad();
-
-               if (!sound->decoder->setup(sounddata->soundinfo.get())) {
-                       log_error("The audio decoder can't decode the audio");
-                       delete sound->decoder;
-                       sound->decoder = NULL;
-               }
-
-               break;
-#endif
 #ifdef USE_FFMPEG
                sound->decoder = new AudioDecoderFfmpeg();
 

=== modified file 'testsuite/MovieTester.cpp'
--- a/testsuite/MovieTester.cpp 2008-09-16 14:28:14 +0000
+++ b/testsuite/MovieTester.cpp 2008-09-23 14:49:55 +0000
@@ -539,11 +539,6 @@
 {
        if ( ! canTestSound() ) return false;
 
-#ifdef USE_MAD
-       // mad doesn't support video !
-       return false;
-#endif
-
        return true;
 }
 

=== modified file 'utilities/Makefile.am'
--- a/utilities/Makefile.am     2008-09-08 17:01:28 +0000
+++ b/utilities/Makefile.am     2008-09-23 14:12:03 +0000
@@ -72,11 +72,6 @@
  GNASH_LIBS += $(FFMPEG_LIBS)
 endif
 
-if USE_MAD_ENGINE
- AM_CPPFLAGS += $(MAD_INCLS) 
- GNASH_LIBS += $(MAD_LIBS)
-endif
-
 #if USE_SOUND_GST
  AM_CPPFLAGS += $(GSTREAMER_CFLAGS) \
                -I$(top_srcdir)/libmedia/gst


reply via email to

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