summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/loopcontrol.cpp
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 90a7cc6..cb8de8a 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -35,5 +35,5 @@
#include "videowidget.h"
#include "audiodevice.h"
-#include "mediaplayerplugininterface.h"
+#include <qpe/mediaplayerplugininterface.h>
#include "mediaplayerstate.h"
@@ -102,5 +102,5 @@ LoopControl::LoopControl( QObject *parent, const char *name )
isMuted = FALSE;
connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) );
-
+//qDebug("starting loopcontrol");
audioMutex = new Mutex;
@@ -119,4 +119,5 @@ LoopControl::LoopControl( QObject *parent, const char *name )
}
#endif
+//qDebug("create audio thread");
pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this);
}
@@ -221,6 +222,6 @@ void LoopControl::startVideo() {
void LoopControl::startAudio() {
+//qDebug("start audio");
audioMutex->lock();
-
if ( moreAudio ) {
@@ -237,12 +238,12 @@ void LoopControl::startAudio() {
long sampleWaitTime = currentSample - sampleWeShouldBeAt;
- 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;
- }
+// 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;
+// }
audioDevice->write( audioBuffer, samplesRead * 2 * channels );
@@ -392,6 +393,11 @@ bool LoopControl::init( const QString& filename ) {
audioSampleCounter = 0;
-
- int bits_per_sample = mediaPlayerState->curDecoder()->audioBitsPerSample( astream);
+ int bits_per_sample;
+ if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) {
+ bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
+ qDebug("using stupid hack");
+ } else {
+ bits_per_sample=0;
+ }
audioDevice = new AudioDevice( freq, channels, bits_per_sample);
@@ -438,5 +444,5 @@ bool LoopControl::init( const QString& filename ) {
void LoopControl::play() {
-
+ qDebug("LC- play");
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) {