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/pngenc.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/pngenc.c')
-rw-r--r-- | libavcodec/pngenc.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 8db5b1fbe6..f67f90cd14 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -1111,17 +1111,17 @@ static const AVClass pngenc_class = { .version = LIBAVUTIL_VERSION_INT, }; -const AVCodec ff_png_encoder = { - .name = "png", - .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_PNG, +const FFCodec ff_png_encoder = { + .p.name = "png", + .p.long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_PNG, .priv_data_size = sizeof(PNGEncContext), .init = png_enc_init, .close = png_enc_close, .encode2 = encode_png, - .capabilities = AV_CODEC_CAP_FRAME_THREADS, - .pix_fmts = (const enum AVPixelFormat[]) { + .p.capabilities = AV_CODEC_CAP_FRAME_THREADS, + .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB48BE, AV_PIX_FMT_RGBA64BE, AV_PIX_FMT_PAL8, @@ -1129,21 +1129,21 @@ const AVCodec ff_png_encoder = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_YA16BE, AV_PIX_FMT_MONOBLACK, AV_PIX_FMT_NONE }, - .priv_class = &pngenc_class, + .p.priv_class = &pngenc_class, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; -const AVCodec ff_apng_encoder = { - .name = "apng", - .long_name = NULL_IF_CONFIG_SMALL("APNG (Animated Portable Network Graphics) image"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_APNG, - .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, +const FFCodec ff_apng_encoder = { + .p.name = "apng", + .p.long_name = NULL_IF_CONFIG_SMALL("APNG (Animated Portable Network Graphics) image"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_APNG, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .priv_data_size = sizeof(PNGEncContext), .init = png_enc_init, .close = png_enc_close, .encode2 = encode_apng, - .pix_fmts = (const enum AVPixelFormat[]) { + .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB48BE, AV_PIX_FMT_RGBA64BE, AV_PIX_FMT_PAL8, @@ -1151,6 +1151,6 @@ const AVCodec ff_apng_encoder = { AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_YA16BE, AV_PIX_FMT_NONE }, - .priv_class = &pngenc_class, + .p.priv_class = &pngenc_class, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; |