summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp8
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp4
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.cpp2
3 files changed, 7 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
index b2b876f..9d04f7e 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
@@ -472,77 +472,77 @@ bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) {
472 samplesMade = samples; 472 samplesMade = samples;
473 memmove( buffer[0], &(buffer[0][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); 473 memmove( buffer[0], &(buffer[0][samples]), (buffered - samples) * sizeof(mad_fixed_t) );
474 if ( d->synth.pcm.channels == 2 ) 474 if ( d->synth.pcm.channels == 2 )
475 memmove( buffer[1], &(buffer[1][samples]), (buffered - samples) * sizeof(mad_fixed_t) ); 475 memmove( buffer[1], &(buffer[1][samples]), (buffered - samples) * sizeof(mad_fixed_t) );
476 buffered -= samples; 476 buffered -= samples;
477 477
478 return TRUE; 478 return TRUE;
479} 479}
480 480
481/* 481/*
482bool LibMadPlugin::audioReadMonoSamples( short *, long, long&, int ) { 482bool LibMadPlugin::audioReadMonoSamples( short *, long, long&, int ) {
483 debugMsg( "LibMadPlugin::audioReadMonoSamples" ); 483 debugMsg( "LibMadPlugin::audioReadMonoSamples" );
484 return FALSE; 484 return FALSE;
485} 485}
486 486
487 487
488bool LibMadPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) { 488bool LibMadPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) {
489*/ 489*/
490bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long samples, long& samplesMade, int ) { 490bool LibMadPlugin::audioReadSamples( short *output, int /*channels*/, long samples, long& samplesMade, int ) {
491 debugMsg( "LibMadPlugin::audioReadStereoSamples" ); 491 debugMsg( "LibMadPlugin::audioReadStereoSamples" );
492 492
493 static bool needInput = TRUE; 493 static bool needInput = TRUE;
494 494
495 if ( samples == 0 ) 495 if ( samples == 0 )
496 return TRUE; 496 return FALSE;
497 497
498 do { 498 do {
499 if ( needInput ) 499 if ( needInput )
500 if ( !read() ) { 500 if ( !read() ) {
501 // if ( d->input.eof ) 501 // if ( d->input.eof )
502 // needInput = FALSE; 502 // needInput = FALSE;
503 // else 503 // else
504 return TRUE; 504 return FALSE;
505 } 505 }
506 506
507 needInput = FALSE; 507 needInput = FALSE;
508 508
509 if ( decode( output, samples, samplesMade ) ) 509 if ( decode( output, samples, samplesMade ) )
510 return FALSE; 510 return TRUE;
511 else 511 else
512 needInput = TRUE; 512 needInput = TRUE;
513 } 513 }
514 while ( ( samplesMade < samples ) && ( !d->input.eof ) ); 514 while ( ( samplesMade < samples ) && ( !d->input.eof ) );
515/* 515/*
516 static bool firstTimeThru = TRUE; 516 static bool firstTimeThru = TRUE;
517 517
518 if ( firstTimeThru ) { 518 if ( firstTimeThru ) {
519 firstTimeThru = FALSE; 519 firstTimeThru = FALSE;
520 decode( output, samples, samplesMade ); 520 decode( output, samples, samplesMade );
521 return FALSE; 521 return FALSE;
522 } else 522 } else
523*/ 523*/
524 return TRUE; 524 return FALSE;
525} 525}
526 526
527 527
528double LibMadPlugin::getTime() { 528double LibMadPlugin::getTime() {
529 debugMsg( "LibMadPlugin::getTime" ); 529 debugMsg( "LibMadPlugin::getTime" );
530 return 0.0; 530 return 0.0;
531} 531}
532 532
533 533
534void LibMadPlugin::printID3Tags() { 534void LibMadPlugin::printID3Tags() {
535 debugMsg( "LibMadPlugin::printID3Tags" ); 535 debugMsg( "LibMadPlugin::printID3Tags" );
536 536
537 char id3v1[128 + 1]; 537 char id3v1[128 + 1];
538 538
539 if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { 539 if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) {
540 qDebug( "error seeking to id3 tags" ); 540 qDebug( "error seeking to id3 tags" );
541 return; 541 return;
542 } 542 }
543 543
544 if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { 544 if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) {
545 qDebug( "error reading in id3 tags" ); 545 qDebug( "error reading in id3 tags" );
546 return; 546 return;
547 } 547 }
548 548
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp
index 93a6e3f..6dfd057 100644
--- a/core/multimedia/opieplayer/loopcontrol.cpp
+++ b/core/multimedia/opieplayer/loopcontrol.cpp
@@ -207,64 +207,64 @@ void LoopControl::startVideo() {
207 207
208 moreVideo = FALSE; 208 moreVideo = FALSE;
209 killTimer( videoId ); 209 killTimer( videoId );
210 210
211 } 211 }
212 212
213 } 213 }
214} 214}
215 215
216 216
217void LoopControl::startAudio() { 217void LoopControl::startAudio() {
218 218
219 audioMutex->lock(); 219 audioMutex->lock();
220 220
221 if ( moreAudio ) { 221 if ( moreAudio ) {
222 222
223 if ( !isMuted && mediaPlayerState->curDecoder() ) { 223 if ( !isMuted && mediaPlayerState->curDecoder() ) {
224 224
225 currentSample = audioSampleCounter + 1; 225 currentSample = audioSampleCounter + 1;
226 226
227 if ( currentSample != audioSampleCounter + 1 ) 227 if ( currentSample != audioSampleCounter + 1 )
228 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter); 228 qDebug("out of sync with decoder %i %i", currentSample, audioSampleCounter);
229 229
230 long samplesRead = 0; 230 long samplesRead = 0;
231 mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream ); 231 bool readOk=mediaPlayerState->curDecoder()->audioReadSamples( (short*)audioBuffer, channels, 1024, samplesRead, stream );
232 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000; 232 long sampleWeShouldBeAt = long( playtime.elapsed() ) * freq / 1000;
233 long sampleWaitTime = currentSample - sampleWeShouldBeAt; 233 long sampleWaitTime = currentSample - sampleWeShouldBeAt;
234 234
235 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) { 235 if ( ( sampleWaitTime > 2000 ) && ( sampleWaitTime < 20000 ) ) {
236 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) ); 236 usleep( (long)((double)sampleWaitTime * 1000000.0 / freq) );
237 } else if ( sampleWaitTime <= -5000 ) { 237 } else if ( sampleWaitTime <= -5000 ) {
238 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt ); 238 qDebug("need to catch up by: %li (%i,%li)", -sampleWaitTime, currentSample, sampleWeShouldBeAt );
239 //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream ); 239 //mediaPlayerState->curDecoder()->audioSetSample( sampleWeShouldBeAt, stream );
240 currentSample = sampleWeShouldBeAt; 240 currentSample = sampleWeShouldBeAt;
241 } 241 }
242 242
243 audioDevice->write( audioBuffer, samplesRead * 2 * channels ); 243 audioDevice->write( audioBuffer, samplesRead * 2 * channels );
244 audioSampleCounter = currentSample + samplesRead - 1; 244 audioSampleCounter = currentSample + samplesRead - 1;
245 245
246 moreAudio = audioSampleCounter <= total_audio_samples; 246 moreAudio = readOk && (audioSampleCounter <= total_audio_samples);
247 247
248 } else { 248 } else {
249 249
250 moreAudio = FALSE; 250 moreAudio = FALSE;
251 251
252 } 252 }
253 253
254 } 254 }
255 255
256 audioMutex->unlock(); 256 audioMutex->unlock();
257} 257}
258 258
259 259
260void LoopControl::killTimers() { 260void LoopControl::killTimers() {
261 261
262 audioMutex->lock(); 262 audioMutex->lock();
263 263
264 if ( hasVideoChannel ) 264 if ( hasVideoChannel )
265 killTimer( videoId ); 265 killTimer( videoId );
266 killTimer( sliderId ); 266 killTimer( sliderId );
267 threadOkToGo = FALSE; 267 threadOkToGo = FALSE;
268 268
269 audioMutex->unlock(); 269 audioMutex->unlock();
270} 270}
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
index 60a0024..a6bd974 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.cpp
@@ -302,33 +302,33 @@ bool WavPlugin::audioReadSamples( short *, int, long, int ) {
302 return FALSE; 302 return FALSE;
303} 303}
304 304
305 305
306bool WavPlugin::audioReReadSamples( short *, int, long, int ) { 306bool WavPlugin::audioReReadSamples( short *, int, long, int ) {
307 debugMsg( "WavPlugin::audioReReadSamples" ); 307 debugMsg( "WavPlugin::audioReReadSamples" );
308 return FALSE; 308 return FALSE;
309} 309}
310 310
311 311
312bool WavPlugin::audioReadMonoSamples( short *output, long samples, long& samplesMade, int ) { 312bool WavPlugin::audioReadMonoSamples( short *output, long samples, long& samplesMade, int ) {
313 debugMsg( "WavPlugin::audioReadMonoSamples" ); 313 debugMsg( "WavPlugin::audioReadMonoSamples" );
314 return !d->add( output, samples, samplesMade, FALSE ); 314 return !d->add( output, samples, samplesMade, FALSE );
315} 315}
316 316
317 317
318bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) { 318bool WavPlugin::audioReadStereoSamples( short *output, long samples, long& samplesMade, int ) {
319 debugMsg( "WavPlugin::audioReadStereoSamples" ); 319 debugMsg( "WavPlugin::audioReadStereoSamples" );
320 return !d->add( output, samples, samplesMade, TRUE ); 320 return !d->add( output, samples, samplesMade, TRUE );
321} 321}
322*/ 322*/
323 323
324bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) { 324bool WavPlugin::audioReadSamples( short *output, int channels, long samples, long& samplesMade, int ) {
325 debugMsg( "WavPlugin::audioReadSamples" ); 325 debugMsg( "WavPlugin::audioReadSamples" );
326 return !d->add( output, samples, samplesMade, channels != 1 ); 326 return d->add( output, samples, samplesMade, channels != 1 );
327} 327}
328 328
329double WavPlugin::getTime() { 329double WavPlugin::getTime() {
330 debugMsg( "WavPlugin::getTime" ); 330 debugMsg( "WavPlugin::getTime" );
331 return 0.0; 331 return 0.0;
332} 332}
333 333
334 334