2019-02-13 23:02:43 -05:00
|
|
|
#pragma once
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "../Utilities/SimpleLock.h"
|
|
|
|
#include "../Utilities/AutoResetEvent.h"
|
|
|
|
#include "SettingTypes.h"
|
|
|
|
|
|
|
|
class BaseVideoFilter;
|
2019-03-10 11:12:50 -04:00
|
|
|
class ScaleFilter;
|
2019-02-13 23:02:43 -05:00
|
|
|
//class RotateFilter;
|
|
|
|
class IRenderingDevice;
|
2019-10-18 17:05:44 -04:00
|
|
|
class InputHud;
|
2019-02-13 23:02:43 -05:00
|
|
|
class Console;
|
|
|
|
|
|
|
|
class VideoDecoder
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
shared_ptr<Console> _console;
|
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
uint16_t *_ppuOutputBuffer = nullptr;
|
2019-02-13 23:02:43 -05:00
|
|
|
uint32_t _frameNumber = 0;
|
|
|
|
|
|
|
|
unique_ptr<thread> _decodeThread;
|
2019-10-18 17:05:44 -04:00
|
|
|
unique_ptr<InputHud> _inputHud;
|
2019-02-13 23:02:43 -05:00
|
|
|
|
|
|
|
AutoResetEvent _waitForFrame;
|
2021-03-10 11:13:28 -05:00
|
|
|
|
2019-02-13 23:02:43 -05:00
|
|
|
atomic<bool> _frameChanged;
|
|
|
|
atomic<bool> _stopFlag;
|
|
|
|
uint32_t _frameCount = 0;
|
|
|
|
|
|
|
|
ScreenSize _previousScreenSize = {};
|
|
|
|
double _previousScale = 0;
|
2019-03-15 10:15:45 -04:00
|
|
|
FrameInfo _baseFrameInfo;
|
2019-02-13 23:02:43 -05:00
|
|
|
FrameInfo _lastFrameInfo;
|
|
|
|
|
|
|
|
VideoFilterType _videoFilterType = VideoFilterType::None;
|
|
|
|
unique_ptr<BaseVideoFilter> _videoFilter;
|
2019-03-10 11:12:50 -04:00
|
|
|
shared_ptr<ScaleFilter> _scaleFilter;
|
2019-02-13 23:02:43 -05:00
|
|
|
//shared_ptr<RotateFilter> _rotateFilter;
|
|
|
|
|
|
|
|
void UpdateVideoFilter();
|
|
|
|
|
|
|
|
void DecodeThread();
|
|
|
|
|
|
|
|
public:
|
|
|
|
VideoDecoder(shared_ptr<Console> console);
|
|
|
|
~VideoDecoder();
|
|
|
|
|
|
|
|
void DecodeFrame(bool synchronous = false);
|
|
|
|
void TakeScreenshot();
|
2021-03-10 11:13:28 -05:00
|
|
|
void TakeScreenshot(std::stringstream &stream);
|
2019-02-13 23:02:43 -05:00
|
|
|
|
|
|
|
uint32_t GetFrameCount();
|
|
|
|
|
|
|
|
FrameInfo GetFrameInfo();
|
2019-03-10 11:12:50 -04:00
|
|
|
ScreenSize GetScreenSize(bool ignoreScale);
|
2019-02-13 23:02:43 -05:00
|
|
|
|
2021-03-10 11:13:28 -05:00
|
|
|
void UpdateFrameSync(uint16_t *ppuOutputBuffer, uint16_t width, uint16_t height, uint32_t frameNumber, bool forRewind);
|
|
|
|
void UpdateFrame(uint16_t *ppuOutputBuffer, uint16_t width, uint16_t height, uint32_t frameNumber);
|
2019-02-13 23:02:43 -05:00
|
|
|
|
|
|
|
bool IsRunning();
|
|
|
|
void StartThread();
|
|
|
|
void StopThread();
|
2021-03-10 11:13:28 -05:00
|
|
|
};
|