Quoting Roel Baardman:
> Hi,
>
> I've been trying to implement video support to a DirectFB wrapper I'm
> writing.
> However, I'm getting really odd behaviour, especially compared with
> the example programs. I fail to so why my code won't work, but
> df_window will with my Video4Linux (1 and 2) card.
> Here's my code:
>
> #include <directfb.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <math.h>
>
> int frame_callback(void * ctx);
>
> int main(int argc, char ** argv)
> {
> IDirectFB *dfb;
> IDirectFBSurface *primary;
> IDirectFBDisplayLayer *layer;
> IDirectFBVideoProvider *vid;
>
> DirectFBInit(&argc, &argv);
> DirectFBCreate(&dfb);
> dfb->SetCooperativeLevel(dfb, DFSCL_EXCLUSIVE);
> dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
> layer->GetSurface(layer, &primary);
You should set cooperative level on the layer only.
> dfb->CreateVideoProvider(dfb, argv[1], &vid);
> vid->PlayTo(vid, primary, NULL, frame_callback, primary);
>
>
> sleep(150);
> primary->Release(primary);
> dfb->Release(dfb);
> return 42;
> }
>
> int frame_callback(void * ctx)
> {
> IDirectFBSurface * surf = (IDirectFBSurface *)ctx;
> surf->Flip(surf, 0, DSFLIP_ONSYNC);
> }
>
> Now, despite the perhaps bad quality of my code, this does play files
> from disk. The odd thing comes when I try to play /dev/video0. When I
> have Video4Linux2 disabled, I get an error noting that VIDIOCAPTURE
Playing directly to a surface with a higher resolution than suported by
your capture card won't work. IIRC dfbsee plays to a temporary surface and
does StretchBlit() for each frame.
> failed, and when I use Video4Linux2 I am told that there is a bad
> file descriptor somewhere. However, df_window doesn't have any
> problem with the video device, nor does dfbsee or df_video. So I hope
> someone can point out where I'm being plain foolish. :)
I don't know why the v4l2 fails.
--
Best regards,
Denis Oliver Kropp
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev