11 #include "ActiveAESink.h" 12 #include "cores/AudioEngine/Engines/ActiveAE/ActiveAEBuffer.h" 13 #include "cores/AudioEngine/Interfaces/AESound.h" 14 #include "cores/AudioEngine/Interfaces/AEStream.h" 15 #include "guilib/DispResource.h" 16 #include "threads/SystemClock.h" 17 #include "threads/Thread.h" 28 #include <libavformat/avformat.h> 29 #include <libavcodec/avcodec.h> 30 #include <libavutil/avutil.h> 40 class CActiveAEStream;
41 class CActiveAESettings;
47 std::string passthroughdevice;
53 bool truehdpassthrough;
54 bool dtshdpassthrough;
55 bool usesdtscorefallback;
61 unsigned int samplerate;
62 AEQuality resampleQuality;
63 double atempoThreshold;
65 int silenceTimeoutMinutes;
72 :
Protocol(std::move(name), inEvent, outEvent)
114 :
Protocol(std::move(name), inEvent, outEvent)
139 unsigned int options;
178 enum AVMatrixEncoding matrix_encoding;
179 enum AVAudioServiceType audio_service_type;
185 void Reset(
unsigned int sampleRate,
bool pcm);
186 void UpdateSinkDelay(
const AEDelayStatus& status,
int samples);
187 void AddSamples(
int samples,
const std::list<CActiveAEStream*>& streams);
189 void AddStream(
unsigned int streamid);
190 void RemoveStream(
unsigned int streamid);
195 float GetCacheTotal();
196 float GetMaxDelay()
const;
197 float GetWaterLevel();
198 void SetSuspended(
bool state);
200 void SetSinkCacheTotal(
float time) { m_sinkCacheTotal = time; }
201 void SetSinkLatency(
float time) { m_sinkLatency = time; }
202 void SetSinkNeedIec(
bool needIEC) { m_sinkNeedIecPack = needIEC; }
206 float m_sinkCacheTotal;
208 int m_bufferedSamples;
209 unsigned int m_sinkSampleRate;
214 bool m_sinkNeedIecPack{
false};
215 CCriticalSection m_lock;
218 unsigned int m_streamId;
219 double m_bufferedTime;
220 double m_resampleRatio;
222 unsigned int m_errorTime;
223 CAESyncInfo::AESyncState m_syncState;
225 std::vector<StreamStats> m_streamStats;
239 void Start()
override;
240 void Shutdown()
override;
241 bool Suspend()
override;
242 bool Resume()
override;
243 bool IsSuspended()
override;
244 void OnSettingsChange();
246 float GetVolume()
override;
247 void SetVolume(
const float volume)
override;
248 void SetMute(
const bool enabled)
override;
249 bool IsMuted()
override;
253 unsigned int options = 0,
257 IAE::SoundPtr MakeSound(
const std::string& file)
override;
259 void EnumerateOutputDevices(AEDeviceList &devices,
bool passthrough)
override;
261 bool SupportsSilenceTimeout()
override;
262 bool UsesDtsCoreFallback()
override;
263 bool HasStereoAudioChannelCount()
override;
264 bool HasHDAudioChannelCount()
override;
265 bool SupportsQualityLevel(
enum AEQuality level)
override;
266 bool IsSettingVisible(
const std::string &settingId)
override;
267 void KeepConfiguration(
unsigned int millis)
override;
268 void DeviceChange()
override;
269 void DeviceCountChange(
const std::string& driver)
override;
270 bool GetCurrentSinkFormat(
AEAudioFormat &SinkFormat)
override;
275 void OnLostDisplay()
override;
276 void OnResetDisplay()
override;
277 void OnAppFocusChange(
bool focus)
override;
280 bool FreeStream(
IAEStream* stream,
bool finish)
override;
281 void FreeSound(
IAESound* sound)
override;
285 static uint8_t **AllocSoundSample(
SampleConfig &
config,
int &samples,
int &bytes_per_sample,
int &planes,
int &linesize);
286 static void FreeSoundSample(uint8_t **data);
289 float GetCacheTime(
CActiveAEStream *stream) {
return m_stats.GetCacheTime(stream); }
290 float GetCacheTotal() {
return m_stats.GetCacheTotal(); }
291 float GetMaxDelay() {
return m_stats.GetMaxDelay(); }
300 void SetStreamFFmpegInfo(
CActiveAEStream *stream,
int profile,
enum AVMatrixEncoding matrix_encoding,
enum AVAudioServiceType audio_service_type);
301 void SetStreamFade(
CActiveAEStream *stream,
float from,
float target,
unsigned int millis);
304 void Process()
override;
308 void UnconfigureSink();
311 void ValidateOutputDevices(
bool saveChanges);
312 bool NeedReconfigureBuffers();
313 bool NeedReconfigureSink();
323 void ClearDiscardedBuffers();
326 void ChangeResamplers();
332 void ResampleSounds();
344 bool m_bStateMachineSelfTrigger;
345 std::chrono::milliseconds m_extTimeout;
349 std::chrono::milliseconds m_extKeepConfig;
351 std::queue<time_t> m_extLastDeviceChange;
352 bool m_extSuspended =
false;
353 bool m_isWinSysReg =
false;
371 std::string m_currDevice;
372 std::unique_ptr<CActiveAESettings> m_settingsHandler;
375 std::unique_ptr<CActiveAEBufferPoolResample> m_sinkBuffers;
376 std::unique_ptr<CActiveAEBufferPoolResample> m_vizBuffers;
377 std::unique_ptr<CActiveAEBufferPool> m_vizBuffersInput;
378 std::unique_ptr<CActiveAEBufferPool>
380 std::unique_ptr<CActiveAEBufferPool> m_encoderBuffers;
383 std::list<CActiveAEStream*> m_streams;
384 std::list<std::unique_ptr<CActiveAEBufferPool>> m_discardBufferPools;
385 unsigned int m_streamIdGen;
393 std::list<SoundState> m_sounds_playing;
394 std::vector<CActiveAESound*> m_sounds;
397 float m_volumeScaled;
399 bool m_sinkHasVolume;
402 std::vector<IAudioCallback*> m_audioCallback;
403 bool m_vizInitialized;
404 CCriticalSection m_vizLock;
409 bool m_aeGUISoundForce;
This is an Event class built from a ConditionVariable.
Definition: Event.h:35
Definition: deflate.c:123
the variables here follow ffmpeg naming
Definition: ActiveAEBuffer.h:28
IAEEncoder interface for on the fly audio compression.
Definition: AEEncoder.h:20
Definition: ActiveAEStream.h:130
Callback interface for VideoPlayer clock needed by AE for sync.
Definition: AEStream.h:23
Definition: ActorProtocol.h:73
Definition: ActiveAESink.h:92
Definition: ActiveAEBuffer.h:75
Definition: SystemClock.h:31
Definition: IAudioCallback.h:15
IAEStream Stream Interface for streaming audio.
Definition: AEStream.h:52
Definition: ActiveAE.h:166
Definition: Application.h:67
Definition: ActorProtocol.h:45
Definition: DispResource.h:14
Definition: ActiveAE.h:136
Definition: settings.py:1
Definition: ActiveAE.h:388
Definition: ActiveAE.h:182
Definition: ActiveAESound.h:26
Definition: ActiveAE.h:68
Definition: ActiveAE.h:149
IAE Interface.
Definition: AE.h:81
Definition: ActiveAEBuffer.h:45
Definition: ActiveAE.h:143
Definition: ActiveAE.h:228
Definition: ActiveAE.h:43
Definition: AEStream.h:31
Definition: ActiveAE.h:216
Definition: ActiveAE.h:155
Definition: ActiveAE.h:110
Definition: ActiveAE.h:174