player: add an option to abort playback on partial init failures
This is probably what libmpv users want; and it also improves error reporting (or we'd have to add a way to communicate such mid-playback failures as events).
This commit is contained in:
1 parent
0c71ae0528
commit
2c320fb609
7 files changed
+16
-3
No files matched your search
@@ -28,6 +28,8 @@ API changes
|
||||
1.9 - add enum mpv_end_file_reason for mpv_event_end_file.reason
|
||||
- add MPV_END_FILE_REASON_ERROR and the mpv_event_end_file.error field
|
||||
for slightly better error reporting on playback failure
|
||||
- add --stop-playback-on-init-failure option, and make it the default
|
||||
behavior for libmpv only
|
||||
1.8 - add qthelper.hpp
|
||||
1.7 - add mpv_command_node(), mpv_command_node_async()
|
||||
1.6 - modify "core-idle" property behavior
|
||||
|
||||
@@ -252,6 +252,12 @@ Playback Control
|
||||
|
||||
Without ``--hr-seek``, skipping will snap to keyframes.
|
||||
|
||||
``--stop-playback-on-init-failure=<yes|no>``
|
||||
Stop playback if either audio or video fails to initialize. Currently,
|
||||
the default behavior is ``no`` for the command line player, but ``yes``
|
||||
for libmpv. With ``no``, playback will continue in video-only or audio-only
|
||||
mode if one of them fails. This doesn't affect playback of audio-only or
|
||||
video-only files.
|
||||
|
||||
Program Behavior
|
||||
----------------
|
||||
|
||||
@@ -478,6 +478,8 @@ const m_option_t mp_opts[] = {
|
||||
OPT_STRING("stream-capture", stream_capture, M_OPT_FIXED | M_OPT_FILE),
|
||||
OPT_STRING("stream-dump", stream_dump, M_OPT_FIXED | M_OPT_FILE),
|
||||
|
||||
OPT_FLAG("stop-playback-on-init-failure", stop_playback_on_init_failure, 0),
|
||||
|
||||
OPT_CHOICE_OR_INT("loop", loop_times, M_OPT_GLOBAL, 2, 10000,
|
||||
({"no", -1}, {"1", -1},
|
||||
{"inf", 0})),
|
||||
|
||||
@@ -110,6 +110,7 @@ typedef struct MPOpts {
|
||||
int untimed;
|
||||
char *stream_capture;
|
||||
char *stream_dump;
|
||||
int stop_playback_on_init_failure;
|
||||
int loop_times;
|
||||
int loop_file;
|
||||
int shuffle;
|
||||
|
||||
@@ -417,6 +417,7 @@ mpv_handle *mpv_create(void)
|
||||
mpv_set_option_string(ctx, "input-appleremote", "no");
|
||||
mpv_set_option_string(ctx, "input-media-keys", "no");
|
||||
mpv_set_option_string(ctx, "input-app-events", "no");
|
||||
mpv_set_option_string(ctx, "stop-playback-on-init-failure", "yes");
|
||||
} else {
|
||||
mp_destroy(mpctx);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1091,7 +1091,7 @@ goto_reopen_demuxer: ;
|
||||
struct demuxer *d = mpctx->demuxer;
|
||||
MP_FATAL(mpctx, "No video or audio streams selected.\n");
|
||||
if (d->stream->uncached_type == STREAMTYPE_DVB) {
|
||||
int dir = mpctx->last_dvb_step;
|
||||
int dir = mpctx->last_dvb_step;
|
||||
if (demux_stream_control(d, STREAM_CTRL_DVB_STEP_CHANNEL, &dir) > 0)
|
||||
mpctx->stop_play = PT_RELOAD_DEMUXER;
|
||||
}
|
||||
|
||||
+3
-2
@@ -189,8 +189,9 @@ void error_on_track(struct MPContext *mpctx, struct track *track)
|
||||
MP_INFO(mpctx, "Audio: no audio\n");
|
||||
if (track->type == STREAM_VIDEO)
|
||||
MP_INFO(mpctx, "Video: no video\n");
|
||||
if (!mpctx->current_track[0][STREAM_AUDIO] &&
|
||||
!mpctx->current_track[0][STREAM_VIDEO])
|
||||
if (mpctx->opts->stop_playback_on_init_failure ||
|
||||
(!mpctx->current_track[0][STREAM_AUDIO] &&
|
||||
!mpctx->current_track[0][STREAM_VIDEO]))
|
||||
{
|
||||
mpctx->stop_play = PT_ERROR;
|
||||
if (mpctx->error_playing >= 0)
|
||||
|
||||
Reference in new issue
Block a user