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

List:       kde-commits
Subject:    kdesupport/phonon
From:       Martin Tobias Holmedahl Sandsmark <sandsmark () samfundet ! no>
Date:       2009-08-12 22:26:03
Message-ID: 1250115963.842162.21904.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1010596 by sandsmark:

remove support for float data in audiodataoutput.

 M  +1 -11     gstreamer/audiodataoutput.cpp  
 M  +0 -3      gstreamer/audiodataoutput.h  
 M  +3 -10     phonon/audiodataoutput.cpp  
 M  +4 -78     phonon/audiodataoutput.h  
 M  +1 -3      phonon/audiodataoutput_p.h  
 M  +2 -65     phonon/tests/audiodataoutputtest.cpp  
 M  +0 -5      xine/audiodataoutput.cpp  
 M  +0 -2      xine/audiodataoutput.h  


--- trunk/kdesupport/phonon/gstreamer/audiodataoutput.cpp #1010595:1010596
@@ -35,8 +35,7 @@
 {
 AudioDataOutput::AudioDataOutput(Backend *backend, QObject *parent)
     : QObject(parent),
-    MediaNode(backend, AudioSink | AudioSource),
-    m_format(Phonon::AudioDataOutput::IntegerFormat)
+    MediaNode(backend, AudioSink | AudioSource)
 {
     static int count = 0;
     m_name = "AudioDataOutput" + QString::number(count++);
@@ -52,11 +51,6 @@
     gst_object_unref(m_queue);
 }
 
-Phonon::AudioDataOutput::Format AudioDataOutput::format() const
-{
-    return Phonon::AudioDataOutput::IntegerFormat;
-}
-
 int AudioDataOutput::dataSize() const
 {
     return m_dataSize;
@@ -67,10 +61,6 @@
     return 44100;
 }
 
-void AudioDataOutput::setFormat(Phonon::AudioDataOutput::Format)
-{
-}
-
 void AudioDataOutput::setDataSize(int size)
 {
     m_dataSize = size;
--- trunk/kdesupport/phonon/gstreamer/audiodataoutput.h #1010595:1010596
@@ -48,10 +48,8 @@
             ~AudioDataOutput();
 
         public Q_SLOTS:
-            Phonon::AudioDataOutput::Format format() const;
             int dataSize() const;
             int sampleRate() const;
-            void setFormat(Phonon::AudioDataOutput::Format format);
             void setDataSize(int size);
 
         public:
@@ -74,7 +72,6 @@
         private:
             void convertAndEmit(const QVector<qint16>&, const QVector<qint16>&);
 
-            Phonon::AudioDataOutput::Format m_format;
             GstElement *m_queue;
             int m_dataSize;
             QVector<qint16> m_pendingData;
--- trunk/kdesupport/phonon/phonon/audiodataoutput.cpp #1010595:1010596
@@ -6,7 +6,7 @@
     License as published by the Free Software Foundation; either
     version 2.1 of the License, or (at your option) version 3, or any
     later version accepted by the membership of KDE e.V. (or its
-    successor approved by the membership of KDE e.V.), Nokia Corporation 
+    successor approved by the membership of KDE e.V.), Nokia Corporation
     (or its successors, if any) and the KDE Free Qt Foundation, which shall
     act as a proxy defined in Section 6 of version 3 of the license.
 
@@ -15,7 +15,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     Lesser General Public License for more details.
 
-    You should have received a copy of the GNU Lesser General Public 
+    You should have received a copy of the GNU Lesser General Public
     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
 */
@@ -31,16 +31,13 @@
 
 PHONON_HEIR_IMPL(AbstractAudioOutput)
 
-PHONON_GETTER(Phonon::AudioDataOutput::Format, format, d->format)
 PHONON_GETTER(int, dataSize, d->dataSize)
 PHONON_GETTER(int, sampleRate, -1)
-PHONON_SETTER(setFormat, format, Phonon::AudioDataOutput::Format)
 PHONON_SETTER(setDataSize, dataSize, int)
 
 bool AudioDataOutputPrivate::aboutToDeleteBackendObject()
 {
     Q_ASSERT(m_backendObject);
-    pBACKEND_GET(Phonon::AudioDataOutput::Format, format, "format");
     pBACKEND_GET(int, dataSize, "dataSize");
 
     return AbstractAudioOutputPrivate::aboutToDeleteBackendObject();
@@ -53,17 +50,13 @@
     AbstractAudioOutputPrivate::setupBackendObject();
 
     // set up attributes
-    pBACKEND_CALL1("setFormat", Phonon::AudioDataOutput::Format, format);
     pBACKEND_CALL1("setDataSize", int, dataSize);
 
     qRegisterMetaType<QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> > \
                >("QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> >");
-        qRegisterMetaType<QMap<Phonon::AudioDataOutput::Channel, QVector<float> > \
>("QMap<Phonon::AudioDataOutput::Channel, QVector<float> >"); +
     QObject::connect(m_backendObject,
             SIGNAL(dataReady(const QMap<Phonon::AudioDataOutput::Channel, \
                QVector<qint16> > &)),
             q, SIGNAL(dataReady(const QMap<Phonon::AudioDataOutput::Channel, \
                QVector<qint16> > &)));
-    QObject::connect(m_backendObject,
-            SIGNAL(dataReady(const QMap<Phonon::AudioDataOutput::Channel, \
                QVector<float> > &)),
-            q, SIGNAL(dataReady(const QMap<Phonon::AudioDataOutput::Channel, \
                QVector<float> > &)));
     QObject::connect(m_backendObject, SIGNAL(endOfMedia(int)), q, \
SIGNAL(endOfMedia(int)));  }
 
--- trunk/kdesupport/phonon/phonon/audiodataoutput.h #1010595:1010596
@@ -6,7 +6,7 @@
     License as published by the Free Software Foundation; either
     version 2.1 of the License, or (at your option) version 3, or any
     later version accepted by the membership of KDE e.V. (or its
-    successor approved by the membership of KDE e.V.), Nokia Corporation 
+    successor approved by the membership of KDE e.V.), Nokia Corporation
     (or its successors, if any) and the KDE Free Qt Foundation, which shall
     act as a proxy defined in Section 6 of version 3 of the license.
 
@@ -15,7 +15,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     Lesser General Public License for more details.
 
-    You should have received a copy of the GNU Lesser General Public 
+    You should have received a copy of the GNU Lesser General Public
     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
 */
@@ -44,18 +44,13 @@
      * visualizations. You can also use the audio data for further processing
      * (e.g. encoding and saving to a file).
      *
-     * The class supports different data formats. One of the most common formats
-     * is to read vectors of integers (which will only use 16 Bit), but you can
-     * also request floats which some backends use internally.
-     *
      * \author Matthias Kretz <kretz@kde.org>
      */
     class PHONON_EXPORT AudioDataOutput : public AbstractAudioOutput
     {
         Q_OBJECT
         K_DECLARE_PRIVATE(AudioDataOutput)
-        Q_ENUMS(Channel Format)
-        Q_PROPERTY(Format format READ format WRITE setFormat)
+        Q_ENUMS(Channel)
         Q_PROPERTY(int dataSize READ dataSize WRITE setDataSize)
         PHONON_HEIR(AudioDataOutput)
         public:
@@ -73,36 +68,6 @@
             };
 
             /**
-             * Used for telling the object whether you want 16 bit Integers or
-             * 32 bit floats.
-             *
-             * \see requestFormat
-             */
-            enum Format
-            {
-                /**
-                 * Requests 16 bit signed integers.
-                 *
-                 * \see dataReady(const QVector<qint16> &)
-                 */
-                IntegerFormat = 1,
-                /**
-                 * Requests 32 bit floating point: signed, zero centered, and
-                 * normalized to the unit value (-1.0 to 1.0).
-                 *
-                 * \see dataReady(const QVector<float> &)
-                 */
-                FloatFormat = 2
-            };
-
-            /**
-             * Returns the currently used format.
-             *
-             * \see setFormat
-             */
-            Format format() const;
-
-            /**
              * Returns the currently used number of samples passed through
              * the signal.
              *
@@ -125,16 +90,6 @@
 
         public Q_SLOTS:
             /**
-             * Requests the dataformat you'd like to receive. Only one of the
-             * signals of this class will be emitted when new data is ready.
-             *
-             * The default format is IntegerFormat.
-             *
-             * \see format()
-             */
-            void setFormat(Format format);
-
-            /**
              * Sets the number of samples to be passed in one signal emission.
              *
              * Defaults to 512 samples per emitted signal.
@@ -145,40 +100,11 @@
 
         Q_SIGNALS:
             /**
-             * Emitted whenever another dataSize number of samples are ready and
-             * format is set to IntegerFormat.
+             * Emitted whenever another dataSize number of samples are ready.
              *
-             * If format is set to FloatFormat the signal is not emitted at all.
-             *
              * \param data A mapping of Channel to a vector holding the audio data.
              */
             void dataReady(const QMap<Phonon::AudioDataOutput::Channel, \
                QVector<qint16> > &data);
-
-            /**
-             * Emitted whenever another dataSize number of samples are ready and
-             * format is set to FloatFormat.
-             *
-             * If format is set to IntegerFormat the signal is not emitted at all.
-             *
-             * \param data A mapping of Channel to a vector holding the audio data.
-             */
-            void dataReady(const QMap<Phonon::AudioDataOutput::Channel, \
                QVector<float> > &data);
-
-            /**
-             * This signal is emitted before the last dataReady signal of a
-             * media is emitted.
-             * 
-             * If, for example, the playback of a media file has finished and the
-             * last audio data of that file is going to be passed with the next
-             * dataReady signal, and only the 28 first samples of the data
-             * vector are from that media file endOfMedia will be emitted right
-             * before dataReady with \p remainingSamples = 28.
-             *
-             * \param remainingSamples The number of samples in the next
-             * dataReady vector that belong to the media that was playing to
-             * this point.
-             */
-            void endOfMedia(int remainingSamples);
     };
 } // namespace Phonon
 
--- trunk/kdesupport/phonon/phonon/audiodataoutput_p.h #1010595:1010596
@@ -35,12 +35,10 @@
     PHONON_PRIVATECLASS
     protected:
         AudioDataOutputPrivate()
-            : format(AudioDataOutput::IntegerFormat)
-            , dataSize(512)
+            : dataSize(512)
         {
         }
 
-        AudioDataOutput::Format format;
         int dataSize;
 };
 
--- trunk/kdesupport/phonon/phonon/tests/audiodataoutputtest.cpp #1010595:1010596
@@ -6,7 +6,7 @@
     License as published by the Free Software Foundation; either
     version 2.1 of the License, or (at your option) version 3, or any
     later version accepted by the membership of KDE e.V. (or its
-    successor approved by the membership of KDE e.V.), Nokia Corporation 
+    successor approved by the membership of KDE e.V.), Nokia Corporation
     (or its successors, if any) and the KDE Free Qt Foundation, which shall
     act as a proxy defined in Section 6 of version 3 of the license.
 
@@ -15,7 +15,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     Lesser General Public License for more details.
 
-    You should have received a copy of the GNU Lesser General Public 
+    You should have received a copy of the GNU Lesser General Public
     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
 */
@@ -37,7 +37,6 @@
     private slots:
         void initTestCase();
         void testSampleRate();
-        void testFormat();
         void testDataSize();
         void cleanupTestCase();
 };
@@ -57,68 +56,6 @@
     QVERIFY(test.sampleRate() > 0);
 }
 
-void AudioDataOutputTest::testFormat()
-{
-    qRegisterMetaType<QMap<Phonon::AudioDataOutput::Channel, QVector<float> > >
-        ("QMap<Phonon::AudioDataOutput::Channel,QVector<float> >");
-    qRegisterMetaType<QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> > >
-        ("QMap<Phonon::AudioDataOutput::Channel,QVector<qint16> >");
-    AudioDataOutput test(this);
-    QSignalSpy floatReadySpy(&test, SIGNAL(dataReady(const \
                QMap<Phonon::AudioDataOutput::Channel, QVector<float> > &)));
-    QSignalSpy intReadySpy(&test, SIGNAL(dataReady(const \
                QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> > &)));
-    QCOMPARE(floatReadySpy.size(), 0);
-    QCOMPARE(intReadySpy.size(), 0);
-    QCOMPARE(test.format(), Phonon::AudioDataOutput::IntegerFormat);
-    test.setFormat(Phonon::AudioDataOutput::IntegerFormat);
-    QCOMPARE(test.format(), Phonon::AudioDataOutput::IntegerFormat);
-    test.setFormat(Phonon::AudioDataOutput::FloatFormat);
-    QCOMPARE(test.format(), Phonon::AudioDataOutput::FloatFormat);
-    test.setFormat(Phonon::AudioDataOutput::FloatFormat);
-    QCOMPARE(test.format(), Phonon::AudioDataOutput::FloatFormat);
-    test.setFormat(Phonon::AudioDataOutput::IntegerFormat);
-    QCOMPARE(test.format(), Phonon::AudioDataOutput::IntegerFormat);
-
-    MediaObject media(this);
-    QUrl url(testUrl());
-    media.setCurrentSource(url);
-    Path path = createPath(&media, &test);
-    QVERIFY(media.outputPaths().contains(path));
-    QVERIFY(test.inputPaths().contains(path));
-
-    QCOMPARE(floatReadySpy.size(), 0);
-    QCOMPARE(intReadySpy.size(), 0);
-
-    media.play();
-    QTime startTime;
-    startTime.start();
-    while (startTime.elapsed() < 1000)
-        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
-    QVERIFY(intReadySpy.size() > 0);
-    QCOMPARE(floatReadySpy.size(), 0);
-
-    media.pause();
-    test.setFormat(Phonon::AudioDataOutput::FloatFormat);
-    QCOMPARE(test.format(), Phonon::AudioDataOutput::FloatFormat);
-    intReadySpy.clear();
-    media.play();
-    startTime.start();
-    while (startTime.elapsed() < 1000)
-        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
-    QVERIFY(floatReadySpy.size() > 0);
-    QCOMPARE(intReadySpy.size(), 0);
-
-    media.pause();
-    test.setFormat(Phonon::AudioDataOutput::IntegerFormat);
-    QCOMPARE(test.format(), Phonon::AudioDataOutput::IntegerFormat);
-    floatReadySpy.clear();
-    media.play();
-    startTime.start();
-    while (startTime.elapsed() < 1000)
-        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
-    QVERIFY(intReadySpy.size() > 0);
-    QCOMPARE(floatReadySpy.size(), 0);
-}
-
 void AudioDataOutputTest::testDataSize()
 {
     AudioDataOutput test(this);
--- trunk/kdesupport/phonon/xine/audiodataoutput.cpp #1010595:1010596
@@ -215,7 +215,6 @@
 AudioDataOutput::AudioDataOutput(QObject*)
 : SinkNode(new AudioDataOutputXT(this))
 , SourceNode(static_cast<AudioDataOutputXT *>(SinkNode::m_threadSafeObject.data()))
-, m_format(Phonon::AudioDataOutput::IntegerFormat)
 , m_mediaObject(0)
 {
     m_keepInSync = false;
@@ -229,10 +228,6 @@
 
 inline void AudioDataOutput::packetReady(const int samples, const qint16 *buffer, \
const qint64 vpts)  {
-    //TODO: support floats, we currently only handle ints
-    if (m_format == Phonon::AudioDataOutput::FloatFormat)
-        return;
-
     if (m_channels < 0 || m_channels > 2)
         return;
 
--- trunk/kdesupport/phonon/xine/audiodataoutput.h #1010595:1010596
@@ -118,7 +118,6 @@
         //Getters
         MediaStreamTypes inputMediaStreamTypes() const { return Phonon::Xine::Audio; \
                }
         MediaStreamTypes outputMediaStreamTypes() const { return \
                Phonon::Xine::Audio; }
-        Phonon::AudioDataOutput::Format format() const { return m_format; }
         Phonon::AudioDataOutput *frontendObject() const { return m_frontend; }
         int channels() const { return m_channels; }
         int dataSize() const { return m_dataSize; }
@@ -146,7 +145,6 @@
         int                           m_dataSize;
         int                         m_sampleRate;
         QList<Frame>       m_pendingFrames;
-        Phonon::AudioDataOutput::Format m_format;
         bool                        m_keepInSync;
         MediaObject               *m_mediaObject;
 


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

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