summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/libmadplugin.cpp
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/libmadplugin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/libmadplugin.cpp13
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
@@ -31,8 +31,9 @@
#include <locale.h>
#include <math.h>
#include <assert.h>
#include <qapplication.h>
+#include <qpe/config.h>
//#define HAVE_MMAP
#if defined(HAVE_MMAP)
@@ -46,8 +47,9 @@ extern "C" {
}
#define MPEG_BUFFER_SIZE 65536
+//#define MPEG_BUFFER_SIZE 32768 //16384 // 8192
//#define debugMsg(a) qDebug(a)
#define debugMsg(a)
@@ -164,9 +166,12 @@ bool LibMadPlugin::isFileSupported( const QString& path ) {
bool LibMadPlugin::open( const QString& path ) {
debugMsg( "LibMadPlugin::open" );
-
+ Config cfg("MediaPlayer");
+ cfg.setGroup("Options");
+ bufferSize = cfg.readNumEntry("MPeg_BufferSize",MPEG_BUFFER_SIZE);
+ qDebug("buffer size is %d", bufferSize);
d->bad_last_frame = 0;
d->flush = TRUE;
info = QString( "" );
@@ -196,9 +201,9 @@ bool LibMadPlugin::open( const QString& path ) {
}
#endif
if (d->input.data == 0) {
- d->input.data = (unsigned char *)malloc(MPEG_BUFFER_SIZE);
+ d->input.data = (unsigned char *)malloc( bufferSize /*MPEG_BUFFER_SIZE*/);
if (d->input.data == 0) {
qDebug("error allocating input buffer");
return FALSE;
}
@@ -368,9 +373,9 @@ bool LibMadPlugin::read() {
d->input.length = &d->input.data[d->input.length] - d->stream.next_frame);
}
do {
- len = ::read(d->input.fd, d->input.data + d->input.length, MPEG_BUFFER_SIZE - d->input.length);
+ len = ::read(d->input.fd, d->input.data + d->input.length, bufferSize /* MPEG_BUFFER_SIZE*/ - d->input.length);
}
while (len == -1 && errno == EINTR);
if (len == -1) {
@@ -379,9 +384,9 @@ bool LibMadPlugin::read() {
}
else if (len == 0) {
d->input.eof = 1;
- assert(MPEG_BUFFER_SIZE - d->input.length >= MAD_BUFFER_GUARD);
+ assert(bufferSize /*MPEG_BUFFER_SIZE*/ - d->input.length >= MAD_BUFFER_GUARD);
while (len < MAD_BUFFER_GUARD)
d->input.data[d->input.length + len++] = 0;
}