Skip to content

Commit

Permalink
Adapt to change of MapInfo.data in Gstreamer 1.18
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed Oct 11, 2020
1 parent d5d1900 commit 76b8bf2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cobang/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,9 @@ def on_new_webcam_sample(self, appsink: GstApp.AppSink) -> Gst.FlowReturn:
if not success:
logger.error('Failed to get mapinfo.')
return Gst.FlowReturn.ERROR
img = zbar.Image(width, height, 'Y800', mapinfo.data)
# In Gstreamer 1.18, Gst.MapInfo.data is memoryview instead of bytes
imgdata = mapinfo.data.tobytes() if isinstance(mapinfo.data, memoryview) else mapinfo.data
img = zbar.Image(width, height, 'Y800', imgdata)
n = self.zbar_scanner.scan(img)
logger.debug('Any QR code?: {}', n)
if not n:
Expand Down

0 comments on commit 76b8bf2

Please sign in to comment.