diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-05-16 19:47:12 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-05-22 17:10:44 +0200 |
commit | d064c9ded58092f82955a27fdefeab14a0907910 (patch) | |
tree | f5062ac124bbe1708d4de9357f8f4a921c910b32 | |
parent | 4fbc699ac3c9ab69b4c5474145593c809e0286f8 (diff) | |
download | ffmpeg-d064c9ded58092f82955a27fdefeab14a0907910.tar.gz |
fftools/ffmpeg: deobfuscate check_decode_result() call
Passing ist=NULL is currently used to identify stream types that do not
decode into AVFrames, i.e. subtitles. That is highly non-obvious -
always pass a non-NULL InputStream and just check the type explicitly.
-rw-r--r-- | fftools/ffmpeg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 1fcabd123a..537f287637 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -777,7 +777,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret) if (ret < 0 && exit_on_error) exit_program(1); - if (*got_output && ist) { + if (*got_output && ist->dec_ctx->codec_type != AVMEDIA_TYPE_SUBTITLE) { if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) { av_log(ist, exit_on_error ? AV_LOG_FATAL : AV_LOG_WARNING, "corrupt decoded frame\n"); @@ -1317,7 +1317,7 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt, int ret = avcodec_decode_subtitle2(ist->dec_ctx, &subtitle, got_output, pkt); - check_decode_result(NULL, got_output, ret); + check_decode_result(ist, got_output, ret); if (ret < 0 || !*got_output) { *decode_failed = 1; |