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"
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  public:
30  static void GetVDPAUTypes(MythRenderOpenGL* Render, MythInteropGPU::InteropMap& Types);
32  std::vector<MythVideoTextureOpenGL*>
33  Acquire(MythRenderOpenGL* Context, MythVideoColourSpace* ColourSpace,
34  MythVideoFrame* Frame, FrameScanType Scan) override;
35  bool IsPreempted(void) const;
36 
37  public slots:
38  void UpdateColourSpace(bool PrimariesChanged);
39  void DisplayPreempted(void);
40 
41  protected:
43  ~MythVDPAUInterop() override;
44 
45  private:
46  bool InitNV(AVVDPAUDeviceContext* DeviceContext);
47  bool InitVDPAU(AVVDPAUDeviceContext* DeviceContext, VdpVideoSurface Surface,
48  MythDeintType Deint, bool DoubleRate);
49  void Cleanup(void);
50  void CleanupDeinterlacer(void);
51  void RotateReferenceFrames(AVBufferRef* Buffer);
52 
54  MythVDPAUHelper* m_helper { nullptr };
55  VdpOutputSurface m_outputSurface { 0 };
57  VdpVideoMixer m_mixer { 0 };
58  VdpChromaType m_mixerChroma { VDP_CHROMA_TYPE_420 };
59  QSize m_mixerSize;
61  QVector<AVBufferRef*> m_referenceFrames;
69  bool m_preempted { false };
70  bool m_preemptedWarning { false };
71  bool m_mapped { false };
72 };
73 
74 #endif
MythVDPAUInterop::m_mixerSize
QSize m_mixerSize
Definition: mythvdpauinterop.h:59
MythVDPAUInterop::RotateReferenceFrames
void RotateReferenceFrames(AVBufferRef *Buffer)
Definition: mythvdpauinterop.cpp:91
APIENTRY
#define APIENTRY
Definition: mythrenderopengldefs.h:21
MythVDPAUInterop::m_initNV
MYTH_VDPAUINITNV m_initNV
Definition: mythvdpauinterop.h:62
kCodec_NONE
@ kCodec_NONE
Definition: mythcodecid.h:14
MYTH_VDPAUREGOUTSURFNV
MythVDPAUSurfaceNV(APIENTRY *)(const void *, GLenum, GLsizei, const GLuint *) MYTH_VDPAUREGOUTSURFNV
Definition: mythvdpauinterop.h:21
MYTH_VDPAUMAPSURFNV
void(APIENTRY *)(GLsizei, MythVDPAUSurfaceNV *) MYTH_VDPAUMAPSURFNV
Definition: mythvdpauinterop.h:23
MythVDPAUInterop::m_mapped
bool m_mapped
Definition: mythvdpauinterop.h:71
mythopenglinterop.h
MythVDPAUInterop::m_colourSpace
MythVideoColourSpace * m_colourSpace
Definition: mythvdpauinterop.h:53
Frame
Definition: zmdefines.h:93
MythVDPAUInterop::CreateVDPAU
static MythVDPAUInterop * CreateVDPAU(MythPlayerUI *Player, MythRenderOpenGL *Context, MythCodecID CodecId)
Definition: mythvdpauinterop.cpp:9
MythVDPAUInterop::~MythVDPAUInterop
~MythVDPAUInterop() override
Definition: mythvdpauinterop.cpp:43
Surface
Definition: surface.h:4
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
MythVDPAUInterop::InitNV
bool InitNV(AVVDPAUDeviceContext *DeviceContext)
Definition: mythvdpauinterop.cpp:114
MythVDPAUInterop::m_helper
MythVDPAUHelper * m_helper
Definition: mythvdpauinterop.h:54
MythVDPAUInterop::Cleanup
void Cleanup(void)
Definition: mythvdpauinterop.cpp:57
MYTH_VDPAUFININV
void(APIENTRY *)(void) MYTH_VDPAUFININV
Definition: mythvdpauinterop.h:20
MythInteropGPU::InteropMap
std::map< VideoFrameType, InteropTypes > InteropMap
Definition: mythinteropgpu.h:44
MythVDPAUInterop::m_deinterlacer
MythDeintType m_deinterlacer
Definition: mythvdpauinterop.h:60
MythCodecID
MythCodecID
Definition: mythcodecid.h:10
MythVDPAUInterop::Acquire
std::vector< MythVideoTextureOpenGL * > Acquire(MythRenderOpenGL *Context, MythVideoColourSpace *ColourSpace, MythVideoFrame *Frame, FrameScanType Scan) override
Map VDPAU video surfaces to an OpenGL texture.
Definition: mythvdpauinterop.cpp:225
MythPlayerUI
Definition: mythplayerui.h:10
MythVDPAUInterop::m_preemptedWarning
bool m_preemptedWarning
Definition: mythvdpauinterop.h:70
MythOpenGLInterop
Definition: mythopenglinterop.h:17
MythVDPAUInterop::m_outputSurface
VdpOutputSurface m_outputSurface
Definition: mythvdpauinterop.h:55
MythVDPAUHelper
A simple wrapper around VDPAU functionality.
Definition: mythvdpauhelper.h:52
mythcodecid.h
MythVDPAUInterop
Definition: mythvdpauinterop.h:25
MythVDPAUInterop::m_accessNV
MYTH_VDPAUSURFACCESSNV m_accessNV
Definition: mythvdpauinterop.h:65
MythVDPAUInterop::m_codec
MythCodecID m_codec
Definition: mythvdpauinterop.h:68
MYTH_VDPAUINITNV
void(APIENTRY *)(const void *, const void *) MYTH_VDPAUINITNV
Definition: mythvdpauinterop.h:19
MythVDPAUInterop::CleanupDeinterlacer
void CleanupDeinterlacer(void)
Definition: mythvdpauinterop.cpp:82
MythVDPAUInterop::m_referenceFrames
QVector< AVBufferRef * > m_referenceFrames
Definition: mythvdpauinterop.h:61
MythRenderOpenGL
Definition: mythrenderopengl.h:96
MythDeintType
MythDeintType
Definition: mythframe.h:67
Buffer
Definition: MythExternControl.h:36
MythVDPAUSurfaceNV
GLintptr MythVDPAUSurfaceNV
Definition: mythvdpauinterop.h:18
MythVDPAUInterop::m_mixerChroma
VdpChromaType m_mixerChroma
Definition: mythvdpauinterop.h:58
MythVDPAUInterop::MythVDPAUInterop
MythVDPAUInterop(MythPlayerUI *Player, MythRenderOpenGL *Context, MythCodecID CodecID)
Definition: mythvdpauinterop.cpp:37
MYTH_VDPAUSURFACCESSNV
void(APIENTRY *)(MythVDPAUSurfaceNV, GLenum) MYTH_VDPAUSURFACCESSNV
Definition: mythvdpauinterop.h:22
MythVDPAUInterop::m_mixer
VdpVideoMixer m_mixer
Definition: mythvdpauinterop.h:57
MythVDPAUInterop::IsPreempted
bool IsPreempted(void) const
Definition: mythvdpauinterop.cpp:387
MythVDPAUInterop::UpdateColourSpace
void UpdateColourSpace(bool PrimariesChanged)
Definition: mythvdpauinterop.cpp:368
Player
Definition: zmliveplayer.h:34
MythVideoFrame
Definition: mythframe.h:88
MythVDPAUInterop::m_preempted
bool m_preempted
Definition: mythvdpauinterop.h:69
DEINT_BASIC
@ DEINT_BASIC
Definition: mythframe.h:70
MythVDPAUInterop::m_finiNV
MYTH_VDPAUFININV m_finiNV
Definition: mythvdpauinterop.h:63
MythVDPAUInterop::m_unmapNV
MYTH_VDPAUMAPSURFNV m_unmapNV
Definition: mythvdpauinterop.h:67
MythVDPAUInterop::m_outputSurfaceReg
MythVDPAUSurfaceNV m_outputSurfaceReg
Definition: mythvdpauinterop.h:56
MythVDPAUInterop::m_registerNV
MYTH_VDPAUREGOUTSURFNV m_registerNV
Definition: mythvdpauinterop.h:64
MythVDPAUInterop::DisplayPreempted
void DisplayPreempted(void)
Definition: mythvdpauinterop.cpp:377
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:18
MythVDPAUInterop::m_mapNV
MYTH_VDPAUMAPSURFNV m_mapNV
Definition: mythvdpauinterop.h:66
MythVDPAUInterop::GetVDPAUTypes
static void GetVDPAUTypes(MythRenderOpenGL *Render, MythInteropGPU::InteropMap &Types)
Definition: mythvdpauinterop.cpp:25
MythVDPAUInterop::InitVDPAU
bool InitVDPAU(AVVDPAUDeviceContext *DeviceContext, VdpVideoSurface Surface, MythDeintType Deint, bool DoubleRate)
Definition: mythvdpauinterop.cpp:151