xbmc
AEEncoder.h
1 /*
2  * Copyright (C) 2010-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "cores/AudioEngine/Utils/AEAudioFormat.h"
12 
13 extern "C" {
14 #include <libavcodec/avcodec.h>
15 }
16 
21 {
22 public:
26  IAEEncoder() = default;
27 
31  virtual ~IAEEncoder() = default;
32 
38  virtual bool IsCompatible(const AEAudioFormat& format) = 0;
39 
46  virtual bool Initialize(AEAudioFormat &format, bool allow_planar_input = false) = 0;
47 
51  virtual void Reset() = 0;
52 
57  virtual unsigned int GetBitRate() = 0;
58 
63  virtual AVCodecID GetCodecID() = 0;
64 
69  virtual unsigned int GetFrames() = 0;
70 
79  virtual int Encode (uint8_t *in, int in_size, uint8_t *out, int out_size) = 0;
80 
86  virtual int GetData(uint8_t **data) = 0;
87 
93  virtual double GetDelay(unsigned int bufferSize) = 0;
94 };
95 
virtual unsigned int GetBitRate()=0
Returns the bitrate of the encoder.
virtual int Encode(uint8_t *in, int in_size, uint8_t *out, int out_size)=0
Encodes the supplied samples into a provided buffer.
virtual bool Initialize(AEAudioFormat &format, bool allow_planar_input=false)=0
Called to setup the encoder to accept data in the specified format.
virtual unsigned int GetFrames()=0
Return the number of frames needed to encode.
virtual double GetDelay(unsigned int bufferSize)=0
Get the delay in seconds.
IAEEncoder interface for on the fly audio compression.
Definition: AEEncoder.h:20
virtual AVCodecID GetCodecID()=0
Returns the AVCodecID of the encoder.
virtual bool IsCompatible(const AEAudioFormat &format)=0
Return true if the supplied format is compatible with the current open encoder.
The audio format structure that fully defines a stream&#39;s audio information.
Definition: AEAudioFormat.h:19
IAEEncoder()=default
Constructor.
virtual int GetData(uint8_t **data)=0
Get the encoded data.
virtual ~IAEEncoder()=default
Destructor.
virtual void Reset()=0
Reset the encoder for new data.