Hi all. I need help after 3 night of work and no result.
I have for v4l cam (fedora 4 core) and i’m trying to build a GTK
interface to show all cam’s frames in the same winwows. I chose to
display YUV2 format. I i try one cam all seem to work correctly. The
code i’m using is the follow:
SDL_Overlay *cam4Overlay;
int flags = SDL_HWSURFACE|SDL_DOUBLEBUF; //SDL_SWSURFACE
| SDL_FULLSCREEN;
int nWidth = XWINDOWSIZE / cam4Struct->nRedim;
int nHeigth = YWINDOWSIZE / cam4Struct->nRedim;
int i = 0;
SDL_Rect rect4;
rect4.x = cam4Struct->nTopX;
rect4.y = cam4Struct->nTopY;
rect4.w = nWidth;
rect4.h = nHeigth;
cam4Overlay = SDL_CreateYUVOverlay(nWidth, nHeigth,
SDL_YUY2_OVERLAY, mainscreen);
while( !quit )
{
....
.....
SDL_LockYUVOverlay(cam4Overlay);
memcpy(cam4Overlay->pixels[0],buffer.data,buffer.buffer_size);
cam4Overlay->pitches[0] = 320;
SDL_UnlockYUVOverlay(cam4Overlay);
SDL_DisplayYUVOverlay(cam4Overlay,&rect4);
}
....
I need to show the 4 cams in 4 SDL_Rect on the main screen.
I use thread to assolve this job.
The problems is:
My frame are showed correctly but each time i update one cam i can see
on the other a rect filled of blue color.
What i’m doing wrong? Anynone know where is my problem? I’m really nes
on the SDl lib. Please help me.
Thank’s in advance.
Carmelo Gallucci