gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r10100: shake some code in Sound::pr


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10100: shake some code in Sound::probeAudio, preparatory for reuse of the probe for a different task (detecting sound completed)
Date: Sat, 25 Oct 2008 18:19:28 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10100
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Sat 2008-10-25 18:19:28 +0200
message:
  shake some code in Sound::probeAudio, preparatory for reuse of the probe for 
a different task (detecting sound completed)
modified:
  libcore/asobj/Sound.cpp
=== modified file 'libcore/asobj/Sound.cpp'
--- a/libcore/asobj/Sound.cpp   2008-10-25 15:44:08 +0000
+++ b/libcore/asobj/Sound.cpp   2008-10-25 16:19:28 +0000
@@ -971,36 +971,41 @@
 Sound::probeAudio()
 {
     log_debug("Probing audio");
+
     bool parsingCompleted = _mediaParser->parsingCompleted();
-    try
-    {
-        if ( ! attachAuxStreamerIfNeeded() )
-        {
-            if ( parsingCompleted )
-            {
-                log_debug("No audio in Sound input.");
-                stopProbeTimer();
-                _mediaParser.reset(); // no use for this anymore...
-            }
-            else
-            {
-                log_unimpl("No info about audio in Sound input yet, 
hot-plugging decoder not supported.");
-                // keep probing
-            }
-        }
-        else
-        {
-            // TODO: reuse the probe timer to detect
-            //       end of sound for running onSoundCompleted()
-            stopProbeTimer();
-        }
-    }
-    catch (MediaException& e)
-    {
+    int attached=0;
+
+    try {
+        attached = attachAuxStreamerIfNeeded();
+    } catch (MediaException& e) {
         assert(!_audioDecoder.get());
                log_error(_("Could not create audio decoder: %s"), e.what());
         _mediaParser.reset(); // no use for this anymore...
         stopProbeTimer();
+        return;
+    }
+
+    if ( ! attached )
+    {
+        if ( parsingCompleted )
+        {
+            log_debug("No audio in Sound input.");
+            stopProbeTimer();
+            _mediaParser.reset(); // no use for this anymore...
+        }
+        else
+        {
+            // keep probing
+        }
+    }
+    else
+    {
+        // An audio decoder was constructed, good!
+        assert(_audioDecoder.get());
+
+        // TODO: reuse the probe timer to detect
+        //       end of sound for running onSoundCompleted()
+        stopProbeTimer();
     }
 }
 


reply via email to

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