2016-01-31 00:41:33 -05:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include <thread>
|
|
|
|
#include "../Utilities/AutoResetEvent.h"
|
2020-02-04 19:36:15 -05:00
|
|
|
#include "../Utilities/IVideoRecorder.h"
|
2017-04-28 19:54:58 -04:00
|
|
|
#include "FrameInfo.h"
|
2016-01-31 00:41:33 -05:00
|
|
|
|
|
|
|
class IRenderingDevice;
|
2017-04-28 19:54:58 -04:00
|
|
|
class AviRecorder;
|
2018-07-01 15:21:05 -04:00
|
|
|
class Console;
|
2017-04-28 19:54:58 -04:00
|
|
|
enum class VideoCodec;
|
2016-01-31 00:41:33 -05:00
|
|
|
|
|
|
|
class VideoRenderer
|
|
|
|
{
|
|
|
|
private:
|
2018-07-01 15:21:05 -04:00
|
|
|
shared_ptr<Console> _console;
|
2016-01-31 00:41:33 -05:00
|
|
|
|
|
|
|
AutoResetEvent _waitForRender;
|
|
|
|
unique_ptr<std::thread> _renderThread;
|
|
|
|
IRenderingDevice* _renderer = nullptr;
|
2016-12-11 10:56:23 -05:00
|
|
|
atomic<bool> _stopFlag;
|
2016-01-31 00:41:33 -05:00
|
|
|
|
2020-02-04 19:36:15 -05:00
|
|
|
shared_ptr<IVideoRecorder> _recorder;
|
2017-04-28 19:54:58 -04:00
|
|
|
|
2016-01-31 00:41:33 -05:00
|
|
|
void RenderThread();
|
|
|
|
|
|
|
|
public:
|
2018-07-01 15:21:05 -04:00
|
|
|
VideoRenderer(shared_ptr<Console> console);
|
2016-01-31 00:41:33 -05:00
|
|
|
~VideoRenderer();
|
|
|
|
|
|
|
|
void StartThread();
|
|
|
|
void StopThread();
|
|
|
|
|
|
|
|
void UpdateFrame(void *frameBuffer, uint32_t width, uint32_t height);
|
|
|
|
void RegisterRenderingDevice(IRenderingDevice *renderer);
|
|
|
|
void UnregisterRenderingDevice(IRenderingDevice *renderer);
|
2017-04-28 19:54:58 -04:00
|
|
|
|
|
|
|
void StartRecording(string filename, VideoCodec codec, uint32_t compressionLevel);
|
|
|
|
void AddRecordingSound(int16_t* soundBuffer, uint32_t sampleCount, uint32_t sampleRate);
|
|
|
|
void StopRecording();
|
|
|
|
bool IsRecording();
|
2016-01-31 00:41:33 -05:00
|
|
|
};
|