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/pnmenc.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/pnmenc.c')
-rw-r--r-- | libavcodec/pnmenc.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c index fbe26ede25..020dbd218c 100644 --- a/libavcodec/pnmenc.c +++ b/libavcodec/pnmenc.c @@ -151,14 +151,14 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } #if CONFIG_PGM_ENCODER -const AVCodec ff_pgm_encoder = { - .name = "pgm", - .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_PGM, - .capabilities = AV_CODEC_CAP_DR1, +const FFCodec ff_pgm_encoder = { + .p.name = "pgm", + .p.long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_PGM, + .p.capabilities = AV_CODEC_CAP_DR1, .encode2 = pnm_encode_frame, - .pix_fmts = (const enum AVPixelFormat[]){ + .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_NONE }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, @@ -166,14 +166,14 @@ const AVCodec ff_pgm_encoder = { #endif #if CONFIG_PGMYUV_ENCODER -const AVCodec ff_pgmyuv_encoder = { - .name = "pgmyuv", - .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_PGMYUV, - .capabilities = AV_CODEC_CAP_DR1, +const FFCodec ff_pgmyuv_encoder = { + .p.name = "pgmyuv", + .p.long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_PGMYUV, + .p.capabilities = AV_CODEC_CAP_DR1, .encode2 = pnm_encode_frame, - .pix_fmts = (const enum AVPixelFormat[]){ + .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P16BE, AV_PIX_FMT_NONE }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, @@ -181,14 +181,14 @@ const AVCodec ff_pgmyuv_encoder = { #endif #if CONFIG_PPM_ENCODER -const AVCodec ff_ppm_encoder = { - .name = "ppm", - .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_PPM, - .capabilities = AV_CODEC_CAP_DR1, +const FFCodec ff_ppm_encoder = { + .p.name = "ppm", + .p.long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_PPM, + .p.capabilities = AV_CODEC_CAP_DR1, .encode2 = pnm_encode_frame, - .pix_fmts = (const enum AVPixelFormat[]){ + .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_RGB24, AV_PIX_FMT_RGB48BE, AV_PIX_FMT_NONE }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, @@ -196,28 +196,28 @@ const AVCodec ff_ppm_encoder = { #endif #if CONFIG_PBM_ENCODER -const AVCodec ff_pbm_encoder = { - .name = "pbm", - .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_PBM, - .capabilities = AV_CODEC_CAP_DR1, +const FFCodec ff_pbm_encoder = { + .p.name = "pbm", + .p.long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_PBM, + .p.capabilities = AV_CODEC_CAP_DR1, .encode2 = pnm_encode_frame, - .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_MONOWHITE, + .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_MONOWHITE, AV_PIX_FMT_NONE }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_PFM_ENCODER -const AVCodec ff_pfm_encoder = { - .name = "pfm", - .long_name = NULL_IF_CONFIG_SMALL("PFM (Portable FloatMap) image"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_PFM, - .capabilities = AV_CODEC_CAP_DR1, +const FFCodec ff_pfm_encoder = { + .p.name = "pfm", + .p.long_name = NULL_IF_CONFIG_SMALL("PFM (Portable FloatMap) image"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_PFM, + .p.capabilities = AV_CODEC_CAP_DR1, .encode2 = pnm_encode_frame, - .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_GBRPF32, + .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_GBRPF32, AV_PIX_FMT_NONE }, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; |