MythTV  master
mythopenglvideo.h
Go to the documentation of this file.
1 #ifndef MYTH_OPENGL_VIDEO_H_
2 #define MYTH_OPENGL_VIDEO_H_
3 
4 // Qt
5 #include <QRect>
6 #include <QObject>
7 
8 // MythTV
9 #include "mythvideoout.h"
10 #include "mythvideogpu.h"
11 #include "videoouttypes.h"
13 #include "mythavutil.h"
15 
16 // Std
17 #include <vector>
18 #include <map>
19 using std::vector;
20 using std::map;
21 
22 class MythOpenGLTonemap;
23 
25 {
26  Q_OBJECT
27 
28  public:
30  {
31  Default = 0, // Plain blit
32  Progressive = 1, // Progressive video frame
33  InterlacedTop = 2, // Deinterlace with top field first
34  InterlacedBot = 3, // Deinterlace with bottom field first
37  };
38 
39  static QString TypeToProfile(VideoFrameType Type);
40 
42  MythVideoBounds* Bounds, const MythVideoProfilePtr& VideoProfile, const QString &Profile);
43  ~MythOpenGLVideo() override;
44 
45  void StartFrame () override {}
47  void RenderFrame (MythVideoFrame* Frame, bool TopFieldFirst, FrameScanType Scan,
48  StereoscopicMode StereoOverride, bool DrawBorder = false) override;
49  void EndFrame () override {}
50  QString GetProfile () const override;
51  void ResetFrameFormat () override;
52  void ResetTextures () override;
53 
54  public slots:
56 
57  protected:
58  void ColourSpaceUpdate(bool PrimariesChanged) override;
59 
60  private:
61  bool SetupFrameFormat (VideoFrameType InputType, VideoFrameType OutputType,
62  QSize Size, GLenum TextureTarget);
64  void BindTextures (bool Deinterlacing, vector<MythVideoTextureOpenGL*>& Current,
65  vector<MythGLTexture*>& Textures);
67  MythDeintType Filter = DEINT_SHADER, bool CreateReferences = true);
68  void CleanupDeinterlacers();
69  void SetupBicubic(VideoResizing& Resize);
70 
72  int m_gles { 0 };
74  std::array<QOpenGLShaderProgram*,ShaderCount> m_shaders { nullptr };
75  std::array<int,ShaderCount> m_shaderCost { 1 };
76  vector<MythVideoTextureOpenGL*> m_inputTextures;
77  vector<MythVideoTextureOpenGL*> m_prevTextures;
78  vector<MythVideoTextureOpenGL*> m_nextTextures;
79  QOpenGLFramebufferObject* m_frameBuffer { nullptr };
81  QOpenGLFunctions::OpenGLFeatures m_features;
82  int m_extraFeatures { 0 };
83  GLenum m_textureTarget { QOpenGLTexture::Target2D };
84  bool m_chromaUpsamplingFilter { false };
86 };
87 #endif
MythOpenGLTonemap
Definition: mythopengltonemap.h:12
MythOpenGLVideo::m_toneMap
MythOpenGLTonemap * m_toneMap
Definition: mythopenglvideo.h:85
MythOpenGLVideo::m_inputTextures
vector< MythVideoTextureOpenGL * > m_inputTextures
Definition: mythopenglvideo.h:76
MythOpenGLVideo::m_gles
int m_gles
Definition: mythopenglvideo.h:72
MythOpenGLVideo::m_prevTextures
vector< MythVideoTextureOpenGL * > m_prevTextures
Definition: mythopenglvideo.h:77
mythvideoout.h
MythOpenGLVideo::InterlacedTop
@ InterlacedTop
Definition: mythopenglvideo.h:33
DEINT_SHADER
@ DEINT_SHADER
Definition: mythframe.h:72
MythVideoTextureOpenGL
Definition: mythvideotextureopengl.h:21
MythOpenGLVideo::BindTextures
void BindTextures(bool Deinterlacing, vector< MythVideoTextureOpenGL * > &Current, vector< MythGLTexture * > &Textures)
Definition: mythopenglvideo.cpp:1020
MythOpenGLVideo::ResetTextures
void ResetTextures() override
Clear reference frames after a seek as they will contain old images.
Definition: mythopenglvideo.cpp:1010
mythopenglinterop.h
MythOpenGLVideo::m_frameBufferTexture
MythVideoTextureOpenGL * m_frameBufferTexture
Definition: mythopenglvideo.h:80
MythOpenGLVideo::MythOpenGLVideo
MythOpenGLVideo(MythRenderOpenGL *Render, MythVideoColourSpace *ColourSpace, MythVideoBounds *Bounds, const MythVideoProfilePtr &VideoProfile, const QString &Profile)
Definition: mythopenglvideo.cpp:34
Frame
Definition: zmdefines.h:93
DEINT_NONE
@ DEINT_NONE
Definition: mythframe.h:67
MythOpenGLVideo::~MythOpenGLVideo
~MythOpenGLVideo() override
Definition: mythopenglvideo.cpp:59
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
MythOpenGLVideo::PrepareFrame
void PrepareFrame(MythVideoFrame *Frame, FrameScanType Scan=kScan_Progressive) override
Update the current input texture using the data from the given video frame.
Definition: mythopenglvideo.cpp:548
MythOpenGLVideo::StartFrame
void StartFrame() override
Definition: mythopenglvideo.h:45
MythOpenGLVideo::SetupFrameFormat
bool SetupFrameFormat(VideoFrameType InputType, VideoFrameType OutputType, QSize Size, GLenum TextureTarget)
Definition: mythopenglvideo.cpp:470
MythOpenGLVideo::m_fallbackDeinterlacer
MythDeintType m_fallbackDeinterlacer
Definition: mythopenglvideo.h:73
MythOpenGLVideo::m_frameBuffer
QOpenGLFramebufferObject * m_frameBuffer
Definition: mythopenglvideo.h:79
MythVideoGPU
Definition: mythvideogpu.h:20
mythrenderopengl.h
MythOpenGLVideo::m_features
QOpenGLFunctions::OpenGLFeatures m_features
Definition: mythopenglvideo.h:81
MythOpenGLVideo::ColourSpaceUpdate
void ColourSpaceUpdate(bool PrimariesChanged) override
Definition: mythopenglvideo.cpp:70
MythOpenGLVideo::m_openglRender
MythRenderOpenGL * m_openglRender
Definition: mythopenglvideo.h:71
videoouttypes.h
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:100
MythOpenGLVideo::InterlacedBot
@ InterlacedBot
Definition: mythopenglvideo.h:34
MythOpenGLVideo::TypeToProfile
static QString TypeToProfile(VideoFrameType Type)
Definition: mythopenglvideo.cpp:1047
MythOpenGLVideo::RenderFrame
void RenderFrame(MythVideoFrame *Frame, bool TopFieldFirst, FrameScanType Scan, StereoscopicMode StereoOverride, bool DrawBorder=false) override
Definition: mythopenglvideo.cpp:647
MythOpenGLVideo::m_chromaUpsamplingFilter
bool m_chromaUpsamplingFilter
Definition: mythopenglvideo.h:84
MythOpenGLVideo::SetupBicubic
void SetupBicubic(VideoResizing &Resize)
Definition: mythopenglvideo.cpp:1062
MythOpenGLVideo::m_textureTarget
GLenum m_textureTarget
Definition: mythopenglvideo.h:83
MythOpenGLVideo::AddDeinterlacer
bool AddDeinterlacer(const MythVideoFrame *Frame, FrameScanType Scan, MythDeintType Filter=DEINT_SHADER, bool CreateReferences=true)
Definition: mythopenglvideo.cpp:157
MythOpenGLVideo::Progressive
@ Progressive
Definition: mythopenglvideo.h:32
MythOpenGLVideo::UpdateShaderParameters
void UpdateShaderParameters()
Definition: mythopenglvideo.cpp:96
MythOpenGLVideo::CleanupDeinterlacers
void CleanupDeinterlacers()
Definition: mythopenglvideo.cpp:135
MythOpenGLVideo::VideoShaderType
VideoShaderType
Definition: mythopenglvideo.h:29
mythvideogpu.h
MythVideoBounds
Definition: mythvideobounds.h:23
StereoscopicMode
StereoscopicMode
Definition: videoouttypes.h:134
MythRenderOpenGL
Definition: mythrenderopengl.h:96
MythOpenGLVideo::Default
@ Default
Definition: mythopenglvideo.h:31
MythDeintType
MythDeintType
Definition: mythframe.h:65
MythOpenGLVideo::ShaderCount
@ ShaderCount
Definition: mythopenglvideo.h:36
MythOpenGLVideo::m_shaders
std::array< QOpenGLShaderProgram *, ShaderCount > m_shaders
Definition: mythopenglvideo.h:74
MythOpenGLVideo
Definition: mythopenglvideo.h:24
MythOpenGLVideo::CreateVideoShader
bool CreateVideoShader(VideoShaderType Type, MythDeintType Deint=DEINT_NONE)
Create the appropriate shader for the operation Type.
Definition: mythopenglvideo.cpp:298
mythavutil.h
MythOpenGLVideo::BicubicUpsize
@ BicubicUpsize
Definition: mythopenglvideo.h:35
VideoFrameType
VideoFrameType
Definition: mythframe.h:18
MythVideoProfilePtr
std::shared_ptr< MythVideoProfile > MythVideoProfilePtr
Definition: mythvideogpu.h:18
MythOpenGLVideo::m_extraFeatures
int m_extraFeatures
Definition: mythopenglvideo.h:82
MythVideoFrame
Definition: mythframe.h:85
MythOpenGLVideo::m_shaderCost
std::array< int, ShaderCount > m_shaderCost
Definition: mythopenglvideo.h:75
MythOpenGLVideo::m_nextTextures
vector< MythVideoTextureOpenGL * > m_nextTextures
Definition: mythopenglvideo.h:78
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:20
MythOpenGLVideo::GetProfile
QString GetProfile() const override
Definition: mythopenglvideo.cpp:128
MythOpenGLVideo::ResetFrameFormat
void ResetFrameFormat() override
Definition: mythopenglvideo.cpp:527
MythOpenGLVideo::EndFrame
void EndFrame() override
Definition: mythopenglvideo.h:49