MythTV master
audioreencodebuffer.h
Go to the documentation of this file.
1#ifndef AUDIOREENCODEBUFFER_H
2#define AUDIOREENCODEBUFFER_H
3
5
6static constexpr size_t ABLOCK_SIZE { 8192 };
7
9{
10 public:
12 AudioBuffer(const AudioBuffer &old);
14
15 void appendData(unsigned char *buffer, int len, int frames, std::chrono::milliseconds time);
16 char *data(void) const { return (char *)m_buffer; }
17 int size(void) const { return m_size; }
18
19 uint8_t *m_buffer {nullptr};
20 size_t m_size {0};
22 int m_frames {0};
23 std::chrono::milliseconds m_time {-1ms};
24};
25
31{
32 public:
33 AudioReencodeBuffer(AudioFormat audio_format, int audio_channels,
34 bool passthru);
35 ~AudioReencodeBuffer() override;
36
37 void Reconfigure(const AudioSettings &settings) override; // AudioOutput
38 void SetEffDsp(int dsprate) override; // AudioOutput
39 void Reset(void) override; // AudioOutput
40 bool AddFrames(void *buffer, int frames, std::chrono::milliseconds timecode) override; // AudioOutput
41 bool AddData(void *buffer, int len, std::chrono::milliseconds timecode,
42 int frames) override; // AudioOutput
43 AudioBuffer *GetData(std::chrono::milliseconds time);
44 long long GetSamples(std::chrono::milliseconds time);
45 void SetTimecode(std::chrono::milliseconds timecode) override; // AudioOutput
46 bool IsPaused(void) const override { return false; } // AudioOutput
47 void Pause(bool paused) override { (void)paused; } // AudioOutput
48 void PauseUntilBuffered(void) override { } // AudioOutput
49 void Drain(void) override { } // AudioOutput
50 std::chrono::milliseconds GetAudiotime(void) override { return m_last_audiotime; } // AudioOutput
51 uint GetCurrentVolume(void) const override { return 100; } // VolumeBase
52 void SetCurrentVolume(int /*value*/) override { } // VolumeBase
53 void AdjustCurrentVolume(int /*change*/) override { } // VolumeBase
54 virtual void SetMute(bool /*mute */) { }
55 void ToggleMute(void) override { } // VolumeBase
56 MuteState GetMuteState(void) const override { return kMuteOff; } // VolumeBase
57 virtual MuteState IterateMutedChannels(void) { return kMuteOff; }
58 bool CanPassthrough(int /*samplerate*/, int /*channels*/, AVCodecID /*codec*/, int /*profile*/) const override // AudioOutput
59 { return m_initpassthru; }
60
61 // These are pure virtual in AudioOutput, but we don't need them here
62 void bufferOutputData(bool /*y*/) override { } // AudioOutput
63 int readOutputData(unsigned char */*read_buffer*/,
64 size_t /*max_length*/) override { return 0; } // AudioOutput
65
66 int m_channels {-1};
69 std::chrono::milliseconds m_last_audiotime {0ms};
70 bool m_passthru {false};
72
73 protected:
74 int GetVolumeChannel(int /*channel*/) const override { return 100; } // VolumeBase
75 void SetVolumeChannel(int /*channel*/, int /*volume*/) override { } // VolumeBase
76 void SetSWVolume(int /*new_volume*/, bool /*save*/) override { } // VolumeBase
77 int GetSWVolume(void) override { return 100; } // VolumeBase
78
79 private:
80 bool m_initpassthru {false};
82 QList<AudioBuffer *> m_bufferList;
84};
85
86#endif
87/* vim: set expandtab tabstop=4 shiftwidth=4: */
88
static constexpr size_t ABLOCK_SIZE
std::chrono::milliseconds m_time
char * data(void) const
void appendData(unsigned char *buffer, int len, int frames, std::chrono::milliseconds time)
uint8_t * m_buffer
int size(void) const
This class is to act as a fake audio output device to store the data for reencoding.
std::chrono::milliseconds m_last_audiotime
int GetVolumeChannel(int) const override
virtual MuteState IterateMutedChannels(void)
void SetTimecode(std::chrono::milliseconds timecode) override
AudioBuffer * m_saveBuffer
void Pause(bool paused) override
bool AddData(void *buffer, int len, std::chrono::milliseconds timecode, int frames) override
Add data to the audiobuffer for playback.
MuteState GetMuteState(void) const override
void ToggleMute(void) override
void SetCurrentVolume(int) override
bool CanPassthrough(int, int, AVCodecID, int) const override
bool IsPaused(void) const override
void SetEffDsp(int dsprate) override
QList< AudioBuffer * > m_bufferList
void AdjustCurrentVolume(int) override
uint GetCurrentVolume(void) const override
bool AddFrames(void *buffer, int frames, std::chrono::milliseconds timecode) override
Add frames to the audiobuffer for playback.
void bufferOutputData(bool) override
int GetSWVolume(void) override
AudioBuffer * GetData(std::chrono::milliseconds time)
virtual void SetMute(bool)
std::chrono::milliseconds GetAudiotime(void) override
void Reconfigure(const AudioSettings &settings) override
reconfigure sound out for new params
void PauseUntilBuffered(void) override
void Reset(void) override
long long GetSamples(std::chrono::milliseconds time)
void SetSWVolume(int, bool) override
void Drain(void) override
AudioReencodeBuffer(AudioFormat audio_format, int audio_channels, bool passthru)
int readOutputData(unsigned char *, size_t) override
void SetVolumeChannel(int, int) override
unsigned int uint
Definition: compat.h:60
MuteState
Definition: volumebase.h:8
@ kMuteOff
Definition: volumebase.h:9