summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/loopcontrol.cpp
authorbipolar <bipolar>2002-03-03 17:13:17 (UTC)
committer bipolar <bipolar>2002-03-03 17:13:17 (UTC)
commita99347380a9006ec81a9dba2340d6aaab690a86e (patch) (side-by-side diff)
tree73fdc2eff476fba2113172ed881dd64a4031def6 /core/multimedia/opieplayer/loopcontrol.cpp
parent0e245156b28b70be5cd98a58a9256fe5e2739562 (diff)
downloadopie-a99347380a9006ec81a9dba2340d6aaab690a86e.zip
opie-a99347380a9006ec81a9dba2340d6aaab690a86e.tar.gz
opie-a99347380a9006ec81a9dba2340d6aaab690a86e.tar.bz2
commited by ljp (llornkcor) reverted to qpe's interface for compatibility. Added playlist features:
save, remove, and have different ones. Uncommented code for background image and added opielogo.
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (ignore 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
@@ -34,7 +34,7 @@
#include "loopcontrol.h"
#include "videowidget.h"
#include "audiodevice.h"
-#include "mediaplayerplugininterface.h"
+#include <qpe/mediaplayerplugininterface.h>
#include "mediaplayerstate.h"
@@ -101,7 +101,7 @@ LoopControl::LoopControl( QObject *parent, const char *name )
: QObject( parent, name ) {
isMuted = FALSE;
connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) );
-
+//qDebug("starting loopcontrol");
audioMutex = new Mutex;
pthread_attr_init(&audio_attr);
@@ -118,6 +118,7 @@ LoopControl::LoopControl( QObject *parent, const char *name )
pthread_attr_init(&audio_attr);
}
#endif
+//qDebug("create audio thread");
pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this);
}
@@ -220,8 +221,8 @@ void LoopControl::startVideo() {
void LoopControl::startAudio() {
+//qDebug("start audio");
audioMutex->lock();
-
if ( moreAudio ) {
if ( !isMuted && mediaPlayerState->curDecoder() ) {
@@ -236,14 +237,14 @@ void LoopControl::startAudio() {
long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
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 );
audioSampleCounter = currentSample + samplesRead - 1;
@@ -391,8 +392,13 @@ bool LoopControl::init( const QString& filename ) {
qDebug( "LC- frequency = %d", freq );
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);
audioBuffer = new char[ audioDevice->bufferSize() ];
@@ -437,7 +443,7 @@ 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 ) {
disabledSuspendScreenSaver = TRUE;