summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
index 428fc28..7438a45 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
@@ -517,130 +517,130 @@ bool LibMadPlugin::close() {
517 d->input.data = 0; 517 d->input.data = 0;
518 } 518 }
519#endif 519#endif
520 520
521 if (d->input.data) { 521 if (d->input.data) {
522 free(d->input.data); 522 free(d->input.data);
523 d->input.data = 0; 523 d->input.data = 0;
524 } 524 }
525 525
526 if (::close(d->input.fd) == -1) { 526 if (::close(d->input.fd) == -1) {
527 // odebug << "error closing file " << d->input.path << "" << oendl; 527 // odebug << "error closing file " << d->input.path << "" << oendl;
528 result = FALSE; 528 result = FALSE;
529 } 529 }
530 530
531 d->input.fd = 0; 531 d->input.fd = 0;
532 532
533 return result; 533 return result;
534} 534}
535 535
536 536
537bool LibMadPlugin::isOpen() { 537bool LibMadPlugin::isOpen() {
538 debugMsg( "LibMadPlugin::isOpen" ); 538 debugMsg( "LibMadPlugin::isOpen" );
539 return ( d->input.fd != 0 ); 539 return ( d->input.fd != 0 );
540} 540}
541 541
542 542
543int LibMadPlugin::audioStreams() { 543int LibMadPlugin::audioStreams() {
544 debugMsg( "LibMadPlugin::audioStreams" ); 544 debugMsg( "LibMadPlugin::audioStreams" );
545 return 1; 545 return 1;
546} 546}
547 547
548 548
549int LibMadPlugin::audioChannels( int ) { 549int LibMadPlugin::audioChannels( int ) {
550 debugMsg( "LibMadPlugin::audioChannels" ); 550 debugMsg( "LibMadPlugin::audioChannels" );
551/* 551/*
552 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); 552 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 );
553 odebug << "LibMadPlugin::audioChannels: " << d->frame.header.mode > 0 ? 2 : 1 << "" << oendl; 553 odebug << "LibMadPlugin::audioChannels: " << d->frame.header.mode > 0 ? 2 : 1 << "" << oendl;
554 return d->frame.header.mode > 0 ? 2 : 1; 554 return d->frame.header.mode > 0 ? 2 : 1;
555*/ 555*/
556 return 2; 556 return 2;
557} 557}
558 558
559 559
560int LibMadPlugin::audioFrequency( int ) { 560int LibMadPlugin::audioFrequency( int ) {
561 debugMsg( "LibMadPlugin::audioFrequency" ); 561 debugMsg( "LibMadPlugin::audioFrequency" );
562 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); 562 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 );
563 // odebug << "LibMadPlugin::audioFrequency: " << d->frame.header.samplerate << "" << oendl; 563 // odebug << "LibMadPlugin::audioFrequency: " << d->frame.header.samplerate << "" << oendl;
564 return d->frame.header.samplerate; 564 return d->frame.header.samplerate;
565} 565}
566 566
567 567
568int LibMadPlugin::audioSamples( int ) { 568int LibMadPlugin::audioSamples( int ) {
569 debugMsg( "LibMadPlugin::audioSamples" ); 569 debugMsg( "LibMadPlugin::audioSamples" );
570 570
571 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); 571 long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 );
572 mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream ); 572 mad_header_decode( (struct mad_header *)&d->frame.header, &d->stream );
573/* 573/*
574 odebug << "LibMadPlugin::audioSamples: " << d->frame.header.duration.seconds << "*" << d->frame.header.samplerate << oendl; 574 odebug << "LibMadPlugin::audioSamples: " << d->frame.header.duration.seconds << "*" << d->frame.header.samplerate << oendl;
575 return d->frame.header.duration.seconds * d->frame.header.samplerate; 575 return d->frame.header.duration.seconds * d->frame.header.samplerate;
576*/ 576*/
577 if ( d->frame.header.bitrate == 0 ) 577 if ( d->frame.header.bitrate == 0 )
578 return 0; 578 return 0;
579 int samples = (d->input.fileLength / (d->frame.header.bitrate/8)) * d->frame.header.samplerate; 579 int samples = (d->input.fileLength / (d->frame.header.bitrate/8)) * d->frame.header.samplerate;
580 580
581 // qDebug( "LibMadPlugin::audioSamples: %i * %i * 8 / %i", (int)d->input.fileLength, 581 // odebug << "LibMadPlugin::audioSamples: " << (int)d->input.fileLength
582 // (int)d->frame.header.samplerate, (int)d->frame.header.bitrate ); 582 // << " * " << (int)d->frame.header.samplerate << " * 8 / " << (int)d->frame.header.bitrate << oendl;
583 // odebug << "LibMadPlugin::audioSamples: " << samples << "" << oendl; 583 // odebug << "LibMadPlugin::audioSamples: " << samples << "" << oendl;
584 584
585 return samples; 585 return samples;
586 586
587// return 10000000; 587// return 10000000;
588} 588}
589 589
590 590
591bool LibMadPlugin::audioSetSample( long, int ) { 591bool LibMadPlugin::audioSetSample( long, int ) {
592 debugMsg( "LibMadPlugin::audioSetSample" ); 592 debugMsg( "LibMadPlugin::audioSetSample" );
593 593
594// long totalSamples = audioSamples(0); 594// long totalSamples = audioSamples(0);
595// if ( totalSamples <= 1 ) 595// if ( totalSamples <= 1 )
596// return FALSE; 596// return FALSE;
597 597
598// // Seek to requested position 598// // Seek to requested position
599// odebug << "seek pos: " << (int)((double)pos * d->input.fileLength / totalSamples) << "" << oendl; 599// odebug << "seek pos: " << (int)((double)pos * d->input.fileLength / totalSamples) << "" << oendl;
600// ::lseek( d->input.fd, (long)((double)pos * d->input.fileLength / totalSamples), SEEK_SET ); 600// ::lseek( d->input.fd, (long)((double)pos * d->input.fileLength / totalSamples), SEEK_SET );
601// mad_stream_sync(&d->stream); 601// mad_stream_sync(&d->stream);
602 602
603// mad_stream_init(&d->stream); 603// mad_stream_init(&d->stream);
604// mad_frame_init(&d->frame); 604// mad_frame_init(&d->frame);
605// mad_synth_init(&d->synth); 605// mad_synth_init(&d->synth);
606 606
607// return TRUE; 607// return TRUE;
608 debugMsg( "LibMadPlugin::audioSetSample" ); 608 debugMsg( "LibMadPlugin::audioSetSample" );
609 return FALSE; 609 return FALSE;
610} 610}
611 611
612 612
613long LibMadPlugin::audioGetSample( int ) { 613long LibMadPlugin::audioGetSample( int ) {
614 debugMsg( "LibMadPlugin::audioGetSample" ); 614 debugMsg( "LibMadPlugin::audioGetSample" );
615 return 0; 615 return 0;
616} 616}
617 617
618/* 618/*
619bool LibMadPlugin::audioReadSamples( short *, int, long, int ) { 619bool LibMadPlugin::audioReadSamples( short *, int, long, int ) {
620debugMsg( "LibMadPlugin::audioReadSamples" ); 620debugMsg( "LibMadPlugin::audioReadSamples" );
621return FALSE; 621return FALSE;
622} 622}
623 623
624 624
625bool LibMadPlugin::audioReReadSamples( short *, int, long, int ) { 625bool LibMadPlugin::audioReReadSamples( short *, int, long, int ) {
626debugMsg( "LibMadPlugin::audioReReadSamples" ); 626debugMsg( "LibMadPlugin::audioReReadSamples" );
627 return FALSE; 627 return FALSE;
628 } 628 }
629*/ 629*/
630 630
631bool LibMadPlugin::read() { 631bool LibMadPlugin::read() {
632 debugMsg( "LibMadPlugin::read" ); 632 debugMsg( "LibMadPlugin::read" );
633 int len; 633 int len;
634 634
635 if (d->input.eof) 635 if (d->input.eof)
636 return FALSE; 636 return FALSE;
637 637
638#if defined(HAVE_MMAP) 638#if defined(HAVE_MMAP)
639 if (d->input.fdm) { 639 if (d->input.fdm) {
640 unsigned long skip = 0; 640 unsigned long skip = 0;
641 641
642 if (d->stream.next_frame) { 642 if (d->stream.next_frame) {
643 struct stat stat; 643 struct stat stat;
644 644
645 if (fstat(d->input.fd, &stat) == -1) 645 if (fstat(d->input.fd, &stat) == -1)
646 return FALSE; 646 return FALSE;