summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/libmadplugin.cpp
authorllornkcor <llornkcor>2002-04-10 19:13:40 (UTC)
committer llornkcor <llornkcor>2002-04-10 19:13:40 (UTC)
commit9237a75548f9b932fbb1900d8ea28dbee9da81ac (patch) (side-by-side diff)
treea0249408df5ce581af8bcee5b6f58bcee1db461a /core/multimedia/opieplayer/libmad/libmadplugin.cpp
parent11d754ffa429875b526c49f125d8a844c5cda3d8 (diff)
downloadopie-9237a75548f9b932fbb1900d8ea28dbee9da81ac.zip
opie-9237a75548f9b932fbb1900d8ea28dbee9da81ac.tar.gz
opie-9237a75548f9b932fbb1900d8ea28dbee9da81ac.tar.bz2
bug fix
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
@@ -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;