Play-/tools/MediaCenter/Source/VideoDecoder.h
2019-08-26 13:16:36 -04:00

62 lines
1.4 KiB
C++

#pragma once
#include "MpegVideoState.h"
#include "bitmap/Bitmap.h"
#include "signal/Signal.h"
#include <thread>
class CVideoDecoder
{
public:
typedef Framework::CSignal<void(const Framework::CBitmap&)> NewFrameEvent;
CVideoDecoder(std::string);
virtual ~CVideoDecoder();
CVideoDecoder(const CVideoDecoder&) = delete;
CVideoDecoder& operator=(const CVideoDecoder&) = delete;
NewFrameEvent NewFrame;
private:
struct FRAME
{
public:
FRAME();
FRAME(FRAME&&);
FRAME(unsigned int, unsigned int);
~FRAME();
FRAME& operator=(FRAME&&);
bool IsEmpty() const;
unsigned int GetWidth() const;
unsigned int GetHeight() const;
Framework::CBitmap y;
Framework::CBitmap cr;
Framework::CBitmap cb;
};
CVideoDecoder(CVideoDecoder&&)
{
}
CVideoDecoder& operator=(CVideoDecoder&&)
{
}
void DecoderThreadProc(std::string);
void OnMacroblockDecoded(MPEG_VIDEO_STATE*);
void OnPictureDecoded(MPEG_VIDEO_STATE*);
static void CopyBlock8x8(Framework::CBitmap&, unsigned int, unsigned int, const int16*);
static void CopyBlock8x8(int16*, unsigned int, unsigned int, int16, int16, const Framework::CBitmap&);
static void CopyMacroblock(Framework::CBitmap&, unsigned int, unsigned int, const uint32*);
std::thread m_decoderThread;
bool m_threadDone;
FRAME m_previousFrame;
FRAME m_currentFrame;
Framework::CBitmap m_frame;
};