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