diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-30 19:52:41 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-04-05 19:53:27 +0200 |
commit | fb59a42ef977dd91085a602f10c9c82f88d072e5 (patch) | |
tree | e65c7b1e66eb0b07dbe51124e88fb3b918129b6f /libavcodec/dvbsubdec.c | |
parent | 1c3c29d07d7e0b7f5bec13cb0214f90e26604aee (diff) |
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/dvbsubdec.c')
-rw-r--r-- | libavcodec/dvbsubdec.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 0731202aaf..c5391ea5ad 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1607,14 +1607,12 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, return 0; } -static int dvbsub_decode(AVCodecContext *avctx, - void *data, int *got_sub_ptr, - AVPacket *avpkt) +static int dvbsub_decode(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; DVBSubContext *ctx = avctx->priv_data; - AVSubtitle *sub = data; const uint8_t *p, *p_end; int segment_type; int page_id; @@ -1748,7 +1746,7 @@ const FFCodec ff_dvbsub_decoder = { .priv_data_size = sizeof(DVBSubContext), .init = dvbsub_init_decoder, .close = dvbsub_close_decoder, - .decode = dvbsub_decode, + .decode_sub = dvbsub_decode, .p.priv_class = &dvbsubdec_class, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; |