By Date: <-- -->
By Thread: <-- -->

What is the correct poll behavior?



Hi all,

Opening a V4L2 video device will not start the capture process, that 
doesn't happen until the first read(). But what should be the behavior 
of poll()? 

Example:

    videofd=open("/dev/video0",  O_RDONLY);

    // Add video device
    poll_item.fd = videofd;
    poll_item.events = POLLIN;
    poll_item.revents = 0;

    // poll infinite
    retvalue = poll(&poll_item, 1, -1);

This question came up for the ivtv driver, and I can't find an answer in 
the V4L2 spec. I think there are three options:

1) poll waits forever (hoping another thread will start reading)
2) poll starts the capture process and waits for the first data to 
arrive
3) poll returns POLLERR.

Currently I'm using 3) in the ivtv driver, but is that correct?

The same applies BTW to a decoder which isn't started until the first 
write().

Regards,

	Hans

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request (at) redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list