MythTV  master
audiooutputbase.h
Go to the documentation of this file.
1 #ifndef AUDIOOUTPUTBASE
2 #define AUDIOOUTPUTBASE
3 
4 // POSIX headers
5 #include <sys/time.h> // for struct timeval
6 
7 // Qt headers
8 #include <QString>
9 #include <QMutex>
10 #include <QWaitCondition>
11 
12 // MythTV headers
13 #include "audiooutput.h"
14 #include "mythlogging.h"
15 #include "mthread.h"
16 
17 #include "samplerate.h"
18 
19 #define VBAUDIO(str) LOG(VB_AUDIO, LOG_INFO, LOC + (str))
20 #define VBAUDIOTS(str) LOG(VB_AUDIO | VB_TIMESTAMP, LOG_INFO, LOC + (str))
21 #define VBGENERAL(str) LOG(VB_GENERAL, LOG_INFO, LOC + (str))
22 #define VBERROR(str) LOG(VB_GENERAL, LOG_ERR, LOC + (str))
23 #define VBWARN(str) LOG(VB_GENERAL, LOG_WARNING, LOC + (str))
24 #define VBERRENO(str) Error(LOC + (str) + ": " + ENO)
25 #define VBERRNOCONST(str) LOG(VB_GENERAL, LOG_ERR, LOC + (str) + ": " + ENO)
26 
27 namespace soundtouch {
28 class SoundTouch;
29 };
30 class FreeSurround;
32 struct AVCodecContext;
33 
35 {
36 public:
37  AsyncLooseLock() = default;
38  void Clear() { m_head = m_tail = 0; }
39  void Ref() { m_head++; }
40  bool TestAndDeref() { bool r = false; if ((r=(m_head != m_tail))) m_tail++; return r; }
41 private:
42  int m_head {0};
43  int m_tail {0};
44 };
45 
46 // Forward declaration of SPDIF encoder
47 class SPDIFEncoder;
48 
49 class AudioOutputBase : public AudioOutput, public MThread
50 {
51  public:
52  static const char *quality_string(int q);
53  explicit AudioOutputBase(const AudioSettings &settings);
54  ~AudioOutputBase() override;
55 
56  AudioOutputSettings* GetOutputSettingsCleaned(bool digital = true) override; // AudioOutput
57  AudioOutputSettings* GetOutputSettingsUsers(bool digital = false) override; // AudioOutput
58 
59  // reconfigure sound out for new params
60  void Reconfigure(const AudioSettings &settings) override; // AudioOutput
61 
62  // dsprate is in 100 * samples/second
63  void SetEffDsp(int dsprate) override; // AudioOutput
64 
65  // timestretch
66  void SetStretchFactor(float factor) override; // AudioOutput
67  float GetStretchFactor(void) const override; // AudioOutput
68  int GetChannels(void) const override { return m_channels; } // AudioOutput
69  AudioFormat GetFormat(void) const override { return m_format; }; // AudioOutput
70  int GetBytesPerFrame(void) const override // AudioOutput
71  { return m_sourceBytesPerFrame; }
72 
73  bool CanPassthrough(int samplerate, int channels,
74  AVCodecID codec, int profile) const override; // AudioOutput
75  bool CanDownmix(void) const override { return true; } // AudioOutput
76  bool IsUpmixing(void) override; // AudioOutput
77  bool ToggleUpmix(void) override; // AudioOutput
78  bool CanUpmix(void) override; // AudioOutput
79  bool CanProcess(AudioFormat /*fmt*/) override { return true; } // AudioOutput
80  uint32_t CanProcess(void) override // AudioOutput
81  {
82  // we support all codec
83  return ~(((~0ULL) >> FORMAT_FLT) << FORMAT_FLT);
84  }
85 
86  void Reset(void) override; // AudioOutput
87 
88  void SetSWVolume(int new_volume, bool save) override; // VolumeBase
89  int GetSWVolume(void) override; // VolumeBase
90 
91  // timecode is in milliseconds.
92  bool AddFrames(void *buffer, int frames, std::chrono::milliseconds timecode) override; // AudioOutput
93  bool AddData(void *buffer, int len, std::chrono::milliseconds timecode, int frames) override; // AudioOutput
94  bool NeedDecodingBeforePassthrough() const override { return false; }; // AudioOutput
95  std::chrono::milliseconds LengthLastData(void) const override { return m_lengthLastData; } // AudioOutput
96 
97  void SetTimecode(std::chrono::milliseconds timecode) override; // AudioOutput
98  bool IsPaused(void) const override { return m_actuallyPaused; } // AudioOutput
99  void Pause(bool paused) override; // AudioOutput
100  void PauseUntilBuffered(void) override; // AudioOutput
101 
102  // Wait for all data to finish playing
103  void Drain(void) override; // AudioOutput
104 
105  std::chrono::milliseconds GetAudiotime(void) override; // AudioOutput
106  std::chrono::milliseconds GetAudioBufferedTime(void) override; // AudioOutput
107 
108  // Send output events showing current progress
109  virtual void Status(void);
110 
111  void SetSourceBitrate(int rate) override; // AudioOutput
112 
113  void GetBufferStatus(uint &fill, uint &total) override; // AudioOutput
114 
115  // Only really used by the AudioOutputNULL object
116  void bufferOutputData(bool y) override // AudioOutput
117  { m_bufferOutputDataForUse = y; }
118  int readOutputData(unsigned char *read_buffer, size_t max_length) override; // AudioOutput
119 
120  static const uint kAudioSRCInputSize = 16384;
121 
123  // In other words, divisible by 96.
124  static const uint kAudioRingBufferSize = 10239936U;
125 
126  protected:
127  // Following function must be called from subclass constructor
128  void InitSettings(const AudioSettings &settings);
129 
130  // You need to implement the following functions
131  virtual bool OpenDevice(void) = 0;
132  virtual void CloseDevice(void) = 0;
133  virtual void WriteAudio(unsigned char *aubuf, int size) = 0;
138  virtual int GetBufferedOnSoundcard(void) const = 0;
139  // Default implementation only supports 2ch s16le at 48kHz
140  virtual AudioOutputSettings* GetOutputSettings(bool /*digital*/)
141  { return new AudioOutputSettings; }
142  // You need to call this from any implementation in the dtor.
143  void KillAudio(void);
144 
145  // The following functions may be overridden, but don't need to be
146  virtual bool StartOutputThread(void);
147  virtual void StopOutputThread(void);
148 
149  int GetAudioData(uchar *buffer, int buf_size, bool full_buffer,
150  volatile uint *local_raud = nullptr);
151 
152  void OutputAudioLoop(void);
153 
154  void run() override; // MThread
155 
156  int CheckFreeSpace(int &frames);
157 
158  inline int audiolen() const; // number of valid bytes in audio buffer
159  int audiofree() const; // number of free bytes in audio buffer
160  int audioready() const; // number of bytes ready to be written
161 
162  void SetStretchFactorLocked(float factor);
163 
164  // For audiooutputca
165  std::chrono::milliseconds GetBaseAudBufTimeCode() const
166  { return m_audbufTimecode; }
167 
168  bool usesSpdif() const { return m_usesSpdif; }
169 
170  protected:
171  // Basic details about the audio stream
172  int m_channels {-1};
173  AVCodecID m_codec {AV_CODEC_ID_NONE};
178  int m_sampleRate {-1};
179  int m_effDsp {0}; // from the recorded stream (NuppelVideo)
180  int m_fragmentSize {0};
182 
183  QString m_mainDevice;
185  bool m_discreteDigital {false};
186 
187  bool m_passthru {false};
188  bool m_enc {false};
189  bool m_reEnc {false};
190 
191  float m_stretchFactor {1.0F};
192  int m_effStretchFactor {100000}; // scaled to 100000 ase ffdsp is
194 
195  bool m_killAudio {false};
196 
197  bool m_pauseAudio {false};
198  bool m_actuallyPaused {false};
199  bool m_wasPaused {false};
200  bool m_unpauseWhenReady {false};
202  bool m_bufferOutputDataForUse {false}; // used by AudioOutputNULL
203 
205  int m_maxChannels {0};
206  enum
207  {
212  };
214  long m_sourceBitRate {-1};
216 
217  private:
218  bool SetupPassthrough(AVCodecID codec, int codec_profile,
219  int &samplerate_tmp, int &channels_tmp);
220  AudioOutputSettings* OutputSettings(bool digital = true);
221  int CopyWithUpmix(char *buffer, int frames, uint &org_waud);
222  void SetAudiotime(int frames, std::chrono::milliseconds timecode);
227  bool m_needResampler {false};
228  SRC_STATE *m_srcCtx {nullptr};
229  soundtouch::SoundTouch *m_pSoundStretch {nullptr};
232 
235  bool m_upmixDefault {false};
236  bool m_needsUpmix {false};
237  bool m_needsDownmix {false};
239  float m_oldStretchFactor {1.0F};
240  int m_volume {80};
242 
243  bool m_processing {false};
244 
245  int64_t m_framesBuffered {0};
246 
247  bool m_audioThreadExists {false};
248 
254 
259  QMutex m_avsyncLock;
260 
264  std::chrono::milliseconds m_audioTime {0ms};
265 
269  volatile uint m_raud {0}; // read position
270  volatile uint m_waud {0}; // write position
274  std::chrono::milliseconds m_audbufTimecode {0ms};
276 
278 
279  std::chrono::seconds m_currentSeconds {-1s};
280 
281  float *m_srcIn;
282 
283  // All actual buffers
284  SRC_DATA m_srcData {};
286  alignas(16) std::array<float,kAudioSRCInputSize> m_srcInBuf {};
288  float *m_srcOut {nullptr};
294  std::array<uchar,kAudioRingBufferSize> m_audioBuffer {0};
296  bool m_configureSucceeded {false};
297  std::chrono::milliseconds m_lengthLastData {0ms};
298 
299  // SPDIF Encoder for digital passthrough
300  bool m_usesSpdif {true};
302 
303  // Flag indicating if SetStretchFactor enabled audio float processing
304  bool m_forcedProcessing {false};
305  int m_previousBpf {0};
306 };
307 
308 #endif
AudioOutputBase::m_srcOut
float * m_srcOut
Definition: audiooutputbase.h:288
AudioOutputBase::m_enc
bool m_enc
Definition: audiooutputbase.h:188
FORMAT_NONE
@ FORMAT_NONE
Definition: audiooutputsettings.h:26
AudioOutputBase::m_outputSettingsRaw
AudioOutputSettings * m_outputSettingsRaw
Definition: audiooutputbase.h:223
AudioOutputBase::m_srcIn
float * m_srcIn
Definition: audiooutputbase.h:281
AudioOutputBase::Reset
void Reset(void) override
Reset the audiobuffer, timecode and mythmusic visualisation.
Definition: audiooutputbase.cpp:924
AudioOutputBase::m_pSoundStretch
soundtouch::SoundTouch * m_pSoundStretch
Definition: audiooutputbase.h:229
AudioOutputBase::GetBytesPerFrame
int GetBytesPerFrame(void) const override
Definition: audiooutputbase.h:70
AudioOutputBase::m_discreteDigital
bool m_discreteDigital
Definition: audiooutputbase.h:185
AudioOutputBase::SetTimecode
void SetTimecode(std::chrono::milliseconds timecode) override
Set the timecode of the samples most recently added to the audiobuffer.
Definition: audiooutputbase.cpp:962
AudioOutputBase::Pause
void Pause(bool paused) override
Definition: audiooutputbase.cpp:902
AudioOutputBase::m_raud
volatile uint m_raud
Audio circular buffer.
Definition: audiooutputbase.h:269
AudioOutputBase::AddData
bool AddData(void *buffer, int len, std::chrono::milliseconds timecode, int frames) override
Add data to the audiobuffer and perform any required processing.
Definition: audiooutputbase.cpp:1316
soundtouch
Definition: audiooutputbase.h:27
AudioOutputBase::CheckFreeSpace
int CheckFreeSpace(int &frames)
Check that there's enough space in the audiobuffer to write the provided number of frames.
Definition: audiooutputbase.cpp:1183
AudioOutputBase::audiolen
int audiolen() const
Get the number of bytes in the audiobuffer.
Definition: audiooutputbase.cpp:983
AudioOutputBase::m_bufferOutputDataForUse
bool m_bufferOutputDataForUse
Definition: audiooutputbase.h:202
AudioOutputBase::m_resetActive
AsyncLooseLock m_resetActive
Definition: audiooutputbase.h:275
AudioOutputBase::m_avsyncLock
QMutex m_avsyncLock
must hold avsync_lock to read or write 'audiotime' and 'audiotime_updated'
Definition: audiooutputbase.h:259
AudioOutputBase::m_forcedProcessing
bool m_forcedProcessing
Definition: audiooutputbase.h:304
AudioOutputBase::CanPassthrough
bool CanPassthrough(int samplerate, int channels, AVCodecID codec, int profile) const override
Test if we can output digital audio and if sample rate is supported.
Definition: audiooutputbase.cpp:206
AsyncLooseLock
Definition: audiooutputbase.h:34
AudioOutputBase::m_needResampler
bool m_needResampler
Definition: audiooutputbase.h:227
AudioOutputBase::CloseDevice
virtual void CloseDevice(void)=0
AudioOutputBase::m_configureSucceeded
bool m_configureSucceeded
Definition: audiooutputbase.h:296
AudioOutputBase::m_memoryCorruptionTest2
uint m_memoryCorruptionTest2
Definition: audiooutputbase.h:290
AudioOutputBase::SetupPassthrough
bool SetupPassthrough(AVCodecID codec, int codec_profile, int &samplerate_tmp, int &channels_tmp)
Definition: audiooutputbase.cpp:406
AudioOutputBase::audiofree
int audiofree() const
Get the free space in the audiobuffer in bytes.
Definition: audiooutputbase.cpp:993
AudioOutputBase::m_previousBpf
int m_previousBpf
Definition: audiooutputbase.h:305
AudioOutputBase::KillAudio
void KillAudio(void)
Kill the output thread and cleanup.
Definition: audiooutputbase.cpp:860
AudioOutputBase::readOutputData
int readOutputData(unsigned char *read_buffer, size_t max_length) override
Definition: audiooutputbase.cpp:1847
AudioOutputBase::GetAudiotime
std::chrono::milliseconds GetAudiotime(void) override
Calculate the timecode of the samples that are about to become audible.
Definition: audiooutputbase.cpp:1018
AudioOutputBase::GetStretchFactor
float GetStretchFactor(void) const override
Get the timetretch factor.
Definition: audiooutputbase.cpp:363
FreeSurround
Definition: freesurround.h:26
AudioOutputBase::IsUpmixing
bool IsUpmixing(void) override
Source is currently being upmixed.
Definition: audiooutputbase.cpp:371
AudioOutputBase::SetEffDsp
void SetEffDsp(int dsprate) override
Set the effective DSP rate.
Definition: audiooutputbase.cpp:974
AudioOutputBase::CanDownmix
bool CanDownmix(void) const override
Definition: audiooutputbase.h:75
AudioOutputBase::m_audbufTimecode
std::chrono::milliseconds m_audbufTimecode
timecode of audio most recently placed into buffer
Definition: audiooutputbase.h:274
AudioOutputBase::quality_string
static const char * quality_string(int q)
Definition: audiooutputbase.cpp:45
AudioOutputBase::m_sampleRate
int m_sampleRate
Definition: audiooutputbase.h:178
AudioOutputBase::m_volume
int m_volume
Definition: audiooutputbase.h:240
AudioOutputBase::m_sourceChannels
int m_sourceChannels
Definition: audiooutputbase.h:233
AudioOutputBase::m_killAudio
bool m_killAudio
Definition: audiooutputbase.h:195
AudioOutputBase::SetAudiotime
void SetAudiotime(int frames, std::chrono::milliseconds timecode)
Set the timecode of the top of the ringbuffer Exclude all other processing elements as they dont vary...
Definition: audiooutputbase.cpp:1098
AsyncLooseLock::AsyncLooseLock
AsyncLooseLock()=default
AudioOutputBase::GetBufferedOnSoundcard
virtual int GetBufferedOnSoundcard(void) const =0
Return the size in bytes of frames currently in the audio buffer adjusted with the audio playback lat...
AudioOutputBase::m_kAudioSRCOutputSize
int m_kAudioSRCOutputSize
Definition: audiooutputbase.h:289
AudioSettings
Definition: audiosettings.h:28
AudioOutputBase::m_lengthLastData
std::chrono::milliseconds m_lengthLastData
Definition: audiooutputbase.h:297
AudioOutputBase::m_mainDevice
QString m_mainDevice
Definition: audiooutputbase.h:183
AudioOutputBase::LengthLastData
std::chrono::milliseconds LengthLastData(void) const override
Definition: audiooutputbase.h:95
AsyncLooseLock::Ref
void Ref()
Definition: audiooutputbase.h:39
AudioOutputBase::Drain
void Drain(void) override
Block until all available frames have been written to the device.
Definition: audiooutputbase.cpp:1822
AudioOutputBase::m_soundcardBufferSize
long m_soundcardBufferSize
Definition: audiooutputbase.h:181
AudioOutputBase::m_stretchFactor
float m_stretchFactor
Definition: audiooutputbase.h:191
AudioOutputBase::m_unpauseWhenReady
bool m_unpauseWhenReady
Definition: audiooutputbase.h:200
AudioOutputBase::GetChannels
int GetChannels(void) const override
Definition: audiooutputbase.h:68
AudioOutput
Definition: audiooutput.h:26
AudioOutputBase
Definition: audiooutputbase.h:49
AudioOutputBase::m_srcInBuf
std::array< float, kAudioSRCInputSize > m_srcInBuf
Definition: audiooutputbase.h:286
AudioOutputDigitalEncoder
Definition: audiooutputdigitalencoder.h:14
AudioOutputBase::m_upmixer
FreeSurround * m_upmixer
Definition: audiooutputbase.h:231
AudioOutputBase::m_killAudioLock
QMutex m_killAudioLock
Definition: audiooutputbase.h:277
mythlogging.h
AudioOutputBase::m_srcQuality
int m_srcQuality
Definition: audiooutputbase.h:213
AudioOutputBase::m_volumeControl
QString m_volumeControl
Definition: audiooutputbase.h:241
AudioOutputBase::m_audioThreadExists
bool m_audioThreadExists
Definition: audiooutputbase.h:247
hardwareprofile.scan.profile
profile
Definition: scan.py:99
AudioOutputBase::m_format
AudioFormat m_format
Definition: audiooutputbase.h:176
AudioOutputBase::AudioOutputBase
AudioOutputBase(const AudioSettings &settings)
Definition: audiooutputbase.cpp:57
AudioOutputBase::m_waud
volatile uint m_waud
Definition: audiooutputbase.h:270
AudioOutputBase::m_sourceSampleRate
int m_sourceSampleRate
Definition: audiooutputbase.h:215
AsyncLooseLock::m_head
int m_head
Definition: audiooutputbase.h:42
AudioOutputBase::QUALITY_LOW
@ QUALITY_LOW
Definition: audiooutputbase.h:209
AudioOutputBase::GetOutputSettingsCleaned
AudioOutputSettings * GetOutputSettingsCleaned(bool digital=true) override
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
Definition: audiooutputbase.cpp:153
AudioOutputBase::m_needsUpmix
bool m_needsUpmix
Definition: audiooutputbase.h:236
AudioOutputBase::m_effStretchFactor
int m_effStretchFactor
Definition: audiooutputbase.h:192
AudioOutputBase::StopOutputThread
virtual void StopOutputThread(void)
Definition: audiooutputbase.cpp:848
FORMAT_FLT
@ FORMAT_FLT
Definition: audiooutputsettings.h:32
AudioOutputBase::Reconfigure
void Reconfigure(const AudioSettings &settings) override
(Re)Configure AudioOutputBase
Definition: audiooutputbase.cpp:466
AudioOutputBase::GetOutputSettings
virtual AudioOutputSettings * GetOutputSettings(bool)
Definition: audiooutputbase.h:140
AudioOutputBase::~AudioOutputBase
~AudioOutputBase() override
Destructor.
Definition: audiooutputbase.cpp:86
AudioOutputBase::m_memoryCorruptionTest1
uint m_memoryCorruptionTest1
Definition: audiooutputbase.h:287
AudioOutputBase::m_oldStretchFactor
float m_oldStretchFactor
Definition: audiooutputbase.h:239
AudioOutputBase::GetAudioData
int GetAudioData(uchar *buffer, int buf_size, bool full_buffer, volatile uint *local_raud=nullptr)
Copy frames from the audiobuffer into the buffer provided.
Definition: audiooutputbase.cpp:1735
AudioOutputBase::m_maxChannels
int m_maxChannels
Definition: audiooutputbase.h:205
AudioOutputBase::m_currentSeconds
std::chrono::seconds m_currentSeconds
Definition: audiooutputbase.h:279
AudioOutputBase::NeedDecodingBeforePassthrough
bool NeedDecodingBeforePassthrough() const override
Definition: audiooutputbase.h:94
AudioOutputBase::m_outputSettingsDigitalRaw
AudioOutputSettings * m_outputSettingsDigitalRaw
Definition: audiooutputbase.h:225
AudioOutputBase::m_pauseAudio
bool m_pauseAudio
Definition: audiooutputbase.h:197
AudioOutputBase::QUALITY_MEDIUM
@ QUALITY_MEDIUM
Definition: audiooutputbase.h:210
AudioOutputBase::kAudioRingBufferSize
static const uint kAudioRingBufferSize
Audio Buffer Size – should be divisible by 32,24,16,12,10,8,6,4,2..
Definition: audiooutputbase.h:124
AudioOutputBase::run
void run() override
Main routine for the output thread.
Definition: audiooutputbase.cpp:1838
AudioOutputBase::bufferOutputData
void bufferOutputData(bool y) override
Definition: audiooutputbase.h:116
AudioOutputBase::m_sourceBytesPerFrame
int m_sourceBytesPerFrame
Definition: audiooutputbase.h:234
uint
unsigned int uint
Definition: compat.h:144
AudioOutputBase::m_upmixDefault
bool m_upmixDefault
Definition: audiooutputbase.h:235
AudioOutputBase::m_passthru
bool m_passthru
Definition: audiooutputbase.h:187
AudioOutputBase::OutputAudioLoop
void OutputAudioLoop(void)
Run in the output thread, write frames to the output device as they become available and there's spac...
Definition: audiooutputbase.cpp:1640
AudioOutputBase::m_outputFormat
AudioFormat m_outputFormat
Definition: audiooutputbase.h:177
AudioOutputBase::m_encoder
AudioOutputDigitalEncoder * m_encoder
Definition: audiooutputbase.h:230
AudioOutputBase::m_reEnc
bool m_reEnc
Definition: audiooutputbase.h:189
AudioOutputBase::GetSWVolume
int GetSWVolume(void) override
Get the volume for software volume control.
Definition: audiooutputbase.cpp:1170
AudioOutputBase::audioready
int audioready() const
Get the scaled number of bytes in the audiobuffer, i.e.
Definition: audiooutputbase.cpp:1008
AudioOutputBase::m_channels
int m_channels
Definition: audiooutputbase.h:172
AudioOutputBase::CopyWithUpmix
int CopyWithUpmix(char *buffer, int frames, uint &org_waud)
Copy frames into the audiobuffer, upmixing en route if necessary.
Definition: audiooutputbase.cpp:1218
AudioOutputBase::m_configuredChannels
int m_configuredChannels
Definition: audiooutputbase.h:204
AudioOutputBase::m_setInitialVol
bool m_setInitialVol
Definition: audiooutputbase.h:201
AudioOutputBase::m_passthruDevice
QString m_passthruDevice
Definition: audiooutputbase.h:184
AudioOutputBase::m_spdifEnc
SPDIFEncoder * m_spdifEnc
Definition: audiooutputbase.h:301
AudioOutputBase::m_codec
AVCodecID m_codec
Definition: audiooutputbase.h:173
AudioOutputBase::SetSWVolume
void SetSWVolume(int new_volume, bool save) override
Set the volume for software volume control.
Definition: audiooutputbase.cpp:1160
AudioOutputBase::CanUpmix
bool CanUpmix(void) override
Upmixing of the current source is available if requested.
Definition: audiooutputbase.cpp:397
AudioOutputBase::Status
virtual void Status(void)
Report status via an OutputEvent.
Definition: audiooutputbase.cpp:1605
AudioOutputBase::GetFormat
AudioFormat GetFormat(void) const override
Definition: audiooutputbase.h:69
AudioOutputBase::WriteAudio
virtual void WriteAudio(unsigned char *aubuf, int size)=0
AudioOutputBase::m_outputBytesPerFrame
int m_outputBytesPerFrame
Definition: audiooutputbase.h:175
AudioOutputBase::m_sourceBitRate
long m_sourceBitRate
Definition: audiooutputbase.h:214
AudioOutputBase::m_actuallyPaused
bool m_actuallyPaused
Definition: audiooutputbase.h:198
AudioOutputBase::m_memoryCorruptionTest0
uint m_memoryCorruptionTest0
Definition: audiooutputbase.h:285
AsyncLooseLock::m_tail
int m_tail
Definition: audiooutputbase.h:43
AudioOutputBase::m_wasPaused
bool m_wasPaused
Definition: audiooutputbase.h:199
AudioOutputBase::m_surroundMode
int m_surroundMode
Definition: audiooutputbase.h:238
AudioOutputBase::m_processing
bool m_processing
Definition: audiooutputbase.h:243
AsyncLooseLock::Clear
void Clear()
Definition: audiooutputbase.h:38
AudioOutputSettings
Definition: audiooutputsettings.h:49
AudioOutputBase::usesSpdif
bool usesSpdif() const
Definition: audiooutputbase.h:168
audiooutput.h
AudioOutputBase::AddFrames
bool AddFrames(void *buffer, int frames, std::chrono::milliseconds timecode) override
Add frames to the audiobuffer and perform any required processing.
Definition: audiooutputbase.cpp:1304
AudioOutputBase::QUALITY_DISABLED
@ QUALITY_DISABLED
Definition: audiooutputbase.h:208
AudioOutputBase::SetStretchFactor
void SetStretchFactor(float factor) override
Set the timestretch factor.
Definition: audiooutputbase.cpp:354
AudioOutputBase::m_bytesPerFrame
int m_bytesPerFrame
Definition: audiooutputbase.h:174
AudioOutputBase::m_effDsp
int m_effDsp
Definition: audiooutputbase.h:179
AudioOutputBase::CanProcess
bool CanProcess(AudioFormat) override
Definition: audiooutputbase.h:79
AudioOutputBase::InitSettings
void InitSettings(const AudioSettings &settings)
Definition: audiooutputbase.cpp:117
AudioOutputBase::QUALITY_HIGH
@ QUALITY_HIGH
Definition: audiooutputbase.h:211
AudioOutputBase::OpenDevice
virtual bool OpenDevice(void)=0
AudioOutputBase::IsPaused
bool IsPaused(void) const override
Definition: audiooutputbase.h:98
AudioOutputBase::PauseUntilBuffered
void PauseUntilBuffered(void) override
Definition: audiooutputbase.cpp:914
AudioOutputBase::CanProcess
uint32_t CanProcess(void) override
Definition: audiooutputbase.h:80
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
AudioOutputBase::StartOutputThread
virtual bool StartOutputThread(void)
Definition: audiooutputbase.cpp:836
mthread.h
AudioOutputSource
AudioOutputSource
Definition: audiosettings.h:21
AudioOutputBase::m_audioBuffer
std::array< uchar, kAudioRingBufferSize > m_audioBuffer
main audio buffer
Definition: audiooutputbase.h:294
AudioOutputBase::m_audioBufLock
QMutex m_audioBufLock
Writes to the audiobuffer, reconfigures and audiobuffer resets can only take place while holding this...
Definition: audiooutputbase.h:253
AudioOutputBase::m_source
AudioOutputSource m_source
Definition: audiooutputbase.h:193
AudioOutputBase::GetOutputSettingsUsers
AudioOutputSettings * GetOutputSettingsUsers(bool digital=false) override
Returns capabilities supported by the audio device amended to take into account the digital audio opt...
Definition: audiooutputbase.cpp:182
AudioOutputBase::SetStretchFactorLocked
void SetStretchFactorLocked(float factor)
Set the timestretch factor.
Definition: audiooutputbase.cpp:279
AudioOutputBase::m_fragmentSize
int m_fragmentSize
Definition: audiooutputbase.h:180
SPDIFEncoder
Definition: spdifencoder.h:14
AudioOutputBase::m_outputSettings
AudioOutputSettings * m_outputSettings
Definition: audiooutputbase.h:224
AudioFormat
AudioFormat
Definition: audiooutputsettings.h:25
AudioOutputBase::GetBufferStatus
void GetBufferStatus(uint &fill, uint &total) override
Fill in the number of bytes in the audiobuffer and the total size of the audiobuffer.
Definition: audiooutputbase.cpp:1629
AudioOutputBase::m_framesBuffered
int64_t m_framesBuffered
Definition: audiooutputbase.h:245
AudioOutputBase::GetAudioBufferedTime
std::chrono::milliseconds GetAudioBufferedTime(void) override
Get the difference in timecode between the samples that are about to become audible and the samples m...
Definition: audiooutputbase.cpp:1148
AudioOutputBase::m_audioTime
std::chrono::milliseconds m_audioTime
timecode of audio leaving the soundcard (same units as timecodes)
Definition: audiooutputbase.h:264
AudioOutputBase::GetBaseAudBufTimeCode
std::chrono::milliseconds GetBaseAudBufTimeCode() const
Definition: audiooutputbase.h:165
AudioOutputBase::m_srcCtx
SRC_STATE * m_srcCtx
Definition: audiooutputbase.h:228
AudioOutputBase::m_usesSpdif
bool m_usesSpdif
Definition: audiooutputbase.h:300
AudioOutputBase::kAudioSRCInputSize
static const uint kAudioSRCInputSize
Definition: audiooutputbase.h:120
AudioOutputBase::m_memoryCorruptionTest3
uint m_memoryCorruptionTest3
Definition: audiooutputbase.h:295
AudioOutputBase::ToggleUpmix
bool ToggleUpmix(void) override
Toggle between stereo and upmixed 5.1 if the source material is stereo.
Definition: audiooutputbase.cpp:379
AudioOutputBase::m_srcData
SRC_DATA m_srcData
Definition: audiooutputbase.h:284
AudioOutputBase::SetSourceBitrate
void SetSourceBitrate(int rate) override
Set the bitrate of the source material, reported in periodic OutputEvents.
Definition: audiooutputbase.cpp:268
AudioOutputBase::m_outputSettingsDigital
AudioOutputSettings * m_outputSettingsDigital
Definition: audiooutputbase.h:226
AudioOutputBase::m_needsDownmix
bool m_needsDownmix
Definition: audiooutputbase.h:237
AsyncLooseLock::TestAndDeref
bool TestAndDeref()
Definition: audiooutputbase.h:40
AudioOutputBase::OutputSettings
AudioOutputSettings * OutputSettings(bool digital=true)
Definition: audiooutputbase.cpp:454