diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-16 23:09:54 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-21 03:33:09 +0300 |
commit | 20f972701806be20a77f808db332d9489343bb78 (patch) | |
tree | 8d8b588c0ca06fa652518a5685db8280b0bf532d /libavcodec/mpeg12enc.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/mpeg12enc.c')
-rw-r--r-- | libavcodec/mpeg12enc.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index c53bcacc90..77cbb60ea1 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -1225,38 +1225,38 @@ static const AVClass mpeg ## x ## _class = { \ mpeg12_class(1) mpeg12_class(2) -const AVCodec ff_mpeg1video_encoder = { - .name = "mpeg1video", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MPEG1VIDEO, +const FFCodec ff_mpeg1video_encoder = { + .p.name = "mpeg1video", + .p.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_MPEG1VIDEO, .priv_data_size = sizeof(MPEG12EncContext), .init = encode_init, .encode2 = ff_mpv_encode_picture, .close = ff_mpv_encode_end, - .supported_framerates = ff_mpeg12_frame_rate_tab + 1, - .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, + .p.supported_framerates = ff_mpeg12_frame_rate_tab + 1, + .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE }, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, + .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, - .priv_class = &mpeg1_class, + .p.priv_class = &mpeg1_class, }; -const AVCodec ff_mpeg2video_encoder = { - .name = "mpeg2video", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MPEG2VIDEO, +const FFCodec ff_mpeg2video_encoder = { + .p.name = "mpeg2video", + .p.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_MPEG2VIDEO, .priv_data_size = sizeof(MPEG12EncContext), .init = encode_init, .encode2 = ff_mpv_encode_picture, .close = ff_mpv_encode_end, - .supported_framerates = ff_mpeg2_frame_rate_tab, - .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, + .p.supported_framerates = ff_mpeg2_frame_rate_tab, + .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE }, - .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, + .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, - .priv_class = &mpeg2_class, + .p.priv_class = &mpeg2_class, }; #endif /* CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER */ |