Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 4ed5921..91153fd 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp @@ -21,3 +21,12 @@ + +#include "mediaplayerstate.h" +#include "loopcontrol.h" +#include "videowidget.h" +#include "audiodevice.h" + +/* OPIE */ #include <qpe/qpeapplication.h> +#include <qpe/mediaplayerplugininterface.h> +#include <opie2/odebug.h> @@ -26,2 +35,6 @@ #endif + +/* QT */ + +/* STD */ #include <stdio.h> @@ -32,7 +45,2 @@ #include <unistd.h> -#include "loopcontrol.h" -#include "videowidget.h" -#include "audiodevice.h" -#include <qpe/mediaplayerplugininterface.h> -#include "mediaplayerstate.h" @@ -102,3 +110,3 @@ LoopControl::LoopControl( QObject *parent, const char *name ) connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); - //qDebug("starting loopcontrol"); + //odebug << "starting loopcontrol" << oendl; audioMutex = new Mutex; @@ -114,3 +122,3 @@ LoopControl::LoopControl( QObject *parent, const char *name ) } else { - // qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); + // odebug << "Error setting up a realtime thread, reverting to using a normal thread." << oendl; pthread_attr_destroy(&audio_attr); @@ -119,3 +127,3 @@ LoopControl::LoopControl( QObject *parent, const char *name ) #endif - //qDebug("create audio thread"); + //odebug << "create audio thread" << oendl; pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); @@ -146,3 +154,3 @@ void LoopControl::timerEvent( QTimerEvent *te ) { - if ( !moreVideo && !moreAudio ) { + if ( !moreVideo && !moreAudio ) { mediaPlayerState->setPlaying( FALSE ); @@ -155,3 +163,3 @@ void LoopControl::setPosition( long pos ) { audioMutex->lock(); -// qDebug("Loop control %d", pos); +// odebug << "Loop control " << pos << "" << oendl; if ( hasVideoChannel && hasAudioChannel ) { @@ -221,3 +229,3 @@ void LoopControl::startVideo() { void LoopControl::startAudio() { - + audioMutex->lock(); @@ -230,3 +238,3 @@ void LoopControl::startAudio() { // if ( currentSample != audioSampleCounter + 1 ) -// qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); +// odebug << "out of sync with decoder " << currentSample << " " << audioSampleCounter << "" << oendl; @@ -243,3 +251,3 @@ void LoopControl::startAudio() { else if ( sampleWaitTime <= -5000 ) { - // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); + // odebug << "need to catch up by: " << -sampleWaitTime << " (" << currentSample << "," << sampleWeShouldBeAt << ")" << oendl; // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); @@ -272,3 +280,3 @@ void LoopControl::killTimers() { - if ( hasVideoChannel ) + if ( hasVideoChannel ) killTimer( videoId ); @@ -326,3 +334,3 @@ void LoopControl::stop( bool willPlayAgainShortly ) { if ( !willPlayAgainShortly && disabledSuspendScreenSaver ) { - disabledSuspendScreenSaver = FALSE; + disabledSuspendScreenSaver = FALSE; // Re-enable the suspend mode @@ -351,3 +359,3 @@ void LoopControl::stop( bool willPlayAgainShortly ) { current_frame=0; - total_audio_samples=0; + total_audio_samples=0; } @@ -362,5 +370,5 @@ bool LoopControl::init( const QString& filename ) { current_frame = total_video_frames = total_audio_samples = 0; - - // qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() ); - + + // odebug << "Using the " << mediaPlayerState->curDecoder()->pluginName() << " decoder" << oendl; + // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin @@ -372,3 +380,3 @@ bool LoopControl::init( const QString& filename ) { // } - + if ( !mediaPlayerState->curDecoder()|| !mediaPlayerState->curDecoder()->open( filename ) ) { @@ -389,4 +397,4 @@ bool LoopControl::init( const QString& filename ) { - // qDebug( "LC- channels = %d", channels ); - + // odebug << "LC- channels = " << channels << "" << oendl; + // if ( !total_audio_samples ) @@ -395,7 +403,7 @@ bool LoopControl::init( const QString& filename ) { total_audio_samples += 1000; - // qDebug("total samples %d", total_audio_samples); + // odebug << "total samples " << total_audio_samples << "" << oendl; mediaPlayerState->setLength( total_audio_samples ); - + freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); - // qDebug( "LC- frequency = %d", freq ); + // odebug << "LC- frequency = " << freq << "" << oendl; @@ -405,3 +413,3 @@ bool LoopControl::init( const QString& filename ) { bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); - // qDebug("using stupid hack"); + // odebug << "using stupid hack" << oendl; } else { @@ -453,11 +461,11 @@ bool LoopControl::init( const QString& filename ) { void LoopControl::play() { - // qDebug("LC- play"); + // odebug << "LC- play" << oendl; mediaPlayerState->setPosition( 0); //uglyhack - + #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) { - disabledSuspendScreenSaver = TRUE; + disabledSuspendScreenSaver = TRUE; previousSuspendMode = hasVideoChannel; // Stop the screen from blanking and power saving state - QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) + QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |