MythTV  master
videoout_d3d.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef VIDEOOUT_D3D_H_
4 #define VIDEOOUT_D3D_H_
5 
6 // MythTV headers
7 #include "videooutbase.h"
8 #include "mythrender_d3d9.h"
9 #include "mythpainter_d3d9.h"
10 
11 #ifdef USING_DXVA2
12 #include "dxva2decoder.h"
13 #endif
14 
16 {
17  public:
18  static void GetRenderOptions(RenderOptions &Options);
21 
22  bool Init(const QSize &video_dim_buf,
23  const QSize &video_dim_disp,
24  float aspect,
25  WId winid, const QRect &win_rect, MythCodecID codec_id) override; // VideoOutput
26  void PrepareFrame(VideoFrame *buffer, FrameScanType, OSD *osd) override; // VideoOutput
27  void ProcessFrame(VideoFrame *frame, OSD *osd,
28  const PIPMap &pipPlayers,
29  FrameScanType scan) override; // VideoOutput
30  void Show(FrameScanType ) override; // VideoOutput
31  void WindowResized(const QSize &new_size) override; // VideoOutput
32  bool InputChanged(const QSize &video_dim_buf,
33  const QSize &video_dim_disp,
34  float aspect,
35  MythCodecID av_codec_id,
36  bool &aspect_only,
37  MythMultiLocker *Locks) override; // VideoOutput
38  void UpdatePauseFrame(int64_t &disp_timecode) override; // VideoOutput
39  void EmbedInWidget(const QRect &rect) override; // VideoOutput
40  void StopEmbedding(void) override; // VideoOutput
41  static QStringList GetAllowedRenderers(MythCodecID myth_codec_id,
42  const QSize &video_dim);
43  static MythCodecID GetBestSupportedCodec(uint width, uint height,
44  const QString &decoder,
45  uint stream_type,
46  bool no_acceleration,
47  AVPixelFormat &pix_fmt);
48 
49  void ShowPIP(VideoFrame *frame,
50  MythPlayer *pipplayer,
51  PIPLocation loc) override; // VideoOutput
52  void RemovePIP(MythPlayer *pipplayer) override; // VideoOutput
53  bool IsPIPSupported(void) const override // VideoOutput
54  { return true; }
55  MythPainter *GetOSDPainter(void) override; // VideoOutput
56 
57  bool CanVisualise(AudioPlayer *audio, MythRender */*render*/) override // VideoOutput
59  bool SetupVisualisation(AudioPlayer *audio, MythRender */*render*/,
60  const QString &name) override // VideoOutput
61  { return MythVideoOutput::SetupVisualisation(audio, (MythRender*)m_render, name); }
62 
63  private:
64  void TearDown(void);
65  bool SetupContext(void);
66  bool CreateBuffers(void);
67  bool InitBuffers(void);
68  bool CreatePauseFrame(void);
69  void SetProfile(void);
70  void DestroyContext(void);
71  void UpdateFrame(VideoFrame *frame, D3D9Image *img);
72 
73  private:
75  QMutex m_lock {QMutex::Recursive};
76  HWND m_hWnd {nullptr};
77  HWND m_hEmbedWnd {nullptr};
79  D3D9Image *m_video {nullptr};
80  bool m_renderValid {false};
81  bool m_renderReset {false};
82 
83  QMap<MythPlayer*,D3D9Image*> m_pips;
84  QMap<MythPlayer*,bool> m_pipReady {nullptr};
85  D3D9Image *m_pipActive {nullptr};
86 
88 
89  bool CreateDecoder(void);
90  void DeleteDecoder(void);
91 #ifdef USING_DXVA2
92  DXVA2Decoder *m_decoder {nullptr};
93 #endif
94  void *m_pauseSurface {nullptr};
95 };
96 
97 #endif
void PrepareFrame(VideoFrame *buffer, FrameScanType, OSD *osd) override
QMap< MythPlayer *, PIPLocation > PIPMap
Definition: mythvideoout.h:32
bool CreateDecoder(void)
MythD3D9Painter * m_osdPainter
Definition: videoout_d3d.h:87
def scan(profile, smoonURL, gate)
Definition: scan.py:57
static void GetRenderOptions(RenderOptions &Options)
void WindowResized(const QSize &new_size) override
MythPainter * GetOSDPainter(void) override
MythCodecID
Definition: mythcodecid.h:10
virtual bool CanVisualise(AudioPlayer *Audio, MythRender *Render)
MythRenderD3D9 * m_render
Definition: videoout_d3d.h:78
bool InitBuffers(void)
void SetProfile(void)
FrameScanType
Definition: videoouttypes.h:80
bool CreatePauseFrame(void)
bool SetupVisualisation(AudioPlayer *audio, MythRender *, const QString &name) override
Definition: videoout_d3d.h:59
bool CreateBuffers(void)
void TearDown(void)
VideoFrame m_pauseFrame
Definition: videoout_d3d.h:74
bool Init(const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, WId winid, const QRect &win_rect, MythCodecID codec_id) override
static MythCodecID GetBestSupportedCodec(uint width, uint height, const QString &decoder, uint stream_type, bool no_acceleration, AVPixelFormat &pix_fmt)
void Show(FrameScanType) override
unsigned int uint
Definition: compat.h:140
bool SetupContext(void)
D3D9Image * m_pipActive
Definition: videoout_d3d.h:85
DXVA2Decoder * m_decoder
Definition: videoout_d3d.h:92
void * m_pauseSurface
Definition: videoout_d3d.h:94
QMap< MythPlayer *, bool > m_pipReady
Definition: videoout_d3d.h:84
PIPLocation
Definition: videoouttypes.h:19
void ShowPIP(VideoFrame *frame, MythPlayer *pipplayer, PIPLocation loc) override
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
void DestroyContext(void)
bool CanVisualise(AudioPlayer *audio, MythRender *) override
Definition: videoout_d3d.h:57
void DeleteDecoder(void)
void UpdateFrame(VideoFrame *frame, D3D9Image *img)
D3D9Image * m_video
Definition: videoout_d3d.h:79
void ProcessFrame(VideoFrame *frame, OSD *osd, const PIPMap &pipPlayers, FrameScanType scan) override
void UpdatePauseFrame(int64_t &disp_timecode) override
Definition: osd.h:131
bool IsPIPSupported(void) const override
Definition: videoout_d3d.h:53
void RemovePIP(MythPlayer *pipplayer) override
void StopEmbedding(void) override
virtual bool SetupVisualisation(AudioPlayer *Audio, MythRender *Render, const QString &Name)
QMap< MythPlayer *, D3D9Image * > m_pips
Definition: videoout_d3d.h:83
void EmbedInWidget(const QRect &rect) override
Tells video output to embed video in an existing window.
bool InputChanged(const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, MythCodecID av_codec_id, bool &aspect_only, MythMultiLocker *Locks) override