MythTV  master
audiooutputnull.h
Go to the documentation of this file.
1 #ifndef AUDIOOUTPUTNULL
2 #define AUDIOOUTPUTNULL
3 
4 #include "audiooutputbase.h"
5 
6 #define NULLAUDIO_OUTPUT_BUFFER_SIZE 32768
7 
8 /*
9 
10  In its default invocation, this AudioOutput object does almost nothing.
11  It takes all bytes written to its "device" and just ignores them. Since
12  there is no device in the way consuming the audio bytes, nothing
13  throttles the speed of decoding.
14 
15  If it is told to buffer the output data (bufferOutputData(true)), then
16  it will maintain a small buffer and will not let anymore audio data be
17  decoded until something pulls the data off (via readOutputData()).
18 
19 */
20 
22 {
23  public:
24  explicit AudioOutputNULL(const AudioSettings &settings);
25  ~AudioOutputNULL() override;
26 
27  void Reset(void) override; // AudioOutputBase
28 
29 
30  // Volume control
31  int GetVolumeChannel(int /* channel */) const override // VolumeBase
32  { return 100; }
33  void SetVolumeChannel(int /* channel */, int /* volume */) override // VolumeBase
34  {}
35 
36  int readOutputData(unsigned char *read_buffer, int max_length) override; // AudioOutputBase
37 
38  protected:
39  // AudioOutputBase
40  bool OpenDevice(void) override; // AudioOutputBase
41  void CloseDevice(void) override; // AudioOutputBase
42  void WriteAudio(unsigned char *aubuf, int size) override; // AudioOutputBase
43  int GetBufferedOnSoundcard(void) const override; // AudioOutputBase
44  AudioOutputSettings* GetOutputSettings(bool digital) override; // AudioOutputBase
45 
46  private:
47  QMutex m_pcm_output_buffer_mutex {QMutex::NonRecursive};
50 };
51 
52 #endif
53 
void WriteAudio(unsigned char *aubuf, int size) override
int GetVolumeChannel(int) const override
bool OpenDevice(void) override
unsigned char m_pcm_output_buffer[NULLAUDIO_OUTPUT_BUFFER_SIZE]
AudioOutputNULL(const AudioSettings &settings)
AudioOutputSettings * GetOutputSettings(bool digital) override
void Reset(void) override
Reset the audiobuffer, timecode and mythmusic visualisation.
void SetVolumeChannel(int, int) override
int readOutputData(unsigned char *read_buffer, int max_length) override
~AudioOutputNULL() override
QMutex m_pcm_output_buffer_mutex
int GetBufferedOnSoundcard(void) const override
Return the size in bytes of frames currently in the audio buffer adjusted with the audio playback lat...
void CloseDevice(void) override
#define NULLAUDIO_OUTPUT_BUFFER_SIZE