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/libaomenc.c | |
parent | a688f3c13ce55c2ba51dbbb344564649f1bb52fe (diff) |
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/libaomenc.c')
-rw-r--r-- | libavcodec/libaomenc.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index d62653135c..b880b3a1ae 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -1229,19 +1229,19 @@ static const enum AVPixelFormat av1_pix_fmts_highbd_with_gray[] = { AV_PIX_FMT_NONE }; -static av_cold void av1_init_static(AVCodec *codec) +static av_cold void av1_init_static(FFCodec *codec) { int supports_monochrome = aom_codec_version() >= 20001; aom_codec_caps_t codec_caps = aom_codec_get_caps(aom_codec_av1_cx()); if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) - codec->pix_fmts = supports_monochrome ? av1_pix_fmts_highbd_with_gray : - av1_pix_fmts_highbd; + codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_highbd_with_gray : + av1_pix_fmts_highbd; else - codec->pix_fmts = supports_monochrome ? av1_pix_fmts_with_gray : - av1_pix_fmts; + codec->p.pix_fmts = supports_monochrome ? av1_pix_fmts_with_gray : + av1_pix_fmts; if (aom_codec_version_major() < 2) - codec->capabilities |= AV_CODEC_CAP_EXPERIMENTAL; + codec->p.capabilities |= AV_CODEC_CAP_EXPERIMENTAL; } static av_cold int av1_init(AVCodecContext *avctx) @@ -1341,21 +1341,21 @@ static const AVClass class_aom = { .version = LIBAVUTIL_VERSION_INT, }; -AVCodec ff_libaom_av1_encoder = { - .name = "libaom-av1", - .long_name = NULL_IF_CONFIG_SMALL("libaom AV1"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_AV1, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | +FFCodec ff_libaom_av1_encoder = { + .p.name = "libaom-av1", + .p.long_name = NULL_IF_CONFIG_SMALL("libaom AV1"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_AV1, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_OTHER_THREADS, + .p.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), + .p.priv_class = &class_aom, + .p.wrapper_name = "libaom", .priv_data_size = sizeof(AOMContext), .init = av1_init, .encode2 = aom_encode, .close = aom_free, .caps_internal = FF_CODEC_CAP_AUTO_THREADS, - .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), - .priv_class = &class_aom, .defaults = defaults, .init_static_data = av1_init_static, - .wrapper_name = "libaom", }; |