diff options
-rw-r--r-- | DOCS/man/en/options.rst | 7 | ||||
-rw-r--r-- | DOCS/man/en/vo.rst | 21 | ||||
-rw-r--r-- | TOOLS/osxbundle/mpv.app/Contents/Resources/fonts.conf | 7 | ||||
-rw-r--r-- | mpvcore/mplayer.c | 4 | ||||
-rw-r--r-- | osdep/macosx_application.m | 13 | ||||
-rw-r--r-- | video/out/gl_video.c | 14 | ||||
-rw-r--r-- | video/out/gl_video.h | 2 | ||||
-rw-r--r-- | video/out/gl_video_shaders.glsl | 3 | ||||
-rw-r--r-- | video/out/vo_opengl.c | 2 | ||||
-rw-r--r-- | video/out/wayland_common.c | 8 | ||||
-rw-r--r-- | video/out/x11_common.c | 11 |
11 files changed, 63 insertions, 29 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index ac07a9a1ba..766118e4c6 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -1452,13 +1452,6 @@ options) are ignored when ASS-subtitles are rendered, unless the ``--no-ass`` option is specified. - .. note:: - - By default the OS X Application Bundle ships with a default fontconfig - fonts.conf that looks for fonts in the ``~/.mpv/fonts`` folder. It does - not include standard OS X paths to reduce the time spent to build - fontconfig's cache. - ``--osd-font-size=<size>``, ``--sub-text-font-size=<size>`` Specify the OSD/sub font size. The unit is the size in scaled pixels at a window height of 720. The actual pixel size is scaled with the window diff --git a/DOCS/man/en/vo.rst b/DOCS/man/en/vo.rst index 6b6d503219..c57f25f125 100644 --- a/DOCS/man/en/vo.rst +++ b/DOCS/man/en/vo.rst @@ -454,13 +454,20 @@ Available video output drivers are: Default is 128x256x64. Sizes must be a power of two, and 256 at most. - ``alpha`` - Try to create a framebuffer with alpha component. This only makes sense - if the video contains alpha information (which is extremely rare). May - not be supported on all platforms. If alpha framebuffers are - unavailable, it silently falls back on a normal framebuffer. Note - that when using FBO indirections (such as with ``opengl-hq``), an FBO - format with alpha must be specified with the ``fbo-format`` option. + ``alpha=<blend|yes|no>`` + Decides what to do if the input has an alpha component (default: blend). + + blend + Blend the frame against a black background. + yes + Try to create a framebuffer with alpha component. This only makes sense + if the video contains alpha information (which is extremely rare). May + not be supported on all platforms. If alpha framebuffers are + unavailable, it silently falls back on a normal framebuffer. Note + that when using FBO indirections (such as with ``opengl-hq``), an FBO + format with alpha must be specified with the ``fbo-format`` option. + no + Ignore alpha component. ``chroma-location=<auto|center|left>`` Set the YUV chroma sample location. auto means use the bitstream diff --git a/TOOLS/osxbundle/mpv.app/Contents/Resources/fonts.conf b/TOOLS/osxbundle/mpv.app/Contents/Resources/fonts.conf index c229cd13c0..5a2e3d2222 100644 --- a/TOOLS/osxbundle/mpv.app/Contents/Resources/fonts.conf +++ b/TOOLS/osxbundle/mpv.app/Contents/Resources/fonts.conf @@ -1,8 +1,11 @@ <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> - <dir>~/.mpv/fonts</dir> - <cachedir>~/.mpv/.fontconfig-cache</cachedir> + <dir>/System/Library/Fonts</dir> + <dir>/Library/Fonts</dir> + <dir>~/Library/Fonts</dir> + <dir>/Network/Library/Fonts</dir> + <cachedir>~/.fontconfig</cachedir> <!-- Accept deprecated 'mono' alias, replacing it with 'monospace' diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c index dc4322d4e3..f4bf6c9316 100644 --- a/mpvcore/mplayer.c +++ b/mpvcore/mplayer.c @@ -3403,7 +3403,7 @@ static void handle_cursor_autohide(struct MPContext *mpctx) mpctx->mouse_cursor_visible = mouse_cursor_visible; } -static void handle_seek_coalesce(struct MPContext *mpctx) +static void handle_input_and_seek_coalesce(struct MPContext *mpctx) { mp_cmd_t *cmd; while ((cmd = mp_input_get_cmd(mpctx->input, 0, 1)) != NULL) { @@ -3849,7 +3849,7 @@ static void run_playloop(struct MPContext *mpctx) handle_pause_on_low_cache(mpctx); - handle_seek_coalesce(mpctx); + handle_input_and_seek_coalesce(mpctx); handle_backstep(mpctx); diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index 3f12454c9b..7e6ab963eb 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -439,13 +439,22 @@ static void get_system_version(int* major, int* minor, int* bugfix) *bugfix = s_bugfix; } +static bool is_psn_argument(char *psn_arg_to_check) +{ + NSString *psn_arg = [NSString stringWithUTF8String:psn_arg_to_check]; + return [psn_arg hasPrefix:@"-psn_"]; +} + static bool bundle_started_from_finder(int argc, char **argv) { bool bundle_detected = [[NSBundle mainBundle] bundleIdentifier]; int major, minor, bugfix; get_system_version(&major, &minor, &bugfix); - bool finder_args = ((major == 10) && (minor >= 9)) ? argc==1 : argc==2; - return bundle_detected && finder_args; + if ((major == 10) && (minor >= 9)) { + return bundle_detected && argc==1; + } else { + return bundle_detected && argc==2 && is_psn_argument(argv[1]); + } } void macosx_finder_args_preinit(int *argc, char ***argv) diff --git a/video/out/gl_video.c b/video/out/gl_video.c index ff5bbc7d47..21efc6dd56 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -271,6 +271,7 @@ static const struct gl_video_opts gl_video_opts_def = { .scale_sep = 1, .scalers = { "bilinear", "bilinear" }, .scaler_params = {NAN, NAN}, + .alpha_mode = 2, }; @@ -319,7 +320,10 @@ const struct m_sub_options gl_video_conf = { ({"auto", MP_CHROMA_AUTO}, {"center", MP_CHROMA_CENTER}, {"left", MP_CHROMA_LEFT})), - OPT_FLAG("alpha", enable_alpha, 0), + OPT_CHOICE("alpha", alpha_mode, M_OPT_OPTIONAL_PARAM, + ({"no", 0}, + {"yes", 1}, {"", 1}, + {"blend", 2})), {0} }, .size = sizeof(struct gl_video_opts), @@ -779,8 +783,8 @@ static void compile_shaders(struct gl_video *p) shader_prelude, PRELUDE_END); // Need to pass alpha through the whole chain. (Not needed for OSD shaders.) - bool use_alpha = p->opts.enable_alpha && p->has_alpha; - shader_def_opt(&header, "USE_ALPHA", use_alpha); + if (p->opts.alpha_mode == 1) + shader_def_opt(&header, "USE_ALPHA", p->has_alpha); char *header_osd = talloc_strdup(tmp, header); shader_def_opt(&header_osd, "USE_OSD_LINEAR_CONV", p->opts.srgb && @@ -831,8 +835,10 @@ static void compile_shaders(struct gl_video *p) shader_def_opt(&header_conv, "USE_INPUT_GAMMA", convert_input_gamma); shader_def_opt(&header_conv, "USE_COLORMATRIX", !p->is_rgb); shader_def_opt(&header_conv, "USE_CONV_GAMMA", convert_input_to_linear); - if (use_alpha && p->plane_count > 3) + if (p->opts.alpha_mode > 0 && p->has_alpha && p->plane_count > 3) shader_def(&header_conv, "USE_ALPHA_PLANE", "3"); + if (p->opts.alpha_mode == 2 && p->has_alpha) + shader_def(&header_conv, "USE_ALPHA_BLEND", "1"); shader_def_opt(&header_final, "USE_LINEAR_CONV_INV", p->use_lut_3d); shader_def_opt(&header_final, "USE_GAMMA_POW", p->opts.gamma); diff --git a/video/out/gl_video.h b/video/out/gl_video.h index bc21310498..3b21edc223 100644 --- a/video/out/gl_video.h +++ b/video/out/gl_video.h @@ -44,7 +44,7 @@ struct gl_video_opts { int temporal_dither; int fbo_format; int stereo_mode; - int enable_alpha; + int alpha_mode; int chroma_location; }; diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl index 8ca6739bf4..b0df20b544 100644 --- a/video/out/gl_video_shaders.glsl +++ b/video/out/gl_video_shaders.glsl @@ -387,6 +387,9 @@ void main() { color = floor(color * dither_quantization + dither_value + dither_center) / dither_quantization; #endif +#ifdef USE_ALPHA_BLEND + color = color * alpha; +#endif #ifdef USE_ALPHA out_color = vec4(color, alpha); #else diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 7f4c05ac58..03d1689667 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -144,7 +144,7 @@ static bool config_window(struct gl_priv *p, uint32_t d_width, if (p->renderer_opts->stereo_mode == GL_3D_QUADBUFFER) flags |= VOFLAG_STEREO; - if (p->renderer_opts->enable_alpha) + if (p->renderer_opts->alpha_mode == 1) flags |= VOFLAG_ALPHA; if (p->use_gl_debug) diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 533b8c056d..109e2dc4b0 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -805,8 +805,12 @@ static int vo_wayland_check_events (struct vo *vo) * when pausing no input events get queued so we have to check if there * are events to read from the file descriptor through poll */ if (poll(&fd, 1, 0) > 0) { - if (fd.revents & POLLERR || fd.revents & POLLHUP) - MP_ERR(wl, "error occurred on the display fd\n"); + if (fd.revents & POLLERR || fd.revents & POLLHUP) { + MP_FATAL(wl, "error occurred on the display fd: " + "closing file descriptor\n"); + close(wl->display.display_fd); + mp_input_put_key(vo->input_ctx, MP_KEY_CLOSE_WIN); + } if (fd.revents & POLLIN) wl_display_dispatch(dp); if (fd.revents & POLLOUT) diff --git a/video/out/x11_common.c b/video/out/x11_common.c index 8c6ddae3ea..a364b0c912 100644 --- a/video/out/x11_common.c +++ b/video/out/x11_common.c @@ -463,7 +463,7 @@ int vo_x11_init(struct vo *vo) x11->display = XOpenDisplay(dispName); if (!x11->display) { MP_MSG(x11, vo->probing ? MSGL_V : MSGL_ERR, - "vo: couldn't open the X11 display (%s)!\n", dispName); + "couldn't open the X11 display (%s)!\n", dispName); talloc_free(x11); vo->x11 = NULL; @@ -479,6 +479,15 @@ int vo_x11_init(struct vo *vo) } x11->xim = XOpenIM(x11->display, NULL, NULL, NULL); + if (!x11->xim) { + MP_MSG(x11, vo->probing ? MSGL_V : MSGL_ERR, + "couldn't find a valid X input method!\n"); + + XCloseDisplay(x11->display); + talloc_free(x11); + vo->x11 = NULL; + return 0; + } init_atoms(vo->x11); |