Play-/tools/MediaCenter/Source/VideoDecoder.h

63 lines
1.4 KiB
C
Raw Permalink Normal View History

#pragma once
2018-04-30 21:01:23 +01:00
#include "MpegVideoState.h"
#include "bitmap/Bitmap.h"
2019-08-26 13:16:36 -04:00
#include "signal/Signal.h"
#include <thread>
class CVideoDecoder
{
public:
2019-06-20 00:40:28 +01:00
typedef Framework::CSignal<void(const Framework::CBitmap&)> NewFrameEvent;
2018-04-30 21:01:23 +01:00
CVideoDecoder(std::string);
virtual ~CVideoDecoder();
CVideoDecoder(const CVideoDecoder&) = delete;
CVideoDecoder& operator=(const CVideoDecoder&) = delete;
2018-04-30 21:01:23 +01:00
NewFrameEvent NewFrame;
private:
struct FRAME
{
public:
2018-04-30 21:01:23 +01:00
FRAME();
FRAME(FRAME&&);
FRAME(unsigned int, unsigned int);
~FRAME();
2018-04-30 21:01:23 +01:00
FRAME& operator=(FRAME&&);
2018-04-30 21:01:23 +01:00
bool IsEmpty() const;
unsigned int GetWidth() const;
unsigned int GetHeight() const;
2018-04-30 21:01:23 +01:00
Framework::CBitmap y;
Framework::CBitmap cr;
Framework::CBitmap cb;
};
2018-04-30 21:01:23 +01:00
CVideoDecoder(CVideoDecoder&&)
{
}
CVideoDecoder& operator=(CVideoDecoder&&)
{
}
2018-04-30 21:01:23 +01:00
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*);
2018-04-30 21:01:23 +01:00
std::thread m_decoderThread;
bool m_threadDone;
2018-04-30 21:01:23 +01:00
FRAME m_previousFrame;
FRAME m_currentFrame;
2018-04-30 21:01:23 +01:00
Framework::CBitmap m_frame;
};