From dbcd654e612ca32673cf2703758b05700cb87d03 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 19 May 2018 18:41:13 +0200 Subject: player: make playback termination asynchronous Until now, stopping playback aborted the demuxer and I/O layer violently by signaling mp_cancel (bound to libavformat's AVIOInterruptCB mechanism). Change it to try closing them gracefully. The main purpose is to silence those libavformat errors that happen when you request termination. Most of libavformat barely cares about the termination mechanism (AVIOInterruptCB), and essentially it's like the network connection is abruptly severed, or file I/O suddenly returns I/O errors. There were issues with dumb TLS warnings, parsers complaining about incomplete data, and some special protocols that require server communication to gracefully disconnect. We still want to abort it forcefully if it refuses to terminate on its own, so a timeout is required. Users can set the timeout to 0, which should give them the old behavior. This also removes the old mechanism that treats certain commands (like "quit") specially, and tries to terminate the demuxers even if the core is currently frozen. This is for situations where the core synchronized to the demuxer or stream layer while network is unresponsive. This in turn can only happen due to the "program" or "cache-size" properties in the current code (see one of the previous commits). Also, the old mechanism doesn't fit particularly well with the new one. We wouldn't want to abort playback immediately on a "quit" command - the new code is all about giving it a chance to end it gracefully. We'd need some sort of watchdog thread or something equally complicated to handle this. So just remove it. The change in osd.c is to prevent that it clears the status line while waiting for termination. The normal status line code doesn't output anything useful at this point, and the code path taken clears it, both of which is an annoying behavior change, so just let it show the old one. --- options/options.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'options/options.c') diff --git a/options/options.c b/options/options.c index 49aac52ba2..bfaf374365 100644 --- a/options/options.c +++ b/options/options.c @@ -461,6 +461,7 @@ const m_option_t mp_opts[] = { OPT_STRING("audio-demuxer", audio_demuxer_name, 0), OPT_STRING("sub-demuxer", sub_demuxer_name, 0), OPT_FLAG("demuxer-thread", demuxer_thread, 0), + OPT_DOUBLE("demuxer-termination-timeout", demux_termination_timeout, 0), OPT_FLAG("prefetch-playlist", prefetch_open, 0), OPT_FLAG("cache-pause", cache_pause, 0), OPT_FLAG("cache-pause-initial", cache_pause_initial, 0), @@ -915,6 +916,7 @@ const struct MPOpts mp_default_opts = { .position_resume = 1, .autoload_files = 1, .demuxer_thread = 1, + .demux_termination_timeout = 0.1, .hls_bitrate = INT_MAX, .cache_pause = 1, .cache_pause_wait = 1.0, -- cgit v1.2.3 From fb22bf2317d4704895fca407507972031e932298 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 21 May 2018 15:11:19 +0200 Subject: ao: use a local option struct Instead of accessing MPOpts. --- options/options.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'options/options.c') diff --git a/options/options.c b/options/options.c index bfaf374365..c9ed2f0008 100644 --- a/options/options.c +++ b/options/options.c @@ -78,7 +78,8 @@ extern const struct m_sub_options demux_conf; extern const struct m_obj_list vf_obj_list; extern const struct m_obj_list af_obj_list; extern const struct m_obj_list vo_obj_list; -extern const struct m_obj_list ao_obj_list; + +extern const struct m_sub_options ao_conf; extern const struct m_sub_options opengl_conf; extern const struct m_sub_options vulkan_conf; @@ -549,10 +550,8 @@ const m_option_t mp_opts[] = { OPT_FLAG("osd-bar", osd_bar_visible, UPDATE_OSD), //---------------------- libao/libvo options ------------------------ - OPT_SETTINGSLIST("ao", audio_driver_list, 0, &ao_obj_list, ), - OPT_STRING("audio-device", audio_device, UPDATE_AUDIO), + OPT_SUBSTRUCT("", ao_opts, ao_conf, 0), OPT_FLAG("audio-exclusive", audio_exclusive, UPDATE_AUDIO), - OPT_STRING("audio-client-name", audio_client_name, UPDATE_AUDIO), OPT_FLAG("audio-fallback-to-null", ao_null_fallback, 0), OPT_FLAG("audio-stream-silence", audio_stream_silence, 0), OPT_FLOATRANGE("audio-wait-open", audio_wait_open, 0, 0, 60), @@ -577,8 +576,6 @@ const m_option_t mp_opts[] = { ({"no", 0}, {"yes", 1}, {"weak", -1})), - OPT_DOUBLE("audio-buffer", audio_buffer, M_OPT_MIN | M_OPT_MAX, - .min = 0, .max = 10), OPT_STRING("title", wintitle, 0), OPT_STRING("force-media-title", media_title, 0), @@ -879,16 +876,12 @@ const m_option_t mp_opts[] = { const struct MPOpts mp_default_opts = { .use_terminal = 1, .msg_color = 1, - .audio_driver_list = NULL, .audio_decoders = NULL, .video_decoders = NULL, .softvol_max = 130, .softvol_volume = 100, .softvol_mute = 0, .gapless_audio = -1, - .audio_buffer = 0.2, - .audio_device = "auto", - .audio_client_name = "mpv", .wintitle = "${?media-title:${media-title}}${!media-title:No file} - mpv", .stop_screensaver = 1, .cursor_autohide_delay = 1000, -- cgit v1.2.3 From a770006c6ec1c0173e33a63d36cafca743e63808 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 21 May 2018 16:05:03 +0200 Subject: vd_lavc: move hwdec opts to local config, don't use global MPOpts The --hwdec* options are a good fit for the vd_lavc local option struct. This annoyingly requires manual prefixing of most of these options with --vd-lavc (could be avoided by using more sub-struct craziness, but let's not). --- options/options.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'options/options.c') diff --git a/options/options.c b/options/options.c index c9ed2f0008..5a77e9973d 100644 --- a/options/options.c +++ b/options/options.c @@ -511,18 +511,13 @@ const m_option_t mp_opts[] = { OPT_STRING("audio-spdif", audio_spdif, 0), - OPT_STRING_VALIDATE("hwdec", hwdec_api, M_OPT_OPTIONAL_PARAM, - hwdec_validate_opt), - OPT_STRING("hwdec-codecs", hwdec_codecs, 0), - OPT_IMAGEFORMAT("hwdec-image-format", hwdec_image_format, 0, .min = -1), - // -1 means auto aspect (prefer container size until aspect change) // 0 means square pixels OPT_ASPECT("video-aspect", movie_aspect, UPDATE_IMGPAR, -1.0, 10.0), OPT_CHOICE("video-aspect-method", aspect_method, UPDATE_IMGPAR, ({"bitstream", 1}, {"container", 2})), - OPT_SUBSTRUCT("vd-lavc", vd_lavc_params, vd_lavc_conf, 0), + OPT_SUBSTRUCT("", vd_lavc_params, vd_lavc_conf, 0), OPT_SUBSTRUCT("ad-lavc", ad_lavc_params, ad_lavc_conf, 0), OPT_SUBSTRUCT("", demux_lavf, demux_lavf_conf, 0), @@ -947,9 +942,6 @@ const struct MPOpts mp_default_opts = { .osd_bar_visible = 1, .screenshot_template = "mpv-shot%n", - .hwdec_api = HAVE_RPI ? "mmal" : "no", - .hwdec_codecs = "h264,vc1,wmv3,hevc,mpeg2video,vp9", - .audio_output_channels = { .set = 1, .auto_safe = 1, -- cgit v1.2.3 From 559a400ac36e75a8d73ba263fd7fa6736df1c2da Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 31 Aug 2018 12:48:36 +0200 Subject: demux, stream: rip out the classic stream cache The demuxer cache is the only cache now. Might need another change to combat seeking failures in mp4 etc. The only bad thing is the loss of cache-speed, which was sort of nice to have. --- options/options.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'options/options.c') diff --git a/options/options.c b/options/options.c index 5a77e9973d..2548759ddb 100644 --- a/options/options.c +++ b/options/options.c @@ -59,7 +59,6 @@ extern const struct m_sub_options tv_params_conf; extern const struct m_sub_options stream_cdda_conf; extern const struct m_sub_options stream_dvb_conf; extern const struct m_sub_options stream_lavf_conf; -extern const struct m_sub_options stream_cache_conf; extern const struct m_sub_options sws_conf; extern const struct m_sub_options drm_conf; extern const struct m_sub_options demux_rawaudio_conf; @@ -387,8 +386,6 @@ const m_option_t mp_opts[] = { // ------------------------- stream options -------------------- - OPT_SUBSTRUCT("", stream_cache, stream_cache_conf, 0), - #if HAVE_DVDREAD || HAVE_DVDNAV OPT_SUBSTRUCT("", dvd_opts, dvd_conf, 0), #endif /* HAVE_DVDREAD */ -- cgit v1.2.3