diff mbox series

[FFmpeg-devel,41/41] avcodec/textdec: Deduplicate AVClasses

Message ID VI1PR0301MB215981664736C45DDB5FB2858F0E9@VI1PR0301MB2159.eurprd03.prod.outlook.com
State Accepted
Commit f067795c7486fc230092eeb45c3dd35b7ca612f3
Headers show
Series [FFmpeg-devel,01/41] avformat/Makefile: Add missing rawdec dependency for IPU demuxer
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt June 17, 2021, 2:32 a.m. UTC
The child_class_next API relied on different (de)muxers to use
different AVClasses; yet this API has been replaced by
child_class_iterate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/textdec.c | 37 +++++++++++--------------------------
 1 file changed, 11 insertions(+), 26 deletions(-)
diff mbox series

Patch

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,
 };