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