2015-07-22 22:08:28 -04:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
2015-08-30 21:04:21 -04:00
|
|
|
#include <thread>
|
|
|
|
using std::thread;
|
|
|
|
|
2015-07-23 23:16:31 -04:00
|
|
|
#include "../Utilities/SimpleLock.h"
|
2015-08-30 21:04:21 -04:00
|
|
|
#include "../Utilities/AutoResetEvent.h"
|
2015-07-23 23:16:31 -04:00
|
|
|
#include "EmulationSettings.h"
|
2015-08-14 21:50:14 -04:00
|
|
|
#include "HdNesPack.h"
|
2015-07-22 22:08:28 -04:00
|
|
|
|
2016-01-05 21:28:38 -05:00
|
|
|
class BaseVideoFilter;
|
2015-08-30 21:04:21 -04:00
|
|
|
class IRenderingDevice;
|
|
|
|
|
2016-01-05 21:28:38 -05:00
|
|
|
struct ScreenSize
|
|
|
|
{
|
|
|
|
int32_t Width;
|
|
|
|
int32_t Height;
|
|
|
|
};
|
|
|
|
|
2015-07-22 22:08:28 -04:00
|
|
|
class VideoDecoder
|
|
|
|
{
|
|
|
|
private:
|
2015-07-23 23:16:31 -04:00
|
|
|
static unique_ptr<VideoDecoder> Instance;
|
2015-08-30 21:04:21 -04:00
|
|
|
|
|
|
|
uint16_t *_ppuOutputBuffer = nullptr;
|
|
|
|
HdPpuPixelInfo *_hdScreenTiles = nullptr;
|
|
|
|
|
|
|
|
unique_ptr<thread> _decodeThread;
|
2015-07-22 22:08:28 -04:00
|
|
|
|
2015-08-30 21:04:21 -04:00
|
|
|
AutoResetEvent _waitForFrame;
|
2016-01-05 21:28:38 -05:00
|
|
|
|
2016-12-11 10:56:23 -05:00
|
|
|
atomic<bool> _frameChanged;
|
|
|
|
atomic<bool> _stopFlag;
|
2015-08-30 21:04:21 -04:00
|
|
|
uint32_t _frameCount = 0;
|
|
|
|
|
2016-01-05 21:28:38 -05:00
|
|
|
VideoFilterType _videoFilterType = VideoFilterType::None;
|
2016-12-11 10:56:23 -05:00
|
|
|
unique_ptr<BaseVideoFilter> _videoFilter;
|
2015-08-14 21:50:14 -04:00
|
|
|
|
2016-01-05 21:28:38 -05:00
|
|
|
void UpdateVideoFilter();
|
2015-08-30 21:04:21 -04:00
|
|
|
|
|
|
|
void DecodeThread();
|
2015-07-22 22:08:28 -04:00
|
|
|
|
|
|
|
public:
|
2015-07-23 23:16:31 -04:00
|
|
|
static VideoDecoder* GetInstance();
|
2015-08-30 21:04:21 -04:00
|
|
|
VideoDecoder();
|
2015-07-23 23:16:31 -04:00
|
|
|
~VideoDecoder();
|
|
|
|
|
2015-08-30 21:04:21 -04:00
|
|
|
void DecodeFrame();
|
2016-06-17 20:53:05 -04:00
|
|
|
void TakeScreenshot();
|
2015-08-08 22:36:39 -04:00
|
|
|
|
2015-08-30 21:04:21 -04:00
|
|
|
uint32_t GetFrameCount();
|
2015-08-14 21:50:14 -04:00
|
|
|
|
2016-02-07 13:05:32 -05:00
|
|
|
void GetScreenSize(ScreenSize &size, bool ignoreScale);
|
2016-01-05 21:28:38 -05:00
|
|
|
|
2015-08-08 22:36:39 -04:00
|
|
|
void DebugDecodeFrame(uint16_t* inputBuffer, uint32_t* outputBuffer, uint32_t length);
|
2015-08-30 21:04:21 -04:00
|
|
|
|
2016-01-12 19:42:28 -05:00
|
|
|
void UpdateFrame(void* frameBuffer, HdPpuPixelInfo *screenTiles = nullptr);
|
2015-08-30 21:04:21 -04:00
|
|
|
|
2016-01-31 00:41:33 -05:00
|
|
|
bool IsRunning();
|
2015-08-30 21:04:21 -04:00
|
|
|
void StartThread();
|
|
|
|
void StopThread();
|
2015-07-22 22:08:28 -04:00
|
|
|
};
|