From ca9216e949314dc4f52c9f3af6977e0b28bba321 Mon Sep 17 00:00:00 2001 From: J Carreira Date: Fri, 31 Jan 2014 22:07:34 +0000 Subject: [PATCH] Improve ffmpeg definition in CMakeLists --- CMakeLists.txt | 7 ++++--- config.h.in | 8 +++++++- source/InputStream.h | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79a1f8e..c7c8e93 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,8 @@ IF( USE_FFMPEG ) FIND_PACKAGE( FFmpeg ) IF( NOT FFMPEG_FOUND ) SET( USE_FFMPEG FALSE ) + ELSE() + SET( CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS ) ENDIF() ENDIF() @@ -214,8 +216,7 @@ ADD_EXECUTABLE( ${PROJECT_NAME} ${SOURCES_FILES} ${HEADERS_MOC_FILES} ${FORMS_HE IF( USE_FFMPEG ) INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}) -# SET( LINKER_LIBS ${LINKER_LIBS} ${FFMPEG_LIBRARIES} ) - SET( LINKER_LIBS ${LINKER_LIBS} avformat avcodec avutil ) + SET( LINKER_LIBS ${LINKER_LIBS} ${FFMPEG_LIBRARIES} ) ENDIF() message( STATUS ${LINKER_LIBS} ) TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${LINKER_LIBS} ) @@ -227,4 +228,4 @@ ENDIF() status("Using third-party libraries:") status(" Use OpenCV:" USE_OPENCV THEN YES ELSE NO) -status(" FFMPEG:" USE_FFMPEG THEN YES ELSE NO) \ No newline at end of file +status(" FFMPEG:" USE_FFMPEG THEN YES ELSE NO) diff --git a/config.h.in b/config.h.in index a4fc011..d2aea32 100644 --- a/config.h.in +++ b/config.h.in @@ -19,5 +19,11 @@ /* FFMPEG */ #cmakedefine USE_FFMPEG +#ifdef USE_FFMPEG + #ifndef __STDC_CONSTANT_MACROS + //#define __STDC_CONSTANT_MACROS + #define smprintf _snprintf + #endif +#endif -#endif // __CONFIG_PLAYUVER_H__ \ No newline at end of file +#endif // __CONFIG_PLAYUVER_H__ diff --git a/source/InputStream.h b/source/InputStream.h index 2dbb23c..bfb5258 100755 --- a/source/InputStream.h +++ b/source/InputStream.h @@ -37,10 +37,12 @@ #endif #ifdef USE_FFMPEG +extern "C" { #include "libavutil/imgutils.h" #include "libavutil/samplefmt.h" #include "libavutil/timestamp.h" #include "libavformat/avformat.h" +} #endif #include "TypeDef.h"