author | llornkcor <llornkcor> | 2002-02-25 01:35:47 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 01:35:47 (UTC) |
commit | f180c1a5e8fc889ff1fb390d5cc94cdbc5085046 (patch) (side-by-side diff) | |
tree | 5e9ea6f1313f4c33d57fb266523c1cfbe0826756 /core/multimedia/opieplayer/loopcontrol.cpp | |
parent | c0446b55fc32b7fdea9f58db06e40da703f5e8ff (diff) | |
download | opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.zip opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.gz opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.bz2 |
fucked up- no workie.. back out
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 1ae0059..dd466ed 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp @@ -1,5 +1,5 @@ /********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. +** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. ** -** This file is part of Qtopia Environment. +** This file is part of the Qtopia Environment. ** @@ -19,9 +19,8 @@ **********************************************************************/ -// L.J.Potter added changes Fri 02-15-2002 - #include <qpe/qpeapplication.h> - #ifdef Q_WS_QWS + #include <qpe/qcopenvelope_qws.h> #endif +#include <qpe/mediaplayerplugininterface.h> #include <stdio.h> @@ -35,3 +34,2 @@ #include "audiodevice.h" -#include "mediaplayerplugininterface.h" #include "mediaplayerstate.h" @@ -106,4 +104,6 @@ LoopControl::LoopControl( QObject *parent, const char *name ) pthread_attr_init(&audio_attr); -#define USE_REALTIME_AUDIO_THREAD -#ifdef USE_REALTIME_AUDIO_THREAD + + if ( getuid() == 0 ) { + printf("true, guid = %i\n", getuid()); + // Attempt to set it to real-time round robin @@ -118,3 +118,6 @@ LoopControl::LoopControl( QObject *parent, const char *name ) } -#endif + } +// printf("false, guid = %i\n", getuid()); + usleep( 100 ); + pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); @@ -233,3 +236,3 @@ void LoopControl::startAudio() { long samplesRead = 0; - bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); + mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; @@ -239,4 +242,3 @@ void LoopControl::startAudio() { usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); - } - else if ( sampleWaitTime <= -5000 ) { + } else if ( sampleWaitTime <= -5000 ) { qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); @@ -249,3 +251,3 @@ void LoopControl::startAudio() { - moreAudio = readOk && (audioSampleCounter <= total_audio_samples); + moreAudio = audioSampleCounter <= total_audio_samples; @@ -379,3 +381,3 @@ bool LoopControl::init( const QString& filename ) { channels = mediaPlayerState->curDecoder()->audioChannels( astream ); - qDebug( "LC- channels = %d", channels ); + DecodeLoopDebug(( "channels = %d\n", channels )); @@ -384,3 +386,3 @@ bool LoopControl::init( const QString& filename ) { -// total_audio_samples += 1000; + total_audio_samples += 1000; @@ -389,3 +391,3 @@ bool LoopControl::init( const QString& filename ) { freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); - qDebug( "LC- frequency = %d", freq ); + DecodeLoopDebug(( "frequency = %d\n", freq )); @@ -393,5 +395,5 @@ bool LoopControl::init( const QString& filename ) { - int bits_per_sample = mediaPlayerState->curDecoder()->audioBitsPerSample( astream); + static const int bytes_per_sample = 2; //16 bit - audioDevice = new AudioDevice( freq, channels, bits_per_sample); + audioDevice = new AudioDevice( freq, channels, bytes_per_sample ); audioBuffer = new char[ audioDevice->bufferSize() ]; |