summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-02-07 17:34:40 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-02-07 17:34:40 +0000
commit2020c00620ef6eea03d928d4c32b57d0aa14cd2d (patch)
tree84ba4419b249436029fccb13155eb48ff0085cd6
parent516a8718ba7a292fcd5e566467e597215473568a (diff)
downloadxine-lib-2020c00620ef6eea03d928d4c32b57d0aa14cd2d.tar.gz
xine-lib-2020c00620ef6eea03d928d4c32b57d0aa14cd2d.tar.bz2
load Xv extension library by hand to avoid libXv linking
PROBLEM: At least on SuSE, libXv.so is not present, but the Xv extension is. So health check would return a false negative. Any better solution? CVS patchset: 4115 CVS date: 2003/02/07 17:34:40
-rw-r--r--src/xine-utils/xine_check.c72
1 files changed, 57 insertions, 15 deletions
diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c
index 38580b182..fa6b90782 100644
--- a/src/xine-utils/xine_check.c
+++ b/src/xine-utils/xine_check.c
@@ -331,9 +331,12 @@ xine_health_check_t* xine_health_check_xv (xine_health_check_t* hc) {
Display *dpy;
unsigned int ver, rev, eventB, reqB, errorB;
char *disname = NULL;
- void *dl_handle;
+ void *x11_handle, *xv_handle;
Display *(*xopendisplay)(char*);
char *(*xdisplayname)(char*);
+ int (*xvqueryextension)(Display*, unsigned int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*);
+ int (*xvqueryadaptors)(Display*, Window, unsigned int*, XvAdaptorInfo**);
+ XvImageFormatValues *(*xvlistimageformats)(Display*, XvPortID, int*);
char *err = NULL;
int formats, adaptors, i;
XvImageFormatValues *img_formats;
@@ -345,55 +348,89 @@ xine_health_check_t* xine_health_check_xv (xine_health_check_t* hc) {
/* Majority of thi code was taken from or inspired by the xvinfo.c file of XFree86 */
- /* Get reference to XOpenDisplay */
dlerror(); /* clear error code */
- dl_handle = dlopen("libX11.so", RTLD_LAZY);
- if(!dl_handle) {
+ x11_handle = dlopen("libX11.so", RTLD_LAZY);
+ if(!x11_handle) {
hc->msg = dlerror();
hc->status = XINE_HEALTH_CHECK_FAIL;
return hc;
}
- xopendisplay = dlsym(dl_handle,"XOpenDisplay");
-
+ /* Get reference to XOpenDisplay */
+ xopendisplay = dlsym(x11_handle,"XOpenDisplay");
if((err = dlerror()) != NULL) {
hc->msg = err;
hc->status = XINE_HEALTH_CHECK_FAIL;
+ dlclose(x11_handle);
return hc;
}
/* Get reference to XDisplayName */
+ xdisplayname = dlsym(x11_handle,"XDisplayName");
+ if((err = dlerror()) != NULL) {
+ hc->msg = err;
+ hc->status = XINE_HEALTH_CHECK_FAIL;
+ dlclose(x11_handle);
+ return hc;
+ }
+
dlerror(); /* clear error code */
- dl_handle = dlopen("libX11.so", RTLD_LAZY);
- if(!dl_handle) {
+ xv_handle = dlopen("libXv.so", RTLD_LAZY);
+ if(!xv_handle) {
hc->msg = dlerror();
hc->status = XINE_HEALTH_CHECK_FAIL;
+ dlclose(x11_handle);
return hc;
}
- xdisplayname = dlsym(dl_handle,"XDisplayName");
-
+ /* Get reference to XvQueryExtension */
+ xvqueryextension = dlsym(xv_handle,"XvQueryExtension");
if((err = dlerror()) != NULL) {
hc->msg = err;
hc->status = XINE_HEALTH_CHECK_FAIL;
+ dlclose(x11_handle);
+ dlclose(xv_handle);
return hc;
}
- dlclose(dl_handle);
-
+
+ /* Get reference to XvQueryAdaptors */
+ xvqueryadaptors = dlsym(xv_handle,"XvQueryAdaptors");
+ if((err = dlerror()) != NULL) {
+ hc->msg = err;
+ hc->status = XINE_HEALTH_CHECK_FAIL;
+ dlclose(x11_handle);
+ dlclose(xv_handle);
+ return hc;
+ }
+
+ /* Get reference to XvListImageFormats */
+ xvlistimageformats = dlsym(xv_handle,"XvListImageFormats");
+ if((err = dlerror()) != NULL) {
+ hc->msg = err;
+ hc->status = XINE_HEALTH_CHECK_FAIL;
+ dlclose(x11_handle);
+ dlclose(xv_handle);
+ return hc;
+ }
+
if(!(dpy = (*xopendisplay)(disname))) {
if (!disname) {
disname = (*xdisplayname)(NULL);
}
set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, "Unable to open display: %s\n", disname);
+ dlclose(x11_handle);
+ dlclose(xv_handle);
return hc;
}
- if((Success != XvQueryExtension(dpy, &ver, &rev, &reqB, &eventB, &errorB))) {
+ if((Success != xvqueryextension(dpy, &ver, &rev, &reqB, &eventB, &errorB))) {
if (!disname) {
disname = xdisplayname(NULL);
}
set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, "Unable to open display: %s\n",disname);
+ dlclose(x11_handle);
+ dlclose(xv_handle);
return hc;
}
else {
@@ -404,13 +441,15 @@ xine_health_check_t* xine_health_check_xv (xine_health_check_t* hc) {
* check adaptors, search for one that supports (at least) yuv12
*/
- if (Success != XvQueryAdaptors(dpy,DefaultRootWindow(dpy),
+ if (Success != xvqueryadaptors(dpy,DefaultRootWindow(dpy),
&adaptors,&adaptor_info)) {
set_hc_result (hc, XINE_HEALTH_CHECK_FAIL, "video_out_xv: XvQueryAdaptors failed.\n");
+ dlclose(x11_handle);
+ dlclose(xv_handle);
return hc;
}
- img_formats = XvListImageFormats (dpy, adaptor_info->base_id, &formats);
+ img_formats = xvlistimageformats (dpy, adaptor_info->base_id, &formats);
for(i = 0; i < formats; i++) {
@@ -427,6 +466,9 @@ xine_health_check_t* xine_health_check_xv (xine_health_check_t* hc) {
}
}
+ dlclose(x11_handle);
+ dlclose(xv_handle);
+
return hc;
#else
hc->title = "Check for MIT Xv extension";