scytheStudio / SCodes

This project is Qt & Qml wrapper for ZXing-C++ Library that is used for decoding 1D and 2D barcodes.
https://scythe-studio.com/
Apache License 2.0
107 stars 36 forks source link

Skip the check of the videoframe handle type before conversion to QImage #33

Closed radkoder closed 8 months ago

radkoder commented 1 year ago

Original code checks if the videoframe's handle type is VideoFrame::NoHandle (CPU addressable) before the conversion to QImage. The other case, if the videoframe resides in GPU is not handled and image is not decoded in that case.

After looking into the QVideoFrame source (link) it turns out that this check is already done in .toImage() method and aproperiate conversion is done within. I wasn't able to test this myself but it seems that skipping of this explicit check should be enough to make conversion work for both cpu and gpu frames.