MythTV  master
audioreencodebuffer.h
Go to the documentation of this file.
1 #ifndef AUDIOREENCODEBUFFER_H
2 #define AUDIOREENCODEBUFFER_H
3 
4 #include "mythconfig.h"
5 #include "audiooutput.h"
6 
7 #define ABLOCK_SIZE 8192
8 
10 {
11  public:
12  AudioBuffer();
13  AudioBuffer(const AudioBuffer &old);
14  ~AudioBuffer();
15 
16  void appendData(unsigned char *buffer, int len, int frames, long long time);
17  char *data(void) { return (char *)m_buffer; }
18  int size(void) { return m_size; }
19 
20  uint8_t *m_buffer {nullptr};
21  int m_size {0};
23  int m_frames {0};
24  long long m_time {-1};
25 };
26 
32 {
33  public:
34  AudioReencodeBuffer(AudioFormat audio_format, int audio_channels,
35  bool passthru);
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, int64_t timecode) override; // AudioOutput
42  bool AddData(void *buffer, int len, int64_t timecode,
43  int frames) override; // AudioOutput
44  AudioBuffer *GetData(long long time);
45  long long GetSamples(long long time);
46  void SetTimecode(int64_t 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  int64_t GetAudiotime(void) override { return m_last_audiotime; } // AudioOutput
52  int GetVolumeChannel(int) const override { return 100; } // VolumeBase
53  void SetVolumeChannel(int, int) override { } // VolumeBase
54  void SetVolumeAll(int) { }
55  uint GetCurrentVolume(void) const override { return 100; } // VolumeBase
56  void SetCurrentVolume(int) override { } // VolumeBase
57  void AdjustCurrentVolume(int) override { } // VolumeBase
58  virtual void SetMute(bool) { }
59  void ToggleMute(void) override { } // VolumeBase
60  MuteState GetMuteState(void) const override { return kMuteOff; } // VolumeBase
61  virtual MuteState IterateMutedChannels(void) { return kMuteOff; }
62  void SetSWVolume(int, bool) override { return; } // VolumeBase
63  int GetSWVolume(void) override { return 100; } // VolumeBase
64  bool CanPassthrough(int, int, AVCodecID, int) const override // AudioOutput
65  { return m_initpassthru; }
66 
67  // These are pure virtual in AudioOutput, but we don't need them here
68  void bufferOutputData(bool) override { return; } // AudioOutput
69  int readOutputData(unsigned char*, int ) override { return 0; } // AudioOutput
70 
74  long long m_last_audiotime {0};
75  bool m_passthru;
77 
78  private:
80  QMutex m_bufferMutex;
81  QList<AudioBuffer *> m_bufferList;
83 };
84 
85 #endif
86 /* vim: set expandtab tabstop=4 shiftwidth=4: */
87 
AudioBuffer * GetData(long long time)
int readOutputData(unsigned char *, int) override
uint8_t * m_buffer
bool AddData(void *buffer, int len, int64_t timecode, int frames) override
Add data to the audiobuffer for playback.
MuteState
Definition: volumebase.h:6
void SetVolumeChannel(int, int) override
int64_t GetAudiotime(void) override
unsigned int uint
Definition: compat.h:140
bool AddFrames(void *buffer, int frames, int64_t timecode) override
Add frames to the audiobuffer for playback.
void SetSWVolume(int, bool) override
int GetSWVolume(void) override
virtual MuteState IterateMutedChannels(void)
AudioBuffer * m_saveBuffer
void Drain(void) override
bool IsPaused(void) const override
#define ABLOCK_SIZE
void SetCurrentVolume(int) override
void Reconfigure(const AudioSettings &settings) override
reconfigure sound out for new params
void AdjustCurrentVolume(int) override
QList< AudioBuffer * > m_bufferList
uint GetCurrentVolume(void) const override
void bufferOutputData(bool) override
bool CanPassthrough(int, int, AVCodecID, int) const override
void appendData(unsigned char *buffer, int len, int frames, long long time)
This class is to act as a fake audio output device to store the data for reencoding.
void ToggleMute(void) override
void PauseUntilBuffered(void) override
AudioReencodeBuffer(AudioFormat audio_format, int audio_channels, bool passthru)
void Pause(bool paused) override
long long GetSamples(long long time)
void SetEffDsp(int dsprate) override
int GetVolumeChannel(int) const override
MuteState GetMuteState(void) const override
virtual void SetMute(bool)
void Reset(void) override
char * data(void)
const char * frames[3]
Definition: element.c:46
void SetTimecode(int64_t timecode) override