The way to do things properly would be to auto-detect xv and use it, and fall back to x11 otherwise.
(see xvinfo and xvctl's code, in general, you want to detect that you have an xv extension *and* that it has useful adapters. This is probably about 20 lines of code...