[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [qtopenal] src: Fix the looping operation in order to get the
From: Laszlo Papp <ext-laszlo.papp () nokia ! com>
Date: 2011-11-30 23:53:01
Message-ID: 20111130235301.78A7BA60B9 () git ! kde ! org
[Download RAW message or body]
Git commit 51b4ab3b121a70821b78ba7b5d6ccb5b4c20ce97 by Laszlo Papp.
Committed on 01/12/2011 at 02:33.
Pushed by lpapp into branch 'master'.
Fix the looping operation in order to get the decoded data into the buffer
M +11 -1 src/qalcontext.cpp
M +1 -3 src/qalsndaudiodecoder.cpp
http://commits.kde.org/qtopenal/51b4ab3b121a70821b78ba7b5d6ccb5b4c20ce97
diff --git a/src/qalcontext.cpp b/src/qalcontext.cpp
index 936e133..20c50a4 100644
--- a/src/qalcontext.cpp
+++ b/src/qalcontext.cpp
@@ -187,7 +187,15 @@ QALContext::cacheBuffer(const QString& filename)
if (qalSndAudioDecoder.open(filename) == false)
return 0;
- // buffer = loadFromFile(filename);
+ QByteArray decodedData;
+ QByteArray tmpData;
+ int maxlen = qalSndAudioDecoder.channels() * qalSndAudioDecoder.sampleRate() \
* qalSndAudioDecode.sampleSize(); +
+ while ((tmpData = qalSndAudioDecoder.decode(maxlen))) {
+ decodedData.append(tmpData);
+ if (tmpData.size() != maxlen)
+ break;
+ }
ALenum error;
if ((error = alGetError()) != AL_NO_ERROR) {
@@ -201,6 +209,8 @@ QALContext::cacheBuffer(const QString& filename)
return 0;
};
+
+
d->loadedBuffers.insert(filename, buffer);
}
diff --git a/src/qalsndaudiodecoder.cpp b/src/qalsndaudiodecoder.cpp
index 9eed040..bb23b66 100644
--- a/src/qalsndaudiodecoder.cpp
+++ b/src/qalsndaudiodecoder.cpp
@@ -211,10 +211,8 @@ QALSndAudioDecoder::decode(qint64 maxlen)
char *decodedData = result.data();
- if (maxlen != decode(decodedData, maxlen)) {
+ if (maxlen != decode(decodedData, maxlen))
qWarning() << Q_FUNC_INFO << "Could not to decode all the data:" << maxlen;
- return QByteArray();
- }
return result;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic