summaryrefslogtreecommitdiff
path: root/libavcodec/subviewerdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-03-30 19:52:41 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-04-05 19:53:27 +0200
commitfb59a42ef977dd91085a602f10c9c82f88d072e5 (patch)
treee65c7b1e66eb0b07dbe51124e88fb3b918129b6f /libavcodec/subviewerdec.c
parent1c3c29d07d7e0b7f5bec13cb0214f90e26604aee (diff)
downloadffmpeg-fb59a42ef977dd91085a602f10c9c82f88d072e5.tar.gz
avcodec/codec_internal: Add FFCodec.decode_sub
This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVSubtitle *sub = data;" line for subtitle decoders. Its only downside is that it increases sizeof(FFCodec), yet this can be more than offset lateron. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/subviewerdec.c')
-rw-r--r--libavcodec/subviewerdec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/subviewerdec.c b/libavcodec/subviewerdec.c
index cbc3056c90..9001dd3d45 100644
--- a/libavcodec/subviewerdec.c
+++ b/libavcodec/subviewerdec.c
@@ -47,11 +47,10 @@ static int subviewer_event_to_ass(AVBPrint *buf, const char *p)
return 0;
}
-static int subviewer_decode_frame(AVCodecContext *avctx,
- void *data, int *got_sub_ptr, AVPacket *avpkt)
+static int subviewer_decode_frame(AVCodecContext *avctx, AVSubtitle *sub,
+ int *got_sub_ptr, AVPacket *avpkt)
{
int ret = 0;
- AVSubtitle *sub = data;
const char *ptr = avpkt->data;
FFASSDecoderContext *s = avctx->priv_data;
AVBPrint buf;
@@ -71,7 +70,7 @@ const FFCodec ff_subviewer_decoder = {
.p.long_name = NULL_IF_CONFIG_SMALL("SubViewer subtitle"),
.p.type = AVMEDIA_TYPE_SUBTITLE,
.p.id = AV_CODEC_ID_SUBVIEWER,
- .decode = subviewer_decode_frame,
+ .decode_sub = subviewer_decode_frame,
.init = ff_ass_subtitle_header_default,
.flush = ff_ass_decoder_flush,
.priv_data_size = sizeof(FFASSDecoderContext),