Skip to content

VIDIO_ENUM_FRAMESIZES ioctl fails because of strange implementation (AEGHB-1247) #40

@ghpille

Description

@ghpille

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

I'm trying to list the known framesizes for each known pixelformat of a MIPI CSI connected camera on a esp32p4.
I'm using a ioctl VIDIOC_ENUM_FRAMESIZES with the fd of the camera and each known pixelformat. Expecting something like

Capture: 0 JPEG, JFIF JPEG
 Sizes for 3, JPEG
 w x h: 320 x 240
 w x h: 640 x 480

Actual behavior (suspected bug)

Not a single framesize is found.

When I look at esp-video-components-master/esp_video/src/esp_video.c, the ioctl is handled by esp_video_enum_framesizes which uses the v4l2_frmsizeenum frmsize parameter's type field to call esp_video_get_stream.
Normally, you don't give a type, you only fill in the pixelformat when calling a VIDIOC_ENUM_FRAMESIZES. The type should be returned, specifying whether the framesize is discrete, stepwise or continuous.
Stranger still, esp_video_get_stream expects a v4l2_buf_type, so passing a pixelformat to the enum functions makes no sense. In the test code, I try passing a buffer type too, but still no framesizes.

capture_stream_main.c

Error logs or terminal output

I (1551) ov5647: Detected Camera sensor PID=0x5647
Trying to list formats for /dev/video0
Capture: 0 BA81, RAW8 BGGR
 Sizes for 5, BA81
VIDIOC_ENUM_FRAMESIZES error: Invalid argument
Capture: 1 RGBP, RGB 5-6-5
 Sizes for 5, RGBP
VIDIOC_ENUM_FRAMESIZES error: Invalid argument
Capture: 2 RGB3, RGB 8-8-8
 Sizes for 5, RGB3
VIDIOC_ENUM_FRAMESIZES error: Invalid argument
Capture: 3 YU12, YUV 4:2:0
 Sizes for 5, YU12

Steps to reproduce the behavior

run the attached code on a esp32p4 with camera attached

Project release version

master

System architecture

other (details in Additional context)

Operating system

Linux

Operating system version

ESP-IDF v6.0

Shell

other (details in Additional context)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions