MythTV  master
audioinput.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007 Anand K. Mistry
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  */
19 /* vim: set expandtab tabstop=4 shiftwidth=4: */
20 
21 #ifndef AUDIOINPUT_H
22 #define AUDIOINPUT_H
23 
24 #include <QString>
25 #include <unistd.h>
26 
28 {
29  public:
30  virtual ~AudioInput() = default;
31 
32  virtual bool Open(uint sample_bits, uint sample_rate, uint channels) = 0;
33  virtual bool IsOpen(void) = 0;
34  virtual void Close(void) = 0;
35 
36  virtual bool Start(void) = 0;
37  virtual bool Stop(void) = 0;
38 
39  virtual int GetBlockSize(void) = 0;
40  virtual int GetSamples(void *buf, uint nbytes) = 0;
41  virtual int GetNumReadyBytes(void) = 0;
42 
43  // Factory function
44  static AudioInput *CreateDevice(const QByteArray &device);
45 
46  protected:
47  explicit AudioInput(const QString &device)
48  : m_audioDevice(device.toLatin1()) {}
49 
50  QByteArray m_audioDevice;
51  int m_audioChannels {0};
54 };
55 #endif /* AUDIOINPUT_H */
AudioInput::Stop
virtual bool Stop(void)=0
AudioInput::m_audioChannels
int m_audioChannels
Definition: audioinput.h:51
AudioInput::GetBlockSize
virtual int GetBlockSize(void)=0
AudioInput::GetSamples
virtual int GetSamples(void *buf, uint nbytes)=0
AudioInput::~AudioInput
virtual ~AudioInput()=default
AudioInput::IsOpen
virtual bool IsOpen(void)=0
AudioInput::Start
virtual bool Start(void)=0
AudioInput::Open
virtual bool Open(uint sample_bits, uint sample_rate, uint channels)=0
AudioInput
Definition: audioinput.h:28
AudioInput::AudioInput
AudioInput(const QString &device)
Definition: audioinput.h:47
AudioInput::GetNumReadyBytes
virtual int GetNumReadyBytes(void)=0
AudioInput::m_audioSampleRate
int m_audioSampleRate
Definition: audioinput.h:53
AudioInput::Close
virtual void Close(void)=0
AudioInput::m_audioSampleBits
int m_audioSampleBits
Definition: audioinput.h:52
AudioInput::m_audioDevice
QByteArray m_audioDevice
Definition: audioinput.h:50
uint
unsigned int uint
Definition: compat.h:140
AudioInput::CreateDevice
static AudioInput * CreateDevice(const QByteArray &device)
Definition: audioinput.cpp:29