author | zecke <zecke> | 2003-10-07 12:53:39 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-10-07 12:53:39 (UTC) |
commit | e65d5c86b5fff521dfb94282a96606546bad9585 (patch) (side-by-side diff) | |
tree | 7aee07687deec9dec91031a0a7f70fc802d47c06 /core/multimedia/opieplayer | |
parent | 877f982ab6996b85870befffcacdef84a6700746 (diff) | |
download | opie-e65d5c86b5fff521dfb94282a96606546bad9585.zip opie-e65d5c86b5fff521dfb94282a96606546bad9585.tar.gz opie-e65d5c86b5fff521dfb94282a96606546bad9585.tar.bz2 |
-Kill stupid QCOP check
-introduce OPIE_SOUND_FRAGMENT_SHIFT
-USE_REALTIME_AUDIO_THREAD is now defined in custom.h
-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 37 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol_threaded.cpp | 33 |
2 files changed, 35 insertions, 35 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 6a38fc9..d296d27 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp @@ -24,6 +24,7 @@ #include <stdio.h> #include <qpe/qpeapplication.h> #include <qpe/config.h> +#include <qpe/custom.h> #include <qmessagebox.h> #include "audiodevice.h" @@ -31,8 +32,8 @@ #include <errno.h> -#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) -#include "qpe/qcopenvelope_qws.h" +#if !defined(QT_NO_COP) +#include <qpe/qcopenvelope_qws.h> #endif #if defined(Q_WS_X11) || defined(Q_WS_QWS) @@ -45,11 +46,11 @@ #include <unistd.h> #endif -# if defined(QT_QWS_IPAQ) -static const int sound_fragment_shift = 14; -# else +#ifdef OPIE_SOUND_FRAGMENT_SHIFT +static const int sound_fragment_shift = OPIE_SOUND_FRAGMENT_SHIFT; +#else static const int sound_fragment_shift = 16; -# endif +#endif static const int sound_fragment_bytes = (1<<sound_fragment_shift); //#endif @@ -145,10 +146,10 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, # endif //#endif -// qDebug( "setting volume to: 0x%x", volume ); +// qDebug( "setting volume to: 0x%x", volume ); #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) // Send notification that the volume has changed - QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; + QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; #endif } @@ -156,7 +157,7 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { // qDebug("creating new audio device"); -// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; +// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; d = new AudioDevicePrivate; d->frequency = f; d->channels = chs; @@ -172,7 +173,7 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { int fragments = 0x10000 * 8 + sound_fragment_shift; int capabilities = 0; - + #ifdef KEEP_DEVICE_OPEN if ( AudioDevicePrivate::dspFd == 0 ) { #endif @@ -187,7 +188,7 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { QMessageBox::critical(0, "Vmemo", errorMsg, tr("Abort")); exit(-1); //harsh? } -#ifdef KEEP_DEVICE_OPEN +#ifdef KEEP_DEVICE_OPEN AudioDevicePrivate::dspFd = d->handle; } else { d->handle = AudioDevicePrivate::dspFd; @@ -209,34 +210,34 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); } -// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; +// QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; d->bufferSize = sound_fragment_bytes; d->unwrittenBuffer = new char[d->bufferSize]; d->unwritten = 0; d->can_GETOSPACE = TRUE; // until we find otherwise - + //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); - + } - + AudioDevice::~AudioDevice() { // qDebug("destryo audiodevice"); // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; - -# ifndef KEEP_DEVICE_OPEN + +# ifndef KEEP_DEVICE_OPEN close( d->handle ); // Now it should be safe to shut the handle # endif delete d->unwrittenBuffer; delete d; // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; - + } diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp index 364e77b..3796549 100644 --- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp +++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp @@ -20,9 +20,10 @@ #define _REENTRANT #include <qpe/qpeapplication.h> +#include <qpe/custom.h> #include <qimage.h> #include <qpainter.h> -#ifdef Q_WS_QWS +#if !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif #include "mediaplayerplugininterface.h" @@ -39,9 +40,7 @@ #include "mediaplayerstate.h" -#if defined(QT_QWS_SL5XXX) || defined(QT_QWS_IPAQ) || defined(QT_QWS_RAMSES) -#define USE_REALTIME_AUDIO_THREAD -#endif + extern VideoWidget *videoUI; // now only needed to tell it to play a frame @@ -256,7 +255,7 @@ void LoopControl::startVideo() { videoMutex->lock(); current_frame = int( (double)playtime.elapsed() * (double)framerate / 1000.0 ); //current_frame = ( clock() - begin ) * (double)framerate / CLOCKS_PER_SEC; - + // Sync to Audio // current_frame = (long)((double)(audioSampleCounter - 1000) * framerate / (double)freq); @@ -312,17 +311,17 @@ void LoopControl::startVideo() { mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream ); } prev_frame = current_frame; - if ( moreVideo = videoUI->playVideo() ) + if ( moreVideo = videoUI->playVideo() ) emitChangePos = TRUE; videoMutex->unlock(); } - } else + } else moreVideo = FALSE; } - if ( !moreVideo && !moreAudio ) + if ( !moreVideo && !moreAudio ) emitPlayFinished = TRUE; pthread_exit(NULL); @@ -330,7 +329,7 @@ void LoopControl::startVideo() { void LoopControl::startAudio() { moreAudio = TRUE; - + while ( moreAudio ) { if ( !isMuted && mediaPlayerState->curDecoder() && hasAudioChannel ) { @@ -404,7 +403,7 @@ void LoopControl::startAudio() { // qDebug( "End of file" ); - if ( !moreVideo && !moreAudio ) + if ( !moreVideo && !moreAudio ) emitPlayFinished = TRUE; pthread_exit(NULL); @@ -484,7 +483,7 @@ void LoopControl::stop( bool willPlayAgainShortly ) { #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !willPlayAgainShortly && disabledSuspendScreenSaver ) { - disabledSuspendScreenSaver = FALSE; + disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; } @@ -512,9 +511,9 @@ bool LoopControl::init( const QString& filename ) { fileName = filename; stream = 0; // only play stream 0 for now current_frame = total_video_frames = total_audio_samples = 0; - + // qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() ); - + // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { if ( mediaPlayerState->libMpeg3Decoder() && mediaPlayerState->libMpeg3Decoder()->open( filename ) ) { @@ -534,12 +533,12 @@ bool LoopControl::init( const QString& filename ) { channels = mediaPlayerState->curDecoder()->audioChannels( astream ); DecodeLoopDebug(( "channels = %d\n", channels )); - + if ( !total_audio_samples ) total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); mediaPlayerState->setLength( total_audio_samples ); - + freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); DecodeLoopDebug(( "frequency = %d\n", freq )); @@ -594,9 +593,9 @@ void LoopControl::play() { #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver ) { - disabledSuspendScreenSaver = TRUE; + disabledSuspendScreenSaver = TRUE; // Stop the screen from blanking and power saving state - QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) + QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend ); } #endif |