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;
|
|
|
|
//class ScaleFilter;
|
|
|
|
//class RotateFilter;
|
|
|
|
class IRenderingDevice;
|
|
|
|
//class VideoHud;
|
|
|
|
class Console;
|
|
|
|
|
|
|
|
class VideoDecoder
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
shared_ptr<Console> _console;
|
|
|
|
|
|
|
|
uint16_t *_ppuOutputBuffer = nullptr;
|
|
|
|
uint32_t _frameNumber = 0;
|
|
|
|
|
|
|
|
unique_ptr<thread> _decodeThread;
|
|
|
|
//unique_ptr<VideoHud> _hud;
|
|
|
|
|
|
|
|
AutoResetEvent _waitForFrame;
|
|
|
|
|
|
|
|
atomic<bool> _frameChanged;
|
|
|
|
atomic<bool> _stopFlag;
|
|
|
|
uint32_t _frameCount = 0;
|
|
|
|
|
2019-02-23 21:39:35 -05:00
|
|
|
FrameInfo _baseFrameInfo = { 256, 224 };
|
2019-02-13 23:02:43 -05:00
|
|
|
ScreenSize _previousScreenSize = {};
|
|
|
|
double _previousScale = 0;
|
|
|
|
FrameInfo _lastFrameInfo;
|
|
|
|
|
|
|
|
VideoFilterType _videoFilterType = VideoFilterType::None;
|
|
|
|
unique_ptr<BaseVideoFilter> _videoFilter;
|
|
|
|
//shared_ptr<ScaleFilter> _scaleFilter;
|
|
|
|
//shared_ptr<RotateFilter> _rotateFilter;
|
|
|
|
|
|
|
|
void UpdateVideoFilter();
|
|
|
|
|
|
|
|
void DecodeThread();
|
|
|
|
|
|
|
|
public:
|
|
|
|
VideoDecoder(shared_ptr<Console> console);
|
|
|
|
~VideoDecoder();
|
|
|
|
|
|
|
|
void DecodeFrame(bool synchronous = false);
|
|
|
|
void TakeScreenshot();
|
|
|
|
void TakeScreenshot(std::stringstream &stream);
|
|
|
|
|
|
|
|
uint32_t GetFrameCount();
|
|
|
|
|
|
|
|
FrameInfo GetFrameInfo();
|
|
|
|
void GetScreenSize(ScreenSize &size, bool ignoreScale);
|
|
|
|
|
2019-02-23 21:39:35 -05:00
|
|
|
void UpdateFrameSync(uint16_t *ppuOutputBuffer, uint16_t width, uint16_t height, uint32_t frameNumber);
|
|
|
|
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();
|
|
|
|
};
|