From f01744ac4e1da514aedbb51e6fad42fdb308937e Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 2 Oct 2013 01:15:59 +0200 Subject: core: add --force-window This commit adds the --force-window option, which will cause mpv always to create a window when started. This can be useful when pretending that mpv is a GUI application (which it isn't, but users pretend anyway), and playing audio files would run mpv in the background without giving a window to control it. This doesn't actually create the window immediately: it only does so only after initializing playback and when it is clear that there won't be any actual video. This could be a problem when starting slow or completely stuck network streams (mpv would remain frozen in the background), or if video initialization somehow is stuck forever in an in-between state (like when the decoder doesn't output a video frame, but doesn't return an error either). Well, we can pretend only so much that mpv is a GUI application. --- video/decode/vd_lavc.c | 1 - video/out/vo.c | 5 +++++ video/out/vo.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'video') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 86c1c92541..6f395ea843 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -778,7 +778,6 @@ static struct mp_image *decode_with_fallback(struct sh_video *sh, // Failed hardware decoding? Try again in software. if (ctx->software_fallback_decoder) { uninit_avctx(sh); - sh->vf_initialized = 0; mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Error using hardware " "decoding, falling back to software decoding.\n"); const char *decoder = ctx->software_fallback_decoder; diff --git a/video/out/vo.c b/video/out/vo.c index a069c442df..0dc60a558d 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -406,6 +406,9 @@ int vo_reconfig(struct vo *vo, struct mp_image_params *params, int flags) vo->dwidth = d_width; vo->dheight = d_height; + talloc_free(vo->params); + vo->params = NULL; + struct mp_image_params p2 = *params; int ret; @@ -419,6 +422,8 @@ int vo_reconfig(struct vo *vo, struct mp_image_params *params, int flags) } vo->config_ok = (ret >= 0); vo->config_count += vo->config_ok; + if (vo->config_ok) + vo->params = talloc_memdup(vo, &p2, sizeof(p2)); if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) { mp_input_add_key_fd(vo->input_ctx, vo->event_fd, 1, event_fd_callback, NULL, vo); diff --git a/video/out/vo.h b/video/out/vo.h index 50e83d2809..3b6adddb0c 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -238,6 +238,7 @@ struct vo { struct mp_log *log; // Using e.g. "[vo/vdpau]" as prefix int config_ok; // Last config call was successful? int config_count; // Total number of successful config calls + struct mp_image_params *params; // Configured parameters (as in vo_reconfig) bool probing; -- cgit v1.2.3