MythTV  master
mythopenglinterop.h
Go to the documentation of this file.
1 #ifndef MYTHOPENGLINTEROP_H
2 #define MYTHOPENGLINTEROP_H
3 
4 // Qt
5 #include <QObject>
6 
7 // MythTV
9 #include "referencecounter.h"
10 #include "videoouttypes.h"
11 #include "mythframe.h"
12 #include "mythvideotexture.h"
13 
14 // Std
15 #include "vector"
16 using std::vector;
17 
18 class MythPlayer;
19 class VideoColourSpace;
20 using FreeAVHWDeviceContext = void (*)(struct AVHWDeviceContext*);
21 #define DUMMY_INTEROP_ID 1
22 
23 class MythOpenGLInterop : public QObject, public ReferenceCounter
24 {
25  Q_OBJECT
26 
27  public:
28 
29  enum Type
30  {
42  DUMMY // used for default free/user_opaque storage
43  };
44 
45  static QStringList GetAllowedRenderers (VideoFrameType Format);
47  static void GetInteropTypeCallback(void *Wait, void *Format, void* Result);
48  static vector<MythVideoTexture*> Retrieve(MythRenderOpenGL *Context,
49  VideoColourSpace *ColourSpace,
51  FrameScanType Scan);
52  static QString TypeToString (Type InteropType);
53  static MythOpenGLInterop* CreateDummy (void);
54 
55  ~MythOpenGLInterop() override;
56  virtual vector<MythVideoTexture*> Acquire(MythRenderOpenGL *Context,
57  VideoColourSpace *ColourSpace,
59 
60  Type GetType (void);
61  MythPlayer* GetPlayer (void);
62  void SetPlayer (MythPlayer *Player);
63  void SetDefaultFree (FreeAVHWDeviceContext FreeContext);
64  void SetDefaultUserOpaque (void* UserOpaque);
66  void* GetDefaultUserOpaque (void);
67 
68  protected:
69  explicit MythOpenGLInterop (MythRenderOpenGL *Context, Type InteropType);
70  virtual void DeleteTextures (void);
71 
72  protected:
75  QHash<unsigned long long, vector<MythVideoTexture*> > m_openglTextures;
77  long long m_discontinuityCounter { 0 };
79  void *m_defaultUserOpaque { nullptr };
80  MythPlayer *m_player { nullptr };
81 };
82 
83 #endif // MYTHOPENGLINTEROP_H
VideoColourSpace contains a QMatrix4x4 that can convert YCbCr data to RGB.
void SetPlayer(MythPlayer *Player)
long long m_discontinuityCounter
void(*)(struct AVHWDeviceContext *) FreeAVHWDeviceContext
QHash< QString, Action * > Context
Definition: action.h:77
static Type GetInteropType(VideoFrameType Format, MythPlayer *Player)
Check whether we support direct rendering for the given VideoFrameType.
General purpose reference counter.
MythPlayer * GetPlayer(void)
FrameScanType
Definition: videoouttypes.h:78
VideoFrameType
Definition: mythframe.h:23
MythOpenGLInterop(MythRenderOpenGL *Context, Type InteropType)
static QStringList GetAllowedRenderers(VideoFrameType Format)
static MythOpenGLInterop * CreateDummy(void)
void SetDefaultUserOpaque(void *UserOpaque)
FreeAVHWDeviceContext m_defaultFree
virtual void DeleteTextures(void)
MythRenderOpenGL * m_context
static void GetInteropTypeCallback(void *Wait, void *Format, void *Result)
QHash< unsigned long long, vector< MythVideoTexture * > > m_openglTextures
void * GetDefaultUserOpaque(void)
FreeAVHWDeviceContext GetDefaultFree(void)
void SetDefaultFree(FreeAVHWDeviceContext FreeContext)
MythPlayer * m_player
virtual vector< MythVideoTexture * > Acquire(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, VideoFrame *Frame, FrameScanType Scan)
static vector< MythVideoTexture * > Retrieve(MythRenderOpenGL *Context, VideoColourSpace *ColourSpace, VideoFrame *Frame, FrameScanType Scan)
static QString TypeToString(Type InteropType)