encode: propagate errors to exit status properly

Don't just let mpv CLI return 0 (success) as exit status if encoding
failed somehow.
This commit is contained in:
wm4 2020-09-03 15:44:35 +02:00
parent d3afe34c09
commit b5c225382e
2 changed files with 7 additions and 1 deletions

View File

@ -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) {

View File

@ -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;
}