diff options
author | phintuka <phintuka> | 2014-01-13 09:01:03 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2014-01-13 09:01:03 +0000 |
commit | 1b85f20a7ec184c8a38b41705f3e33ee9125afd1 (patch) | |
tree | e38305060299485d103261dc6a8041397dd6d5ce | |
parent | f28b69caecff6c86e45d80f0ce72413006ab4cb4 (diff) | |
download | xineliboutput-1b85f20a7ec184c8a38b41705f3e33ee9125afd1.tar.gz xineliboutput-1b85f20a7ec184c8a38b41705f3e33ee9125afd1.tar.bz2 |
Added sxfe_display_edid()
-rwxr-xr-x | configure | 7 | ||||
-rw-r--r-- | xine_frontend.h | 3 | ||||
-rw-r--r-- | xine_sxfe_frontend.c | 90 |
3 files changed, 96 insertions, 4 deletions
@@ -7,7 +7,7 @@ # See the main source file 'xineliboutput.c' for copyright information and # how to reach the author. # -# * $Id: configure,v 1.43 2013-08-15 10:12:27 phintuka Exp $ +# * $Id: configure,v 1.44 2014-01-13 09:01:03 phintuka Exp $ # PKG_CONFIG="pkg-config" @@ -231,6 +231,7 @@ FEATURES=" xshm xdpms xinerama + xrandr xrender xshape opengl @@ -272,6 +273,7 @@ show_help(){ echo " --disable-xshm disable XShm support [no]" echo " --disable-xdpms disable Xdpms support [no]" echo " --disable-xinerama disable Xinerama support [no]" + echo " --disable-xrandr disable Xrandr support [no]" echo " --disable-xrender disable Xrender support (HUD OSD) [no]" echo " --disable-xshape disable Xshape support (non-transparent HUD OSD without composite manager) [no]" echo " --disable-opengl disable OpenGL support (transparent HUD OSD without composite manager) [no]" @@ -331,7 +333,7 @@ done check_deps(){ disabled libxine && disable x11 fb libavutil libjpeg - disabled x11 && disable dbus-glib-1 xshm xrender xshape opengl xdpms xinerama vdpau + disabled x11 && disable dbus-glib-1 xshm xrandr xrender xshape opengl xdpms xinerama vdpau disabled vdr && disable libextractor libcap libbluray disabled dlfcn && disable opengl disabled pthread && disable opengl @@ -373,6 +375,7 @@ if enabled libxine; then if enabled x11; then test_library X11 xext "X11/extensions/Xext.h" "-lXext" "" test_library X11 xshm "X11/extensions/XShm.h" "-lXext" "XShmQueryExtension(0)" + test_library X11 xrandr "X11/extensions/Xrandr.h" "-lXrandr" "XRRGetScreenInfo(0,0)" test_library X11 xrender "X11/extensions/Xrender.h" "-lXrender" "XRenderQueryFormats(0)" test_library X11 xshape "X11/extensions/shape.h" "-lXext" "XShapeQueryExtension(0,0,0)" test_library X11 xdpms "X11/extensions/dpms.h" "-lXext" "DPMSDisable(0)" diff --git a/xine_frontend.h b/xine_frontend.h index 220ee37d..ab259348 100644 --- a/xine_frontend.h +++ b/xine_frontend.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_frontend.h,v 1.30 2013-08-19 08:50:19 phintuka Exp $ + * $Id: xine_frontend.h,v 1.31 2014-01-13 09:01:03 phintuka Exp $ * */ @@ -89,6 +89,7 @@ struct frontend_s { int fullscreen, int modeswitch, const char *modeline, int aspect, int scale_video); + unsigned char * (*fe_display_edid)(frontend_t *, int *size); void (*fe_display_close)(frontend_t*); /* Xine engine */ diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c index 7c55046f..b9f662f8 100644 --- a/xine_sxfe_frontend.c +++ b/xine_sxfe_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_sxfe_frontend.c,v 1.205 2013-08-18 07:58:29 phintuka Exp $ + * $Id: xine_sxfe_frontend.c,v 1.206 2014-01-13 09:01:02 phintuka Exp $ * */ @@ -37,6 +37,9 @@ #ifdef HAVE_XINERAMA # include <X11/extensions/Xinerama.h> #endif +#ifdef HAVE_XRANDR +# include <X11/extensions/Xrandr.h> +#endif #ifdef HAVE_OPENGL # include <GL/glx.h> @@ -2564,6 +2567,90 @@ static void sxfe_toggle_fullscreen(fe_t *this_gen, int fullscreen) this->fullscreen_state_forced = !force; } +static unsigned char *sxfe_display_edid(fe_t *this_gen, int *size) +{ + sxfe_t *this = (sxfe_t*)this_gen; + unsigned char *edid = NULL; + +#ifdef HAVE_XRANDR + + XLockDisplay(this->display); + + do { + if (!this->display) + break; + + int event_base, error_base; + int major, minor; + if (!XRRQueryExtension(this->display, &event_base, &error_base) || + !XRRQueryVersion(this->display, &major, &minor)) { + LOGMSG("edid: RandR extension missing"); + break; + } + if (major < 1 || (major == 1 && minor < 2)) { + LOGMSG("edid: RandR extension < 1.2"); + break; + } + + XRRScreenResources *res; + res = XRRGetScreenResourcesCurrent(this->display, this->root_window); + if (!res) { + LOGMSG("edid: failed getting screen resources"); + break; + } + + int o; + for (o = 0; o < res->noutput && !edid; o++) { + XRROutputInfo *output_info = XRRGetOutputInfo(this->display, res, res->outputs[o]); + if (!output_info) { + LOGMSG("edid: failed getting output %d information", o); + continue; + } + if (output_info->connection != RR_Connected) { + LOGDBG("edid: output %s not connected", output_info->name); + continue; + } + LOGDBG("edid: checking connected output %s", output_info->name); + + int nprop, j; + Atom *props = XRRListOutputProperties(this->display, res->outputs[o], &nprop); + for (j = 0; j < nprop && !edid; j++) { + char *atom_name = XGetAtomName(this->display, props[j]); + + if (!strcmp(atom_name, "EDID")) { + + unsigned char *prop; + int actual_format; + unsigned long nitems, bytes_after; + Atom actual_type; + XRRGetOutputProperty(this->display, res->outputs[o], props[j], + 0, 100, False, False, + AnyPropertyType, + &actual_type, &actual_format, + &nitems, &bytes_after, &prop); + if (actual_format == 8 && actual_type == XA_INTEGER) { + LOGDBG("edid: Found EDID, %d bytes", nitems); + *size = nitems; + edid = malloc(*size); + memcpy(edid, prop, *size); + break; + } + } + } + } + } while (0); + + XUnlockDisplay(this->display); + + if (!edid) { + LOGMSG("no EDID found"); + } +#endif /* HAVE_XRANDR */ + + return edid; +} + + /* * X event loop */ @@ -3099,6 +3186,7 @@ static frontend_t *sxfe_get_frontend(void) this->fe.fe_display_open = sxfe_display_open; this->fe.fe_display_config = sxfe_display_config; + this->fe.fe_display_edid = sxfe_display_edid; this->fe.fe_display_close = sxfe_display_close; this->fe.fe_run = sxfe_run; |