summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-05-23 20:36:26 (UTC)
committer harlekin <harlekin>2002-05-23 20:36:26 (UTC)
commitf44fc6d458a116b7f932f1c7628d53557f5183d3 (patch) (unidiff)
treee6b4dea86309c2c4d82ad0db1dd8a0d4047bd1fe
parent582f7e6b7da49b90d2cfccd638bccd4ca279da37 (diff)
downloadopie-f44fc6d458a116b7f932f1c7628d53557f5183d3.zip
opie-f44fc6d458a116b7f932f1c7628d53557f5183d3.tar.gz
opie-f44fc6d458a116b7f932f1c7628d53557f5183d3.tar.bz2
include #include <linux/limits.h> reagrding PATH_MAX build problem
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
@@ -22,48 +22,49 @@
22#include <stdio.h> 22#include <stdio.h>
23#include <stdarg.h> 23#include <stdarg.h>
24#include <stdlib.h> 24#include <stdlib.h>
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/stat.h> 26#include <sys/stat.h>
27#include <fcntl.h> 27#include <fcntl.h>
28#include <unistd.h> 28#include <unistd.h>
29#include <string.h> 29#include <string.h>
30#include <ctype.h> 30#include <ctype.h>
31#include <errno.h> 31#include <errno.h>
32#include <time.h> 32#include <time.h>
33#include <locale.h> 33#include <locale.h>
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
58 59
59extern "C" { 60extern "C" {
60#include "mad.h" 61#include "mad.h"
61} 62}
62 63
63 64
64#define MPEG_BUFFER_SIZE 65536 65#define MPEG_BUFFER_SIZE 65536
65//#define MPEG_BUFFER_SIZE 32768 //16384 // 8192 66//#define MPEG_BUFFER_SIZE 32768 //16384 // 8192
66//#define debugMsg(a) qDebug(a) 67//#define debugMsg(a) qDebug(a)
67#define debugMsg(a) 68#define debugMsg(a)
68 69
69 70
@@ -413,73 +414,66 @@ int LibMadPlugin::http_open(const QString& path ) {
413 } 414 }
414 } while (strcmp(http_request, "\n") != 0); 415 } while (strcmp(http_request, "\n") != 0);
415 416
416 info = QString(name + genre + url + bitrate + message).replace( QRegExp("\n"), " : " ); 417 info = QString(name + genre + url + bitrate + message).replace( QRegExp("\n"), " : " );
417 418
418 qDebug("Stream info: " + info); 419 qDebug("Stream info: " + info);
419 420
420 return (tcp_sock); 421 return (tcp_sock);
421} 422}
422 423
423 424
424 425
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;
474 } 468 }
475#endif 469#endif
476 470
477 if (d->input.data == 0) { 471 if (d->input.data == 0) {
478 d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); 472 d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/);
479 if (d->input.data == 0) { 473 if (d->input.data == 0) {
480 qDebug("error allocating input buffer"); 474 qDebug("error allocating input buffer");
481 return FALSE; 475 return FALSE;
482 } 476 }
483 d->input.length = 0; 477 d->input.length = 0;
484 } 478 }
485 479