From f067795c7486fc230092eeb45c3dd35b7ca612f3 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 7 Jun 2021 16:13:33 +0200 Subject: avcodec/textdec: Deduplicate AVClasses The child_class_next API relied on different AVCodecs to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt --- libavcodec/textdec.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c index becbab601c..308553660a 100644 --- a/libavcodec/textdec.c +++ b/libavcodec/textdec.c @@ -71,17 +71,14 @@ static void text_flush(AVCodecContext *avctx) text->readorder = 0; } -#define DECLARE_CLASS(decname) static const AVClass decname ## _decoder_class = { \ - .class_name = #decname " decoder", \ - .item_name = av_default_item_name, \ - .option = decname ## _options, \ - .version = LIBAVUTIL_VERSION_INT, \ -} +static const AVClass textsub_decoder_class = { + .class_name = "text/vplayer/stl/pjs/subviewer1 decoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; #if CONFIG_TEXT_DECODER -#define text_options options -DECLARE_CLASS(text); - const AVCodec ff_text_decoder = { .name = "text", .long_name = NULL_IF_CONFIG_SMALL("Raw text subtitle"), @@ -90,7 +87,7 @@ const AVCodec ff_text_decoder = { .id = AV_CODEC_ID_TEXT, .decode = text_decode_frame, .init = ff_ass_subtitle_header_default, - .priv_class = &text_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; @@ -106,9 +103,6 @@ static int linebreak_init(AVCodecContext *avctx) } #if CONFIG_VPLAYER_DECODER -#define vplayer_options options -DECLARE_CLASS(vplayer); - const AVCodec ff_vplayer_decoder = { .name = "vplayer", .long_name = NULL_IF_CONFIG_SMALL("VPlayer subtitle"), @@ -117,16 +111,13 @@ const AVCodec ff_vplayer_decoder = { .id = AV_CODEC_ID_VPLAYER, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &vplayer_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_STL_DECODER -#define stl_options options -DECLARE_CLASS(stl); - const AVCodec ff_stl_decoder = { .name = "stl", .long_name = NULL_IF_CONFIG_SMALL("Spruce subtitle format"), @@ -135,16 +126,13 @@ const AVCodec ff_stl_decoder = { .id = AV_CODEC_ID_STL, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &stl_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_PJS_DECODER -#define pjs_options options -DECLARE_CLASS(pjs); - const AVCodec ff_pjs_decoder = { .name = "pjs", .long_name = NULL_IF_CONFIG_SMALL("PJS subtitle"), @@ -153,16 +141,13 @@ const AVCodec ff_pjs_decoder = { .id = AV_CODEC_ID_PJS, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &pjs_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_SUBVIEWER1_DECODER -#define subviewer1_options options -DECLARE_CLASS(subviewer1); - const AVCodec ff_subviewer1_decoder = { .name = "subviewer1", .long_name = NULL_IF_CONFIG_SMALL("SubViewer1 subtitle"), @@ -171,7 +156,7 @@ const AVCodec ff_subviewer1_decoder = { .id = AV_CODEC_ID_SUBVIEWER1, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &subviewer1_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; -- cgit v1.2.3