From bc5a0e48b2e2c2b896c109e1641433460b4b0422 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Sat, 16 Jul 2022 09:59:56 +0200 Subject: [PATCH 1/2] dvdsubdec: return number of bytes used Documentation says avcodec_decode_subtitle2 returns the number of bytes used. Original patch by John Stebbins. --- libavcodec/dvdsubdec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c index 97f366cc74..fdeead372b 100644 --- a/libavcodec/dvdsubdec.c +++ b/libavcodec/dvdsubdec.c @@ -536,7 +536,11 @@ static int dvdsub_decode(AVCodecContext *avctx, AVSubtitle *sub, is_menu = decode_dvd_subtitles(ctx, sub, buf, buf_size); if (is_menu == AVERROR(EAGAIN)) { *data_size = 0; - return appended ? 0 : append_to_cached_buf(avctx, buf, buf_size); + int ret = appended ? 0 : append_to_cached_buf(avctx, buf, buf_size); + if (ret < 0) { + return ret; + } + return buf_size; } if (is_menu < 0) { -- 2.32.1 (Apple Git-133)