summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/loopcontrol_threaded.cpp
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol_threaded.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/loopcontrol_threaded.cpp54
1 files changed, 30 insertions, 24 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol_threaded.cpp b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
index 0a1fc17..9a162c2 100644
--- a/core/multimedia/opieplayer/loopcontrol_threaded.cpp
+++ b/core/multimedia/opieplayer/loopcontrol_threaded.cpp
@@ -20,12 +20,26 @@
#define _REENTRANT
+#include "mediaplayerplugininterface.h"
+#include "loopcontrol.h"
+#include "audiodevice.h"
+#include "videowidget.h"
+#include "audiowidget.h"
+#include "mediaplayerstate.h"
+
+/* OPIE */
#include <qpe/qpeapplication.h>
#include <qpe/custom.h>
-#include <qimage.h>
-#include <qpainter.h>
+
#if !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
-#include "mediaplayerplugininterface.h"
+
+#include <opie2/odebug.h>
+
+/* QT */
+#include <qimage.h>
+#include <qpainter.h>
+
+/* STD */
#include <stdio.h>
#include <stdlib.h>
@@ -34,12 +48,4 @@
#include <unistd.h>
#include <pthread.h>
-#include "loopcontrol.h"
-#include "audiodevice.h"
-#include "videowidget.h"
-#include "audiowidget.h"
-#include "mediaplayerstate.h"
-
-
-
@@ -192,5 +198,5 @@ void LoopControl::setPosition( long pos ) {
videoMutex->lock();
audioMutex->lock();
- //qDebug("setting position");
+ //odebug << "setting position" << oendl;
playtime.restart();
playtime = playtime.addMSecs( -pos * 1000 / framerate );
@@ -293,5 +299,5 @@ void LoopControl::startVideo() {
} while ( !done );
-// qDebug("elapsed: %i %i (%f)", int( playtime.elapsed() ), current_frame, framerate );
+// odebug << "elapsed: " << int( playtime.elapsed() ) << " " << current_frame << " (" << framerate << ")" << oendl;
} else {
@@ -308,5 +314,5 @@ void LoopControl::startVideo() {
videoMutex->lock();
if ( current_frame > prev_frame + 1 ) {
- // qDebug("skipped a frame");
+ // odebug << "skipped a frame" << oendl;
mediaPlayerState->curDecoder()->videoSetFrame( current_frame, stream );
}
@@ -342,5 +348,5 @@ 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;
audioMutex->unlock();
@@ -366,10 +372,10 @@ void LoopControl::startAudio() {
if ( sampleWaitTime >= 0 && sampleWaitTime <= 2000 ) {
- //qDebug("sampleWaitTime: %i", sampleWaitTime);
+ //odebug << "sampleWaitTime: " << sampleWaitTime << "" << oendl;
usleep( ( sampleWaitTime * 1000000 ) / ( freq ) );
} else {
audioMutex->lock();
if ( sampleWaitTime <= -2000 ) {
- // 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 );
currentSample = sampleWeShouldBeAt;
@@ -388,6 +394,6 @@ void LoopControl::startAudio() {
emitChangePos = TRUE;
- //qDebug("currentSample: %i audioSampleCounter: %i total_audio_samples: %i", currentSample, audioSampleCounter, total_audio_samples);
-// qDebug("current: %i counter: %i total: %i", currentSample, audioSampleCounter, (int)total_audio_samples);
+ //odebug << "currentSample: " << currentSample << " audioSampleCounter: " << audioSampleCounter << " total_audio_samples: " << total_audio_samples << "" << oendl;
+// odebug << "current: " << currentSample << " counter: " << audioSampleCounter << " total: " << (int)total_audio_samples << "" << oendl;
moreAudio = audioSampleCounter <= total_audio_samples;
@@ -402,5 +408,5 @@ void LoopControl::startAudio() {
}
- // qDebug( "End of file" );
+ // odebug << "End of file" << oendl;
if ( !moreVideo && !moreAudio )
@@ -416,5 +422,5 @@ void LoopControl::killTimers() {
void *thread_result = 0;
if ( pthread_join(video_tid,&thread_result) != 0 )
- // qDebug("thread join error 1");
+ // odebug << "thread join error 1" << oendl;
pthread_attr_destroy(&video_attr);
}
@@ -426,5 +432,5 @@ void LoopControl::killTimers() {
void *thread_result = 0;
if ( pthread_join(audio_tid,&thread_result) != 0 )
- // qDebug("thread join error 2");
+ // odebug << "thread join error 2" << oendl;
pthread_attr_destroy(&audio_attr);
}
@@ -448,5 +454,5 @@ void LoopControl::startTimers() {
#ifdef USE_REALTIME_AUDIO_THREAD
pthread_attr_setschedpolicy(&audio_attr,SCHED_RR); // Real-time round robin
- //qDebug("min: %i, max: %i", sched_get_priority_min( SCHED_RR ), sched_get_priority_max( SCHED_RR ) );
+ //odebug << "min: " << sched_get_priority_min( SCHED_RR ) << ", max: " << sched_get_priority_max( SCHED_RR ) << "" << oendl;
sched_param params;
params.sched_priority = 50;
@@ -513,5 +519,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