gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10612: Fix build w/out media handle


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10612: Fix build w/out media handler, and avoid aborting as a consequence (no media => no sound)
Date: Mon, 23 Feb 2009 17:16:17 +0100
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10612
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Mon 2009-02-23 17:16:17 +0100
message:
  Fix build w/out media handler, and avoid aborting as a consequence (no media 
=> no sound)
modified:
  libsound/Makefile.am
  testsuite/MovieTester.cpp
  utilities/processor.cpp
=== modified file 'libsound/Makefile.am'
--- a/libsound/Makefile.am      2008-11-08 10:14:21 +0000
+++ b/libsound/Makefile.am      2009-02-23 16:16:17 +0000
@@ -40,14 +40,12 @@
        $(NULL)
 
 libgnashsound_la_SOURCES = \
-       sdl/sound_handler_sdl.cpp \
        sound_handler.cpp \
        EmbedSound.cpp \
        EmbedSoundInst.cpp \
        $(NULL)
 
 noinst_HEADERS = \
-       sdl/sound_handler_sdl.h \
        NullSoundHandler.h \
        sound_handler.h \
        SoundEnvelope.h \
@@ -57,6 +55,11 @@
     AuxStream.h
        $(NULL)
 
+if USE_SOUND_SDL
+ libgnashsound_la_SOURCES += sdl/sound_handler_sdl.cpp 
+ noinst_HEADERS += sdl/sound_handler_sdl.h
+endif
+
 
 libgnashsound_la_LDFLAGS = -release $(VERSION)
 

=== modified file 'testsuite/MovieTester.cpp'
--- a/testsuite/MovieTester.cpp 2009-02-09 09:29:52 +0000
+++ b/testsuite/MovieTester.cpp 2009-02-23 16:16:17 +0000
@@ -238,28 +238,31 @@
 {
        _clock.advance(ms);
 
-    // We need to fetch as many samples
-    // as needed for a theoretical 44100hz loop.
-    // That is 44100 samples each second.
-    // 44100/1000 = x/ms
-    //  x = (44100*ms) / 1000
-    unsigned int nSamples = (441*ms) / 10;
-    if ( ms%10 )
-    {
-        log_error("MovieTester::advanceClock: %d ms lost in sound advancement",
-            ms%10);
-    }
-
-    unsigned int toFetch = nSamples*2;
-
-    log_debug("advanceClock(%d) needs to fetch %d samples", ms, toFetch);
-
-    boost::int16_t samples[1024];
-    while (toFetch)
-    {
-        unsigned int n = std::min(toFetch, 1024u);
-        _sound_handler->fetchSamples((boost::int16_t*)&samples, n);
-        toFetch -= n;
+    if ( _sound_handler )
+    {
+        // We need to fetch as many samples
+        // as needed for a theoretical 44100hz loop.
+        // That is 44100 samples each second.
+        // 44100/1000 = x/ms
+        //  x = (44100*ms) / 1000
+        unsigned int nSamples = (441*ms) / 10;
+        if ( ms%10 )
+        {
+            log_error("MovieTester::advanceClock: %d ms lost in sound 
advancement",
+                ms%10);
+        }
+
+        unsigned int toFetch = nSamples*2;
+
+        log_debug("advanceClock(%d) needs to fetch %d samples", ms, toFetch);
+
+        boost::int16_t samples[1024];
+        while (toFetch)
+        {
+            unsigned int n = std::min(toFetch, 1024u);
+            _sound_handler->fetchSamples((boost::int16_t*)&samples, n);
+            toFetch -= n;
+        }
     }
     
 }
@@ -573,8 +576,15 @@
 void
 MovieTester::initTestingSoundHandlers()
 {
-
-    _sound_handler.reset( new sound::NullSoundHandler() );
+    // Currently, SoundHandler can't be constructed
+    // w/out a registered MediaHandler .
+    // Should be fixed though...
+    //
+    if ( gnash::media::MediaHandler::get() ) {
+        log_error("MediaHandler::get returns: %s",
+            gnash::media::MediaHandler::get());
+        _sound_handler.reset( new sound::NullSoundHandler() );
+    }
 }
 
 void
@@ -588,7 +598,7 @@
 #elif defined(USE_GST)
         handler.reset( new gnash::media::gst::MediaHandlerGst() );
 #else
-       std::cerr << "Neigher SOUND_SDL nor SOUND_GST defined" << std::endl;
+       std::cerr << "Neigther SOUND_SDL nor SOUND_GST defined" << std::endl;
        return;
 #endif
 

=== modified file 'utilities/processor.cpp'
--- a/utilities/processor.cpp   2009-02-09 09:29:52 +0000
+++ b/utilities/processor.cpp   2009-02-23 16:16:17 +0000
@@ -342,19 +342,23 @@
 
 
 #ifdef USE_FFMPEG
-    std::auto_ptr<media::MediaHandler> handler(
+    gnash::media::MediaHandler::set(
             new gnash::media::ffmpeg::MediaHandlerFfmpeg() );
+    );
 #elif defined(USE_GST)
-    std::auto_ptr<media::MediaHandler> handler(
-            new gnash::media::gst::MediaHandlerGst() );
+    gnash::media::MediaHandler::set(
+            new gnash::media::gst::MediaHandlerGst()
+    );
 #else
-    std::cerr << "Neither SOUND_SDL nor SOUND_GST defined" << std::endl;
-    exit(1);
+    //std::cerr << "Neither SOUND_SDL nor SOUND_GST defined" << std::endl;
+    //exit(1);
 #endif
-    gnash::media::MediaHandler::set(handler);
-
-    boost::shared_ptr<sound::sound_handler> soundHandler(
-            new sound::NullSoundHandler());
+
+    boost::shared_ptr<sound::sound_handler> soundHandler;
+
+    if ( gnash::media::MediaHandler::get() ) {
+        soundHandler.reset( new sound::NullSoundHandler() );
+    }
 
     boost::shared_ptr<StreamProvider> sp(new StreamProvider);
 


reply via email to

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