Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions indi-libcamera/indi_libcamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,10 @@ RpiCamProperties INDILibCamera::getAvailableCamProperties()

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

// This is used to initialize the CCD geometry during Connect().
m_CaptureWidth = config->at(0).size.width;
m_CaptureHeight = config->at(0).size.height;

const auto &controls = cam->controls();

Expand Down Expand Up @@ -926,10 +930,30 @@ void INDILibCamera::default_signal_handler(int signal_number)
bool INDILibCamera::Connect()
{
LOGF_INFO("Connecting to %s", getDeviceName());
auto pas = m_ControlList.get(properties::PixelArraySize);
// no idea why the IMX290 returns an uneven number of pixels, so just round down
auto width = 2.0 * (pas->width / 2);
auto height = pas->height;

// Use the negotiated StillCapture stream size when available.
// PixelArraySize describes the sensor array and may differ from
// the actual capture stream dimensions on some cameras.
uint32_t width = m_CaptureWidth;
uint32_t height = m_CaptureHeight;

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

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

LOG_WARN("Negotiated stream size unavailable, falling back to PixelArraySize.");
}
else
{
LOG_ERROR("Unable to determine CCD size.");
return false;
}
}

PrimaryCCD.setResolution(width, height);
UpdateCCDFrame(0, 0, width, height);
Expand Down
4 changes: 4 additions & 0 deletions indi-libcamera/indi_libcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ class INDILibCamera : public INDI::CCD
int m_black_levels[4] {0, 0, 0, 0};
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

uint32_t m_CaptureHeight = 0;

libcamera::ControlList m_ControlList;

RpiCamProperties getAvailableCamProperties();
Expand Down