Zbar does not recognize MJPG format. This is a strange format, not a JPEG format equivalent. I have one camera that connected to Win7 produces such stream. I tried to force treating this stream as JPEG but zbar crashed.
So I tried to use native windows bitmap conversion utility, DrawDIB functions.
That succeeded, but I had to employ ffdshow to decode MJPG. Without that zbar produced black screen instead of the image. The solution is not perfect as ffdshow contains a memory leak, noticeable through task manager. But the advantage of this solution is that it keeps zbar outside of Windows bitmap formats, as Windows always delivers RGB24 image to zbar decoder.
Oh, I almost forgot. Here are my zbar patches that I use in my app. The app is licensed under GNU GPL >=3, but you may consider zbar patches as zbar contribution under LGPL 2.1. DrawDib is included in patch named rgb0. Notice functions win_decomp_image*.
Current revision of zbar_patches:
Always up-to-date trunk directory, from which you should go to trunk/src/zbar_patches
Is there a better way to handle MJPG stream? @trueqbit , maybe you have something easy to implement provided that we use your directshow patch?
Log in to post a comment.