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) const;
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
MythVDPAUInterop::m_mixerSize
QSize m_mixerSize
Definition: mythvdpauinterop.h:60
MythVDPAUInterop::RotateReferenceFrames
void RotateReferenceFrames(AVBufferRef *Buffer)
Definition: mythvdpauinterop.cpp:84
APIENTRY
#define APIENTRY
Definition: mythrenderopengldefs.h:21
MythVDPAUInterop::m_initNV
MYTH_VDPAUINITNV m_initNV
Definition: mythvdpauinterop.h:63
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
mythopenglinterop.h
Frame
Definition: zmdefines.h:93
MythVDPAUInterop::~MythVDPAUInterop
~MythVDPAUInterop() override
Definition: mythvdpauinterop.cpp:36
Surface
Definition: surface.h:4
FrameScanType
FrameScanType
Definition: videoouttypes.h:78
Context
QHash< QString, Action * > Context
Definition: action.h:77
slots
unsigned int slots[4]
Definition: element.cpp:38
MythVDPAUInterop::InitNV
bool InitNV(AVVDPAUDeviceContext *DeviceContext)
Definition: mythvdpauinterop.cpp:107
MythDate::Format
Format
Definition: mythdate.h:12
MythVDPAUInterop::m_helper
MythVDPAUHelper * m_helper
Definition: mythvdpauinterop.h:55
VideoFrame
Definition: mythframe.h:137
MythVDPAUInterop::Cleanup
void Cleanup(void)
Definition: mythvdpauinterop.cpp:50
MythVDPAUInterop::Create
static MythVDPAUInterop * Create(MythRenderOpenGL *Context, MythCodecID CodecId)
Definition: mythvdpauinterop.cpp:9
MYTH_VDPAUFININV
void(APIENTRY *)(void) MYTH_VDPAUFININV
Definition: mythvdpauinterop.h:20
MythVDPAUInterop::m_deinterlacer
MythDeintType m_deinterlacer
Definition: mythvdpauinterop.h:61
MythCodecID
MythCodecID
Definition: mythcodecid.h:10
MythVDPAUInterop::m_preemptedWarning
bool m_preemptedWarning
Definition: mythvdpauinterop.h:70
MythOpenGLInterop
Definition: mythopenglinterop.h:23
MythVDPAUInterop::m_outputSurface
VdpOutputSurface m_outputSurface
Definition: mythvdpauinterop.h:56
MythVDPAUInterop::GetInteropType
static Type GetInteropType(VideoFrameType Format)
Definition: mythvdpauinterop.cpp:16
MythVDPAUHelper
A simple wrapper around VDPAU functionality.
Definition: mythvdpauhelper.h:38
mythcodecid.h
MythVDPAUInterop::MythVDPAUInterop
MythVDPAUInterop(MythRenderOpenGL *Context, MythCodecID CodecID)
Definition: mythvdpauinterop.cpp:30
MythVDPAUInterop
Definition: mythvdpauinterop.h:25
MythVDPAUInterop::m_accessNV
MYTH_VDPAUSURFACCESSNV m_accessNV
Definition: mythvdpauinterop.h:66
MythVDPAUInterop::m_codec
MythCodecID m_codec
Definition: mythvdpauinterop.h:68
MythOpenGLInterop::Type
Type
Definition: mythopenglinterop.h:29
MYTH_VDPAUINITNV
void(APIENTRY *)(const void *, const void *) MYTH_VDPAUINITNV
Definition: mythvdpauinterop.h:19
MythVDPAUInterop::Acquire
vector< MythVideoTexture * > Acquire(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, VideoFrame *Frame, FrameScanType Scan) override
Map VDPAU video surfaces to an OpenGL texture.
Definition: mythvdpauinterop.cpp:217
MythVDPAUInterop::CleanupDeinterlacer
void CleanupDeinterlacer(void)
Definition: mythvdpauinterop.cpp:75
MythVDPAUInterop::m_referenceFrames
QVector< AVBufferRef * > m_referenceFrames
Definition: mythvdpauinterop.h:62
MythRenderOpenGL
Definition: mythrenderopengl.h:86
VideoColourSpace
VideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: videocolourspace.h:17
MythDeintType
MythDeintType
Definition: mythframe.h:121
Buffer
Definition: MythExternControl.h:36
MythVDPAUSurfaceNV
GLintptr MythVDPAUSurfaceNV
Definition: mythvdpauinterop.h:18
MythVDPAUInterop::m_mixerChroma
VdpChromaType m_mixerChroma
Definition: mythvdpauinterop.h:59
MYTH_VDPAUSURFACCESSNV
void(APIENTRY *)(MythVDPAUSurfaceNV, GLenum) MYTH_VDPAUSURFACCESSNV
Definition: mythvdpauinterop.h:22
MythVDPAUInterop::m_mixer
VdpVideoMixer m_mixer
Definition: mythvdpauinterop.h:58
MythVDPAUInterop::IsPreempted
bool IsPreempted(void) const
Definition: mythvdpauinterop.cpp:375
MythVDPAUInterop::m_colourSpace
VideoColourSpace * m_colourSpace
Definition: mythvdpauinterop.h:54
VideoFrameType
VideoFrameType
Definition: mythframe.h:24
MythVDPAUInterop::UpdateColourSpace
void UpdateColourSpace(bool PrimariesChanged)
Definition: mythvdpauinterop.cpp:356
MythVDPAUInterop::m_preempted
bool m_preempted
Definition: mythvdpauinterop.h:69
DEINT_BASIC
@ DEINT_BASIC
Definition: mythframe.h:124
MythVDPAUInterop::m_finiNV
MYTH_VDPAUFININV m_finiNV
Definition: mythvdpauinterop.h:64
MythVDPAUInterop::m_outputSurfaceReg
MythVDPAUSurfaceNV m_outputSurfaceReg
Definition: mythvdpauinterop.h:57
MythVDPAUInterop::m_registerNV
MYTH_VDPAUREGOUTSURFNV m_registerNV
Definition: mythvdpauinterop.h:65
MythVDPAUInterop::DisplayPreempted
void DisplayPreempted(void)
Definition: mythvdpauinterop.cpp:365
MythVDPAUInterop::m_mapNV
MYTH_VDPAUMAPSURFNV m_mapNV
Definition: mythvdpauinterop.h:67
MythVDPAUInterop::InitVDPAU
bool InitVDPAU(AVVDPAUDeviceContext *DeviceContext, VdpVideoSurface Surface, MythDeintType Deint, bool DoubleRate)
Definition: mythvdpauinterop.cpp:143