From 062e90a81aaa53977fa130281b77fb9fb830477a Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Dec 2010 17:47:28 +0000 Subject: [PATCH] We don't really need jpegint.h --- panda/src/vision/webcamVideoCursorV4L.cxx | 19 ++++++++++++------- panda/src/vision/webcamVideoCursorV4L.h | 4 +--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/panda/src/vision/webcamVideoCursorV4L.cxx b/panda/src/vision/webcamVideoCursorV4L.cxx index f2629d1710..1063033ec3 100644 --- a/panda/src/vision/webcamVideoCursorV4L.cxx +++ b/panda/src/vision/webcamVideoCursorV4L.cxx @@ -22,16 +22,21 @@ #include #include -#ifdef SUPPORT_WEBCAM_VIDEO_JPEG +#ifdef HAVE_JPEG extern "C" { #include - #include #include } #include #endif +// This is supposed to be defined in jpegint.h, +// but not all implementations of JPEG provide that file. +#ifndef DSTATE_READY +#define DSTATE_READY 202 +#endif + TypeHandle WebcamVideoCursorV4L::_type_handle; #define clamp(x) min(max(x, 0.0), 255.0) @@ -61,7 +66,7 @@ INLINE static void yuyv_to_rgbargba(unsigned char *dest, const unsigned char *sr dest[7] = (unsigned char) -1; } -#if defined(SUPPORT_WEBCAM_VIDEO_JPEG) && !defined(CPPPARSER) +#if defined(HAVE_JPEG) && !defined(CPPPARSER) struct my_error_mgr { struct jpeg_error_mgr pub; @@ -155,7 +160,7 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { _format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; pvector::iterator it; for (it = src->_pformats.begin(); it != src->_pformats.end(); ++it) { -#ifdef SUPPORT_WEBCAM_VIDEO_JPEG +#ifdef HAVE_JPEG if (*it == V4L2_PIX_FMT_MJPEG) { _format->fmt.pix.pixelformat = *it; break; @@ -242,7 +247,7 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { vision_cat.error() << "Failed to stream from buffer!\n"; } -#ifdef SUPPORT_WEBCAM_VIDEO_JPEG +#ifdef HAVE_JPEG // Initialize the JPEG library, if necessary if (_format->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { _cinfo = (struct jpeg_decompress_struct *) malloc(sizeof(struct jpeg_decompress_struct)); @@ -269,7 +274,7 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { //////////////////////////////////////////////////////////////////// WebcamVideoCursorV4L:: ~WebcamVideoCursorV4L() { -#ifdef SUPPORT_WEBCAM_VIDEO_JPEG +#ifdef HAVE_JPEG if (_cinfo != NULL) { jpeg_destroy_decompress(_cinfo); free(_cinfo); @@ -320,7 +325,7 @@ fetch_into_buffer(double time, unsigned char *block, bool bgra) { unsigned char *buf = (unsigned char *) _buffers[vbuf.index]; if (_format->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) { -#ifdef SUPPORT_WEBCAM_VIDEO_JPEG +#ifdef HAVE_JPEG nassertv(!bgra); struct my_error_mgr jerr; _cinfo->err = jpeg_std_error(&jerr.pub); diff --git a/panda/src/vision/webcamVideoCursorV4L.h b/panda/src/vision/webcamVideoCursorV4L.h index 429cb4e743..1bc75cdaa3 100644 --- a/panda/src/vision/webcamVideoCursorV4L.h +++ b/panda/src/vision/webcamVideoCursorV4L.h @@ -23,9 +23,7 @@ struct v4l2_format; -// We can only decode a motion-jpeg stream if we have jpegint.h. -#if defined(HAVE_JPEG) && defined(PHAVE_JPEGINT_H) -#define SUPPORT_WEBCAM_VIDEO_JPEG 1 +#if defined(HAVE_JPEG) struct jpeg_decompress_struct; #endif