econsysqtcam / qtcam

QtCAM is a free, Open Source Linux Webcamera Software with more than 10 image control settings, extension settings and Color space switching.
http://www.e-consystems.com/opensource-linux-webcam-software-application.asp
GNU General Public License v3.0
182 stars 94 forks source link

Build fails to CODIC_IDs not declared in scope. #6

Closed ImNtReal closed 8 years ago

ImNtReal commented 8 years ago

I'm trying to build the current revision on Arch Linux, and it's failing with:

videostreaming.cpp: In member function ‘void Videostreaming::recordBegin(int, QString, QString)’:
videostreaming.cpp:1359:28: error: ‘CODEC_ID_RAWVIDEO’ was not declared in this scope
         videoEncoderType = CODEC_ID_RAWVIDEO;
                            ^
videostreaming.cpp:1362:28: error: ‘CODEC_ID_MJPEG’ was not declared in this scope
         videoEncoderType = CODEC_ID_MJPEG;
                            ^
videostreaming.cpp:1365:28: error: ‘CODEC_ID_H264’ was not declared in this scope
         videoEncoderType = CODEC_ID_H264;
                            ^
videostreaming.cpp:1368:28: error: ‘CODEC_ID_VP8’ was not declared in this scope
         videoEncoderType = CODEC_ID_VP8;
                            ^
Makefile:1007: recipe for target 'videostreaming.o' failed
make: *** [videostreaming.o] Error 1
ImNtReal commented 8 years ago

Well, that was simple enough to fix. I used this patch:

diff -Naur qtcam/src/videoencoder.h-orig qtcam/src/videoencoder.h
--- qtcam/src/videoencoder.h-orig       2016-03-15 10:01:54.349734386 -0400
+++ qtcam/src/videoencoder.h    2016-03-15 10:04:45.037886363 -0400
@@ -30,14 +30,14 @@
                                                LIBAVCODEC_VERSION_MINOR >= minor))

-//#if !LIBAVCODEC_VER_AT_LEAST(54,25)
-//    #define AV_CODEC_ID_NONE CODEC_ID_NONE
-//    #define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG
-//    #define AV_CODEC_ID_RAWVIDEO CODEC_ID_RAWVIDEO
-//    #define AV_CODEC_ID_H264 CODEC_ID_H264
-//    #define AV_CODEC_ID_VP8 CODEC_ID_VP8
-//    #define AVCodecID CodecID
-//#endif
+#if !LIBAVCODEC_VER_AT_LEAST(54,25)
+    #define AV_CODEC_ID_NONE CODEC_ID_NONE
+    #define AV_CODEC_ID_MJPEG CODEC_ID_MJPEG
+    #define AV_CODEC_ID_RAWVIDEO CODEC_ID_RAWVIDEO
+    #define AV_CODEC_ID_H264 CODEC_ID_H264
+    #define AV_CODEC_ID_VP8 CODEC_ID_VP8
+    #define AVCodecID CodecID
+#endif

 extern "C" {
 #include "libavcodec/avcodec.h"