MythTV  master
mythvdpauinterop.h
Go to the documentation of this file.
1 #ifndef MYTHVDPAUINTEROP_H
2 #define MYTHVDPAUINTEROP_H
3 
4 // Qt
5 #include <QObject>
6 
7 // MythTV
8 #include "mythcodecid.h"
9 #include "mythopenglinterop.h"
10 
11 // FFmpeg
12 extern "C" {
13 #include "libavutil/hwcontext_vdpau.h"
14 }
15 
16 class MythVDPAUHelper;
17 
18 using MythVDPAUSurfaceNV = GLintptr;
19 using MYTH_VDPAUINITNV = void (APIENTRY *)(const void*, const void*);
20 using MYTH_VDPAUFININV = void (APIENTRY *)(void);
21 using MYTH_VDPAUREGOUTSURFNV = MythVDPAUSurfaceNV (APIENTRY *)(const void*, GLenum, GLsizei, const GLuint*);
23 using MYTH_VDPAUMAPSURFNV = void (APIENTRY *)(GLsizei, MythVDPAUSurfaceNV*);
24 
26 {
27  Q_OBJECT
28 
29  friend class MythOpenGLInterop;
30 
31  public:
33  vector<MythVideoTexture*> Acquire(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace,
34  VideoFrame *Frame, FrameScanType Scan) override;
35 
36  public slots:
37  void UpdateColourSpace(bool PrimariesChanged);
38  void DisplayPreempted(void);
39  bool IsPreempted(void);
40 
41  protected:
44  ~MythVDPAUInterop() override;
45 
46  private:
47  bool InitNV(AVVDPAUDeviceContext* DeviceContext);
48  bool InitVDPAU(AVVDPAUDeviceContext* DeviceContext, VdpVideoSurface Surface,
49  MythDeintType Deint, bool DoubleRate);
50  void Cleanup(void);
51  void CleanupDeinterlacer(void);
52  void RotateReferenceFrames(AVBufferRef *Buffer);
53 
55  MythVDPAUHelper *m_helper { nullptr };
56  VdpOutputSurface m_outputSurface { 0 };
58  VdpVideoMixer m_mixer { 0 };
59  VdpChromaType m_mixerChroma { VDP_CHROMA_TYPE_420 };
60  QSize m_mixerSize { };
62  QVector<AVBufferRef*> m_referenceFrames { };
69  bool m_preempted { false };
70  bool m_preemptedWarning { false };
71 };
72 
73 #endif // MYTHVDPAUINTEROP_H
VideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
unsigned int slots[4]
Definition: element.c:38
void(APIENTRY *)(const void *, const void *) MYTH_VDPAUINITNV
MythDeintType m_deinterlacer
QHash< QString, Action * > Context
Definition: action.h:77
MythCodecID
Definition: mythcodecid.h:10
MYTH_VDPAUFININV m_finiNV
void(APIENTRY *)(GLsizei, MythVDPAUSurfaceNV *) MYTH_VDPAUMAPSURFNV
MYTH_VDPAUREGOUTSURFNV m_registerNV
FrameScanType
Definition: videoouttypes.h:78
VideoFrameType
Definition: mythframe.h:23
MYTH_VDPAUMAPSURFNV m_mapNV
void DisplayPreempted(void)
MythCodecID m_codec
MYTH_VDPAUSURFACCESSNV m_accessNV
MythDeintType
Definition: mythframe.h:120
QVector< AVBufferRef * > m_referenceFrames
vector< MythVideoTexture * > Acquire(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, VideoFrame *Frame, FrameScanType Scan) override
Map VDPAU video surfaces to an OpenGL texture.
MYTH_VDPAUINITNV m_initNV
VideoColourSpace * m_colourSpace
GLintptr MythVDPAUSurfaceNV
void UpdateColourSpace(bool PrimariesChanged)
VdpVideoMixer m_mixer
void(APIENTRY *)(MythVDPAUSurfaceNV, GLenum) MYTH_VDPAUSURFACCESSNV
static MythVDPAUInterop * Create(MythRenderOpenGL *Context, MythCodecID CodecId)
MythVDPAUSurfaceNV m_outputSurfaceReg
A simple wrapper around VDPAU functionality.
#define APIENTRY
bool InitVDPAU(AVVDPAUDeviceContext *DeviceContext, VdpVideoSurface Surface, MythDeintType Deint, bool DoubleRate)
Definition: surface.h:4
VdpOutputSurface m_outputSurface
MythVDPAUInterop(MythRenderOpenGL *Context, MythCodecID CodecID)
static Type GetInteropType(VideoFrameType Format)
void(APIENTRY *)(void) MYTH_VDPAUFININV
void RotateReferenceFrames(AVBufferRef *Buffer)
~MythVDPAUInterop() override
bool InitNV(AVVDPAUDeviceContext *DeviceContext)
void CleanupDeinterlacer(void)
MythVDPAUHelper * m_helper
MythVDPAUSurfaceNV(APIENTRY *)(const void *, GLenum, GLsizei, const GLuint *) MYTH_VDPAUREGOUTSURFNV
VdpChromaType m_mixerChroma