2014-07-14 05:03:36 +08:00
|
|
|
#ifndef AUDIOINPUTPROXY_H
|
|
|
|
#define AUDIOINPUTPROXY_H
|
|
|
|
|
|
|
|
#include <QIODevice>
|
|
|
|
#include <functional>
|
|
|
|
#include "memring.h"
|
|
|
|
|
|
|
|
class AudioInputProxy : public QIODevice
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit AudioInputProxy(QObject *parent = 0);
|
|
|
|
virtual ~AudioInputProxy();
|
|
|
|
|
|
|
|
std::function< void() > callback;
|
2014-07-14 21:16:44 +08:00
|
|
|
qint64 bytesAvailable() const;
|
2014-07-14 05:03:36 +08:00
|
|
|
|
2014-07-14 21:16:44 +08:00
|
|
|
protected:
|
2014-07-14 05:03:36 +08:00
|
|
|
qint64 readData(char *data, qint64 maxlen);
|
|
|
|
qint64 writeData(const char *data, qint64 len);
|
2014-07-14 21:16:44 +08:00
|
|
|
bool isSequential() const;
|
2014-07-14 05:03:36 +08:00
|
|
|
|
|
|
|
private:
|
2014-07-14 21:16:44 +08:00
|
|
|
MemRing<int16_t> *ring_buffer;
|
2014-07-14 05:03:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // AUDIOINPUTPROXY_H
|