Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index cb8de8a..4b2827e 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -221,7 +221,6 @@ void LoopControl::startVideo() { | |||
221 | 221 | ||
222 | void LoopControl::startAudio() { | 222 | void LoopControl::startAudio() { |
223 | 223 | ||
224 | //qDebug("start audio"); | ||
225 | audioMutex->lock(); | 224 | audioMutex->lock(); |
226 | if ( moreAudio ) { | 225 | if ( moreAudio ) { |
227 | 226 | ||
@@ -237,14 +236,14 @@ void LoopControl::startAudio() { | |||
237 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; | 236 | long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; |
238 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; | 237 | long sampleWaitTime = currentSample - sampleWeShouldBeAt; |
239 | 238 | ||
240 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { | 239 | // if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { |
241 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); | 240 | // usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); |
242 | // } | 241 | // } |
243 | // else if ( sampleWaitTime <= -5000 ) { | 242 | // else if ( sampleWaitTime <= -5000 ) { |
244 | // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); | 243 | // // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); |
245 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); | 244 | // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); |
246 | // currentSample = sampleWeShouldBeAt; | 245 | // currentSample = sampleWeShouldBeAt; |
247 | // } | 246 | // } |
248 | 247 | ||
249 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); | 248 | audioDevice->write( audioBuffer, samplesRead * 2 * channels ); |
250 | audioSampleCounter = currentSample + samplesRead - 1; | 249 | audioSampleCounter = currentSample + samplesRead - 1; |
@@ -379,7 +378,7 @@ bool LoopControl::init( const QString& filename ) { | |||
379 | int astream = 0; | 378 | int astream = 0; |
380 | 379 | ||
381 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); | 380 | channels = mediaPlayerState->curDecoder()->audioChannels( astream ); |
382 | qDebug( "LC- channels = %d", channels ); | 381 | // qDebug( "LC- channels = %d", channels ); |
383 | 382 | ||
384 | if ( !total_audio_samples ) | 383 | if ( !total_audio_samples ) |
385 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); | 384 | total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); |
@@ -389,15 +388,17 @@ bool LoopControl::init( const QString& filename ) { | |||
389 | mediaPlayerState->setLength( total_audio_samples ); | 388 | mediaPlayerState->setLength( total_audio_samples ); |
390 | 389 | ||
391 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); | 390 | freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); |
392 | qDebug( "LC- frequency = %d", freq ); | 391 | // qDebug( "LC- frequency = %d", freq ); |
393 | 392 | ||
394 | audioSampleCounter = 0; | 393 | audioSampleCounter = 0; |
395 | int bits_per_sample; | 394 | int bits_per_sample; |
396 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { | 395 | if ( mediaPlayerState->curDecoder()->pluginName() == QString("WavPlugin") ) { |
397 | bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); | 396 | bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); |
398 | qDebug("using stupid hack"); | 397 | // qDebug("using stupid hack"); |
399 | } else { | 398 | } else { |
400 | bits_per_sample=0; | 399 | bits_per_sample=0; |
400 | // freq=44100; | ||
401 | channels=2; | ||
401 | } | 402 | } |
402 | 403 | ||
403 | audioDevice = new AudioDevice( freq, channels, bits_per_sample); | 404 | audioDevice = new AudioDevice( freq, channels, bits_per_sample); |