mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Make AVRecorder WebM an optional part of the build
This commit is contained in:
parent
7c01136247
commit
11fecebc47
7 changed files with 56 additions and 14 deletions
|
|
@ -71,6 +71,7 @@ cmake_dependent_option(
|
|||
OFF "NOT SRB2_CONFIG_SYSTEM_LIBRARIES"
|
||||
OFF
|
||||
)
|
||||
option(SRB2_CONFIG_ENABLE_WEBM_MOVIES "Enable WebM recording support" ON)
|
||||
option(SRB2_CONFIG_HWRENDER "Enable hardware render (OpenGL) support" ON)
|
||||
option(SRB2_CONFIG_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF)
|
||||
option(SRB2_CONFIG_ERRORMODE "Compile C code with warnings treated as errors." OFF)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
|||
m_aatree.c
|
||||
m_anigif.c
|
||||
m_argv.c
|
||||
m_avrecorder.cpp
|
||||
m_bbox.c
|
||||
m_cheat.c
|
||||
m_cond.c
|
||||
|
|
@ -136,6 +135,10 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
|||
k_roulette.c
|
||||
)
|
||||
|
||||
if(SRB2_CONFIG_ENABLE_WEBM_MOVIES)
|
||||
target_sources(SRB2SDL2 PRIVATE m_avrecorder.cpp)
|
||||
endif()
|
||||
|
||||
# This updates the modification time for comptime.c at the
|
||||
# end of building so when the build system is ran next time,
|
||||
# that file gets flagged. comptime.c will always be rebuilt.
|
||||
|
|
@ -232,9 +235,12 @@ target_link_libraries(SRB2SDL2 PRIVATE xmp-lite::xmp-lite)
|
|||
target_link_libraries(SRB2SDL2 PRIVATE glad::glad)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE fmt)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE imgui::imgui)
|
||||
if(SRB2_CONFIG_ENABLE_WEBM_MOVIES)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE webm::libwebm webm::libvpx)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE libyuv::libyuv)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE Vorbis::vorbis Vorbis::vorbisenc)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DSRB2_CONFIG_ENABLE_WEBM_MOVIES)
|
||||
endif()
|
||||
|
||||
target_link_libraries(SRB2SDL2 PRIVATE acsvm)
|
||||
|
||||
|
|
@ -552,7 +558,9 @@ if(SRB2_CONFIG_ENABLE_TESTS)
|
|||
add_subdirectory(tests)
|
||||
endif()
|
||||
add_subdirectory(menus)
|
||||
if(SRB2_CONFIG_ENABLE_WEBM_MOVIES)
|
||||
add_subdirectory(media)
|
||||
endif()
|
||||
|
||||
# strip debug symbols into separate file when using gcc.
|
||||
# to be consistent with Makefile, don't generate for OS X.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,10 @@
|
|||
#include "deh_tables.h"
|
||||
#include "m_perfstats.h"
|
||||
#include "k_specialstage.h"
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
#include "m_avrecorder.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
|
|
@ -904,7 +907,11 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_moviemode);
|
||||
CV_RegisterVar(&cv_movie_option);
|
||||
CV_RegisterVar(&cv_movie_folder);
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
M_AVRecorder_AddCommands();
|
||||
#endif
|
||||
|
||||
// PNG variables
|
||||
CV_RegisterVar(&cv_zlib_level);
|
||||
CV_RegisterVar(&cv_zlib_memory);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@
|
|||
#include "../discord.h"
|
||||
#endif
|
||||
#include "../doomstat.h"
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
#include "../m_avrecorder.h"
|
||||
#endif
|
||||
#include "../st_stuff.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../st_stuff.h"
|
||||
|
|
@ -59,8 +61,9 @@ static void temp_legacy_finishupdate_draws()
|
|||
}
|
||||
if (cv_mindelay.value && consoleplayer == serverplayer && Playing())
|
||||
SCR_DisplayLocalPing();
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
M_AVRecorder_DrawFrameRate();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (marathonmode)
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@
|
|||
#include "command.h" // cv_execversion
|
||||
|
||||
#include "m_anigif.h"
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
#include "m_avrecorder.h"
|
||||
#endif
|
||||
|
||||
// So that the screenshot menu auto-updates...
|
||||
#include "k_menu.h"
|
||||
|
|
@ -1299,6 +1301,9 @@ static inline moviemode_t M_StartMovieGIF(const char *pathname)
|
|||
|
||||
static inline moviemode_t M_StartMovieAVRecorder(const char *pathname)
|
||||
{
|
||||
#ifndef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
return MM_OFF;
|
||||
#else
|
||||
const char *ext = M_AVRecorder_GetFileExtension();
|
||||
const char *freename;
|
||||
|
||||
|
|
@ -1314,6 +1319,7 @@ static inline moviemode_t M_StartMovieAVRecorder(const char *pathname)
|
|||
}
|
||||
|
||||
return MM_AVRECORDER;
|
||||
#endif
|
||||
}
|
||||
|
||||
void M_StartMovie(void)
|
||||
|
|
@ -1366,11 +1372,13 @@ void M_StartMovie(void)
|
|||
CONS_Printf(M_GetText("Movie mode enabled (%s).\n"), "GIF");
|
||||
else if (moviemode == MM_SCREENSHOT)
|
||||
CONS_Printf(M_GetText("Movie mode enabled (%s).\n"), "screenshots");
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
else if (moviemode == MM_AVRECORDER)
|
||||
{
|
||||
CONS_Printf(M_GetText("Movie mode enabled (%s).\n"), M_AVRecorder_GetCurrentFormat());
|
||||
M_AVRecorder_PrintCurrentConfiguration();
|
||||
}
|
||||
#endif
|
||||
|
||||
//singletics = (moviemode != MM_OFF);
|
||||
#endif
|
||||
|
|
@ -1382,6 +1390,7 @@ void M_SaveFrame(void)
|
|||
// paranoia: should be unnecessary without singletics
|
||||
static tic_t oldtic = 0;
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
if (moviemode == MM_AVRECORDER)
|
||||
{
|
||||
// TODO: replace once hwr2 twodee is finished
|
||||
|
|
@ -1396,6 +1405,7 @@ void M_SaveFrame(void)
|
|||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// skip interpolated frames for other modes
|
||||
if (oldtic == I_GetTime())
|
||||
|
|
@ -1485,9 +1495,11 @@ void M_StopMovie(void)
|
|||
#endif
|
||||
case MM_SCREENSHOT:
|
||||
break;
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
case MM_AVRECORDER:
|
||||
M_AVRecorder_Close();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@
|
|||
#include "../audio/sound_effect_player.hpp"
|
||||
#include "../cxxutil.hpp"
|
||||
#include "../io/streams.hpp"
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
#include "../m_avrecorder.hpp"
|
||||
#endif
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../i_sound.h"
|
||||
|
|
@ -58,7 +61,9 @@ static shared_ptr<Gain<2>> gain_music;
|
|||
|
||||
static vector<shared_ptr<SoundEffectPlayer>> sound_effect_channels;
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
static shared_ptr<srb2::media::AVRecorder> av_recorder;
|
||||
#endif
|
||||
|
||||
static void (*music_fade_callback)();
|
||||
|
||||
|
|
@ -138,9 +143,10 @@ void audio_callback(void* userdata, Uint8* buffer, int len)
|
|||
std::clamp(float_buffer[i].amplitudes[1], -1.f, 1.f),
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
if (av_recorder)
|
||||
av_recorder->push_audio_samples(tcb::span {float_buffer, float_len});
|
||||
#endif
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
@ -758,8 +764,10 @@ boolean I_FadeInPlaySong(UINT32 ms, boolean looping)
|
|||
|
||||
void I_UpdateAudioRecorder(void)
|
||||
{
|
||||
#ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES
|
||||
// must be locked since av_recorder is used by audio_callback
|
||||
SdlAudioLockHandle _;
|
||||
|
||||
av_recorder = g_av_recorder;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
9
thirdparty/CMakeLists.txt
vendored
9
thirdparty/CMakeLists.txt
vendored
|
|
@ -15,9 +15,6 @@ include("cpm-sdl2.cmake")
|
|||
include("cpm-png.cmake")
|
||||
include("cpm-curl.cmake")
|
||||
include("cpm-libgme.cmake")
|
||||
include("cpm-libvpx.cmake")
|
||||
include("cpm-ogg.cmake") # libvorbis depends
|
||||
include("cpm-libvorbis.cmake")
|
||||
endif()
|
||||
|
||||
include("cpm-rapidjson.cmake")
|
||||
|
|
@ -26,8 +23,14 @@ include("cpm-xmp-lite.cmake")
|
|||
include("cpm-fmt.cmake")
|
||||
include("cpm-imgui.cmake")
|
||||
include("cpm-acsvm.cmake")
|
||||
|
||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND SRB2_CONFIG_ENABLE_WEBM_MOVIES)
|
||||
include("cpm-libvpx.cmake")
|
||||
include("cpm-ogg.cmake") # libvorbis depends
|
||||
include("cpm-libvorbis.cmake")
|
||||
include("cpm-libwebm.cmake")
|
||||
include("cpm-libyuv.cmake")
|
||||
endif()
|
||||
|
||||
add_subdirectory(tcbrindle_span)
|
||||
add_subdirectory(stb_vorbis)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue