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 <QChar> // Fix Qt6 GCC SFINAE warning
8#include <QMutex>
9
10#include "audiooutputbase.h"
11
12static constexpr int32_t NULLAUDIO_OUTPUT_BUFFER_SIZE { 32768 };
13
14/*
15
16 In its default invocation, this AudioOutput object does almost nothing.
17 It takes all bytes written to its "device" and just ignores them. Since
18 there is no device in the way consuming the audio bytes, nothing
19 throttles the speed of decoding.
20
21 If it is told to buffer the output data (bufferOutputData(true)), then
22 it will maintain a small buffer and will not let anymore audio data be
23 decoded until something pulls the data off (via readOutputData()).
24
25*/
26
28{
29 public:
30 explicit AudioOutputNULL(const AudioSettings &settings);
31 ~AudioOutputNULL() override;
32
33 void Reset(void) override; // AudioOutputBase
34 int readOutputData(unsigned char *read_buffer, size_t max_length) override; // AudioOutputBase
35
36 protected:
37 // Volume control
38 int GetVolumeChannel(int /* channel */) const override // VolumeBase
39 { return 100; }
40 void SetVolumeChannel(int /* channel */, int /* volume */) override // VolumeBase
41 {}
42
43 // AudioOutputBase
44 bool OpenDevice(void) override; // AudioOutputBase
45 void CloseDevice(void) override; // AudioOutputBase
46 void WriteAudio(unsigned char *aubuf, int size) override; // AudioOutputBase
47 int GetBufferedOnSoundcard(void) const override; // AudioOutputBase
48 AudioOutputSettings* GetOutputSettings(bool digital) override; // AudioOutputBase
49
50 private:
52 std::vector<unsigned char> m_pcmOutputBuffer {0};
53};
54
55#endif
56
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