hi Mike! > XVideo Question > > This is not a question about the video4linux driver per se, but I think > someone on this list may be able to help me out. > > I am trying to write an application to display animation on an X server. > I wish to use the XFree86 XVideo extension to take advantage of hardware > scaling if available. > Unfortunately, I am having a lot of trouble finding good documentation > on XVideo. I have looked at the code to X Movie, but am hoping someone > could recommend a simpler source of documentation or example code. > Currently my application barfs and spouts: > > X Error of failed request: BadAccess (attempt to access private > > resource denied) > > Major opcode of failed request: 142 (XVideo) > > Minor opcode of failed request: 19 () > > Serial number of failed request: 113 > > Current serial number in output stream: 116 > > Any ideas? > > -- > Mike > > :wq this is the program i wrote for playing around with XVideo. i have a Hauppauge WinTV card, xvinfo prints: X-Video Extension version 2.2 XFree86 4.0.3 distro is SuSE 7.2 i had Video4Linux (NOT Video4Linux2 - v4l2) installed at the time. the module section in the /etc/XF86Config looks like Section "Module" Load "type1" Load "speedo" Load "extmod" Load "freetype" Load "fgl1" Load "fgl23" Load "glx" Load "dri" Load "v4l" EndSection note the "Load v4l"! ok here's the prog: /* * adapterinfo.c * Michael Zillich, 11.3.2001 * Using Xvideo extension (function XvXXXX()) to get info about known * video cards. * Open a window and display live video. */ #include <stdlib.h> #include <stdio.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/extensions/Xvlib.h> int main(int argc, char **argv) { Display *disp; Window root_win, win; int screen; unsigned int num_adaptors; XvAdaptorInfo *adaptor_info; int rtc; unsigned int version, release, request_base, event_base, error_base; char error_str[100]; unsigned int i; unsigned long j; unsigned int win_width, win_height; XGCValues values; unsigned long valuemask = 0; GC gc; disp = XOpenDisplay(NULL); if(disp == NULL) { fprintf(stderr,"* failed to open X display\n"); return(1); } screen = DefaultScreen(disp); root_win = DefaultRootWindow(disp); /* get extension info */ rtc = XvQueryExtension(disp, &version, &release, &request_base, &event_base, &error_base); XGetErrorText(disp, rtc, error_str, 100); printf("XvQueryExtension: %s\n", error_str); /* get adapter info */ rtc = XvQueryAdaptors(disp, root_win, &num_adaptors, &adaptor_info); XGetErrorText(disp, rtc, error_str, 100); printf("XvQueryAdaptors: %s\n", error_str); printf("%d adaptors found\n", num_adaptors); for(i = 0; i < num_adaptors; i++) { printf("adapter %d:\n", i); printf("name: %s\n", adaptor_info[i].name); printf("num ports: %lu\n", adaptor_info[i].num_ports); if(adaptor_info[i].type && XvInputMask) printf("supports video input\n"); if(adaptor_info[i].type && XvOutputMask) printf("supports video output\n"); printf("%lu supported formats:\n", adaptor_info[i].num_formats); for(j = 0; j < adaptor_info[i].num_formats; j++) { printf("depth: %d visual: %lu\n", adaptor_info[i].formats[j].depth, adaptor_info[i].formats[j].visual_id); } printf("num adaptors: %lu\n", adaptor_info[i].num_adaptors); } if(num_adaptors < 1) { printf("no adapter found - exiting.\n"); XCloseDisplay(disp); exit(0); } XvQueryBestSize(disp, adaptor_info[0].base_id, True, 768, 576, 768, 576, &win_width, &win_height); printf("best window size: %u x %u\n", win_width, win_height); win = XCreateSimpleWindow(disp, root_win, 0, 0, win_width, win_height, 10, BlackPixel(disp, screen), BlackPixel(disp, screen)); gc = XCreateGC(disp,win,valuemask,&values); XMapWindow(disp, win); XvPutVideo(disp, adaptor_info[0].base_id, win, gc, 0, 0, win_width, win_height, 0, 0, win_width, win_height); XFlush(disp); printf("press any key to abort..."); getchar(); XFreeGC(disp,gc); XDestroyWindow(disp, win); XCloseDisplay(disp); } basically it's a two-liner: XvQueryAdaptors(disp, root_win, &num_adaptors, &adaptor_info); XvPutVideo(disp, adaptor_info[0].base_id, win, gc, 0, 0, win_width, win_height, 0, 0, win_width, win_height); the rest is error checking and getting some infos. works very nice & fast. i had to set the video format (composite input, PAL etc.) from another program (xawtv) before calling this. looked to easy? ok, here come the problems: right now i can't get it to work with v4l2 xvinfo says: no adaptors present i'll have a deeper look into this. but if You are using Video4Linux, there You are. mike, too :) ----------------------------------------------------------------------- Dipl.-Ing. Michael Zillich email: mz@xxxxxxxxxxxxxxxxx Institute of Flexible Automation web: http://www.infa.tuwien.ac.at Vienna University of Technology phone: +43/1/5041446-12 Floragasse 7a, 1040 Wien, Austria fax: +43/1/58801-36199