summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libmad') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp13
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.h2
2 files changed, 10 insertions, 5 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
@@ -32,6 +32,7 @@
32#include <math.h> 32#include <math.h>
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
37 38
@@ -47,6 +48,7 @@ extern "C" {
47 48
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)
52 54
@@ -165,7 +167,10 @@ bool LibMadPlugin::isFileSupported( const QString& path ) {
165 167
166bool LibMadPlugin::open( const QString& path ) { 168bool 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;
171 info = QString( "" ); 176 info = QString( "" );
@@ -197,7 +202,7 @@ bool LibMadPlugin::open( const QString& path ) {
197#endif 202#endif
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");
203 return FALSE; 208 return FALSE;
@@ -369,7 +374,7 @@ bool LibMadPlugin::read() {
369 } 374 }
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);
375 380
@@ -380,7 +385,7 @@ bool LibMadPlugin::read() {
380 else if (len == 0) { 385 else if (len == 0) {
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)
386 d->input.data[d->input.length + len++] = 0; 391 d->input.data[d->input.length + len++] = 0;
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h
index b240b77..46cd4a1 100644
--- a/core/multimedia/opieplayer/libmad/libmadplugin.h
+++ b/core/multimedia/opieplayer/libmad/libmadplugin.h
@@ -103,7 +103,7 @@ public:
103private: 103private:
104 LibMadPluginData *d; 104 LibMadPluginData *d;
105 QString info; 105 QString info;
106 106int bufferSize;
107}; 107};
108 108
109 109