Diffstat (limited to 'core/multimedia/opieplayer/libmad/libmadplugin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 1989b4a..428fc28 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -21,2 +21,14 @@ | |||
21 | 21 | ||
22 | #include "libmadplugin.h" | ||
23 | |||
24 | /* OPIE */ | ||
25 | #include <qpe/config.h> | ||
26 | #include <opie2/odebug.h> | ||
27 | |||
28 | /* QT */ | ||
29 | #include <qapplication.h> | ||
30 | #include <qmessagebox.h> | ||
31 | #include <qregexp.h> | ||
32 | |||
33 | /* STD */ | ||
22 | #include <stdio.h> | 34 | #include <stdio.h> |
@@ -36,8 +48,2 @@ | |||
36 | 48 | ||
37 | #include <qapplication.h> | ||
38 | #include <qmessagebox.h> | ||
39 | #include <qregexp.h> | ||
40 | |||
41 | #include <qpe/config.h> | ||
42 | |||
43 | // for network handling | 49 | // for network handling |
@@ -56,3 +62,2 @@ | |||
56 | #endif | 62 | #endif |
57 | #include "libmadplugin.h" | ||
58 | 63 | ||
@@ -384,3 +389,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
384 | if (len == -1) { | 389 | if (len == -1) { |
385 | // qDebug( "http_open: "+ QString(strerror(errno)) +"\n"); | 390 | // odebug << "http_open: "+ QString(strerror(errno)) +"\n" << oendl; |
386 | return 0; | 391 | return 0; |
@@ -398,3 +403,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
398 | if (strncmp(http_request + 4, "200 ", 4)) { | 403 | if (strncmp(http_request + 4, "200 ", 4)) { |
399 | // qDebug("http_open: " + QString(http_request) + "\n"); | 404 | // odebug << "http_open: " + QString(http_request) + "\n" << oendl; |
400 | return 0; | 405 | return 0; |
@@ -419,3 +424,3 @@ int LibMadPlugin::http_open(const QString& path ) { | |||
419 | 424 | ||
420 | // qDebug("Stream info: " + info); | 425 | // odebug << "Stream info: " + info << oendl; |
421 | 426 | ||
@@ -431,3 +436,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
431 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); | 436 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); |
432 | // qDebug("buffer size is %d", bufferSize); | 437 | // odebug << "buffer size is " << bufferSize << "" << oendl; |
433 | d->bad_last_frame = 0; | 438 | d->bad_last_frame = 0; |
@@ -436,3 +441,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
436 | 441 | ||
437 | //qDebug( "Opening %s", path.latin1() ); | 442 | //odebug << "Opening " << path << "" << oendl; |
438 | 443 | ||
@@ -452,3 +457,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
452 | if (d->input.fd == -1) { | 457 | if (d->input.fd == -1) { |
453 | // qDebug("error opening %s", d->input.path ); | 458 | // odebug << "error opening " << d->input.path << "" << oendl; |
454 | return FALSE; | 459 | return FALSE; |
@@ -458,3 +463,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
458 | if (fstat(d->input.fd, &stat) == -1) { | 463 | if (fstat(d->input.fd, &stat) == -1) { |
459 | // qDebug("error calling fstat"); return FALSE; | 464 | // odebug << "error calling fstat" << oendl; return FALSE; |
460 | } | 465 | } |
@@ -470,3 +475,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
470 | if (d->input.fdm == 0) { | 475 | if (d->input.fdm == 0) { |
471 | // qDebug("error mmapping file"); return FALSE; | 476 | // odebug << "error mmapping file" << oendl; return FALSE; |
472 | } | 477 | } |
@@ -479,3 +484,3 @@ bool LibMadPlugin::open( const QString& path ) { | |||
479 | if (d->input.data == 0) { | 484 | if (d->input.data == 0) { |
480 | // qDebug("error allocating input buffer"); | 485 | // odebug << "error allocating input buffer" << oendl; |
481 | return FALSE; | 486 | return FALSE; |
@@ -507,3 +512,3 @@ bool LibMadPlugin::close() { | |||
507 | if (unmap_file(d->input.fdm, d->input.length) == -1) { | 512 | if (unmap_file(d->input.fdm, d->input.length) == -1) { |
508 | // qDebug("error munmapping file"); | 513 | // odebug << "error munmapping file" << oendl; |
509 | result = FALSE; | 514 | result = FALSE; |
@@ -521,3 +526,3 @@ bool LibMadPlugin::close() { | |||
521 | if (::close(d->input.fd) == -1) { | 526 | if (::close(d->input.fd) == -1) { |
522 | // qDebug("error closing file %s", d->input.path); | 527 | // odebug << "error closing file " << d->input.path << "" << oendl; |
523 | result = FALSE; | 528 | result = FALSE; |
@@ -547,3 +552,3 @@ int LibMadPlugin::audioChannels( int ) { | |||
547 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 552 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
548 | qDebug( "LibMadPlugin::audioChannels: %i", d->frame.header.mode > 0 ? 2 : 1 ); | 553 | odebug << "LibMadPlugin::audioChannels: " << d->frame.header.mode > 0 ? 2 : 1 << "" << oendl; |
549 | return d->frame.header.mode > 0 ? 2 : 1; | 554 | return d->frame.header.mode > 0 ? 2 : 1; |
@@ -557,3 +562,3 @@ int LibMadPlugin::audioFrequency( int ) { | |||
557 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); | 562 | long t; short t1[5]; audioReadSamples( t1, 2, 1, t, 0 ); |
558 | // qDebug( "LibMadPlugin::audioFrequency: %i", d->frame.header.samplerate ); | 563 | // odebug << "LibMadPlugin::audioFrequency: " << d->frame.header.samplerate << "" << oendl; |
559 | return d->frame.header.samplerate; | 564 | return d->frame.header.samplerate; |
@@ -568,4 +573,3 @@ int LibMadPlugin::audioSamples( int ) { | |||
568 | /* | 573 | /* |
569 | qDebug( "LibMadPlugin::audioSamples: %i*%i", d->frame.header.duration.seconds, | 574 | odebug << "LibMadPlugin::audioSamples: " << d->frame.header.duration.seconds << "*" << d->frame.header.samplerate << oendl; |
570 | d->frame.header.samplerate ); | ||
571 | return d->frame.header.duration.seconds * d->frame.header.samplerate; | 575 | return d->frame.header.duration.seconds * d->frame.header.samplerate; |
@@ -578,3 +582,3 @@ int LibMadPlugin::audioSamples( int ) { | |||
578 | // (int)d->frame.header.samplerate, (int)d->frame.header.bitrate ); | 582 | // (int)d->frame.header.samplerate, (int)d->frame.header.bitrate ); |
579 | // qDebug( "LibMadPlugin::audioSamples: %i", samples ); | 583 | // odebug << "LibMadPlugin::audioSamples: " << samples << "" << oendl; |
580 | 584 | ||
@@ -594,3 +598,3 @@ bool LibMadPlugin::audioSetSample( long, int ) { | |||
594 | // // Seek to requested position | 598 | // // Seek to requested position |
595 | // qDebug( "seek pos: %i", (int)((double)pos * d->input.fileLength / totalSamples) ); | 599 | // odebug << "seek pos: " << (int)((double)pos * d->input.fileLength / totalSamples) << "" << oendl; |
596 | // ::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 ); |
@@ -682,3 +686,3 @@ bool LibMadPlugin::read() { | |||
682 | if (len == -1) { | 686 | if (len == -1) { |
683 | // qDebug("error reading audio"); | 687 | // odebug << "error reading audio" << oendl; |
684 | return FALSE; | 688 | return FALSE; |
@@ -760,3 +764,3 @@ bool LibMadPlugin::decode( short *output, long samples, long& samplesMade ) { | |||
760 | mad_frame_mute(&d->frame); | 764 | mad_frame_mute(&d->frame); |
761 | // qDebug( "error decoding, bad crc" ); | 765 | // odebug << "error decoding, bad crc" << oendl; |
762 | } | 766 | } |
@@ -823,3 +827,3 @@ double LibMadPlugin::getTime() { | |||
823 | void LibMadPlugin::printID3Tags() { | 827 | void LibMadPlugin::printID3Tags() { |
824 | // qDebug( "LibMadPlugin::printID3Tags" ); | 828 | // odebug << "LibMadPlugin::printID3Tags" << oendl; |
825 | 829 | ||
@@ -828,3 +832,3 @@ void LibMadPlugin::printID3Tags() { | |||
828 | if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { | 832 | if ( ::lseek( d->input.fd, -128, SEEK_END ) == -1 ) { |
829 | // qDebug( "error seeking to id3 tags" ); | 833 | // odebug << "error seeking to id3 tags" << oendl; |
830 | return; | 834 | return; |
@@ -833,3 +837,3 @@ void LibMadPlugin::printID3Tags() { | |||
833 | if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { | 837 | if ( ::read( d->input.fd, id3v1, 128 ) != 128 ) { |
834 | // qDebug( "error reading in id3 tags" ); | 838 | // odebug << "error reading in id3 tags" << oendl; |
835 | return; | 839 | return; |
@@ -843,3 +847,3 @@ void LibMadPlugin::printID3Tags() { | |||
843 | char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; | 847 | char *ptr = id3v1 + 3, *ptr2 = ptr + len[0]; |
844 | // qDebug( "ID3 tags in file:" ); | 848 | // odebug << "ID3 tags in file:" << oendl; |
845 | info = ""; | 849 | info = ""; |
@@ -855,3 +859,3 @@ void LibMadPlugin::printID3Tags() { | |||
855 | } | 859 | } |
856 | // qDebug( info.latin1() ); | 860 | // odebug << info.latin1() << oendl; |
857 | *ptr3 = push2; | 861 | *ptr3 = push2; |
@@ -864,3 +868,3 @@ void LibMadPlugin::printID3Tags() { | |||
864 | if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { | 868 | if ( ::lseek(d->input.fd, 0, SEEK_SET) == -1 ) { |
865 | // qDebug( "error seeking back to beginning" ); | 869 | // odebug << "error seeking back to beginning" << oendl; |
866 | return; | 870 | return; |