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

List:       kde-commits
Subject:    [qtopenal] src: Add the channels, sampleRate,
From:       Laszlo Papp <ext-laszlo.papp () nokia ! com>
Date:       2011-11-30 23:07:36
Message-ID: 20111130230736.6C305A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit bbee03142599b99f7b84f286c1f5e35bfad9934a by Laszlo Papp.
Committed on 01/12/2011 at 02:07.
Pushed by lpapp into branch 'master'.

Add the channels, sampleRate, sampleSize getters to the interface and impl.

M  +4    -0    src/qalabstractaudiodecoder.h
M  +21   -0    src/qalsndaudiodecoder.cpp
M  +4    -0    src/qalsndaudiodecoder.h

http://commits.kde.org/qtopenal/bbee03142599b99f7b84f286c1f5e35bfad9934a

diff --git a/src/qalabstractaudiodecoder.h b/src/qalabstractaudiodecoder.h
index 080571b..7a539fd 100644
--- a/src/qalabstractaudiodecoder.h
+++ b/src/qalabstractaudiodecoder.h
@@ -42,6 +42,10 @@ public:
 
     virtual void setEncodedData(const QByteArray &encodedData) = 0;
 
+    virtual int channels() const = 0;
+    virtual int sampleRate() const = 0;
+    virtual int sampleSize() const = 0;
+
     virtual QByteArray decode(qint64 maxlen) = 0;
     virtual qint64 decode(char *decodedData, qint64 maxlen) = 0;
 };
diff --git a/src/qalsndaudiodecoder.cpp b/src/qalsndaudiodecoder.cpp
index 1d01be0..bb23b66 100644
--- a/src/qalsndaudiodecoder.cpp
+++ b/src/qalsndaudiodecoder.cpp
@@ -46,6 +46,7 @@ class QALSndAudioDecoder::Private
 
         QByteArray encodedData;
         SNDFILE *sndFile;
+        SF_INFO sfInfo;
 };
 
 sf_count_t
@@ -140,6 +141,8 @@ QALSndAudioDecoder::open(const QString &fileName)
         return false;
     }
 
+    d->sfInfo = sfInfo;
+
     return true;
 }
 
@@ -182,6 +185,24 @@ QALSndAudioDecoder::setEncodedData(const QByteArray &encodedData)
     d->encodedData = encodedData;
 }
 
+int
+QALSndAudioDecoder::channels() const
+{
+    return d->sfInfo.channels;
+}
+
+int
+QALSndAudioDecoder::sampleRate() const
+{
+    return d->sfInfo.samplerate;
+}
+
+int
+QALSndAudioDecoder::sampleSize() const
+{
+    return 16;
+}
+
 QByteArray
 QALSndAudioDecoder::decode(qint64 maxlen)
 {
diff --git a/src/qalsndaudiodecoder.h b/src/qalsndaudiodecoder.h
index e837f24..619ef68 100644
--- a/src/qalsndaudiodecoder.h
+++ b/src/qalsndaudiodecoder.h
@@ -40,6 +40,10 @@ public:
 
     void setEncodedData(const QByteArray &encodedData);
 
+    int channels() const;
+    int sampleRate() const;
+    int sampleSize() const;
+
     QByteArray decode(qint64 maxlen);
     qint64 decode(char *decodedData, qint64 maxlen);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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