SampleBuffer: for OGG files try with OGG Vorbis decoder first

This is workaround for a bug in libsndfile or our libsndfile decoder
causing some OGG files to be distorted. Therefore try the OGG Vorbis
decoder first if filename extension matches "ogg".

Closes #2957937.
This commit is contained in:
Tobias Doerffel
2010-08-22 02:18:34 +02:00
parent 32dbda5b33
commit 6e64bcfc42

View File

@@ -1,7 +1,7 @@
/*
* sample_buffer.cpp - container-class sampleBuffer
*
* Copyright (c) 2005-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -201,13 +201,21 @@ void sampleBuffer::update( bool _keep_settings )
sample_rate_t samplerate = engine::getMixer()->baseSampleRate();
m_frames = 0;
if( QFileInfo( file ).size() > 100*1024*1024 )
const QFileInfo fileInfo( file );
if( fileInfo.size() > 100*1024*1024 )
{
qWarning( "refusing to load sample files bigger "
"than 100 MB" );
}
else
{
#ifdef LMMS_HAVE_OGGVORBIS
// workaround for a bug in libsndfile or our libsndfile decoder
// causing some OGG files to be distorted -> try with OGG Vorbis
// decoder first if filename extension matches "ogg"
if( m_frames == 0 && fileInfo.suffix() == "ogg" )
m_frames = decodeSampleOGGVorbis( f, buf, channels, samplerate );
#endif
// PCM wave
if( m_frames == 0 )
m_frames = decodeSampleSF( f, buf, channels, samplerate );