Pass on rtpmap to raop_buffer in order to add AAC support later
[deb_shairplay.git] / AirTV-Qt / audiooutput.h
1 /**
2 * Copyright (C) 2011-2012 Juho Vähä-Herttua
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 */
14
15 #ifndef AUDIOOUTPUT_H
16 #define AUDIOOUTPUT_H
17
18 #include <QObject>
19 #include <QIODevice>
20 #include <QByteArray>
21 #include <QAudioFormat>
22 #include <QAudioDeviceInfo>
23 #include <QAudioOutput>
24 #include <QIODevice>
25
26 class AudioOutput : public QIODevice
27 {
28 Q_OBJECT
29 public:
30 explicit AudioOutput(QObject *parent = 0);
31 bool init(int bits, int channels, int samplerate);
32 bool setDevice(QAudioDeviceInfo deviceInfo);
33
34 void start();
35 void setVolume(float volume);
36 void output(const QByteArray & data);
37 void flush();
38 void stop();
39
40 qint64 readData(char *data, qint64 maxlen);
41 qint64 writeData(const char *data, qint64 len);
42 qint64 bytesAvailable() const;
43 bool isSequential() const;
44
45 private:
46 void reinit();
47
48 private:
49 bool m_initialized;
50 QByteArray m_buffer;
51 QAudioFormat m_format;
52 QAudioDeviceInfo m_deviceInfo;
53 QAudioOutput* m_output;
54 float m_volume;
55
56 signals:
57
58 public slots:
59
60 private slots:
61 void notified();
62 void stateChanged(QAudio::State state);
63 };
64
65 #endif // AUDIOOUTPUT_H