~ubuntu-branches/ubuntu/oneiric/phonon/oneiric-201108111512

« back to all changes in this revision

Viewing changes to gstreamer/audiodataoutput.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2011-01-24 10:12:11 UTC
  • mfrom: (0.5.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110124101211-w9rew7q0dmwbwhqx
Tags: 4:4.7.0really4.4.4-0ubuntu1
* New upstream release
* Xine and GStreamer backends now split out source, remove build-deps and
  binary packages from debian/control
* Remove 02_no_rpath.patch, now upstream
* Disable kubuntu04_no_va_mangle.patch, no longer applies
* Remove kubuntu_05_gst_codec_installer_window_id.diff, kubuntu_06_forward_events.diff,
  kubuntu_07_include_fix.diff, gstreamer now separate

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 "common.h"
27
 
#include "medianode.h"
28
 
#include <phonon/audiodataoutput.h>
29
 
#include <phonon/audiodataoutputinterface.h>
30
 
 
31
 
QT_BEGIN_HEADER
32
 
QT_BEGIN_NAMESPACE
33
 
 
34
 
namespace Phonon
35
 
{
36
 
namespace Gstreamer
37
 
{
38
 
/**
39
 
 * \author Martin Sandsmark <sandsmark@samfundet.no>
40
 
 */
41
 
class AudioDataOutput : public QObject,
42
 
        public AudioDataOutputInterface,
43
 
        public MediaNode
44
 
{
45
 
    Q_OBJECT
46
 
    Q_INTERFACES(Phonon::AudioDataOutputInterface Phonon::Gstreamer::MediaNode)
47
 
 
48
 
public:
49
 
    AudioDataOutput(Backend *, QObject *);
50
 
    ~AudioDataOutput();
51
 
 
52
 
public Q_SLOTS:
53
 
    int dataSize() const;
54
 
    int sampleRate() const;
55
 
    void setDataSize(int size);
56
 
 
57
 
public:
58
 
    /// callback function for handling new audio data
59
 
    static void processBuffer(GstPad*, GstBuffer*, gpointer);
60
 
 
61
 
    Phonon::AudioDataOutput* frontendObject() const { return m_frontend; }
62
 
    void setFrontendObject(Phonon::AudioDataOutput *frontend) { m_frontend = frontend; }
63
 
 
64
 
    GstElement *audioElement() { return m_queue; }
65
 
 
66
 
    void mediaNodeEvent(const MediaNodeEvent *event);
67
 
 
68
 
 
69
 
signals:
70
 
    void dataReady(const QMap<Phonon::AudioDataOutput::Channel, QVector<qint16> > &data);
71
 
    void dataReady(const QMap<Phonon::AudioDataOutput::Channel, QVector<float> > &data);
72
 
    void endOfMedia(int remainingSamples);
73
 
 
74
 
private:
75
 
    void convertAndEmit(const QVector<qint16>&, const QVector<qint16>&);
76
 
 
77
 
    GstElement *m_queue;
78
 
    int m_dataSize;
79
 
    QVector<qint16> m_pendingData;
80
 
    Phonon::AudioDataOutput *m_frontend;
81
 
    int m_channels;
82
 
};
83
 
} // namespace Gstreamer
84
 
} // namespace Phonon
85
 
 
86
 
QT_END_NAMESPACE
87
 
QT_END_HEADER
88
 
 
89
 
// vim: sw=4 ts=4 tw=80
90
 
#endif // Phonon_FAKE_AUDIODATAOUTPUT_H