2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "cores/AudioEngine/Interfaces/AE.h"
12 #include "cores/AudioEngine/Interfaces/AEStream.h"
13 #include "cores/AudioEngine/Utils/AEChannelInfo.h"
14 #include "threads/CriticalSection.h"
19 #include "PlatformDefs.h"
22 #include <libavcodec/avcodec.h>
25 typedef struct stDVDAudioFrame DVDAudioFrame
;
29 class CAudioSinkAE
: IAEClockCallback
32 explicit CAudioSinkAE(CDVDClock
*clock
);
33 ~CAudioSinkAE() override
;
35 void SetVolume(float fVolume
);
36 void SetDynamicRangeCompression(long drc
);
39 bool Create(const DVDAudioFrame
&audioframe
, AVCodecID codec
, bool needresampler
);
40 bool IsValidFormat(const DVDAudioFrame
&audioframe
);
41 void Destroy(bool finish
);
42 unsigned int AddPackets(const DVDAudioFrame
&audioframe
);
43 double GetPlayingPts();
44 double GetCacheTime();
45 double GetCacheTotal(); // returns total time a stream can buffer
46 double GetMaxDelay(); // returns total time of audio in AE for the stream
47 double GetDelay(); // returns the time it takes to play a packet if we add one at this time
48 double GetSyncError();
49 void SetSyncErrorCorrection(double correction
);
52 * \brief Returns the resample ratio, or 0.0 if unknown/invalid
54 double GetResampleRatio();
56 void SetResampleMode(int mode
);
59 void AbortAddPackets();
61 double GetClock() override
;
62 double GetClockSpeed() override
;
64 CAEStreamInfo::DataType
GetPassthroughStreamType(AVCodecID codecId
, int samplerate
, int profile
);
67 IAE::StreamPtr m_pAudioStream
;
71 unsigned int m_syncErrorTime
;
72 double m_resampleRatio
= 0.0; // invalid
73 CCriticalSection m_critSection
;
75 AEDataFormat m_dataFormat
;
76 unsigned int m_sampleRate
;
79 CAEChannelInfo m_channelLayout
;
80 CAEStreamInfo::DataType m_dataType
;
83 std::atomic_bool m_bAbort
;