[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [qtopenal] src/decoders: Make a dirty and nasty hackaround for
From:       Laszlo Papp <ext-laszlo.papp () nokia ! com>
Date:       2011-12-13 19:53:29
Message-ID: 20111213195329.2D4B2A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 3089e5d0a2e8fdf7ad54619b58900baba6e758a9 by Laszlo Papp.
Committed on 13/12/2011 at 22:53.
Pushed by lpapp into branch 'master'.

Make a dirty and nasty hackaround for compilation, but needs to be revisited..

M  +20   -2    src/decoders/qalflacaudiodecoder.cpp

http://commits.kde.org/qtopenal/3089e5d0a2e8fdf7ad54619b58900baba6e758a9

diff --git a/src/decoders/qalflacaudiodecoder.cpp \
b/src/decoders/qalflacaudiodecoder.cpp index c25ad03..5f854ce 100644
--- a/src/decoders/qalflacaudiodecoder.cpp
+++ b/src/decoders/qalflacaudiodecoder.cpp
@@ -23,6 +23,7 @@
 #include <QtCore/QString>
 #include <QtCore/QUrl>
 #include <QtCore/QDebug>
+#include <QtCore/QtGlobal>
 
 #include <FLAC/stream_decoder.h>
 
@@ -263,12 +264,29 @@ qint64
 QALFlacAudioDecoder::decodeData(char *decodedData, qint64 maxlen)
 {
     if (FLAC__stream_decoder_get_state(d->flacStreamDecoder) == \
                FLAC__STREAM_DECODER_SEEK_ERROR
-        && FLAC__stream_decoder_reset(d->flacStreamDecoder) == false)
+        && FLAC__stream_decoder_reset(d->flacStreamDecoder) == false) {
         {
             qWarning() << Q_FUNC_INFO << "Failed to allocate memory while resetting \
before decoding";;  return -1;
         }
     }
 
-    return sf_readf_short(d->sndFile, reinterpret_cast<short*>(decodedData), \
maxlen); +    int tmplen = 0;
+
+    if (d->initialData.size() > 0)
+    {   
+        tmplen = qMin(qint64(d->initialData.size()), maxlen);
+        decodedData = reinterpret_cast<char*>(d->initialData.mid(0, tmplen).data());
+        d->initialData.remove(0, tmplen);
+    }   
+
+    while (tmplen < maxlen)
+    {   
+        if (FLAC__stream_decoder_process_single(d->flacStreamDecoder) == false
+            || FLAC__stream_decoder_get_state(d->flacStreamDecoder) == \
FLAC__STREAM_DECODER_END_OF_STREAM) { +            break;
+        }
+    }   
+
+    return tmplen;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic