[libcamera-devel] Accessing all available framesizes to display in qcam
Kieran Bingham
kieran.bingham at ideasonboard.com
Mon Jun 10 10:26:26 CEST 2019
Hi H,
On 10/06/2019 07:56, Jacopo Mondi wrote:
> Hello H,
>
> On Sat, Jun 08, 2019 at 07:51:47PM -0700, Your Name wrote:
>> Hello,
>> I am trying to access all the frame sizes that are available in order
>> to list it out in qcam as a drop down menu. When I try to add the
>> following code in v4l2_device.cpp inside int V4L2Device:open()
>>
>> struct v4l2_frmsizeenum v4l2frmsizeenum = {};
>> ret = ioctl(fd_,VIDIOC_ENUM_FRAMESIZES,&v4l2frmsizeenum);
>> The ret value comes out to be -1 indicating an error with ioctl.
The 'error' value is stored in a variable called errno.
When 'ret == -1' you need to check that variable to determine what the
error was.
>>
>> The standard
>> ret = ioctl(fd_, VIDIOC_QUERYCAP, &caps_);
>> seems to work just fine.
>
> It's pretty hard to provide any meaningful suggestion without seeing
> any of the code or the complete error messages :)
>
>>
>> Is there something specific in v4l2 that I am missing to query all the
>> frame sizes? It would be better if it's located somewhere else in the
>> libcamera repo.
>>
>
> Format enumeration is currently in development. Kieran sent a series a
> month ago where format enumeration was introduced as a V4L2Device
> operation:
> https://lists.libcamera.org/pipermail/libcamera-devel/2019-May/002737.html
>
> That series is now replaced by one from Niklas which is in review and
> where support for size and format enumerations is implemented as well:
> "[PATCH 00/17] libcamera: Add support for format information and validation"
>
> You can have a look at how enumeration is implemented there and
> compare it with your code.
Indeed, Niklas has done a lot of work in this area with patches at:
https://lists.libcamera.org/pipermail/libcamera-devel/2019-May/003023.html
I would recommend you apply these 17 patches, so either save them and
apply them using git-am, or for ease I have pushed a branch to my
personal repository:
https://github.com/kbingham/libcamera/tree/niklas/enum
His series creates a dialog box to confirm the format, and sizes at startup.
If you are interested, it would be useful to take this series further so
that the options are all presented in a 'tool box' on a larger window,
but that may involve learning how to get started with Qt developments.
>> I am learning how to help with open source development. I can reformat
>> the message if you think it is more appropriate.
>>
>> I am using Logitech HD Pro Webcam C920 on ubuntu 18.04.
>
> Message is fine (if "Your Name" in the subject was intentional :)
>
> It's nice having people testing with multiple cameras, so keep
> experimenting and maybe try to apply one of the above two series and see
> what happens.
>
> Thanks
> j
>
>>
>> Thanks,
>> H
>> libcamera-devel mailing list
>> libcamera-devel at lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list