Diffstat (limited to 'core/multimedia/opieplayer/libmad/libmadplugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.cpp b/core/multimedia/opieplayer/libmad/libmadplugin.cpp index 9f8ba65..8ede537 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.cpp +++ b/core/multimedia/opieplayer/libmad/libmadplugin.cpp | |||
@@ -33,4 +33,5 @@ | |||
33 | #include <assert.h> | 33 | #include <assert.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpe/config.h> | ||
35 | 36 | ||
36 | //#define HAVE_MMAP | 37 | //#define HAVE_MMAP |
@@ -48,4 +49,5 @@ extern "C" { | |||
48 | 49 | ||
49 | #define MPEG_BUFFER_SIZE 65536 | 50 | #define MPEG_BUFFER_SIZE 65536 |
51 | //#define MPEG_BUFFER_SIZE 32768 //16384 // 8192 | ||
50 | //#define debugMsg(a) qDebug(a) | 52 | //#define debugMsg(a) qDebug(a) |
51 | #define debugMsg(a) | 53 | #define debugMsg(a) |
@@ -166,5 +168,8 @@ bool LibMadPlugin::isFileSupported( const QString& path ) { | |||
166 | bool LibMadPlugin::open( const QString& path ) { | 168 | bool LibMadPlugin::open( const QString& path ) { |
167 | debugMsg( "LibMadPlugin::open" ); | 169 | debugMsg( "LibMadPlugin::open" ); |
168 | 170 | Config cfg("MediaPlayer"); | |
171 | cfg.setGroup("Options"); | ||
172 | bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE); | ||
173 | qDebug("buffer size is %d", bufferSize); | ||
169 | d->bad_last_frame = 0; | 174 | d->bad_last_frame = 0; |
170 | d->flush = TRUE; | 175 | d->flush = TRUE; |
@@ -198,5 +203,5 @@ bool LibMadPlugin::open( const QString& path ) { | |||
198 | 203 | ||
199 | if (d->input.data == 0) { | 204 | if (d->input.data == 0) { |
200 | d->input.data = (unsigned char *)malloc(MPEG_BUFFER_SIZE); | 205 | d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/); |
201 | if (d->input.data == 0) { | 206 | if (d->input.data == 0) { |
202 | qDebug("error allocating input buffer"); | 207 | qDebug("error allocating input buffer"); |
@@ -370,5 +375,5 @@ bool LibMadPlugin::read() { | |||
370 | 375 | ||
371 | do { | 376 | do { |
372 | len = ::read(d->input.fd, d->input.data + d->input.length, MPEG_BUFFER_SIZE - d->input.length); | 377 | len = ::read(d->input.fd, d->input.data + d->input.length, bufferSize /* MPEG_BUFFER_SIZE*/ - d->input.length); |
373 | } | 378 | } |
374 | while (len == -1 && errno == EINTR); | 379 | while (len == -1 && errno == EINTR); |
@@ -381,5 +386,5 @@ bool LibMadPlugin::read() { | |||
381 | d->input.eof = 1; | 386 | d->input.eof = 1; |
382 | 387 | ||
383 | assert(MPEG_BUFFER_SIZE - d->input.length >= MAD_BUFFER_GUARD); | 388 | assert(bufferSize /*MPEG_BUFFER_SIZE*/ - d->input.length >= MAD_BUFFER_GUARD); |
384 | 389 | ||
385 | while (len < MAD_BUFFER_GUARD) | 390 | while (len < MAD_BUFFER_GUARD) |