I have a Philips webcam, and it only supports the YUV420P palette. I've tried to use it with IDirectFBVideoProvider to render it to a DSPF_I420 or DSPF_YV12 surface, but both of them was unsuccesful. DirectFB responded as YUV conversion is unimplemented in software.
This should only happen if you try to do some gfx operation on the surface.
I just want to display the video from the webcam in a surface, and at some time Stop() it, and save the last frame (which is available on the surface).
I looked closer the source, and found that GetSurfaceDescription() returns **WRONG** values: It reports that width is 768, height is 576, the image is interlaced, and the pixel format is RGB16 which is NOT true! The webcam supports max. 640x480, YUV420P images (and I think not interlaced)
The code I use is:
DFBCHECK(DirectFBInit( &argc, &argv ));
DFBCHECK(DirectFBCreate( &dfb ));
DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &primary ));
DFBCHECK(dfb->CreateVideoProvider( dfb, argv[1], &videoprovider ));
videoprovider->GetSurfaceDescription( videoprovider, &sdsc );
desc.flags = DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT
| DWDESC_PIXELFORMAT;
desc.posx = 0;
desc.posy = 0;
desc.width = sdsc.width;
desc.height = sdsc.height;// IMPORTANT: desc.pixelformat = sdsc.pixelformat; //desc.pixelformat = DSPF_I420;
DFBCHECK(primary->CreateWindow( primary, &desc, &videowindow ) );
DFBCHECK(videowindow->GetSurface( videowindow, &videosurface ) );
videowindow->SetOpacity( videowindow, 0xFF );
DFBCHECK(videoprovider->PlayTo( videoprovider, videosurface, NULL,
flip_callback, NULL ));
If I use the code above with my tuner card, everything works fine. If I use it my webcam I got the error message:
(!) DirectFB/v4l: Could not start capturing (VIDIOCMCAPTURE failed)!
--> Invalid argument
df_video.c <141>:
(#) DirectFBError [videoprovider->PlayTo( videoprovider,
videosurface, NULL, NULL, NULL )]: General failure!I found out that the problem is that the webcam can not capture in RGB16 (which was incorrectly reported by GetSurfaceDescription()), so I explicitely requested DSPF_I420 pixel format (in the above code it is commented). The error message in this case:
(!) *** [only copying blits supported for YUV in software] *** generic.c (2862)
Oh, I forgot: I use DirectFB 0.9.17. Should I use the CVS version instead?
-- B�RCI Norbert
-- Info: To unsubscribe send a mail to [EMAIL PROTECTED] with "unsubscribe directfb-users" as subject.
