From b5c225382ef6e354dfda767cc2a0f2d20e65aa09 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 3 Sep 2020 15:44:35 +0200 Subject: encode: propagate errors to exit status properly Don't just let mpv CLI return 0 (success) as exit status if encoding failed somehow. --- player/loadfile.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index c3214d5cc2..b5ae9c0212 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1701,6 +1701,12 @@ terminate_playback: mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL); + if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) + mpctx->stop_play = PT_ERROR; + + if (mpctx->stop_play == PT_ERROR && !mpctx->error_playing) + mpctx->error_playing = MPV_ERROR_GENERIC; + bool nothing_played = !mpctx->shown_aframes && !mpctx->shown_vframes && mpctx->error_playing <= 0; switch (mpctx->stop_play) { -- cgit v1.2.3