MJPG format on Windows platform

2012-05-15
2013-02-02
  • 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.
    http://msdn.microsoft.com/en-us/library/windows/desktop/dd797892(v=vs.85).aspx
    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:
    https://sourceforge.net/p/pbntools/code/114/tree/trunk/src/zbar_patches/
    Always up-to-date trunk directory, from which you should go to trunk/src/zbar_patches
    https://sourceforge.net/p/pbntools/code/

    Is there a better way to handle MJPG stream? @trueqbit , maybe you have something easy to implement provided that we use your directshow patch?
    https://sourceforge.net/tracker/?func=detail&aid=3522421&group_id=189236&atid=928517