-
Notifications
You must be signed in to change notification settings - Fork 2
/
DVDVideoCodecMFC.h
67 lines (52 loc) · 2.07 KB
/
DVDVideoCodecMFC.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#ifndef THIS_IS_NOT_XBMC
#include "DVDVideoCodec.h"
#include "DVDStreamInfo.h"
#include "utils/BitstreamConverter.h"
#include "xbmc/linux/LinuxV4l2Sink.h"
#else
#include "xbmcstubs.h"
#include "LinuxV4l2Sink.h"
#endif
#ifndef V4L2_CAP_VIDEO_M2M_MPLANE
#define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000
#endif
#define BUFFER_SIZE 1048576 // Compressed frame size. 1080p mpeg4 10Mb/s can be >256k in size, so this is to make sure frame fits into the buffer
// For very unknown reason lesser than 1Mb buffer causes MFC to corrupt its own setup, setting inapropriate values
#define INPUT_BUFFERS 3 // 3 input buffers. 2 is enough almost for everything, but on some heavy videos 3 makes a difference
#define OUTPUT_BUFFERS 3 // Triple buffering for smooth output
#define memzero(x) memset(&(x), 0, sizeof (x))
class CDVDVideoCodecMFC : public CDVDVideoCodec
{
public:
CDVDVideoCodecMFC(CProcessInfo &processInfo);
virtual ~CDVDVideoCodecMFC();
virtual bool Open(CDVDStreamInfo &hints, CDVDCodecOptions &options);
virtual void Dispose();
virtual int Decode(BYTE* pData, int iSize, double dts, double pts);
virtual void Reset();
bool GetPictureCommon(DVDVideoPicture* pDvdVideoPicture);
virtual bool GetPicture(DVDVideoPicture* pDvdVideoPicture);
virtual void SetDropState(bool bDrop);
virtual const char* GetName() { return m_name.c_str(); }; // m_name is never changed after open
virtual bool GetCodecStats(double &pts, int &droppedFrames, int &skippedPics) override;
protected:
std::string m_name;
bool m_bCodecHealthy;
V4l2Device *m_iDecoderHandle;
V4l2Device *m_iConverterHandle;
CLinuxV4l2Sink *m_MFCCapture;
CLinuxV4l2Sink *m_MFCOutput;
CLinuxV4l2Sink *m_FIMCCapture;
CLinuxV4l2Sink *m_FIMCOutput;
V4l2SinkBuffer *m_Buffer;
V4l2SinkBuffer *m_BufferNowOnScreen;
bool m_bVideoConvert;
CDVDStreamInfo m_hints;
CBitstreamConverter m_converter;
bool m_bDropPictures;
DVDVideoPicture m_videoBuffer;
int m_droppedFrames;
double m_codecPts;
bool OpenDevices();
};