diff options
author | wm4 <wm4@nowhere> | 2020-09-03 14:13:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-09-03 14:13:17 +0200 |
commit | 80bf6b26ba800b0bf65b40123940481e4e9911b7 (patch) | |
tree | 65106662d790ffd7b8c6b3f4562e9063c7913506 /player | |
parent | 2761f37fe48aa5b3aae3c4d4ce611a6ef07db0ae (diff) | |
download | mpv-80bf6b26ba800b0bf65b40123940481e4e9911b7.tar.bz2 mpv-80bf6b26ba800b0bf65b40123940481e4e9911b7.tar.xz |
encode: disable unsupported media types automatically
If you encode to e.g. an audio-only format, then video is disabled
automatically. This also takes care of the very cryptic error message.
It says "[vo/lavc] codec for video not found". Sort of true, but
obscures the real problem if it's e.g. an audio-only format.
Diffstat (limited to 'player')
-rw-r--r-- | player/loadfile.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/player/loadfile.c b/player/loadfile.c index f8d5327acf..c3214d5cc2 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1548,7 +1548,16 @@ static void play_current_file(struct MPContext *mpctx) // One track can strictly feed at most 1 decoder struct track *track = mpctx->current_track[i][t]; if (track) { - if (track->selected) { + if (track->type != STREAM_SUB && + mpctx->encode_lavc_ctx && + !encode_lavc_stream_type_ok(mpctx->encode_lavc_ctx, + track->type)) + { + MP_WARN(mpctx, "Disabling %s (not supported by target " + "format).\n", stream_type_name(track->type)); + mpctx->current_track[i][t] = NULL; + mark_track_selection(mpctx, i, t, -2); // disable + } else if (track->selected) { MP_ERR(mpctx, "Track %d can't be selected twice.\n", track->user_tid); mpctx->current_track[i][t] = NULL; |