Refine GVFG capture API

This commit is contained in:
Mark.lin
2026-07-28 17:38:44 +08:00
parent 5662d74df9
commit d9f194c1ab
6 changed files with 375 additions and 410 deletions
+6 -2
View File
@@ -297,7 +297,7 @@ bool MainWindow::openDevice()
st = gvfg_open_channel(handle_, deviceIndex, channelIndex);
if (st != GVFG_OK)
{
showError(QStringLiteral("gvfg_open"), st);
showError(QStringLiteral("gvfg_open_channel"), st);
closeDevice();
return false;
}
@@ -795,9 +795,13 @@ void MainWindow::captureReadLoop()
if (gvfg_get_frame_layout(&frame, &layout) == GVFG_OK &&
layout.plane_count > 0 &&
layout.plane_data[0] &&
layout.plane_stride[0] > 0)
layout.plane_stride[0] > 0 &&
layout.plane_size[0] >=
static_cast<uint64_t>(layout.plane_stride[0]) *
static_cast<uint64_t>(frame.height))
{
previewFrame.data = layout.plane_data[0];
previewFrame.data_size = layout.plane_size[0];
previewFrame.row_bytes = layout.plane_stride[0];
}