diff data/fileio/WavFileReader.cpp @ 825:69bde159744f tonioni

Merge from default branch
author Chris Cannam
date Wed, 17 Jul 2013 15:41:20 +0100
parents f0558e69a074
children e802e550a1f2
line wrap: on
line diff
--- a/data/fileio/WavFileReader.cpp	Fri Jul 12 13:10:28 2013 +0100
+++ b/data/fileio/WavFileReader.cpp	Wed Jul 17 15:41:20 2013 +0100
@@ -24,6 +24,7 @@
     m_file(0),
     m_source(source),
     m_path(source.getLocalFilename()),
+    m_seekable(false),
     m_buffer(0),
     m_bufsiz(0),
     m_lastStart(0),
@@ -54,12 +55,26 @@
     }
 
     if (m_fileInfo.channels > 0) {
+
         m_frameCount = m_fileInfo.frames;
         m_channelCount = m_fileInfo.channels;
         m_sampleRate = m_fileInfo.samplerate;
+
+        m_seekable = (m_fileInfo.seekable != 0);
+
+        // Our m_seekable reports whether a file is rapidly seekable,
+        // so things like Ogg don't qualify. We cautiously report
+        // every file type of "at least" the historical period of Ogg
+        // or FLAC as non-seekable.
+        int type = m_fileInfo.format & SF_FORMAT_TYPEMASK;
+//        std::cerr << "WavFileReader: format type is " << type << " (flac, ogg are " << SF_FORMAT_FLAC << ", " << SF_FORMAT_OGG << ")" << std::endl;
+        if (type >= SF_FORMAT_FLAC || type >= SF_FORMAT_OGG) {
+//            std::cerr << "WavFileReader: Recording as non-seekable" << std::endl;
+            m_seekable = false;
+        }
     }
 
-//    std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << std::endl;
+//    std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << ", seekable " << m_seekable << std::endl;
 
 }