diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 990c32f5e5..2c26091ef4 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2236,11 +2236,7 @@ DTOOL_CONFIG=[ ("HAVE_CG", 'UNDEF', 'UNDEF'), ("HAVE_CGGL", 'UNDEF', 'UNDEF'), ("HAVE_CGDX9", 'UNDEF', 'UNDEF'), - ("HAVE_FFMPEG", 'UNDEF', 'UNDEF'), - ("HAVE_SWSCALE", 'UNDEF', 'UNDEF'), - ("HAVE_SWRESAMPLE", 'UNDEF', 'UNDEF'), ("HAVE_ARTOOLKIT", 'UNDEF', 'UNDEF'), - ("HAVE_OPENCV", 'UNDEF', 'UNDEF'), ("HAVE_DIRECTCAM", 'UNDEF', 'UNDEF'), ("HAVE_SQUISH", 'UNDEF', 'UNDEF'), ("HAVE_CARBON", 'UNDEF', 'UNDEF'), @@ -2295,9 +2291,6 @@ def WriteConfigSettings(): else: dtool_config["HAVE_"+x] = 'UNDEF' - if not PkgSkip("OPENCV"): - dtool_config["OPENCV_VER_23"] = '1' if OPENCV_VER_23 else 'UNDEF' - dtool_config["HAVE_NET"] = '1' if (PkgSkip("NVIDIACG")==0): @@ -4128,8 +4121,20 @@ if (not RUNTIME): # if (PkgSkip("VISION") == 0) and (not RUNTIME): + # We want to know whether we have ffmpeg so that we can override the .avi association. + if not PkgSkip("FFMPEG"): + DefSymbol("OPENCV", "HAVE_FFMPEG") + if not PkgSkip("OPENCV"): + DefSymbol("OPENCV", "HAVE_OPENCV") + if OPENCV_VER_23: + DefSymbol("OPENCV", "OPENCV_VER_23") + OPTS=['DIR:panda/src/vision', 'BUILDING:VISION', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS'] - TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx') + TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx', dep=[ + 'dtool_have_ffmpeg.dat', + 'dtool_have_opencv.dat', + 'dtool_have_directcam.dat', + ]) TargetAdd('libp3vision.dll', input='p3vision_composite1.obj') TargetAdd('libp3vision.dll', input=COMMON_PANDA_LIBS) @@ -4318,8 +4323,15 @@ if (PkgSkip("VRPN")==0 and not RUNTIME): # DIRECTORY: panda/src/ffmpeg # if PkgSkip("FFMPEG") == 0 and not RUNTIME: + if not PkgSkip("SWSCALE"): + DefSymbol("FFMPEG", "HAVE_SWSCALE") + if not PkgSkip("SWRESAMPLE"): + DefSymbol("FFMPEG", "HAVE_SWRESAMPLE") + OPTS=['DIR:panda/src/ffmpeg', 'BUILDING:FFMPEG', 'FFMPEG', 'SWSCALE', 'SWRESAMPLE'] - TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx') + TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx', dep=[ + 'dtool_have_swscale.dat', 'dtool_have_swresample.dat']) + TargetAdd('libp3ffmpeg.dll', input='p3ffmpeg_composite1.obj') TargetAdd('libp3ffmpeg.dll', input=COMMON_PANDA_LIBS) TargetAdd('libp3ffmpeg.dll', opts=OPTS) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.cxx b/panda/src/ffmpeg/ffmpegAudioCursor.cxx index 2f73cff60c..659925cce3 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.cxx +++ b/panda/src/ffmpeg/ffmpegAudioCursor.cxx @@ -50,9 +50,7 @@ FfmpegAudioCursor(FfmpegAudio *src) : _packet_data(0), _format_ctx(0), _audio_ctx(0), -#ifdef HAVE_SWRESAMPLE _resample_ctx(0), -#endif _buffer(0), _buffer_alloc(0), _frame(0) diff --git a/panda/src/ffmpeg/ffmpegAudioCursor.h b/panda/src/ffmpeg/ffmpegAudioCursor.h index 21f79dc62d..ff37fa8bc6 100644 --- a/panda/src/ffmpeg/ffmpegAudioCursor.h +++ b/panda/src/ffmpeg/ffmpegAudioCursor.h @@ -31,10 +31,7 @@ struct AVFormatContext; struct AVCodecContext; struct AVStream; struct AVPacket; - -#ifdef HAVE_SWRESAMPLE struct SwrContext; -#endif /** * A stream that generates a sequence of audio samples. @@ -72,9 +69,7 @@ protected: int _buffer_head; int _buffer_tail; -#ifdef HAVE_SWRESAMPLE SwrContext *_resample_ctx; -#endif public: static TypeHandle get_class_type() { diff --git a/panda/src/vision/openCVTexture.cxx b/panda/src/vision/openCVTexture.cxx index 34c70284b1..7d09636b0c 100644 --- a/panda/src/vision/openCVTexture.cxx +++ b/panda/src/vision/openCVTexture.cxx @@ -21,6 +21,22 @@ #include "bamReader.h" #include "bamCacheRecord.h" +// This symbol is predefined by the Panda3D build system to select whether we +// are using the OpenCV 2.3 or later interface, or if it is not defined, we +// are using the original interface. +#ifdef OPENCV_VER_23 + +#include +// #include +#include + +#else +#include +#include +#include + +#endif // OPENCV_VER_23 + TypeHandle OpenCVTexture::_type_handle; /** diff --git a/panda/src/vision/openCVTexture.h b/panda/src/vision/openCVTexture.h index ad898e51a8..1ad8e11a7a 100644 --- a/panda/src/vision/openCVTexture.h +++ b/panda/src/vision/openCVTexture.h @@ -19,21 +19,7 @@ #include "videoTexture.h" -// This symbol is predefined by the Panda3D build system to select whether we -// are using the OpenCV 2.3 or later interface, or if it is not defined, we -// are using the original interface. -#ifdef OPENCV_VER_23 - -#include -// #include -#include - -#else -#include -#include -#include - -#endif // OPENCV_VER_23 +struct CvCapture; /** * A specialization on VideoTexture that takes its input using the CV library,