Question

I have been developing some video apps using USB webCam and the v4l2 API. The API gives lots of ioctl() calls to enumerate general capabilities, video standard, pixel color formats, etc. But there is not an ioctl() to enumerate all of the possible image sizes the USB webCam supports.

What is the preferred way to do this?

The API documentation says you can set a particular image size and the ioctl() will return its closest match. So I guess I could try every possible image size and see if the USB webCam rejects it. But that seems like a rather inefficient way to enumerate all possible supported image sizes when there are so many standard size formats (QCIF, CIF, 4CIF, 16CIF,VGA, DV, SVGA, XGA, UVGA, SXGA, UXGA, etc).

Thanks,

-Andres

Était-ce utile?

La solution

I will answer my own question...

Turns out I have been viewing some very old documentation on v4l2 that did not include any reference to the ioctl() for image sizes. The newer documentation does indeed had an VIDIOC_ENUM_FRAMESIZES ioctl() for enumerating all of the supported frame sizes.

Moral of this story: Always get the most current documentation for any API you intend to use. For video4linux2 use this:

http://linuxtv.org/downloads/v4l-dvb-apis/

-Andres

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top