From 6dcc1b13a313f25c3e27bbe2bd949f938574e4d1 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 7 May 2023 04:10:18 +0300 Subject: [PATCH] engine: client: avi: add new macro XASH_AVI and corresponding backend select macros (AVI_NULL, AVI_WIN32 and AVI_FFMPEG) --- common/backends.h | 5 +++++ common/defaults.h | 14 +++++++++++++- engine/client/avi/avi.h | 2 +- engine/client/avi/avi_stub.c | 6 +++--- engine/client/avi/avi_win.c | 6 +++--- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/common/backends.h b/common/backends.h index 6fd51f19f..db8bd7a03 100644 --- a/common/backends.h +++ b/common/backends.h @@ -50,4 +50,9 @@ GNU General Public License for more details. #define LIB_WIN32 2 #define LIB_STATIC 3 +// movies (XASH_AVI) +#define AVI_NULL 0 +#define AVI_WIN32 1 +#define AVI_FFMPEG 2 + #endif /* BACKENDS_H */ diff --git a/common/defaults.h b/common/defaults.h index a3e572957..46ae81ef9 100644 --- a/common/defaults.h +++ b/common/defaults.h @@ -78,7 +78,6 @@ SETUP BACKENDS DEFINITIONS // usually only 10-20 fds availiable #define XASH_REDUCE_FD #endif - #endif // XASH_DEDICATED // @@ -105,6 +104,19 @@ SETUP BACKENDS DEFINITIONS #endif // !XASH_WIN32 #endif +// +// determine movie playback backend +// +#ifndef XASH_AVI + #if HAVE_FFMPEG + #define XASH_AVI AVI_FFMPEG + #elif XASH_WIN32 + #define XASH_AVI AVI_WIN32 + #else + #define XASH_AVI AVI_NULL + #endif +#endif + #ifdef XASH_STATIC_LIBS #define XASH_LIB LIB_STATIC #define XASH_INTERNAL_GAMELIBS diff --git a/engine/client/avi/avi.h b/engine/client/avi/avi.h index 20fb04507..6bc1c7ad0 100644 --- a/engine/client/avi/avi.h +++ b/engine/client/avi/avi.h @@ -18,7 +18,7 @@ GNU General Public License for more details. // // avikit.c // -typedef struct movie_state_s movie_state_t; +typedef struct movie_state_s movie_state_t; int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time ); byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame ); qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration ); diff --git a/engine/client/avi/avi_stub.c b/engine/client/avi/avi_stub.c index 0c6504d2e..a4ff7fb03 100644 --- a/engine/client/avi/avi_stub.c +++ b/engine/client/avi/avi_stub.c @@ -13,8 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ -#include "build.h" -#if !XASH_WIN32 +#include "defaults.h" +#if XASH_AVI == AVI_NULL #include "common.h" int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time ) @@ -87,4 +87,4 @@ void AVI_Shutdown( void ) ; } -#endif // WIN32 +#endif // XASH_AVI == AVI_NULL diff --git a/engine/client/avi/avi_win.c b/engine/client/avi/avi_win.c index 128fe62ff..853707125 100644 --- a/engine/client/avi/avi_win.c +++ b/engine/client/avi/avi_win.c @@ -14,8 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ -#include "build.h" -#if XASH_WIN32 +#include "defaults.h" +#if XASH_AVI == AVI_WIN32 #include "common.h" #include "client.h" #include // video for windows @@ -732,4 +732,4 @@ void AVI_Shutdown( void ) Sys_FreeLibrary( &msacm_dll ); avi_initialized = false; } -#endif // _WIN32 +#endif // XASH_AVI == AVI_WIN32