mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fps for videos configurable and videos are stored at a proper location
This commit is contained in:
parent
98568eba43
commit
4b86630b42
|
@ -31,6 +31,8 @@ CVideo::CVideo(CGraphics_Threaded* pGraphics, IStorage* pStorage, IConsole *pCon
|
|||
m_Width = width;
|
||||
m_Height = height;
|
||||
|
||||
m_FPS = g_Config.m_ClVideoRecorderFPS;
|
||||
|
||||
m_Recording = false;
|
||||
m_Started = false;
|
||||
m_ProcessingVideoFrame = false;
|
||||
|
@ -45,6 +47,7 @@ CVideo::CVideo(CGraphics_Threaded* pGraphics, IStorage* pStorage, IConsole *pCon
|
|||
|
||||
dbg_assert(ms_pCurrentVideo == 0, "ms_pCurrentVideo is NOT set to NULL while creating a new Video.");
|
||||
|
||||
ms_TickTime = time_freq() / m_FPS;
|
||||
ms_pCurrentVideo = this;
|
||||
}
|
||||
|
||||
|
@ -55,8 +58,13 @@ CVideo::~CVideo()
|
|||
|
||||
void CVideo::start()
|
||||
{
|
||||
char aDate[20];
|
||||
str_timestamp(aDate, sizeof(aDate));
|
||||
char aBuf[64];
|
||||
str_format(aBuf, sizeof(aBuf), "videos/%s.mp4", aDate);
|
||||
|
||||
char aWholePath[1024];
|
||||
IOHANDLE File = m_pStorage->OpenFile("tmp.mp4", IOFLAG_WRITE, IStorage::TYPE_SAVE, aWholePath, sizeof(aWholePath));
|
||||
IOHANDLE File = m_pStorage->OpenFile(aBuf, IOFLAG_WRITE, IStorage::TYPE_SAVE, aWholePath, sizeof(aWholePath));
|
||||
|
||||
if(File)
|
||||
{
|
||||
|
@ -562,7 +570,7 @@ void CVideo::add_stream(OutputStream *ost, AVFormatContext *oc, AVCodec **codec,
|
|||
* of which frame timestamps are represented. For fixed-fps content,
|
||||
* timebase should be 1/framerate and timestamp increments should be
|
||||
* identical to 1. */
|
||||
ost->st->time_base = (AVRational){ 1, STREAM_FRAME_RATE };
|
||||
ost->st->time_base = (AVRational){ 1, m_FPS };
|
||||
c->time_base = ost->st->time_base;
|
||||
|
||||
c->gop_size = 12; /* emit one intra frame every twelve frames at most */
|
||||
|
|
|
@ -92,6 +92,8 @@ private:
|
|||
int m_Width;
|
||||
int m_Height;
|
||||
|
||||
int m_FPS;
|
||||
|
||||
bool m_Started;
|
||||
bool m_Recording;
|
||||
|
||||
|
|
|
@ -367,3 +367,8 @@ MACRO_CONFIG_INT(GfxEnableTextureUnitOptimization, gfx_enable_texture_unit_optim
|
|||
MACRO_CONFIG_INT(GfxEnableTextureUnitOptimization, gfx_enable_texture_unit_optimization, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use multiple texture units, instead of only one.")
|
||||
#endif
|
||||
MACRO_CONFIG_INT(GfxUsePreinitBuffer, gfx_use_preinitialized_buffer, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use only one buffer for data, that is uploaded to the GPU(might help when using an iGPUs).")
|
||||
|
||||
#if defined(CONF_VIDEORECORDER)
|
||||
MACRO_CONFIG_INT(ClVideoRecorderFPS, cl_video_recorder_fps, 60, 1, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "At which FPS the videorecorder should record demos.")
|
||||
#endif
|
||||
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
fs_makedir(GetPath(TYPE_SAVE, "screenshots/auto/stats", aPath, sizeof(aPath)));
|
||||
fs_makedir(GetPath(TYPE_SAVE, "maps", aPath, sizeof(aPath)));
|
||||
fs_makedir(GetPath(TYPE_SAVE, "downloadedmaps", aPath, sizeof(aPath)));
|
||||
#if defined(CONF_VIDEORECORDER)
|
||||
fs_makedir(GetPath(TYPE_SAVE, "videos", aPath, sizeof(aPath)));
|
||||
#endif
|
||||
}
|
||||
fs_makedir(GetPath(TYPE_SAVE, "dumps", aPath, sizeof(aPath)));
|
||||
fs_makedir(GetPath(TYPE_SAVE, "demos", aPath, sizeof(aPath)));
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#if defined(CONF_VIDEORECORDER)
|
||||
|
||||
#include <engine/shared/config.h>
|
||||
|
||||
#include "video.h"
|
||||
|
||||
IVideo* IVideo::ms_pCurrentVideo = 0;
|
||||
|
@ -7,6 +9,6 @@ IVideo* IVideo::ms_pCurrentVideo = 0;
|
|||
int64 IVideo::ms_Time = 0;
|
||||
float IVideo::ms_LocalTime = 0;
|
||||
int64 IVideo::ms_LocalStartTime = 0;
|
||||
int64 IVideo::ms_TickTime = time_freq() / STREAM_FRAME_RATE;
|
||||
int64 IVideo::ms_TickTime = 0;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include <base/system.h>
|
||||
|
||||
#define STREAM_FRAME_RATE 60 /* 60 images/s */
|
||||
|
||||
class IVideo
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue