source: trunk/src/3rdparty/phonon/gstreamer/audiodataoutput.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 3.1 KB
Line 
1/* This file is part of the KDE project
2 Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
3 Copyright (C) 2009 Martin Sandsmark <sandsmark@samfundet.no>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) version 3, or any
9 later version accepted by the membership of KDE e.V. (or its
10 successor approved by the membership of KDE e.V.), Nokia Corporation
11 (or its successors, if any) and the KDE Free Qt Foundation, which shall
12 act as a proxy defined in Section 6 of version 3 of the license.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#ifndef Phonon_GSTREAMER_AUDIODATAOUTPUT_H
24#define Phonon_GSTREAMER_AUDIODATAOUTPUT_H
25
26#include "abstractaudiooutput.h"
27#include "backend.h"
28#include "medianode.h"
29#include <phonon/audiodataoutput.h>
30#include <phonon/audiodataoutputinterface.h>
31
32QT_BEGIN_HEADER
33QT_BEGIN_NAMESPACE
34
35namespace Phonon
36{
37namespace Gstreamer
38{
39 /**
40 * \author Martin Sandsmark <sandsmark@samfundet.no>
41 */
42 class AudioDataOutput : public QObject,
43 public AudioDataOutputInterface,
44 public MediaNode
45 {
46 Q_OBJECT
47 Q_INTERFACES(Phonon::AudioDataOutputInterface Phonon::Gstreamer::MediaNode)
48
49 public:
50 AudioDataOutput(Backend *, QObject *);
51 ~AudioDataOutput();
52
53 public Q_SLOTS:
54 int dataSize() const;
55 int sampleRate() const;
56 void setDataSize(int size);
57
58 public:
59 /// callback function for handling new audio data
60 static void processBuffer(GstPad*, GstBuffer*, gpointer);
61
62 Phonon::AudioDataOutput* frontendObject() const { return m_frontend; }
63 void setFrontendObject(Phonon::AudioDataOutput *frontend) { m_frontend = frontend; }
64
65 GstElement *audioElement() { return m_queue; }
66
67 void mediaNodeEvent(const MediaNodeEvent *event);
68
69
70 signals:
71 void dataReady(const QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> > &data);
72 void dataReady(const QMap<Phonon::AudioDataOutput::Channel, QVector<float> > &data);
73 void endOfMedia(int remainingSamples);
74
75 private:
76 void convertAndEmit(const QVector<qint16>&, const QVector<qint16>&);
77
78 GstElement *m_queue;
79 int m_dataSize;
80 QVector<qint16> m_pendingData;
81 Phonon::AudioDataOutput *m_frontend;
82 int m_channels;
83 };
84}} //namespace Phonon::Gstreamer
85
86QT_END_NAMESPACE
87QT_END_HEADER
88
89// vim: sw=4 ts=4 tw=80
90#endif // Phonon_FAKE_AUDIODATAOUTPUT_H
Note: See TracBrowser for help on using the repository browser.