Explorar el Código

We don't really need jpegint.h

rdb hace 15 años
padre
commit
062e90a81a

+ 12 - 7
panda/src/vision/webcamVideoCursorV4L.cxx

@@ -22,16 +22,21 @@
 #include <linux/videodev.h>
 #include <linux/videodev2.h>
 
-#ifdef SUPPORT_WEBCAM_VIDEO_JPEG
+#ifdef HAVE_JPEG
 extern "C" {
   #include <jpeglib.h>
-  #include <jpegint.h>
   #include <jerror.h>
 }
 
 #include <setjmp.h>
 #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<uint32_t>::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);

+ 1 - 3
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