[FFmpeg-devel] [PATCH 1/2 v5] avcodec/encode: restructure the core encoding code
James Almer
jamrial at gmail.com
Thu Jun 18 00:39:32 EEST 2020
On 6/9/2020 7:22 PM, James Almer wrote:
> 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 at gmail.com>
> ---
> Rebased once again.
>
> libavcodec/amfenc.c | 43 ++---
> libavcodec/amfenc.h | 2 -
> libavcodec/amfenc_h264.c | 1 -
> libavcodec/amfenc_hevc.c | 1 -
> libavcodec/codec.h | 10 +-
> libavcodec/encode.c | 286 ++++++++++++++++++++++++--------
> libavcodec/encode.h | 39 +++++
> libavcodec/internal.h | 7 +-
> libavcodec/librav1e.c | 51 ++++--
> libavcodec/mfenc.c | 58 ++++---
> libavcodec/nvenc.c | 72 ++++----
> libavcodec/nvenc.h | 9 +-
> libavcodec/nvenc_h264.c | 6 -
> libavcodec/nvenc_hevc.c | 4 -
> libavcodec/utils.c | 10 +-
> libavcodec/v4l2_m2m.c | 8 +
> libavcodec/v4l2_m2m.h | 3 +
> libavcodec/v4l2_m2m_enc.c | 15 +-
> libavcodec/vaapi_encode.c | 26 ++-
> libavcodec/vaapi_encode.h | 3 +-
> libavcodec/vaapi_encode_h264.c | 1 -
> libavcodec/vaapi_encode_h265.c | 1 -
> libavcodec/vaapi_encode_mjpeg.c | 1 -
> libavcodec/vaapi_encode_mpeg2.c | 1 -
> libavcodec/vaapi_encode_vp8.c | 1 -
> libavcodec/vaapi_encode_vp9.c | 1 -
> 26 files changed, 441 insertions(+), 219 deletions(-)
> create mode 100644 libavcodec/encode.h
[...]
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index cb05ebd774..98026f451a 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -25,6 +25,7 @@
> #include "libavutil/pixdesc.h"
>
> #include "vaapi_encode.h"
> +#include "encode.h"
> #include "avcodec.h"
>
> const AVCodecHWConfigInternal *ff_vaapi_encode_hw_configs[] = {
> @@ -1043,7 +1044,7 @@ static int vaapi_encode_check_frame(AVCodecContext *avctx,
> return 0;
> }
>
> -int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
> +static int vaapi_encode_send_frame(AVCodecContext *avctx, AVFrame *frame)
> {
> VAAPIEncodeContext *ctx = avctx->priv_data;
> VAAPIEncodePicture *pic;
> @@ -1066,9 +1067,7 @@ int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
> err = AVERROR(ENOMEM);
> goto fail;
> }
> - err = av_frame_ref(pic->input_image, frame);
> - if (err < 0)
> - goto fail;
> + av_frame_move_ref(pic->input_image, frame);
Applied
http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2020-May/263318.html locally.
Will push the set soon.
More information about the ffmpeg-devel
mailing list