avcodec/encode: restructure the core encoding code

This commit follows the same logic as 061a0c14bb, but for the encode API: The
new public encoding API will no longer be a wrapper around the old deprecated
one, and the internal API used by the encoders now consists of a single
receive_packet() callback that pulls frames as required.

amf encoders adapted by James Almer
librav1e encoder adapted by James Almer
nvidia encoders adapted by James Almer
MediaFoundation encoders adapted by James Almer
vaapi encoders adapted by Linjie Fu
v4l2_m2m encoders adapted by Andriy Gelman

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-06-09 18:31:32 -03:00
parent 71f19bf5e3
commit 827d6fe73d
27 changed files with 449 additions and 226 deletions

View file

@ -113,6 +113,10 @@ typedef struct DecodeSimpleContext {
AVFrame *out_frame;
} DecodeSimpleContext;
typedef struct EncodeSimpleContext {
AVFrame *in_frame;
} EncodeSimpleContext;
typedef struct AVCodecInternal {
/**
* Whether the parent AVCodecContext is a copy of the context which had
@ -151,6 +155,8 @@ typedef struct AVCodecInternal {
void *frame_thread_encoder;
EncodeSimpleContext es;
/**
* Number of audio samples to skip at the start of the next decoded frame
*/
@ -170,7 +176,6 @@ typedef struct AVCodecInternal {
* buffers for using new encode/decode API through legacy API
*/
AVPacket *buffer_pkt;
int buffer_pkt_valid; // encoding: packet without data can be valid
AVFrame *buffer_frame;
int draining_done;
int compat_decode_warned;