diff --git a/include/xine.h b/include/xine.h --- a/include/xine.h +++ b/include/xine.h @@ -414,6 +414,9 @@ int xine_get_current_frame (xine_stream #define XINE_IMGFMT_YUY2 (('2'<<24)|('Y'<<16)|('U'<<8)|'Y') #define XINE_IMGFMT_XVMC (('C'<<24)|('M'<<16)|('v'<<8)|'X') #define XINE_IMGFMT_XXMC (('C'<<24)|('M'<<16)|('x'<<8)|'X') +/* xf86-video-intel.git (xvmc branch) says "XVMC", not "XvMC" */ +#define XINE_IMGFMT_XVMC_ALT (('C'<<24)|('M'<<16)|('V'<<8)|'X') +#define XINE_IMGFMT_XXMC_ALT (('C'<<24)|('M'<<16)|('X'<<8)|'X') /* get current xine's virtual presentation timestamp (1/90000 sec) * note: this is mostly internal data. diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -2081,22 +2081,28 @@ static void xxmc_dispose (vo_driver_t *t } /* called xlocked */ -static int xxmc_check_yv12 (Display *display, XvPortID port) { +static int xxmc_check_yv12 (Display *display, XvPortID port, int with_xvmc) { XvImageFormatValues *formatValues; int formats; int i; + int count = with_xvmc ? 0 : 2; formatValues = XvListImageFormats (display, port, &formats); for (i = 0; i < formats; i++) + { if ((formatValues[i].id == XINE_IMGFMT_YV12) && (! (strcmp (formatValues[i].guid, "YV12")))) { - XFree (formatValues); - return 0; + count |= 1; } - + else if (((formatValues[i].id == XINE_IMGFMT_XVMC) || + (formatValues[i].id == XINE_IMGFMT_XVMC_ALT)) && + (! (strcmp (formatValues[i].guid, "XVMC")))) { + count |= 2; + } + } XFree (formatValues); - return 1; + return count != 3; /* 0 == success */ } /* called xlocked */ @@ -2237,10 +2243,10 @@ static void xxmc_update_disable_bob_for_ this->disable_bob_for_scaled_osd = entry->num_value; } -static int xxmc_open_port (xxmc_driver_t *this, XvPortID port) { +static int xxmc_open_port (xxmc_driver_t *this, XvPortID port, int with_xvmc) { int ret; x11_InstallXErrorHandler (this); - ret = ! xxmc_check_yv12(this->display, port) + ret = ! xxmc_check_yv12(this->display, port, with_xvmc) && XvGrabPort(this->display, port, 0) == Success; x11_DeInstallXErrorHandler (this); return ret; @@ -2262,14 +2268,15 @@ static XvPortID xxmc_autodetect_port(xxm static XvPortID xxmc_autodetect_port(xxmc_driver_t *this, unsigned int adaptors, XvAdaptorInfo *adaptor_info, - unsigned int *adaptor_num) { + unsigned int *adaptor_num, + int with_xvmc) { unsigned int an, j; for (an = 0; an < adaptors; an++) if (adaptor_info[an].type & XvImageMask) for (j = 0; j < adaptor_info[an].num_ports; j++) { XvPortID port = adaptor_info[an].base_id + j; - if (xxmc_open_port(this, port)) { + if (xxmc_open_port(this, port, with_xvmc)) { *adaptor_num = an; return port; } @@ -2481,16 +2488,26 @@ static vo_driver_t *open_plugin (video_d VIDEO_DEVICE_XV_PORT_HELP, 10, NULL, NULL); - if (xv_port != 0) { - if (! xxmc_open_port(this, xv_port)) { - xprintf(class->xine, XINE_VERBOSITY_NONE, - _("%s: could not open Xv port %d - autodetecting\n"), - LOG_MODULE, xv_port); - xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num); + i = 1; /* set to check for XvMC as well as Xv*/ + do { + XvPortID port = xv_port; + if (port != 0) { + if (! xxmc_open_port(this, port, i)) { + xprintf(class->xine, XINE_VERBOSITY_NONE, + _("%s: could not open Xv port %d - autodetecting\n"), + LOG_MODULE, port); + port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, i); + } else + adaptor_num = xxmc_find_adaptor_by_port (port, adaptors, adaptor_info); } else - adaptor_num = xxmc_find_adaptor_by_port (xv_port, adaptors, adaptor_info); - } else - xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num); + port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, i); + if (port) { + xv_port = port; + printf ("using port %d, with%s xvmc support\n", port, i ? "" : "out"); + break; + } + i ^= 1; + } while (!i); if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG,