2 * Copyright (C) 2010-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/AEEncoder.h"
14 #include <libswresample/swresample.h>
17 /* ffmpeg re-defines this, so undef it to squash the warning */
20 class CAEEncoderFFmpeg
: public IAEEncoder
24 ~CAEEncoderFFmpeg() override
;
26 bool IsCompatible(const AEAudioFormat
& format
) override
;
27 bool Initialize(AEAudioFormat
&format
, bool allow_planar_input
= false) override
;
28 void Reset() override
;
30 unsigned int GetBitRate() override
;
31 AVCodecID
GetCodecID() override
;
32 unsigned int GetFrames() override
;
34 int Encode(uint8_t *in
, int in_size
, uint8_t *out
, int out_size
) override
;
35 int GetData(uint8_t **data
) override
;
36 double GetDelay(unsigned int bufferSize
) override
;
38 unsigned int BuildChannelLayout(const int64_t ffmap
, CAEChannelInfo
& layout
);
40 std::string m_CodecName
;
42 unsigned int m_BitRate
= 0;
43 AEAudioFormat m_CurrentFormat
;
44 AVCodecContext
*m_CodecCtx
;
46 CAEChannelInfo m_Layout
;
47 uint8_t m_Buffer
[8 + AV_INPUT_BUFFER_MIN_SIZE
];
50 double m_OutputRatio
= 0.0;
51 double m_SampleRateMul
= 0.0;
52 unsigned int m_NeededFrames
= 0;
53 bool m_NeedConversion
= false;