Skip to content

indi-libcamera: use negotiated stream size for CCD geometry#1344

Open
OLEGsandrMB wants to merge 1 commit into
indilib:masterfrom
OLEGsandrMB:fix-libcamera-stream-size
Open

indi-libcamera: use negotiated stream size for CCD geometry#1344
OLEGsandrMB wants to merge 1 commit into
indilib:masterfrom
OLEGsandrMB:fix-libcamera-stream-size

Conversation

@OLEGsandrMB

Copy link
Copy Markdown

Summary

Use the negotiated libcamera StillCapture stream size to initialize the INDI CCD geometry instead of properties::PixelArraySize.

Background

While testing an IMX462 camera on Raspberry Pi OS Bookworm (64-bit) with libcamera 0.5.2, I noticed the driver reported a CCD/ROI size of 1944×1097, while libcamera negotiated a 1920×1080 StillCapture stream.

The driver initialized the CCD geometry from properties::PixelArraySize, which describes the sensor array and may differ from the negotiated capture stream on some cameras.

This patch stores the negotiated StillCapture stream dimensions after camera configuration and uses them to initialize the CCD geometry.

If the negotiated stream size is unavailable, the driver falls back to PixelArraySize to preserve compatibility.

Tested on

  • Raspberry Pi Zero 2 W
  • Raspberry Pi OS Bookworm 64-bit
  • libcamera 0.5.2
  • Sony IMX462

Verified using:

  • rpicam-hello --list-cameras
  • rpicam-still
  • INDI Control Panel
  • Ekos-KStars

After this change the driver reports:

  • CCD: 1920×1080
  • Frame ROI: 1920×1080

matching the negotiated libcamera capture stream.

This is my first contribution to the project. If there is a preferred way to implement this or any coding style changes you'd like, I'd be happy to update the patch.

@knro

knro commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Thanks! @geoffrey-vl Can you please take a look?


config->validate();
cam->configure(config.get());
// Save the negotiated StillCapture stream size.

@geoffrey-vl geoffrey-vl Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation


if (width == 0 || height == 0)
{
auto pas = m_ControlList.get(properties::PixelArraySize);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation looks to be of here too


if (pas)
{
width = 2 * (pas->width / 2);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd keep the comment here about rounding down

int m_LiveVideoWidth {-1}, m_LiveVideoHeight {-1};
uint8_t m_CameraIndex;

uint32_t m_CaptureWidth = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation looks of

{
width = 2 * (pas->width / 2);
height = pas->height;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd remove this empty line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants