summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/loopcontrol.cpp
authorllornkcor <llornkcor>2002-04-21 03:26:09 (UTC)
committer llornkcor <llornkcor>2002-04-21 03:26:09 (UTC)
commit6818807a46b80774de328b4c3001d4bc9d788666 (patch) (side-by-side diff)
tree1bede7ebbb324058b664330abf481f7afb25eb73 /core/multimedia/opieplayer/loopcontrol.cpp
parent1c459273c0e9e387fd5fe2e2c05bef4db5bce115 (diff)
downloadopie-6818807a46b80774de328b4c3001d4bc9d788666.zip
opie-6818807a46b80774de328b4c3001d4bc9d788666.tar.gz
opie-6818807a46b80774de328b4c3001d4bc9d788666.tar.bz2
fixed when playing stream, slider moved and stopped stream when it reached the end
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index b9f96de..45c2d3e 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -233,20 +233,21 @@ void LoopControl::startAudio() {
long samplesRead = 0;
bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
long sampleWaitTime = currentSample - sampleWeShouldBeAt;
-// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
-// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
+// this causes drop outs not sure why its even here
+// if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
+// usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
+// }
+// else if ( sampleWaitTime <= -5000 ) {
+// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
+// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
+// currentSample = sampleWeShouldBeAt;
// }
-// else if ( sampleWaitTime <= -5000 ) {
-// qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
-// //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
-// currentSample = sampleWeShouldBeAt;
-// }
audioDevice->write( audioBuffer, samplesRead * 2 * channels );
audioSampleCounter = currentSample + samplesRead - 1;
moreAudio = readOk && (audioSampleCounter <= total_audio_samples);
@@ -429,12 +430,15 @@ bool LoopControl::init( const QString& filename ) {
}
current_frame = 0;
prev_frame = -1;
+ if( fileName.left(7) == "http://")
+ mediaPlayerState->isStreaming = TRUE;
+
connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) );
audioMutex->unlock();
return TRUE;