MythTV  master
videoout_vdpau.h
Go to the documentation of this file.
1 #ifndef VIDEOOUT_VDPAU_H
2 #define VIDEOOUT_VDPAU_H
3 
4 // MythTV headers
5 #include "videooutbase.h"
6 #include "mythrender_vdpau.h"
7 
8 class MythVDPAUPainter;
9 class OSD;
10 
11 struct vdpauPIP
12 {
13  QSize videoSize;
16 };
17 
19 {
20  public:
21  static void GetRenderOptions(render_opts &opts);
24  bool Init(const QSize &video_dim_buf,
25  const QSize &video_dim_disp,
26  float aspect,
27  WId winid, const QRect &win_rect, MythCodecID codec_id) override; // VideoOutput
28  void* GetDecoderContext(unsigned char* buf, uint8_t*& id) override; // VideoOutput
29  bool SetDeinterlacingEnabled(bool interlaced) override; // VideoOutput
30  bool SetupDeinterlace(bool interlaced, const QString& overridefilter="") override; // VideoOutput
31  bool ApproveDeintFilter(const QString& filtername) const override; // VideoOutput
32  void ProcessFrame(VideoFrame *frame, OSD *osd,
33  FilterChain *filterList,
34  const PIPMap &pipPlayers,
35  FrameScanType scan) override; // VideoOutput
36  void PrepareFrame(VideoFrame*, FrameScanType, OSD *osd) override; // VideoOutput
37  void DrawSlice(VideoFrame*, int x, int y, int w, int h) override; // VideoOutput
38  void Show(FrameScanType) override; // VideoOutput
39  void ClearAfterSeek(void) override; // VideoOutput
40  bool InputChanged(const QSize &video_dim_buf,
41  const QSize &video_dim_disp,
42  float aspect,
43  MythCodecID av_codec_id,
44  void *codec_private,
45  bool &aspect_only) override; // VideoOutput
46  void Zoom(ZoomDirection direction) override; // VideoOutput
47  void VideoAspectRatioChanged(float aspect) override; // VideoOutput
48  void EmbedInWidget(const QRect &rect) override; // VideoOutput
49  void StopEmbedding(void) override; // VideoOutput
50  void MoveResizeWindow(QRect new_rect) override; // VideoOutput
51  void DrawUnusedRects(bool sync = true) override; // VideoOutput
52  void UpdatePauseFrame(int64_t &disp_timecode) override; // VideoOutput
53  int SetPictureAttribute(PictureAttribute attribute, int newValue) override; // VideoOutput
54  void InitPictureAttributes(void) override; // VideoOutput
55  static QStringList GetAllowedRenderers(MythCodecID myth_codec_id,
56  const QSize &video_dim);
57  static MythCodecID GetBestSupportedCodec(uint width, uint height,
58  const QString &decoder,
59  uint stream_type,
60  bool no_acceleration);
61  static bool IsNVIDIA(void);
62  bool IsPIPSupported(void) const override // VideoOutput
63  { return true; }
64  bool IsPBPSupported(void) const override // VideoOutput
65  { return false; }
66  bool NeedExtraAudioDecode(void) const override // VideoOutput
67  { return codec_is_vdpau(video_codec_id); }
68  bool hasHWAcceleration(void) const override // VideoOutput
69  { return codec_is_vdpau(video_codec_id); }
70  MythPainter *GetOSDPainter(void) override; // VideoOutput
71  bool GetScreenShot(int width = 0, int height = 0,
72  QString filename = "") override; // VideoOutput
73 
74  bool CanVisualise(AudioPlayer *audio, MythRender */*render*/) override // VideoOutput
75  { return VideoOutput::CanVisualise(audio, m_render); }
76  bool SetupVisualisation(AudioPlayer *audio, MythRender */*render*/,
77  const QString &name) override // VideoOutput
78  { return VideoOutput::SetupVisualisation(audio, m_render, name); }
79  QStringList GetVisualiserList(void) override; // VideoOutput
80  void ClearDummyFrame(VideoFrame* frame) override; // VideoOutput
81  void SetVideoFlip(void) override; // VideoOutput
82  MythRenderVDPAU* getRender() const { return m_render; }
83 
84  private:
85  bool hasFullScreenOSD(void) const override // VideoOutput
86  { return true; }
87  void TearDown(void);
88  bool InitRender(void);
89  void DeleteRender(void);
90  bool InitBuffers(void);
91  bool CreateVideoSurfaces(uint num);
92  void ClaimVideoSurfaces(void);
93  void DeleteVideoSurfaces(void);
94  void DeleteBuffers(void);
95  void RestoreDisplay(void);
96  void UpdateReferenceFrames(VideoFrame *frame);
97  bool FrameIsInUse(VideoFrame *frame);
98  void ClearReferenceFrames(void);
99  void DiscardFrame(VideoFrame*) override; // VideoOutput
100  void DiscardFrames(bool next_frame_keyframe) override; // VideoOutput
101  void DoneDisplayingFrame(VideoFrame *frame) override; // VideoOutput
102  void CheckFrameStates(void) override; // VideoOutput
103  void ShowPIP(VideoFrame *frame,
104  MythPlayer *pipplayer,
105  PIPLocation loc) override; // VideoOutput
106  void RemovePIP(MythPlayer *pipplayer) override; // VideoOutput
107  bool InitPIPLayer(QSize size);
108  void DeinitPIPS(void);
109  void DeinitPIPLayer(void);
110  void ParseOptions(void);
111 
112  Window m_win;
114  AVVDPAUContext *m_context;
115 
118  QVector<uint> m_video_surfaces;
119  QVector<uint> m_reference_frames;
126 
129 
130  QMutex m_lock;
131 
135  QMap<MythPlayer*,vdpauPIP> m_pips;
136 
138 
140  float m_denoise;
141  float m_sharpen;
143 };
144 
145 #endif // VIDEOOUT_VDPAU_H
bool ApproveDeintFilter(const QString &filtername) const override
Approves bobdeint filter for XVideo and otherwise defers to VideoOutput::ApproveDeintFilter(const QSt...
void DeinitPIPLayer(void)
QMap< MythPlayer *, vdpauPIP > m_pips
MythRenderVDPAU * getRender() const
static MythCodecID GetBestSupportedCodec(uint width, uint height, const QString &decoder, uint stream_type, bool no_acceleration)
virtual bool CanVisualise(AudioPlayer *audio, MythRender *render)
def scan(profile, smoonURL, gate)
Definition: scan.py:43
void DiscardFrame(VideoFrame *) override
Releases frame from any queue onto the queue of frames ready for decoding onto.
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.
QMap< MythPlayer *, PIPLocation > PIPMap
Definition: videooutbase.h:37
bool IsPBPSupported(void) const override
uint videoMixer
MythCodecID
Definition: mythcodecid.h:10
void UpdateReferenceFrames(VideoFrame *frame)
void SetVideoFlip(void) override
Tells the player to flip the video frames for proper display.
void CheckFrameStates(void) override
void DrawUnusedRects(bool sync=true) override
Draws non-video portions of the screen.
bool SetupDeinterlace(bool interlaced, const QString &overridefilter="") override
Attempts to enable or disable deinterlacing.
bool m_checked_output_surfaces
#define codec_is_vdpau(id)
Definition: mythcodecid.h:129
void DiscardFrames(bool next_frame_keyframe) override
Releases all frames not being actively displayed from any queue onto the queue of frames ready for de...
FrameScanType
Definition: videoouttypes.h:80
QStringList GetVisualiserList(void) override
unsigned int uint
Definition: compat.h:140
void ProcessFrame(VideoFrame *frame, OSD *osd, FilterChain *filterList, const PIPMap &pipPlayers, FrameScanType scan) override
QSize videoSize
void * GetDecoderContext(unsigned char *buf, uint8_t *&id) override
void ClearDummyFrame(VideoFrame *frame) override
Clears the frame to black.
bool InitPIPLayer(QSize size)
bool SetDeinterlacingEnabled(bool interlaced) override
Attempts to enable/disable deinterlacing using existing deinterlace method when enabling.
bool m_checked_surface_ownership
void DrawSlice(VideoFrame *, int x, int y, int w, int h) override
Informs video output of new data for frame, used for hardware accelerated decoding.
This class serves as the base class for all video output methods.
Definition: videooutbase.h:46
bool CanVisualise(AudioPlayer *audio, MythRender *) override
void EmbedInWidget(const QRect &rect) override
Tells video output to embed video in an existing window.
void DoneDisplayingFrame(VideoFrame *frame) override
Releases frame returned from GetLastShownFrame() onto the queue of frames ready for decoding onto.
void RemovePIP(MythPlayer *pipplayer) override
MythCodecID video_codec_id
Definition: videooutbase.h:329
bool FrameIsInUse(VideoFrame *frame)
void RestoreDisplay(void)
bool hasFullScreenOSD(void) const override
void ClearReferenceFrames(void)
void DeleteRender(void)
AVVDPAUContext * m_context
PictureAttribute
Definition: videoouttypes.h:89
bool InitBuffers(void)
void Zoom(ZoomDirection direction) override
Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().
bool NeedExtraAudioDecode(void) const override
void ClearAfterSeek(void) override
Tells video output to toss decoded buffers due to a seek.
const char * name
Definition: ParseText.cpp:328
void UpdatePauseFrame(int64_t &disp_timecode) override
Updates frame displayed when video is paused.
int SetPictureAttribute(PictureAttribute attribute, int newValue) override
Sets a specified picture attribute.
QVector< uint > m_video_surfaces
PIPLocation
Definition: videoouttypes.h:19
uint videoSurface
bool IsPIPSupported(void) const override
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
void VideoAspectRatioChanged(float aspect) override
Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
void InitPictureAttributes(void) override
void Show(FrameScanType) override
bool SetupVisualisation(AudioPlayer *audio, MythRender *, const QString &name) override
QVector< uint > m_reference_frames
static bool IsNVIDIA(void)
void StopEmbedding(void) override
Tells video output to stop embedding video in an existing window.
MythPainter * GetOSDPainter(void) override
static void GetRenderOptions(render_opts &opts)
Definition: osd.h:132
void DeleteVideoSurfaces(void)
bool GetScreenShot(int width=0, int height=0, QString filename="") override
void MoveResizeWindow(QRect new_rect) override
bool hasHWAcceleration(void) const override
Return true if HW Acceleration is running.
void DeleteBuffers(void)
void ClaimVideoSurfaces(void)
MythRenderVDPAU * m_render
void ShowPIP(VideoFrame *frame, MythPlayer *pipplayer, PIPLocation loc) override
Composites PiP image onto a video frame.
ZoomDirection
Definition: videoouttypes.h:28
virtual bool SetupVisualisation(AudioPlayer *audio, MythRender *render, const QString &name)
void PrepareFrame(VideoFrame *, FrameScanType, OSD *osd) override
bool CreateVideoSurfaces(uint num)
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.
MythVDPAUPainter * m_osd_painter