Skip to content

Commit

Permalink
engine: client: avi: add new macro XASH_AVI and corresponding backend…
Browse files Browse the repository at this point in the history
… select macros (AVI_NULL, AVI_WIN32 and AVI_FFMPEG)
  • Loading branch information
a1batross committed Jul 24, 2023
1 parent e49848d commit 6dcc1b1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
5 changes: 5 additions & 0 deletions common/backends.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
14 changes: 13 additions & 1 deletion common/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ SETUP BACKENDS DEFINITIONS
// usually only 10-20 fds availiable
#define XASH_REDUCE_FD
#endif

#endif // XASH_DEDICATED

//
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion engine/client/avi/avi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
6 changes: 3 additions & 3 deletions engine/client/avi/avi_stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -87,4 +87,4 @@ void AVI_Shutdown( void )
;
}

#endif // WIN32
#endif // XASH_AVI == AVI_NULL
6 changes: 3 additions & 3 deletions engine/client/avi/avi_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <vfw.h> // video for windows
Expand Down Expand Up @@ -732,4 +732,4 @@ void AVI_Shutdown( void )
Sys_FreeLibrary( &msacm_dll );
avi_initialized = false;
}
#endif // _WIN32
#endif // XASH_AVI == AVI_WIN32

0 comments on commit 6dcc1b1

Please sign in to comment.