summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
index 3df23249..9a1ab2a 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp
@@ -34,24 +34,25 @@
34#include <math.h> 34#include <math.h>
35#include <assert.h> 35#include <assert.h>
36 36
37#include <qapplication.h> 37#include <qapplication.h>
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39#include <qregexp.h> 39#include <qregexp.h>
40 40
41#include <qpe/config.h> 41#include <qpe/config.h>
42 42
43// for network handling 43// for network handling
44#include <netinet/in.h> 44#include <netinet/in.h>
45#include <netdb.h> 45#include <netdb.h>
46#include <linux/limits.h>
46#include <sys/socket.h> 47#include <sys/socket.h>
47#include <arpa/inet.h> 48#include <arpa/inet.h>
48#include <unistd.h> 49#include <unistd.h>
49 50
50 51
51//#define HAVE_MMAP 52//#define HAVE_MMAP
52 53
53#if defined(HAVE_MMAP) 54#if defined(HAVE_MMAP)
54# include <sys/mman.h> 55# include <sys/mman.h>
55#endif 56#endif
56#include "libmadplugin.h" 57#include "libmadplugin.h"
57 58
@@ -425,49 +426,42 @@ int LibMadPlugin::http_open(const QString& path ) {
425bool LibMadPlugin::open( const QString& path ) { 426bool LibMadPlugin::open( const QString& path ) {
426 debugMsg( "LibMadPlugin::open" ); 427 debugMsg( "LibMadPlugin::open" );
427 Config cfg("OpiePlayer"); 428 Config cfg("OpiePlayer");
428 cfg.setGroup("Options"); 429 cfg.setGroup("Options");
429 bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); 430 bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE);
430 qDebug("buffer size is %d", bufferSize); 431 qDebug("buffer size is %d", bufferSize);
431 d->bad_last_frame = 0; 432 d->bad_last_frame = 0;
432 d->flush = TRUE; 433 d->flush = TRUE;
433 info = QString( "" ); 434 info = QString( "" );
434 435
435 //qDebug( "Opening %s", path.latin1() ); 436 //qDebug( "Opening %s", path.latin1() );
436 437
437
438 if (path.left( 4 ) == "http" ) { 438 if (path.left( 4 ) == "http" ) {
439 qDebug("Test2");
440 // in case of any error we get 0 here 439 // in case of any error we get 0 here
441 if ( !(http_open(path) == 0) ) { 440 if ( !(http_open(path) == 0) ) {
442 qDebug("Test3");
443 d->input.fd = http_open(path); 441 d->input.fd = http_open(path);
444 } else { 442 } else {
445 qDebug("Test5");
446 return FALSE; 443 return FALSE;
447 } 444 }
448 } else { 445 } else {
449 qDebug("Test4");
450 d->input.path = path.latin1(); 446 d->input.path = path.latin1();
451 d->input.fd = ::open( d->input.path, O_RDONLY ); 447 d->input.fd = ::open( d->input.path, O_RDONLY );
452 // thats a better place, since it should only seek for ID3 tags on mp3 files, not streams 448 // thats a better place, since it should only seek for ID3 tags on mp3 files, not streams
453 printID3Tags(); 449 printID3Tags();
454 } 450 }
455 if (d->input.fd == -1) { 451 if (d->input.fd == -1) {
456 qDebug("error opening %s", d->input.path ); 452 qDebug("error opening %s", d->input.path );
457 return FALSE; 453 return FALSE;
458 } 454 }
459 455
460// printID3Tags();
461
462#if defined(HAVE_MMAP) 456#if defined(HAVE_MMAP)
463 struct stat stat; 457 struct stat stat;
464 if (fstat(d->input.fd, &stat) == -1) { 458 if (fstat(d->input.fd, &stat) == -1) {
465 //qDebug("error calling fstat"); return FALSE; 459 //qDebug("error calling fstat"); return FALSE;
466 } 460 }
467 if (S_ISREG(stat.st_mode) && stat.st_size > 0) { 461 if (S_ISREG(stat.st_mode) && stat.st_size > 0) {
468 d->input.length = stat.st_size; 462 d->input.length = stat.st_size;
469 d->input.fdm = map_file(d->input.fd, &d->input.length); 463 d->input.fdm = map_file(d->input.fd, &d->input.length);
470 if (d->input.fdm == 0) { 464 if (d->input.fdm == 0) {
471 qDebug("error mmapping file"); return FALSE; 465 qDebug("error mmapping file"); return FALSE;
472 } 466 }
473 d->input.data = (unsigned char *)d->input.fdm; 467 d->input.data = (unsigned char *)d->input.fdm;