// gcc -g -Wall xv-query-adaptors.c -o xv-query-adaptors -lX11 -lXv -lxcb -lxcb-xv #include #include #include #include #include static void test_xlib (void) { Display *d = XOpenDisplay (NULL); unsigned int n_adaptors, i; XvAdaptorInfo *adaptors; XvQueryAdaptors (d, DefaultRootWindow (d), &n_adaptors, &adaptors); printf ("Xlib:\n"); for (i = 0; i < n_adaptors; i++) printf ("\"%s\"\n", adaptors[i].name); } static void test_xcb (void) { xcb_connection_t *c = xcb_connect (NULL, NULL); xcb_screen_t *screen = xcb_setup_roots_iterator (xcb_get_setup (c)).data; xcb_xv_query_adaptors_cookie_t cookie = xcb_xv_query_adaptors (c, screen->root); xcb_xv_query_adaptors_reply_t *reply = xcb_xv_query_adaptors_reply (c, cookie, NULL); xcb_xv_adaptor_info_iterator_t iter = xcb_xv_query_adaptors_info_iterator (reply); printf ("XCB:\n"); while (iter.rem > 0) { printf ("\"%.*s\"\n", xcb_xv_adaptor_info_name_length (iter.data), xcb_xv_adaptor_info_name (iter.data)); printf ("%d\n", xcb_xv_adaptor_info_sizeof (iter.data)); // Should be 32 bit aligned xcb_xv_adaptor_info_next (&iter); } } int main (int argc, char **argv) { test_xlib (); test_xcb (); return 0; }