MythTV  master
videoout_omx.h
Go to the documentation of this file.
1 #ifndef VIDEOOUT_OMX_H
2 #define VIDEOOUT_OMX_H
3 
4 #ifdef USING_OPENGLES
5 #ifdef USING_BROADCOM
6 #define OSD_EGL // OSD with EGL
7 #endif
8 #endif
9 
10 #include <OMX_Types.h>
11 #include <OMX_Core.h>
12 
13 #include <QStringList>
14 #include <QVector>
15 #include <QRect>
16 
17 #include "videooutbase.h"
18 #include "omxcontext.h"
19 
20 class MythRenderEGL;
21 class GlOsdThread;
22 #ifdef OSD_EGL
23 class MythOpenGLPainter;
24 #endif
25 class MythScreenType;
26 
28 {
29  public:
30  static QString const kName; // ="openmax"
31  static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
32  static QStringList GetAllowedRenderers(MythCodecID, const QSize&);
33 
35  virtual ~VideoOutputOMX();
36 
37  // VideoOutput overrides
38  bool Init(const QSize&, const QSize&, float, WId, const QRect&, MythCodecID) override;
39  bool InputChanged(const QSize&, const QSize&, float, MythCodecID, void*, bool&) override;
40  void Zoom(ZoomDirection) override;
41  void EmbedInWidget(const QRect&) override;
42  void StopEmbedding(void) override;
43  bool ApproveDeintFilter(const QString&) const override;
44  bool SetDeinterlacingEnabled(bool interlaced) override;
45  bool SetupDeinterlace(bool interlaced, const QString& overridefilter="") override;
46  QString GetName(void) const override { return kName; } // = "openmax"
47  bool IsPIPSupported(void) const override { return true; }
48  bool IsPBPSupported(void) const override { return true; }
49  QRect GetPIPRect(PIPLocation, MythPlayer* = nullptr, bool = true) const override;
50  MythPainter *GetOSDPainter(void) override;
51 
52  // VideoOutput implementation
53  void PrepareFrame(VideoFrame*, FrameScanType, OSD*) override;
54  void ProcessFrame(VideoFrame*, OSD*, FilterChain*, const PIPMap&, FrameScanType) override;
55  void Show(FrameScanType) override;
56  void MoveResizeWindow(QRect) override;
57  void DrawUnusedRects(bool) override;
58  void UpdatePauseFrame(int64_t &) override;
59 
60  protected:
61  // VideoOutput overrides
62  bool hasFullScreenOSD(void) const override;
63  bool DisplayOSD(VideoFrame *frame, OSD *osd) override;
64  bool CanVisualise(AudioPlayer*, MythRender*) override;
65  bool SetupVisualisation(AudioPlayer*, MythRender*, const QString&) override;
66  QStringList GetVisualiserList(void) override;
67 
68  private:
69  // OMXComponentCtx implementation
70  OMX_ERRORTYPE EmptyBufferDone(OMXComponent&, OMX_BUFFERHEADERTYPE*) override;
71  void ReleaseBuffers(OMXComponent&) override;
72 
73  private:
74  // OMXComponentCB actions
75  typedef OMX_ERRORTYPE ComponentCB();
77 
78  void CreatePauseFrame(void);
79  bool SetVideoRect(const QRect &d_rect, const QRect &vid_rect);
80  bool CreateBuffers(const QSize&, const QSize&);
81  void DeleteBuffers();
82  bool Start();
83  OMX_ERRORTYPE SetImageFilter(OMX_IMAGEFILTERTYPE);
84 
85  private:
89  QVector<void*> m_bufs;
90 #ifdef OSD_EGL
91  MythRenderEGL *m_context;
92  MythOpenGLPainter *m_osdpainter;
93  MythPainter *m_threaded_osdpainter;
94  GlOsdThread *m_glOsdThread;
95  bool m_changed;
96 #endif
99 };
100 
101 #endif // ndef VIDEOOUT_OMX_H
void UpdatePauseFrame(int64_t &) override
Updates frame displayed when video is paused.
void Zoom(ZoomDirection) override
Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().
QRect GetPIPRect(PIPLocation, MythPlayer *=nullptr, bool=true) const override
returns QRect of PIP based on PIPLocation
virtual ~VideoOutputOMX()
bool SetupVisualisation(AudioPlayer *, MythRender *, const QString &) override
QMap< MythPlayer *, PIPLocation > PIPMap
Definition: videooutbase.h:37
MythCodecID
Definition: mythcodecid.h:10
FrameScanType
Definition: videoouttypes.h:80
bool SetupDeinterlace(bool interlaced, const QString &overridefilter="") override
Attempts to enable or disable deinterlacing.
void MoveResizeWindow(QRect) override
void PrepareFrame(VideoFrame *, FrameScanType, OSD *) override
bool DisplayOSD(VideoFrame *frame, OSD *osd) override
If the OSD has changed, this will convert the OSD buffer to the OSDSurface's color format.
MythScreenType * m_backgroundscreen
Definition: videoout_omx.h:97
bool IsPIPSupported(void) const override
Definition: videoout_omx.h:47
bool CanVisualise(AudioPlayer *, MythRender *) override
OMX_ERRORTYPE SetImageFilter(OMX_IMAGEFILTERTYPE)
OMX_ERRORTYPE ComponentCB()
Definition: videoout_omx.h:75
void Show(FrameScanType) override
This class serves as the base class for all video output methods.
Definition: videooutbase.h:46
void ProcessFrame(VideoFrame *, OSD *, FilterChain *, const PIPMap &, FrameScanType) override
Draw OSD, apply filters and deinterlacing,.
ComponentCB UseBuffersCB
Definition: videoout_omx.h:76
bool IsPBPSupported(void) const override
Definition: videoout_omx.h:48
MythPainter * GetOSDPainter(void) override
OMXComponent m_imagefx
Definition: videoout_omx.h:86
bool SetDeinterlacingEnabled(bool interlaced) override
Attempts to enable/disable deinterlacing using existing deinterlace method when enabling.
bool InputChanged(const QSize &, const QSize &, float, MythCodecID, void *, bool &) override
Tells video output to discard decoded frames and wait for new ones.
static QString const kName
Definition: videoout_omx.h:30
static QStringList GetAllowedRenderers(MythCodecID, const QSize &)
QString GetName(void) const override
Definition: videoout_omx.h:46
static void GetRenderOptions(render_opts &opts, QStringList &cpudeints)
PIPLocation
Definition: videoouttypes.h:19
bool SetVideoRect(const QRect &d_rect, const QRect &vid_rect)
void StopEmbedding(void) override
Tells video output to stop embedding video in an existing window.
void EmbedInWidget(const QRect &) override
Tells video output to embed video in an existing window.
void DrawUnusedRects(bool) override
Draws non-video portions of the screen.
Definition: osd.h:132
bool Init(const QSize &, const QSize &, float, WId, const QRect &, MythCodecID) override
Performs most of the initialization for VideoOutput.
OMXComponent m_render
Definition: videoout_omx.h:86
Screen in which all other widgets are contained and rendered.
QVector< void * > m_bufs
Definition: videoout_omx.h:89
ComponentCB FreeBuffersCB
Definition: videoout_omx.h:76
bool CreateBuffers(const QSize &, const QSize &)
ZoomDirection
Definition: videoouttypes.h:28
VideoFrame av_pause_frame
Definition: videoout_omx.h:87
QStringList GetVisualiserList(void) override
bool ApproveDeintFilter(const QString &) const override
Approves bobdeint filter for XVideo and otherwise defers to VideoOutput::ApproveDeintFilter(const QSt...
OMX_ERRORTYPE EmptyBufferDone(OMXComponent &, OMX_BUFFERHEADERTYPE *) override
bool hasFullScreenOSD(void) const override
void CreatePauseFrame(void)
void ReleaseBuffers(OMXComponent &) override