summaryrefslogtreecommitdiffstats
path: root/video/out/vo_x11.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-30 00:37:44 +0200
committerwm4 <wm4@nowhere>2013-09-30 00:47:24 +0200
commitc000a08de2d967aff85d0c19b3e8dd3e762a76c2 (patch)
treedeceb1b2e06ea9144ee470a18276201d208e4be8 /video/out/vo_x11.c
parent00d41cc5b065cc809ab64901aca3dcaae8035869 (diff)
downloadmpv-c000a08de2d967aff85d0c19b3e8dd3e762a76c2.tar.bz2
mpv-c000a08de2d967aff85d0c19b3e8dd3e762a76c2.tar.xz
x11: remove colormap code, always request TrueColor visuals
vo_x11 had a clever trick to implement a video equalizer: it requested a DirectColor visual. This is a X11 mechanism which allows you to specify a lookup table for each color channel. Effectively, this is a safe override for the graphic card's gamma ramp. If X thinks the window deserves priority over other windows in the system, X would temporarily switch the gamma ramp so that DirectColor visuals can be displayed as the application intends. (I'm not sure what the exact policy is, but in practice, this meant the equalizer worked when the mouse button was inside the window.) But all in all, this is just lots of useless code for a feature that is rarely ever useful. Remove it and use the libswscale equalizer instead. (This comes without a cost, since vo_x11 already uses libswscale.) One worry was that using DirectColor could have made it work better in 8-bit paletted mode. But this is not the case: there's no difference, and in both cases, the video looks equally bad.
Diffstat (limited to 'video/out/vo_x11.c')
-rw-r--r--video/out/vo_x11.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c
index 95f4ba299c..98d7a23534 100644
--- a/video/out/vo_x11.c
+++ b/video/out/vo_x11.c
@@ -29,6 +29,7 @@
#include "video/csputils.h"
#include "video/mp_image.h"
#include "video/vfcap.h"
+#include "video/filter/vf.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -302,13 +303,8 @@ static int reconfig(struct vo *vo, struct mp_image_params *fmt, int flags)
p->depth = find_depth_from_visuals(vo, &visual);
}
if (!XMatchVisualInfo(vo->x11->display, vo->x11->screen, p->depth,
- DirectColor, &p->vinfo)
- || (vo->opts->WinID > 0
- && p->vinfo.visualid != XVisualIDFromVisual(p->attribs.visual)))
- {
- XMatchVisualInfo(vo->x11->display, vo->x11->screen, p->depth, TrueColor,
- &p->vinfo);
- }
+ TrueColor, &p->vinfo))
+ return -1;
vo_x11_config_vo_window(vo, &p->vinfo, vo->dx, vo->dy, vo->dwidth,
vo->dheight, flags, "x11");
@@ -612,12 +608,19 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_SET_EQUALIZER:
{
struct voctrl_set_equalizer_args *args = data;
- return vo_x11_set_equalizer(vo, args->name, args->value);
+ struct vf_seteq eq = {args->name, args->value};
+ if (mp_sws_set_vf_equalizer(p->sws, &eq) == 0)
+ break;
+ return true;
}
case VOCTRL_GET_EQUALIZER:
{
struct voctrl_get_equalizer_args *args = data;
- return vo_x11_get_equalizer(vo, args->name, args->valueptr);
+ struct vf_seteq eq = {args->name};
+ if (mp_sws_get_vf_equalizer(p->sws, &eq) == 0)
+ break;
+ *(int *)args->valueptr = eq.value;
+ return true;
}
case VOCTRL_GET_PANSCAN:
return VO_TRUE;