--- a/cmake_modules/FindFFMPEG.cmake Fri Aug 10 17:25:22 2012 +0400
+++ b/cmake_modules/FindFFMPEG.cmake Fri Aug 10 17:35:48 2012 +0400
@@ -4,6 +4,9 @@
# FFMPEG_FOUND - system has ffmpeg
# FFMPEG_INCLUDE_DIR - the ffmpeg include directory
# FFMPEG_LIBRARIES - Link these to use ffmpeg
+# FFMPEG_LIBAVCODEC
+# FFMPEG_LIBAVFORMAT
+# FFMPEG_LIBAVUTIL
#
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
@@ -32,32 +35,32 @@
PATH_SUFFIXES ffmpeg libav
)
- find_library(FFMPEG_AVCODEC_LIBRARY
+ find_library(FFMPEG_LIBAVCODEC
NAMES avcodec
PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
- find_library(FFMPEG_AVFORMAT_LIBRARY
+ find_library(FFMPEG_LIBAVFORMAT
NAMES avformat
PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
- find_library(FFMPEG_AVUTIL_LIBRARY
+ find_library(FFMPEG_LIBAVUTIL
NAMES avutil
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
- if (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY)
+ if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
set(FFMPEG_FOUND TRUE)
- endif (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY)
+ endif()
if (FFMPEG_FOUND)
set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}/..)
set(FFMPEG_LIBRARIES
- ${FFMPEG_AVCODEC_LIBRARY}
- ${FFMPEG_AVFORMAT_LIBRARY}
- ${FFMPEG_AVUTIL_LIBRARY}
+ ${FFMPEG_LIBAVCODEC}
+ ${FFMPEG_LIBAVFORMAT}
+ ${FFMPEG_LIBAVUTIL}
)
endif (FFMPEG_FOUND)
@@ -68,7 +71,7 @@
endif (NOT FFMPEG_FIND_QUIETLY)
else (FFMPEG_FOUND)
if (FFMPEG_FIND_REQUIRED)
- message(FATAL_ERROR "Could not find FFMPEG libavcodec, libavformat or libswscale")
+ message(FATAL_ERROR "Could not find FFMPEG libavcodec or libavformat or libavutil")
endif (FFMPEG_FIND_REQUIRED)
endif (FFMPEG_FOUND)
--- a/hedgewars/CMakeLists.txt Fri Aug 10 17:25:22 2012 +0400
+++ b/hedgewars/CMakeLists.txt Fri Aug 10 17:35:48 2012 +0400
@@ -185,16 +185,25 @@
message(STATUS "PNG screenshots disabled per user request, using BMP format")
endif()
-set(fpc_flags ${noexecstack_flags} ${pascal_flags} ${hwengine_project})
+if(NOT NO_VIDEOREC)
+ if(${FFMPEG_FOUND})
+ message(STATUS "Compiling with video recording")
+ include_directories(${FFMPEG_INCLUDE_DIR})
+ set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
+ IF (WIN32)
+ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
+ # there are some problems with linking our avwrapper as static lib, so link it as shared
+ add_library(avwrapper SHARED avwrapper.c)
+ target_link_libraries(avwrapper ${FFMPEG_LIBRARIES})
+ ELSE()
+ add_library(avwrapper STATIC avwrapper.c)
+ ENDIF()
+ endif()
+else()
+ message(STATUS "Video recording disabled by user")
+endif()
-IF (WIN32)
- set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
- include_directories(${FFMPEG_INCLUDE_DIR})
- add_library(avwrapper SHARED avwrapper.c)
- target_link_libraries(avwrapper ${FFMPEG_LIBRARIES})
-ELSE()
- add_library(avwrapper STATIC avwrapper.c)
-ENDIF()
+set(fpc_flags ${noexecstack_flags} ${pascal_flags} ${hwengine_project})
IF(NOT APPLE)
#here is the command for standard executables or for shared library
--- a/hedgewars/options.inc Fri Aug 10 17:25:22 2012 +0400
+++ b/hedgewars/options.inc Fri Aug 10 17:35:48 2012 +0400
@@ -50,7 +50,6 @@
{$DEFINE USE_TOUCH_INTERFACE}
{$ELSE}
{$DEFINE USE_AM_NUMCOLUMN}
- {$DEFINE USE_VIDEO_RECORDING}
{$ENDIF}
--- a/hedgewars/uVideoRec.pas Fri Aug 10 17:25:22 2012 +0400
+++ b/hedgewars/uVideoRec.pas Fri Aug 10 17:35:48 2012 +0400
@@ -27,7 +27,7 @@
end.
{$ELSE}
-{$IFDEF UNIX}
+{$IFNDEF WIN32}
{$LINKLIB avwrapper}
{$LINKLIB avutil}
{$LINKLIB avcodec}
@@ -53,27 +53,16 @@
uses uVariables, uUtils, GLunit, SDLh, SysUtils, uIO, uMisc, uTypes;
-{$IFDEF WIN32}
-const AVWrapperLibName = 'libavwrapper.dll';
-{$ENDIF}
+const AVWrapperLibName = {$IFDEF WIN32}'libavwrapper.dll'{$ELSE}''{$ENDIF};
type TAddFileLogRaw = procedure (s: pchar); cdecl;
-{$IFDEF WIN32}
procedure AVWrapper_Init(
AddLog: TAddFileLogRaw;
filename, desc, soundFile, format, vcodec, acodec: PChar;
width, height, framerateNum, framerateDen, vquality: LongInt); cdecl; external AVWrapperLibName;
procedure AVWrapper_Close; cdecl; external AVWrapperLibName;
procedure AVWrapper_WriteFrame( pY, pCb, pCr: PByte ); cdecl; external AVWrapperLibName;
-{$ELSE}
-procedure AVWrapper_Init(
- AddLog: TAddFileLogRaw;
- filename, desc, soundFile, format, vcodec, acodec: PChar;
- width, height, framerateNum, framerateDen, vquality: LongInt); cdecl; external;
-procedure AVWrapper_Close; cdecl; external;
-procedure AVWrapper_WriteFrame( pY, pCb, pCr: PByte ); cdecl; external;
-{$ENDIF}
type TFrame = record
realTicks: LongWord;