diff --git a/engine/client/avi/avi_ffmpeg.c b/engine/client/avi/avi_ffmpeg.c index 132f0cf939..b8b6fc2e98 100644 --- a/engine/client/avi/avi_ffmpeg.c +++ b/engine/client/avi/avi_ffmpeg.c @@ -16,9 +16,13 @@ GNU General Public License for more details. */ #include "defaults.h" -#if XASH_AVI == AVI_FFMPEG #include "common.h" #include "client.h" + +static qboolean avi_initialized; +static poolhandle_t avi_mempool; + +#if XASH_AVI == AVI_FFMPEG #include #include #include @@ -74,10 +78,6 @@ struct movie_state_s byte quiet : 1; }; -static qboolean avi_initialized; -static poolhandle_t avi_mempool; -static movie_state_t avi[2]; - qboolean AVI_SetParm( movie_state_t *Avi, enum movie_parms_e parm, ... ) { qboolean ret = true; @@ -585,6 +585,122 @@ void AVI_CloseVideo( movie_state_t *Avi ) memset( Avi, 0, sizeof( *Avi )); } +static void AVI_PrintFFmpegVersion( void ) +{ + uint ver; + + // print version we're compiled with and which version we're running with + ver = avutil_version(); + Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBAVUTIL_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); + + ver = avformat_version(); + Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBAVFORMAT_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); + + ver = avformat_version(); + Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBAVCODEC_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); + + ver = swscale_version(); + Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBSWSCALE_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); + + ver = swresample_version(); + Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBSWRESAMPLE_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); +} +#else +struct movie_state_s +{ + qboolean active; +}; + +int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time ) +{ + return 0; +} + +byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame ) +{ + return NULL; +} + +qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration ) +{ + return false; +} + +qboolean AVI_HaveAudioTrack( const movie_state_t *Avi ) +{ + return false; +} + +void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet ) +{ + ; +} + +int AVI_TimeToSoundPosition( movie_state_t *Avi, int time ) +{ + return 0; +} + +void AVI_CloseVideo( movie_state_t *Avi ) +{ + ; +} + +qboolean AVI_Think( movie_state_t *Avi ) +{ + return false; +} + +qboolean AVI_SetParm( movie_state_t *Avi, enum movie_parms_e parm, ... ) +{ + return false; +} + +static void AVI_PrintFFmpegVersion( void ) +{ + +} +#endif // XASH_AVI == AVI_NULL + +static movie_state_t avi[2]; +movie_state_t *AVI_GetState( int num ) +{ + return &avi[num]; +} + +qboolean AVI_IsActive( movie_state_t *Avi ) +{ + return Avi ? Avi->active : false; +} + +qboolean AVI_Initailize( void ) +{ + if( XASH_AVI == AVI_NULL ) + { + Con_Printf( "AVI: Not supported\n" ); + return false; + } + + if( Sys_CheckParm( "-noavi" )) + { + Con_Printf( "AVI: Disabled\n" ); + return false; + } + + AVI_PrintFFmpegVersion(); + + avi_initialized = true; + avi_mempool = Mem_AllocPool( "AVI Zone" ); + + return false; +} + +void AVI_Shutdown( void ) +{ + Mem_FreePool( &avi_mempool ); + avi_initialized = XASH_AVI != AVI_NULL; +} + movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio ) { movie_state_t *Avi; @@ -629,52 +745,3 @@ void AVI_FreeVideo( movie_state_t *Avi ) if( Mem_IsAllocatedExt( avi_mempool, Avi )) Mem_Free( Avi ); } - -qboolean AVI_IsActive( movie_state_t *Avi ) -{ - return Avi ? Avi->active : false; -} - -movie_state_t *AVI_GetState( int num ) -{ - return &avi[num]; -} - -qboolean AVI_Initailize( void ) -{ - uint ver; - - if( Sys_CheckParm( "-noavi" )) - { - Con_Printf( "AVI: Disabled\n" ); - return false; - } - - // print version we're compiled with and which version we're running with - ver = avutil_version(); - Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBAVUTIL_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); - - ver = avformat_version(); - Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBAVFORMAT_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); - - ver = avformat_version(); - Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBAVCODEC_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); - - ver = swscale_version(); - Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBSWSCALE_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); - - ver = swresample_version(); - Con_Reportf( "AVI: %s (runtime %d.%d.%d)\n", LIBSWRESAMPLE_IDENT, AV_VERSION_MAJOR( ver ), AV_VERSION_MINOR( ver ), AV_VERSION_MICRO( ver )); - - avi_initialized = true; - avi_mempool = Mem_AllocPool( "AVI Zone" ); - return true; -} - -void AVI_Shutdown( void ) -{ - Mem_FreePool( &avi_mempool ); - avi_initialized = false; -} - -#endif // XASH_AVI == AVI_NULL diff --git a/engine/client/avi/avi_stub.c b/engine/client/avi/avi_stub.c index c911e3e440..e69de29bb2 100644 --- a/engine/client/avi/avi_stub.c +++ b/engine/client/avi/avi_stub.c @@ -1,92 +0,0 @@ -/* -avi_stub.c - playing AVI files (stub) -Copyright (C) 2018 a1batross - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -*/ - -#include "defaults.h" -#if XASH_AVI == AVI_NULL -#include "common.h" - -int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time ) -{ - return 0; -} - -byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame ) -{ - return NULL; -} - -qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration ) -{ - return false; -} - -qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info ) -{ - return false; -} - -int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length ) -{ - return 0; -} - -void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet ) -{ - ; -} - -movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio ) -{ - return NULL; -} - -int AVI_TimeToSoundPosition( movie_state_t *Avi, int time ) -{ - return 0; -} - -void AVI_CloseVideo( movie_state_t *Avi ) -{ - ; -} - -qboolean AVI_IsActive( movie_state_t *Avi ) -{ - return false; -} - -void AVI_FreeVideo( movie_state_t *Avi ) -{ - ; -} - -movie_state_t *AVI_GetState( int num ) -{ - return NULL; -} - -qboolean AVI_Initailize( void ) -{ - Con_Printf( "AVI: Not supported\n" ); - - return false; -} - -void AVI_Shutdown( void ) -{ - ; -} - -#endif // XASH_AVI == AVI_NULL