From 346cd0b70917803065aa7e5fcdb8c1544759130f Mon Sep 17 00:00:00 2001 From: Timo Nolle Date: Wed, 6 Nov 2024 21:15:43 +0100 Subject: [PATCH] Change type of VideoCaptureProperties to int32 This patch changes the type of `VideoCaptureProperties` to `int32`. It is currently set to `int`. This breaks `VideoCapture_OpenDeviceWithAPIParams` because it doesn't correclty unroll the slice into the `std::vector` here: ```c++ bool VideoCapture_OpenDeviceWithAPIParams(VideoCapture v, int device, int apiPreference, int *paramsv, int paramsc) { std::vector< int > params; for( int i = 0; i< paramsc; i++) { params.push_back(paramsv[i]); } return v->open(device, apiPreference, params); } ``` With `int64` this for loop will create only zeros in the value parts of the array that OpenCV expects (`[p1, v1, ..., pn, vn]`). Changing it to `int32` unpacks the slice correctly and OpenCV will pass the parameters correctly to the respective VideoCapture backends. --- videoio.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/videoio.go b/videoio.go index ce36b43d..5d14356d 100644 --- a/videoio.go +++ b/videoio.go @@ -119,7 +119,7 @@ const ( ) // VideoCaptureProperties are the properties used for VideoCapture operations. -type VideoCaptureProperties int +type VideoCaptureProperties int32 const ( // VideoCapturePosMsec contains current position of the