diff options
author | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-03-10 18:19:09 +0000 |
---|---|---|
committer | Darren Salt <linux@youmustbejoking.demon.co.uk> | 2008-03-10 18:19:09 +0000 |
commit | 58fd88ef13a7e18ebf075e2658c26ac6f80d65c2 (patch) | |
tree | df0dc4ef37399ccd6f486e0a84a676096acf705c | |
parent | 613d610d74bc008482c3f5f71ba4d2917aee0884 (diff) | |
download | xine-lib-58fd88ef13a7e18ebf075e2658c26ac6f80d65c2.tar.gz xine-lib-58fd88ef13a7e18ebf075e2658c26ac6f80d65c2.tar.bz2 |
Add Xv port selection by type (overlay or textured video).
This uses the adapter names reported by the X 2D graphics driver.
(Transplanted from 8c06e053c6dbb2f31c004f6eb615ebbf3f67d667)
-rw-r--r-- | src/video_out/video_out_xcbxv.c | 23 | ||||
-rw-r--r-- | src/video_out/video_out_xv.c | 22 | ||||
-rw-r--r-- | src/video_out/video_out_xxmc.c | 21 | ||||
-rw-r--r-- | src/video_out/xv_common.h | 11 |
4 files changed, 62 insertions, 15 deletions
diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index a9420261c..b6e5544c3 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -156,6 +156,8 @@ typedef struct { xine_t *xine; } xv_class_t; +static const char *const prefer_types[] = VIDEO_DEVICE_XV_PREFER_TYPES; + static uint32_t xv_get_capabilities (vo_driver_t *this_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -1309,10 +1311,15 @@ xv_find_adaptor_by_port (int port, xcb_xv_adaptor_info_iterator_t *adaptor_it) static xcb_xv_port_t xv_autodetect_port(xv_driver_t *this, xcb_xv_adaptor_info_iterator_t *adaptor_it, - xcb_xv_port_t base) + xcb_xv_port_t base, + xv_prefertype prefer_type) { + xcb_xv_adaptor_info_iterator_t *start = adaptor_it; + for (; adaptor_it->rem; xcb_xv_adaptor_info_next(adaptor_it)) - if (adaptor_it->data->type & XCB_XV_TYPE_IMAGE_MASK) + if (adaptor_it->data->type & XCB_XV_TYPE_IMAGE_MASK && + (prefer_type == xv_prefer_none || + strcasestr (xcb_xv_adaptor_info_name (adaptor_it->data), prefer_types[prefer_type]))) { int j; for (j = 0; j < adaptor_it->data->num_ports; ++j) @@ -1332,6 +1339,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis int i; xcb_visual_t *visual = (xcb_visual_t *) visual_gen; xcb_xv_port_t xv_port; + xv_prefertype prefer_type; const xcb_query_extension_reply_t *query_extension_reply; @@ -1383,19 +1391,24 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis adaptor_it = xcb_xv_query_adaptors_info_iterator(query_adaptors_reply); xv_port = config->register_num (config, "video.device.xv_port", 0, VIDEO_DEVICE_XV_PORT_HELP, - 10, NULL, NULL); + 20, NULL, NULL); + prefer_type = config->register_enum (config, "video.device.xv_preferred_method", 0, + prefer_types, VIDEO_DEVICE_XV_PREFER_TYPE_HELP, + 10, NULL, NULL); if (xv_port != 0) { if (! xv_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 = xv_autodetect_port (this, &adaptor_it, xv_port); + xv_port = xv_autodetect_port (this, &adaptor_it, xv_port, prefer_type); } else xv_find_adaptor_by_port (xv_port, &adaptor_it); } if (!xv_port) - xv_port = xv_autodetect_port (this, &adaptor_it, 0); + xv_port = xv_autodetect_port (this, &adaptor_it, 0, prefer_type); + if (!xv_port) + xv_port = xv_autodetect_port (this, &adaptor_it, 0, xv_prefer_none); if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG, diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index edb275eb2..8f5da8ea0 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -169,6 +169,8 @@ typedef struct { static int gX11Fail; +static const char *const prefer_types[] = VIDEO_DEVICE_XV_PREFER_TYPES; + static uint32_t xv_get_capabilities (vo_driver_t *this_gen) { xv_driver_t *this = (xv_driver_t *) this_gen; @@ -1347,11 +1349,15 @@ static XvPortID xv_autodetect_port(xv_driver_t *this, unsigned int adaptors, XvAdaptorInfo *adaptor_info, unsigned int *adaptor_num, - XvPortID base) { + XvPortID base, + xv_prefertype prefer_type) +{ unsigned int an, j; for (an = 0; an < adaptors; an++) - if (adaptor_info[an].type & XvImageMask) + if (adaptor_info[an].type & XvImageMask && + (prefer_type == xv_prefer_none || + strcasestr (adaptor_info[an].name, prefer_types[prefer_type]))) for (j = 0; j < adaptor_info[an].num_ports; j++) { XvPortID port = adaptor_info[an].base_id + j; if (port >= base && xv_open_port(this, port)) { @@ -1381,6 +1387,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * XvPortID xv_port; XvAdaptorInfo *adaptor_info; unsigned int adaptor_num; + xv_prefertype prefer_type; this = (xv_driver_t *) calloc(1, sizeof(xv_driver_t)); if (!this) @@ -1420,19 +1427,24 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * xv_port = config->register_num (config, "video.device.xv_port", 0, VIDEO_DEVICE_XV_PORT_HELP, - 10, NULL, NULL); + 20, NULL, NULL); + prefer_type = config->register_enum (config, "video.device.xv_preferred_method", 0, + prefer_types, VIDEO_DEVICE_XV_PREFER_TYPE_HELP, + 10, NULL, NULL); if (xv_port != 0) { if (! xv_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 = xv_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, xv_port); + xv_port = xv_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, xv_port, prefer_type); } else adaptor_num = xv_find_adaptor_by_port (xv_port, adaptors, adaptor_info); } if (!xv_port) - xv_port = xv_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, 0); + xv_port = xv_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, 0, prefer_type); + if (!xv_port) + xv_port = xv_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, 0, xv_prefer_none); if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG, diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index 9c4dd478b..b8d6abf83 100644 --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -45,6 +45,7 @@ static void xxmc_frame_updates(xxmc_driver_t *driver, xxmc_frame_t *frame, static void dispose_ximage (xxmc_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage); +static const char *const prefer_types[] = VIDEO_DEVICE_XV_PREFER_TYPES; /* * Acceleration level priority. Static for now. It may well turn out that IDCT @@ -2223,11 +2224,15 @@ static XvPortID xxmc_autodetect_port(xxmc_driver_t *this, unsigned int adaptors, XvAdaptorInfo *adaptor_info, unsigned int *adaptor_num, - XvPortID base) { + XvPortID base, + xv_prefertype prefer_type) +{ unsigned int an, j; for (an = 0; an < adaptors; an++) - if (adaptor_info[an].type & XvImageMask) + if (adaptor_info[an].type & XvImageMask && + (prefer_type == xv_prefer_none || + strcasestr (adaptor_info[an].name, prefer_types[prefer_type]))) for (j = 0; j < adaptor_info[an].num_ports; j++) { XvPortID port = adaptor_info[an].base_id + j; if (port >= base && xxmc_open_port(this, port)) { @@ -2407,6 +2412,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XvPortID xv_port; XvAdaptorInfo *adaptor_info; unsigned int adaptor_num; + xv_prefertype prefer_type; cfg_entry_t *entry; int use_more_frames; int use_unscaled; @@ -2444,19 +2450,24 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi xv_port = config->register_num (config, "video.device.xv_port", 0, VIDEO_DEVICE_XV_PORT_HELP, - 10, NULL, NULL); + 20, NULL, NULL); + prefer_type = config->register_enum (config, "video.device.xv_preferred_method", 0, + prefer_types, VIDEO_DEVICE_XV_PREFER_TYPE_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, xv_port); + xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, xv_port, prefer_type); } else adaptor_num = xxmc_find_adaptor_by_port (xv_port, adaptors, adaptor_info); } if (!xv_port) - xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, 0); + xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, 0, prefer_type); + if (!xv_port) + xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num, 0, xv_prefer_none); if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG, diff --git a/src/video_out/xv_common.h b/src/video_out/xv_common.h index ee2ab9a10..259afe616 100644 --- a/src/video_out/xv_common.h +++ b/src/video_out/xv_common.h @@ -56,3 +56,14 @@ #define VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP \ _("pitch alignment workaround"), \ _("Some buggy video drivers need a workaround to function properly.") + +typedef enum { + xv_prefer_none, xv_prefer_overlay, xv_prefer_textured +} xv_prefertype; +#define VIDEO_DEVICE_XV_PREFER_TYPES \ + { "Any", "Overlay", "Textured Video", NULL } +#define VIDEO_DEVICE_XV_PREFER_TYPE_HELP \ + _("video display method preference"), \ + _("Selects which video output method is preferred. " \ + "Detection is done using the reported Xv adaptor names.\n" \ + "(Only applies when auto-detecting which Xv port to use.)") |