diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-16 21:09:54 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-21 01:33:09 +0100 |
commit | 20f972701806be20a77f808db332d9489343bb78 (patch) | |
tree | 8d8b588c0ca06fa652518a5685db8280b0bf532d /libavcodec/libx265.c | |
parent | a688f3c13ce55c2ba51dbbb344564649f1bb52fe (diff) | |
download | ffmpeg-20f972701806be20a77f808db332d9489343bb78.tar.gz |
avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
Up until now, codec.h contains both public and private parts
of AVCodec. This exposes the internals of AVCodec to users
and leads them into the temptation of actually using them
and forces us to forward-declare structures and types that
users can't use at all.
This commit changes this by adding a new structure FFCodec to
codec_internal.h that extends AVCodec, i.e. contains the public
AVCodec as first member; the private fields of AVCodec are moved
to this structure, leaving codec.h clean.
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/libx265.c')
-rw-r--r-- | libavcodec/libx265.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 3217d45284..0ad2006cdc 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -693,14 +693,14 @@ static const enum AVPixelFormat x265_csp_twelve[] = { AV_PIX_FMT_NONE }; -static av_cold void libx265_encode_init_csp(AVCodec *codec) +static av_cold void libx265_encode_init_csp(FFCodec *codec) { if (x265_api_get(12)) - codec->pix_fmts = x265_csp_twelve; + codec->p.pix_fmts = x265_csp_twelve; else if (x265_api_get(10)) - codec->pix_fmts = x265_csp_ten; + codec->p.pix_fmts = x265_csp_ten; else if (x265_api_get(8)) - codec->pix_fmts = x265_csp_eight; + codec->p.pix_fmts = x265_csp_eight; } #define OFFSET(x) offsetof(libx265Context, x) @@ -740,21 +740,21 @@ static const AVCodecDefault x265_defaults[] = { { NULL }, }; -AVCodec ff_libx265_encoder = { - .name = "libx265", - .long_name = NULL_IF_CONFIG_SMALL("libx265 H.265 / HEVC"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_HEVC, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | +FFCodec ff_libx265_encoder = { + .p.name = "libx265", + .p.long_name = NULL_IF_CONFIG_SMALL("libx265 H.265 / HEVC"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_HEVC, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, + .p.priv_class = &class, + .p.wrapper_name = "libx265", .init = libx265_encode_init, .init_static_data = libx265_encode_init_csp, .encode2 = libx265_encode_frame, .close = libx265_encode_close, .priv_data_size = sizeof(libx265Context), - .priv_class = &class, .defaults = x265_defaults, .caps_internal = FF_CODEC_CAP_AUTO_THREADS, - .wrapper_name = "libx265", }; |