MythTV  master
mythvideotexture.h
Go to the documentation of this file.
1 #ifndef MYTHVIDEOTEXTURE_H
2 #define MYTHVIDEOTEXTURE_H
3 
4 // MythTV
6 #include "mythavutil.h"
7 #include "mythframe.h"
8 
9 // FFmpeg
10 extern "C" {
11 #include "libavutil/pixfmt.h"
12 }
13 
14 // Std
15 #include <vector>
16 
17 using namespace std;
18 class QMatrix4x4;
19 
21 {
22  public:
23  explicit MythVideoTexture(GLuint Texture);
24  static vector<MythVideoTexture*> CreateTextures(MythRenderOpenGL* Context,
25  VideoFrameType Type,
27  vector<QSize> Sizes,
28  GLenum Target = QOpenGLTexture::Target2D);
29  static MythVideoTexture* CreateHelperTexture(MythRenderOpenGL *Context);
30  static void UpdateTextures(MythRenderOpenGL* Context, const VideoFrame *Frame,
31  const vector<MythVideoTexture*> &Textures);
32  static void DeleteTexture (MythRenderOpenGL* Context, MythVideoTexture *Texture);
33  static void DeleteTextures(MythRenderOpenGL* Context, vector<MythVideoTexture*> &Textures);
34  static void SetTextureFilters(MythRenderOpenGL* Context, const vector<MythVideoTexture*> &Textures,
35  QOpenGLTexture::Filter Filter,
36  QOpenGLTexture::WrapMode Wrap = QOpenGLTexture::ClampToEdge);
37  static MythVideoTexture* CreateTexture(MythRenderOpenGL *Context, QSize Size,
38  GLenum Target = QOpenGLTexture::Target2D,
39  QOpenGLTexture::PixelType PixelType = QOpenGLTexture::UInt8,
40  QOpenGLTexture::PixelFormat PixelFormat = QOpenGLTexture::RGBA,
41  QOpenGLTexture::TextureFormat Format = QOpenGLTexture::NoFormat,
42  QOpenGLTexture::Filter Filter = QOpenGLTexture::Linear,
43  QOpenGLTexture::WrapMode Wrap = QOpenGLTexture::ClampToEdge);
44  ~MythVideoTexture() = default;
45 
46  public:
47  bool m_valid { false };
48  QOpenGLTexture::Filter m_filter { QOpenGLTexture::Linear };
49  VideoFrameType m_frameType { FMT_NONE };
50  VideoFrameType m_frameFormat { FMT_NONE };
51  uint m_plane { 0 };
52  uint m_planeCount { 0 };
53  bool m_allowGLSLDeint { false };
54 #ifdef USING_MEDIACODEC
55  QMatrix4x4 *m_transform { nullptr };
56 #endif
57  MythAVCopy *m_copyContext { nullptr };
58 
59  protected:
60  explicit MythVideoTexture(QOpenGLTexture* Texture);
61 
62  private:
63  static vector<MythVideoTexture*> CreateHardwareTextures(MythRenderOpenGL* Context,
65  vector<QSize> Sizes, GLenum Target);
66  static vector<MythVideoTexture*> CreateSoftwareTextures(MythRenderOpenGL* Context,
68  vector<QSize> Sizes, GLenum Target);
69 
70  Q_DISABLE_COPY(MythVideoTexture)
71  static void YV12ToYV12 (MythRenderOpenGL *Context, const VideoFrame *Frame, MythVideoTexture* Texture, uint Plane);
72  static void YV12ToYUYV (const VideoFrame *Frame, MythVideoTexture* Texture);
73  static void NV12ToNV12 (MythRenderOpenGL *Context, const VideoFrame *Frame, MythVideoTexture* Texture, uint Plane);
74  static bool CreateBuffer (MythVideoTexture* Texture, int Size);
75  static void StoreBicubicWeights(float X, float *Dest);
76 };
77 
78 #endif // MYTHVIDEOTEXTURE_H
MythGLTexture
Definition: mythrenderopengl.h:44
Frame
Definition: zmdefines.h:93
Context
QHash< QString, Action * > Context
Definition: action.h:77
MythDate::Format
Format
Definition: mythdate.h:12
mythframe.h
VideoFrame
Definition: mythframe.h:137
FMT_NONE
@ FMT_NONE
Definition: mythframe.h:26
mythrenderopengl.h
uint
unsigned int uint
Definition: compat.h:140
MythRenderOpenGL
Definition: mythrenderopengl.h:86
mythavutil.h
MythAVCopy
MythAVCopy Copy AVFrame<->frame, performing the required conversion if any.
Definition: mythavutil.h:107
CreateBuffer
static unsigned char * CreateBuffer(VideoFrameType Type, int Width, int Height)
Definition: mythframe.h:689
VideoFrameType
VideoFrameType
Definition: mythframe.h:24
MythVideoTexture
Definition: mythvideotexture.h:20