summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/loopcontrol.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/loopcontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 8cf0a75..82242a3 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -100,7 +100,7 @@ LoopControl::LoopControl( QObject *parent, const char *name )
100 : QObject( parent, name ) { 100 : QObject( parent, name ) {
101 isMuted = FALSE; 101 isMuted = FALSE;
102 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) ); 102 connect( qApp, SIGNAL( volumeChanged(bool) ), this, SLOT( setMute(bool) ) );
103qDebug("starting loopcontrol"); 103 //qDebug("starting loopcontrol");
104 audioMutex = new Mutex; 104 audioMutex = new Mutex;
105 105
106 pthread_attr_init(&audio_attr); 106 pthread_attr_init(&audio_attr);
@@ -112,12 +112,12 @@ qDebug("starting loopcontrol");
112 params.sched_priority = 50; 112 params.sched_priority = 50;
113 pthread_attr_setschedparam(&audio_attr,&params); 113 pthread_attr_setschedparam(&audio_attr,&params);
114 } else { 114 } else {
115 qDebug( "Error setting up a realtime thread, reverting to using a normal thread." ); 115 // qDebug( "Error setting up a realtime thread, reverting to using a normal thread." );
116 pthread_attr_destroy(&audio_attr); 116 pthread_attr_destroy(&audio_attr);
117 pthread_attr_init(&audio_attr); 117 pthread_attr_init(&audio_attr);
118 } 118 }
119#endif 119#endif
120qDebug("create audio thread"); 120 //qDebug("create audio thread");
121 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this); 121 pthread_create(&audio_tid, &audio_attr, (void * (*)(void *))startAudioThread, this);
122} 122}
123 123
@@ -227,8 +227,8 @@ void LoopControl::startAudio() {
227 227
228 currentSample = audioSampleCounter + 1; 228 currentSample = audioSampleCounter + 1;
229 229
230 if ( currentSample != audioSampleCounter + 1 ) 230// if ( currentSample != audioSampleCounter + 1 )
231 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); 231// qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter);
232 232
233 long samplesRead = 0; 233 long samplesRead = 0;
234 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); 234 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
@@ -241,7 +241,7 @@ void LoopControl::startAudio() {
241 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); 241 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
242 } 242 }
243 else if ( sampleWaitTime <= -5000 ) { 243 else if ( sampleWaitTime <= -5000 ) {
244 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 244 // qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
245 // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 245 // //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
246 currentSample = sampleWeShouldBeAt; 246 currentSample = sampleWeShouldBeAt;
247 } 247 }
@@ -361,7 +361,7 @@ bool LoopControl::init( const QString& filename ) {
361 stream = 0; // only play stream 0 for now 361 stream = 0; // only play stream 0 for now
362 current_frame = total_video_frames = total_audio_samples = 0; 362 current_frame = total_video_frames = total_audio_samples = 0;
363 363
364 qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() ); 364 // qDebug( "Using the %s decoder", mediaPlayerState->curDecoder()->pluginName() );
365 365
366 // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin 366 // ### Hack to use libmpeg3plugin to get the number of audio samples if we are using the libmad plugin
367// if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) { 367// if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibMadPlugin") ) {
@@ -387,23 +387,23 @@ bool LoopControl::init( const QString& filename ) {
387 else 387 else
388 channels = mediaPlayerState->curDecoder()->audioChannels( astream ); 388 channels = mediaPlayerState->curDecoder()->audioChannels( astream );
389 389
390 qDebug( "LC- channels = %d", channels ); 390 // qDebug( "LC- channels = %d", channels );
391 391
392// if ( !total_audio_samples ) 392// if ( !total_audio_samples )
393 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream ); 393 total_audio_samples = mediaPlayerState->curDecoder()->audioSamples( astream );
394 394
395 total_audio_samples += 1000; 395 total_audio_samples += 1000;
396 qDebug("total samples %d", total_audio_samples); 396 // qDebug("total samples %d", total_audio_samples);
397 mediaPlayerState->setLength( total_audio_samples ); 397 mediaPlayerState->setLength( total_audio_samples );
398 398
399 freq = mediaPlayerState->curDecoder()->audioFrequency( astream ); 399 freq = mediaPlayerState->curDecoder()->audioFrequency( astream );
400 qDebug( "LC- frequency = %d", freq ); 400 // qDebug( "LC- frequency = %d", freq );
401 401
402 audioSampleCounter = 0; 402 audioSampleCounter = 0;
403 int bits_per_sample; 403 int bits_per_sample;
404 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) { 404 if ( mediaPlayerState->curDecoder()->pluginName() == QString("LibWavPlugin") ) {
405 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime(); 405 bits_per_sample =(int) mediaPlayerState->curDecoder()->getTime();
406 qDebug("using stupid hack"); 406 // qDebug("using stupid hack");
407 } else { 407 } else {
408 bits_per_sample=0; 408 bits_per_sample=0;
409 } 409 }
@@ -451,7 +451,7 @@ bool LoopControl::init( const QString& filename ) {
451 451
452 452
453void LoopControl::play() { 453void LoopControl::play() {
454 qDebug("LC- play"); 454 // qDebug("LC- play");
455 mediaPlayerState->setPosition( 0); //uglyhack 455 mediaPlayerState->setPosition( 0); //uglyhack
456 456
457#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 457#if defined(Q_WS_QWS) && !defined(QT_NO_COP)