summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad
Side-by-side diff
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 @@
#include <math.h>
#include <assert.h>
#include <qapplication.h>
+#include <qpe/config.h>
//#define HAVE_MMAP
@@ -47,6 +48,7 @@ extern "C" {
#define MPEG_BUFFER_SIZE 65536
+//#define MPEG_BUFFER_SIZE 32768 //16384 // 8192
//#define debugMsg(a) qDebug(a)
#define debugMsg(a)
@@ -165,7 +167,10 @@ 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( "" );
@@ -197,7 +202,7 @@ 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;
@@ -369,7 +374,7 @@ bool LibMadPlugin::read() {
}
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);
@@ -380,7 +385,7 @@ 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;
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:
private:
LibMadPluginData *d;
QString info;
-
+int bufferSize;
};