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>
This commit is contained in:
Andreas Rheinhardt
2022-03-30 19:52:41 +02:00
parent 1c3c29d07d
commit fb59a42ef9
22 changed files with 76 additions and 87 deletions

View File

@@ -862,7 +862,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
if (avctx->pkt_timebase.num && avpkt->pts != AV_NOPTS_VALUE)
sub->pts = av_rescale_q(avpkt->pts,
avctx->pkt_timebase, AV_TIME_BASE_Q);
ret = ffcodec(avctx->codec)->decode(avctx, sub, got_sub_ptr, pkt);
ret = ffcodec(avctx->codec)->decode_sub(avctx, sub, got_sub_ptr, pkt);
if (pkt == avci->buffer_pkt) // did we recode?
av_packet_unref(avci->buffer_pkt);
if (ret < 0) {