Skip to content

Commit

Permalink
Change type of VideoCaptureProperties to int32
Browse files Browse the repository at this point in the history
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<int>` 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.
  • Loading branch information
tnolle authored Nov 6, 2024
1 parent 6935b87 commit 346cd0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion videoio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 346cd0b

Please sign in to comment.