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