Hi Developers.

Iám programming a new ambilight system

I hope anyone can help me with my problem.
I have this code to get a pic from the decoder memory on my Dreambox 800.
But my problem is that my code is to fast.
I have tryed it with sleep but then my pics are to late.

See my attachements:
pic1 Ok.
pic2 you see pic3 on top of pic2(so my code is to fast)
pic3 Ok.

Is there some fix, so i can check when memory is complete and has a complete pic ?
Or some lock and unlock ?

Code:
memory = (unsigned char*)mmap(0, offset + stride*(ofs2+64), PROT_READ, MAP_SHARED, mem_fd, adr);
if (memory == MAP_FAILED) {
printf("[grabber] mmap failed\n");
return false;
}

usleep(1000);  // we try to get a full picture, its not possible to get a sync from the decoder so we use a delay
How can i check if the mmap is complete ?

I hope any can help.

Name:  post-27679-0-80406100-1347268467_thumb.png
Views: 482
Size:  4.2 KBName:  post-27679-0-83375500-1347268471_thumb.png
Views: 473
Size:  4.0 KBName:  post-27679-0-76610900-1347268473_thumb.png
Views: 484
Size:  1.2 KB


Kind regards Martijn