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/mpeg12dec.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/mpeg12dec.c')
-rw-r--r-- | libavcodec/mpeg12dec.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 715f24ff4f..6110e63af8 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2862,16 +2862,16 @@ static av_cold int mpeg_decode_end(AVCodecContext *avctx) return 0; } -const AVCodec ff_mpeg1video_decoder = { - .name = "mpeg1video", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MPEG1VIDEO, +const FFCodec ff_mpeg1video_decoder = { + .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(Mpeg1Context), .init = mpeg_decode_init, .close = mpeg_decode_end, .decode = mpeg_decode_frame, - .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | + .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | #if FF_API_FLAG_TRUNCATED AV_CODEC_CAP_TRUNCATED | #endif @@ -2879,7 +2879,7 @@ const AVCodec ff_mpeg1video_decoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = flush, - .max_lowres = 3, + .p.max_lowres = 3, .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context), .hw_configs = (const AVCodecHWConfigInternal *const []) { #if CONFIG_MPEG1_NVDEC_HWACCEL @@ -2895,16 +2895,16 @@ const AVCodec ff_mpeg1video_decoder = { }, }; -const AVCodec ff_mpeg2video_decoder = { - .name = "mpeg2video", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MPEG2VIDEO, +const FFCodec ff_mpeg2video_decoder = { + .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(Mpeg1Context), .init = mpeg_decode_init, .close = mpeg_decode_end, .decode = mpeg_decode_frame, - .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | + .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | #if FF_API_FLAG_TRUNCATED AV_CODEC_CAP_TRUNCATED | #endif @@ -2912,8 +2912,8 @@ const AVCodec ff_mpeg2video_decoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = flush, - .max_lowres = 3, - .profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles), + .p.max_lowres = 3, + .p.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles), .hw_configs = (const AVCodecHWConfigInternal *const []) { #if CONFIG_MPEG2_DXVA2_HWACCEL HWACCEL_DXVA2(mpeg2), @@ -2941,16 +2941,16 @@ const AVCodec ff_mpeg2video_decoder = { }; //legacy decoder -const AVCodec ff_mpegvideo_decoder = { - .name = "mpegvideo", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_MPEG2VIDEO, +const FFCodec ff_mpegvideo_decoder = { + .p.name = "mpegvideo", + .p.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_MPEG2VIDEO, .priv_data_size = sizeof(Mpeg1Context), .init = mpeg_decode_init, .close = mpeg_decode_end, .decode = mpeg_decode_frame, - .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | + .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | #if FF_API_FLAG_TRUNCATED AV_CODEC_CAP_TRUNCATED | #endif @@ -2958,7 +2958,7 @@ const AVCodec ff_mpegvideo_decoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .flush = flush, - .max_lowres = 3, + .p.max_lowres = 3, }; typedef struct IPUContext { @@ -3107,15 +3107,15 @@ static av_cold int ipu_decode_end(AVCodecContext *avctx) return 0; } -const AVCodec ff_ipu_decoder = { - .name = "ipu", - .long_name = NULL_IF_CONFIG_SMALL("IPU Video"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_IPU, +const FFCodec ff_ipu_decoder = { + .p.name = "ipu", + .p.long_name = NULL_IF_CONFIG_SMALL("IPU Video"), + .p.type = AVMEDIA_TYPE_VIDEO, + .p.id = AV_CODEC_ID_IPU, .priv_data_size = sizeof(IPUContext), .init = ipu_decode_init, .decode = ipu_decode_frame, .close = ipu_decode_end, - .capabilities = AV_CODEC_CAP_DR1, + .p.capabilities = AV_CODEC_CAP_DR1, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, }; |