diff options
author | wm4 <wm4@nowhere> | 2013-10-02 01:15:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-10-02 01:39:28 +0200 |
commit | f01744ac4e1da514aedbb51e6fad42fdb308937e (patch) | |
tree | 29b1cfa288df201b1ad9ca350cc1066e234feb6d /mpvcore/screenshot.c | |
parent | 3c0333978ecba247109366bf07fdfe87dd4a6b38 (diff) | |
download | mpv-f01744ac4e1da514aedbb51e6fad42fdb308937e.tar.bz2 mpv-f01744ac4e1da514aedbb51e6fad42fdb308937e.tar.xz |
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.
Diffstat (limited to 'mpvcore/screenshot.c')
-rw-r--r-- | mpvcore/screenshot.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mpvcore/screenshot.c b/mpvcore/screenshot.c index 161bfac1e5..181292474b 100644 --- a/mpvcore/screenshot.c +++ b/mpvcore/screenshot.c @@ -316,8 +316,10 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode) struct voctrl_screenshot_args args = { .full_window = (mode == MODE_FULL_WINDOW) }; - struct vf_instance *vfilter = mpctx->sh_video->vfilter; - vfilter->control(vfilter, VFCTRL_SCREENSHOT, &args); + if (mpctx->sh_video && mpctx->sh_video->vfilter) { + struct vf_instance *vfilter = mpctx->sh_video->vfilter; + vfilter->control(vfilter, VFCTRL_SCREENSHOT, &args); + } if (!args.out_image) vo_control(mpctx->video_out, VOCTRL_SCREENSHOT, &args); |