Mesen/Core/VideoDecoder.h

75 lines
1.6 KiB
C
Raw Normal View History

#pragma once
#include "stdafx.h"
#include <thread>
using std::thread;
2015-07-24 03:16:31 +00:00
#include "../Utilities/SimpleLock.h"
#include "../Utilities/AutoResetEvent.h"
2015-07-24 03:16:31 +00:00
#include "EmulationSettings.h"
2016-12-23 04:08:34 +00:00
#include "FrameInfo.h"
class BaseVideoFilter;
class ScaleFilter;
class IRenderingDevice;
struct HdPpuPixelInfo;
struct ScreenSize
{
int32_t Width;
int32_t Height;
2016-12-23 04:08:34 +00:00
double Scale;
};
class VideoDecoder
{
private:
2015-07-24 03:16:31 +00:00
static unique_ptr<VideoDecoder> Instance;
uint16_t *_ppuOutputBuffer = nullptr;
HdPpuPixelInfo *_hdScreenTiles = nullptr;
bool _hdFilterEnabled = false;
unique_ptr<thread> _decodeThread;
AutoResetEvent _waitForFrame;
2016-12-11 15:56:23 +00:00
atomic<bool> _frameChanged;
atomic<bool> _stopFlag;
uint32_t _frameCount = 0;
ScreenSize _previousScreenSize = {};
2016-12-23 04:08:34 +00:00
double _previousScale = 0;
VideoFilterType _videoFilterType = VideoFilterType::None;
2016-12-11 15:56:23 +00:00
unique_ptr<BaseVideoFilter> _videoFilter;
2017-09-01 20:00:55 +00:00
shared_ptr<ScaleFilter> _scaleFilter;
void UpdateVideoFilter();
void DecodeThread();
public:
2015-07-24 03:16:31 +00:00
static VideoDecoder* GetInstance();
VideoDecoder();
2015-07-24 03:16:31 +00:00
~VideoDecoder();
static void Release();
void DecodeFrame();
void TakeScreenshot();
void TakeScreenshot(std::stringstream &stream);
uint32_t GetFrameCount();
2017-04-28 23:54:58 +00:00
FrameInfo GetFrameInfo();
void GetScreenSize(ScreenSize &size, bool ignoreScale);
void DebugDecodeFrame(uint16_t* inputBuffer, uint32_t* outputBuffer, uint32_t length);
2017-04-28 23:54:58 +00:00
void UpdateFrameSync(void* frameBuffer, HdPpuPixelInfo *screenTiles = nullptr);
void UpdateFrame(void* frameBuffer, HdPpuPixelInfo *screenTiles = nullptr);
bool IsRunning();
void StartThread();
void StopThread();
};