summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-09-03 15:44:35 +0200
committerwm4 <wm4@nowhere>2020-09-03 15:44:35 +0200
commitb5c225382ef6e354dfda767cc2a0f2d20e65aa09 (patch)
tree739d968ad1f5ae20752a2f28c7f4c9a8e89fe4ff
parentd3afe34c09df6850c4038ba8e7888a7a8cabbc90 (diff)
downloadmpv-b5c225382ef6e354dfda767cc2a0f2d20e65aa09.tar.bz2
mpv-b5c225382ef6e354dfda767cc2a0f2d20e65aa09.tar.xz
encode: propagate errors to exit status properly
Don't just let mpv CLI return 0 (success) as exit status if encoding failed somehow.
-rw-r--r--player/loadfile.c6
-rw-r--r--player/playloop.c2
2 files changed, 7 insertions, 1 deletions
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) {
diff --git a/player/playloop.c b/player/playloop.c
index e50aa944d1..ddd3f6dbdb 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -1182,7 +1182,7 @@ static void handle_eof(struct MPContext *mpctx)
void run_playloop(struct MPContext *mpctx)
{
if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) {
- mpctx->stop_play = PT_QUIT;
+ mpctx->stop_play = PT_ERROR;
return;
}