[MPlayer-users] [BUG] filemembers 'Z_NO/BEST_COMPRESSION' used though zlib.h is not included

Stefan Gürtler Stefan.guertler at stud.tum.de
Mon Dec 15 11:56:50 CET 2003


I found a bug in mplayer-1.opre3 and yesterdays mplayer-source from CVS.
In libmpcodecs/vd_lcl.c the filemembers Z_NO_COMPRESSION and
Z_BEST_COMPRESSION of zlib.h are used no matter if zlib.h is inculded or
not.
This is e.g. a problem when trying to compile MPlayer for win32 using MinGW
following the instructions given in the documentation chapter 6.6.2. MinGW
(http://www.mplayerhq.hu/DOCS/HTML/en/windows.html) as zlib.h is included
neither in current MinGW  3.1.0-1 nor in MSYS 1.0.9.

Here are the relevant parts of /libmpcodecs/vd_lcl.c

....
/*Here zlib.h will be included or not depending on the detections made by
./configure*/
#ifdef HAVE_ZLIB
#include <zlib.h>
#endif
...

/*the zlib's datamembers 'Z_NO/BEST_COMPRESSION' will be used in this code
no matter of HAVE_ZLIB is defined or not. Look out for part highlighted
using ***HERE***  */
  /* Detect compression method */
  hc->compression = *((char *)bih + sizeof(BITMAPINFOHEADER) + 5);
  switch (hc->codec) {
    case CODEC_MSZH:
      switch (hc->compression) {
        case COMP_MSZH:
          mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Compression enabled.\n");
          break;
        case COMP_MSZH_NOCOMP:
          hc->decomp_size = 0;
          mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] No compression.\n");
          break;
        default:
          mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] Unsupported compression
format for MSZH (%d).\n", hc->compression);
          return 0;
      }
      break;
    case CODEC_ZLIB:
      switch (hc->compression) {
        case COMP_ZLIB_HISPEED:
          mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] High speed
compression.\n");
          break;
        case COMP_ZLIB_HICOMP:
          mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] High compression.\n");
          break;
        case COMP_ZLIB_NORMAL:
          mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Normal compression.\n");
          break;
        default:
/***HERE***/
          if ((hc->compression < Z_NO_COMPRESSION) || (hc->compression >
Z_BEST_COMPRESSION)) {
/***HERE***/
     mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Unusupported compression level
for ZLIB: (%d).\n", hc->compression);
     return 0;
   }
          mp_msg(MSGT_DECVIDEO, MSGL_INFO, "[LCL] Compression level for
ZLIB: (%d).\n", hc->compression);
      }
      break;
    default:
      mp_msg(MSGT_DECVIDEO, MSGL_ERR, "[LCL] BUG! Unknown codec in
compression switch.\n");
      return 0;
  }


Adding
#define Z_NO_COMPRESSION         0
#define Z_BEST_COMPRESSION       9
will enable compilation again.

Yours
Stefan



More information about the MPlayer-users mailing list