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
10 #include "mythvideoout.h"
11 #include "mythvideogpu.h"
12 #include "videoouttypes.h"
13 #include "mythavutil.h"
15 
16 // Std
17 #include <vector>
18 #include <map>
19 
20 class MythOpenGLTonemap;
21 
23 {
24  Q_OBJECT
25 
26  public:
28  {
29  Default = 0, // Plain blit
30  Progressive = 1, // Progressive video frame
31  InterlacedTop = 2, // Deinterlace with top field first
32  InterlacedBot = 3, // Deinterlace with bottom field first
35  };
36 
37  static QString TypeToProfile(VideoFrameType Type);
38 
40  MythVideoBounds* Bounds, const MythVideoProfilePtr& VideoProfile, const QString &Profile);
41  ~MythOpenGLVideo() override;
42 
43  void StartFrame () override {}
45  void RenderFrame (MythVideoFrame* Frame, bool TopFieldFirst, FrameScanType Scan,
46  StereoscopicMode StereoOverride, bool DrawBorder = false) override;
47  void EndFrame () override {}
48  QString GetProfile () const override;
49  void ResetFrameFormat () override;
50  void ResetTextures () override;
51 
52  public slots:
54 
55  protected:
56  void ColourSpaceUpdate(bool PrimariesChanged) override;
57 
58  private:
59  bool SetupFrameFormat (VideoFrameType InputType, VideoFrameType OutputType,
60  QSize Size, GLenum TextureTarget);
62  void BindTextures (bool Deinterlacing, std::vector<MythVideoTextureOpenGL*>& Current,
63  std::vector<MythGLTexture*>& Textures);
65  MythDeintType Filter = DEINT_SHADER, bool CreateReferences = true);
66  void CleanupDeinterlacers();
67  void SetupBicubic(VideoResizing& Resize);
68 
70  int m_gles { 0 };
72  std::array<QOpenGLShaderProgram*,ShaderCount> m_shaders { nullptr };
73  std::array<int,ShaderCount> m_shaderCost { 1 };
74  std::vector<MythVideoTextureOpenGL*> m_inputTextures;
75  std::vector<MythVideoTextureOpenGL*> m_prevTextures;
76  std::vector<MythVideoTextureOpenGL*> m_nextTextures;
77  QOpenGLFramebufferObject* m_frameBuffer { nullptr };
79  QOpenGLFunctions::OpenGLFeatures m_features;
80  int m_extraFeatures { 0 };
81  GLenum m_textureTarget { QOpenGLTexture::Target2D };
82  bool m_chromaUpsamplingFilter { false };
84 };
85 #endif
MythOpenGLTonemap
Definition: mythopengltonemap.h:12
MythOpenGLVideo::m_toneMap
MythOpenGLTonemap * m_toneMap
Definition: mythopenglvideo.h:83
MythOpenGLVideo::m_gles
int m_gles
Definition: mythopenglvideo.h:70
mythvideoout.h
MythOpenGLVideo::InterlacedTop
@ InterlacedTop
Definition: mythopenglvideo.h:31
DEINT_SHADER
@ DEINT_SHADER
Definition: mythframe.h:74
MythVideoTextureOpenGL
Definition: mythvideotextureopengl.h:21
MythOpenGLVideo::ResetTextures
void ResetTextures() override
Clear reference frames after a seek as they will contain old images.
Definition: mythopenglvideo.cpp:1018
mythopenglinterop.h
MythOpenGLVideo::m_frameBufferTexture
MythVideoTextureOpenGL * m_frameBufferTexture
Definition: mythopenglvideo.h:78
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:69
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:552
MythOpenGLVideo::StartFrame
void StartFrame() override
Definition: mythopenglvideo.h:43
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:71
MythOpenGLVideo::m_frameBuffer
QOpenGLFramebufferObject * m_frameBuffer
Definition: mythopenglvideo.h:77
MythVideoGPU
Definition: mythvideogpu.h:20
mythrenderopengl.h
MythOpenGLVideo::m_features
QOpenGLFunctions::OpenGLFeatures m_features
Definition: mythopenglvideo.h:79
MythOpenGLVideo::BindTextures
void BindTextures(bool Deinterlacing, std::vector< MythVideoTextureOpenGL * > &Current, std::vector< MythGLTexture * > &Textures)
Definition: mythopenglvideo.cpp:1028
MythOpenGLVideo::ColourSpaceUpdate
void ColourSpaceUpdate(bool PrimariesChanged) override
Definition: mythopenglvideo.cpp:70
MythOpenGLVideo::m_openglRender
MythRenderOpenGL * m_openglRender
Definition: mythopenglvideo.h:69
videoouttypes.h
kScan_Progressive
@ kScan_Progressive
Definition: videoouttypes.h:100
MythOpenGLVideo::InterlacedBot
@ InterlacedBot
Definition: mythopenglvideo.h:32
MythOpenGLVideo::TypeToProfile
static QString TypeToProfile(VideoFrameType Type)
Definition: mythopenglvideo.cpp:1055
MythOpenGLVideo::RenderFrame
void RenderFrame(MythVideoFrame *Frame, bool TopFieldFirst, FrameScanType Scan, StereoscopicMode StereoOverride, bool DrawBorder=false) override
Definition: mythopenglvideo.cpp:651
MythOpenGLVideo::m_inputTextures
std::vector< MythVideoTextureOpenGL * > m_inputTextures
Definition: mythopenglvideo.h:74
MythOpenGLVideo::m_chromaUpsamplingFilter
bool m_chromaUpsamplingFilter
Definition: mythopenglvideo.h:82
MythOpenGLVideo::SetupBicubic
void SetupBicubic(VideoResizing &Resize)
Definition: mythopenglvideo.cpp:1070
MythOpenGLVideo::m_textureTarget
GLenum m_textureTarget
Definition: mythopenglvideo.h:81
MythOpenGLVideo::AddDeinterlacer
bool AddDeinterlacer(const MythVideoFrame *Frame, FrameScanType Scan, MythDeintType Filter=DEINT_SHADER, bool CreateReferences=true)
Definition: mythopenglvideo.cpp:157
MythOpenGLVideo::m_prevTextures
std::vector< MythVideoTextureOpenGL * > m_prevTextures
Definition: mythopenglvideo.h:75
MythOpenGLVideo::Progressive
@ Progressive
Definition: mythopenglvideo.h:30
MythOpenGLVideo::UpdateShaderParameters
void UpdateShaderParameters()
Definition: mythopenglvideo.cpp:96
MythOpenGLVideo::CleanupDeinterlacers
void CleanupDeinterlacers()
Definition: mythopenglvideo.cpp:135
MythOpenGLVideo::VideoShaderType
VideoShaderType
Definition: mythopenglvideo.h:27
mythvideogpu.h
MythVideoBounds
Definition: mythvideobounds.h:23
StereoscopicMode
StereoscopicMode
Definition: videoouttypes.h:134
MythRenderOpenGL
Definition: mythrenderopengl.h:96
MythOpenGLVideo::Default
@ Default
Definition: mythopenglvideo.h:29
MythDeintType
MythDeintType
Definition: mythframe.h:67
MythOpenGLVideo::ShaderCount
@ ShaderCount
Definition: mythopenglvideo.h:34
MythOpenGLVideo::m_shaders
std::array< QOpenGLShaderProgram *, ShaderCount > m_shaders
Definition: mythopenglvideo.h:72
MythOpenGLVideo
Definition: mythopenglvideo.h:22
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::m_nextTextures
std::vector< MythVideoTextureOpenGL * > m_nextTextures
Definition: mythopenglvideo.h:76
MythOpenGLVideo::BicubicUpsize
@ BicubicUpsize
Definition: mythopenglvideo.h:33
VideoFrameType
VideoFrameType
Definition: mythframe.h:20
MythVideoProfilePtr
std::shared_ptr< MythVideoProfile > MythVideoProfilePtr
Definition: mythvideogpu.h:18
MythOpenGLVideo::m_extraFeatures
int m_extraFeatures
Definition: mythopenglvideo.h:80
MythVideoFrame
Definition: mythframe.h:88
MythOpenGLVideo::m_shaderCost
std::array< int, ShaderCount > m_shaderCost
Definition: mythopenglvideo.h:73
MythVideoColourSpace
MythVideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
Definition: mythvideocolourspace.h:18
MythOpenGLVideo::GetProfile
QString GetProfile() const override
Definition: mythopenglvideo.cpp:128
MythOpenGLVideo::ResetFrameFormat
void ResetFrameFormat() override
Definition: mythopenglvideo.cpp:531
MythOpenGLVideo::EndFrame
void EndFrame() override
Definition: mythopenglvideo.h:47