/* Set any XV property. * For example: * xvset XV_COLORKEY 0xFF40FF * xvset XV_SWITCHCRT 1 * Adam Sampson */ #include #include #include #include #include void die(const char *s) { fprintf(stderr, "xvset: %s\n", s); exit(1); } int main(int argc, char **argv) { Display *display; Atom attribute; unsigned int nadaptors; XvAdaptorInfo *ainfo; int value; if (argc != 3) die("usage: xvset OPTION DECIMAL, or xvset OPTION 0xHEX"); display = XOpenDisplay(NULL); if (!display) die("can't open display"); XvQueryAdaptors(display, RootWindow(display, 0), &nadaptors, &ainfo); if (nadaptors != 1) die("not exactly 1 adaptor"); if (strncmp(argv[2], "0x", 2) == 0) { value = strtol(argv[2] + 2, NULL, 16); } else { value = strtol(argv[2], NULL, 10); } attribute = XInternAtom(display, argv[1], False); if (XvSetPortAttribute(display, ainfo[0].base_id, attribute, value) != Success) die("unable to set attribute"); XCloseDisplay(display); return 0; }