Hi,

4 Feb 2007 19:47:02 +0100, Tim Teulings <[EMAIL PROTECTED]>:
Hallo!

Subject says it all:

Does the camera in the N800 support the X11 Xv extension, that mean can
I use this extension for displaying images of the camera or must I use
v4l V2 (what about the V1 interface) or gstreamer?

I did a small test, see code below. And it seem you must use the gstreamer or
the v4l grabber unfortunately (lets hope the next version has XvPutVideo for
this device, or I made a mistake :-) ).

(note I had to comment out the XvInputMask check to get output at all)

$ g++ -o xvtest xvtest.cpp -lX11 -lXv
$ run-standalone.sh ./xvtest
xvport 56
XV_COLORKEY[72] (0 .. 65535) current: 1091
XV_OMAP_DOWNSCALING[73] (0 .. 2) current: 1
XV_OMAP_VSYNC[74] (0 .. 2) current: 1


#include <stdio.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/Xvlib.h>

int main (int argc, char ** argv) {
 Display * display = XOpenDisplay(NULL);
 int screen  = XDefaultScreen(display);

 unsigned int ver, rel, req, evb, err;
 if (XvQueryExtension (display, &ver, &rel, &req, &evb, &err) != Success) {
   fprintf (stderr, "XVideo not supported on display\n");
   XCloseDisplay (display);
   return 1;
 }
 XvAdaptorInfo * ai;
 unsigned int adaptors;
 bool xv_success = true;
 if (XvQueryAdaptors (display, XDefaultRootWindow (display),
&adaptors, &ai) == Success) {
   for (unsigned i = 0; i < adaptors; i++) {
     //if ((ai[i].type & XvInputMask) &&
     //    (ai[i].type & XvVideoMask) &&
     //    ai[i].base_id > 0) {
       int port = ai[i].base_id;
       fprintf (stderr, "xvport %d\n", port);
       bool freq_found = false;
       XvAttribute *attributes = 0L;
       int nr_attr, cur_val;
       attributes = XvQueryPortAttributes (display, port, &nr_attr);
       if (attributes) {
         for (int i = 0; i < nr_attr; i++) {
           if (!strcmp (attributes[i].name, "XV_FREQ"))
             freq_found = true;
           Atom atom = XInternAtom (display, attributes[i].name, false);
           fprintf (stderr, "%s[%d] (%d .. %d)", attributes[i].name, ( int ) at
om, attributes[i].min_value, attributes[i].max_value);
                    if ((attributes[i].flags & XvGettable) &&
XvGetPortAttribute (displa
y, port, atom, &cur_val) == Success)
             fprintf (stderr, " current: %d", cur_val);
           fprintf (stderr, "\n");
         }
         XFree(attributes);
       }
      XvEncodingInfo * encodings = 0L;
       unsigned nr_encode;
       XvQueryEncodings (display, port, &nr_encode, &encodings);
       if (encodings) {
         for (unsigned i = 0; i < nr_encode; i++) {
           if (strcmp (encodings[i].name, "XV_IMAGE"))
             fprintf (stderr, " encoding: %d %s dim %d %d\n", ( int )
encodings[i].encoding_id, encodings[i].name, encodings[i].width,
encodings[i].height);
         }
       }
       XvFreeEncodingInfo (encodings);
     //}
   }
 }
 XvFreeAdaptorInfo(ai);
 XCloseDisplay (display);
 return 0;
}
_______________________________________________
maemo-developers mailing list
[email protected]
https://maemo.org/mailman/listinfo/maemo-developers

Reply via email to