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(render_opts &opts, QStringList &cpudeints);
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  FilterChain *filterList,
29  const PIPMap &pipPlayers,
30  FrameScanType scan) override; // VideoOutput
31  void Show(FrameScanType ) override; // VideoOutput
32  void WindowResized(const QSize &new_size) override; // VideoOutput
33  bool InputChanged(const QSize &video_dim_buf,
34  const QSize &video_dim_disp,
35  float aspect,
36  MythCodecID av_codec_id,
37  void *codec_private,
38  bool &aspect_only) override; // VideoOutput
39  void MoveResizeWindow(QRect new_rect) override {;} // VideoOutput
40  void UpdatePauseFrame(int64_t &disp_timecode) override; // VideoOutput
41  void DrawUnusedRects(bool) override {;} // VideoOutput
42  void Zoom(ZoomDirection direction) override; // VideoOutput
43  void EmbedInWidget(const QRect &rect) override; // VideoOutput
44  void StopEmbedding(void) override; // VideoOutput
45  bool hasFullScreenOSD(void) const override // VideoOutput
46  { return true; }
47  static QStringList GetAllowedRenderers(MythCodecID myth_codec_id,
48  const QSize &video_dim);
49  static MythCodecID GetBestSupportedCodec(uint width, uint height,
50  const QString &decoder,
51  uint stream_type,
52  bool no_acceleration,
53  AVPixelFormat &pix_fmt);
54 
55  void ShowPIP(VideoFrame *frame,
56  MythPlayer *pipplayer,
57  PIPLocation loc) override; // VideoOutput
58  void RemovePIP(MythPlayer *pipplayer) override; // VideoOutput
59  bool IsPIPSupported(void) const override // VideoOutput
60  { return true; }
61  MythPainter *GetOSDPainter(void) override; // VideoOutput
62  bool hasHWAcceleration(void) const override // VideoOutput
63  { return !codec_is_std(video_codec_id); }
64  bool ApproveDeintFilter(const QString& filtername) const override; // VideoOutput
65  void* GetDecoderContext(unsigned char* buf, uint8_t*& id) override; // VideoOutput
66 
67  bool CanVisualise(AudioPlayer *audio, MythRender */*render*/) override // VideoOutput
68  { return VideoOutput::CanVisualise(audio, (MythRender*)m_render); }
69  bool SetupVisualisation(AudioPlayer *audio, MythRender */*render*/,
70  const QString &name) override // VideoOutput
72 
73  private:
74  void TearDown(void);
75  bool SetupContext(void);
76  bool CreateBuffers(void);
77  bool InitBuffers(void);
78  bool CreatePauseFrame(void);
79  void SetProfile(void);
80  void DestroyContext(void);
81  void UpdateFrame(VideoFrame *frame, D3D9Image *img);
82 
83  private:
85  QMutex m_lock;
86  HWND m_hWnd;
92 
93  QMap<MythPlayer*,D3D9Image*> m_pips;
94  QMap<MythPlayer*,bool> m_pip_ready;
96 
98 
99  bool CreateDecoder(void);
100  void DeleteDecoder(void);
101 #ifdef USING_DXVA2
103 #endif
105 };
106 
107 #endif
void PrepareFrame(VideoFrame *buffer, FrameScanType, OSD *osd) override
bool CreateDecoder(void)
virtual bool CanVisualise(AudioPlayer *audio, MythRender *render)
def scan(profile, smoonURL, gate)
Definition: scan.py:43
QMap< MythPlayer *, PIPLocation > PIPMap
Definition: videooutbase.h:37
void WindowResized(const QSize &new_size) override
void MoveResizeWindow(QRect new_rect) override
Definition: videoout_d3d.h:39
MythPainter * GetOSDPainter(void) override
void DrawUnusedRects(bool) override
Draws non-video portions of the screen.
Definition: videoout_d3d.h:41
MythCodecID
Definition: mythcodecid.h:10
bool hasHWAcceleration(void) const override
Return true if HW Acceleration is running.
Definition: videoout_d3d.h:62
void Zoom(ZoomDirection direction) override
Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().
static void GetRenderOptions(render_opts &opts, QStringList &cpudeints)
MythRenderD3D9 * m_render
Definition: videoout_d3d.h:88
bool InitBuffers(void)
bool ApproveDeintFilter(const QString &filtername) const override
Approves bobdeint filter for XVideo and otherwise defers to VideoOutput::ApproveDeintFilter(const QSt...
void SetProfile(void)
FrameScanType
Definition: videoouttypes.h:80
unsigned int uint
Definition: compat.h:140
bool CreatePauseFrame(void)
bool SetupVisualisation(AudioPlayer *audio, MythRender *, const QString &name) override
Definition: videoout_d3d.h:69
bool CreateBuffers(void)
void TearDown(void)
VideoFrame m_pauseFrame
Definition: videoout_d3d.h:84
bool Init(const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, WId winid, const QRect &win_rect, MythCodecID codec_id) override
Performs most of the initialization for VideoOutput.
void * m_pause_surface
Definition: videoout_d3d.h:104
void * GetDecoderContext(unsigned char *buf, uint8_t *&id) override
static MythCodecID GetBestSupportedCodec(uint width, uint height, const QString &decoder, uint stream_type, bool no_acceleration, AVPixelFormat &pix_fmt)
bool hasFullScreenOSD(void) const override
Definition: videoout_d3d.h:45
This class serves as the base class for all video output methods.
Definition: videooutbase.h:46
void Show(FrameScanType) override
MythD3D9Painter * m_osd_painter
Definition: videoout_d3d.h:97
MythCodecID video_codec_id
Definition: videooutbase.h:329
bool SetupContext(void)
const char * name
Definition: ParseText.cpp:328
DXVA2Decoder * m_decoder
Definition: videoout_d3d.h:102
PIPLocation
Definition: videoouttypes.h:19
void ShowPIP(VideoFrame *frame, MythPlayer *pipplayer, PIPLocation loc) override
Composites PiP image onto a video frame.
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
QMap< MythPlayer *, bool > m_pip_ready
Definition: videoout_d3d.h:94
void DestroyContext(void)
bool CanVisualise(AudioPlayer *audio, MythRender *) override
Definition: videoout_d3d.h:67
void DeleteDecoder(void)
void UpdateFrame(VideoFrame *frame, D3D9Image *img)
D3D9Image * m_video
Definition: videoout_d3d.h:89
void UpdatePauseFrame(int64_t &disp_timecode) override
Updates frame displayed when video is paused.
Definition: osd.h:132
bool IsPIPSupported(void) const override
Definition: videoout_d3d.h:59
void ProcessFrame(VideoFrame *frame, OSD *osd, FilterChain *filterList, const PIPMap &pipPlayers, FrameScanType scan) override
void RemovePIP(MythPlayer *pipplayer) override
void StopEmbedding(void) override
Tells video output to stop embedding video in an existing window.
QMap< MythPlayer *, D3D9Image * > m_pips
Definition: videoout_d3d.h:93
D3D9Image * m_pip_active
Definition: videoout_d3d.h:95
bool InputChanged(const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, MythCodecID av_codec_id, void *codec_private, bool &aspect_only) override
Tells video output to discard decoded frames and wait for new ones.
void EmbedInWidget(const QRect &rect) override
Tells video output to embed video in an existing window.
ZoomDirection
Definition: videoouttypes.h:28
virtual bool SetupVisualisation(AudioPlayer *audio, MythRender *render, const QString &name)
#define codec_is_std(id)
Definition: mythcodecid.h:127