00001 #ifndef VIDEOOUT_VDPAU_H
00002 #define VIDEOOUT_VDPAU_H
00003
00004
00005 #include "videooutbase.h"
00006 #include "mythrender_vdpau.h"
00007
00008 class MythVDPAUPainter;
00009 class OSD;
00010
00011 struct vdpauPIP
00012 {
00013 QSize videoSize;
00014 uint videoSurface;
00015 uint videoMixer;
00016 };
00017
00018 class VideoOutputVDPAU : public VideoOutput
00019 {
00020 public:
00021 static void GetRenderOptions(render_opts &opts);
00022 VideoOutputVDPAU();
00023 ~VideoOutputVDPAU();
00024 bool Init(const QSize &video_dim_buf,
00025 const QSize &video_dim_disp,
00026 float aspect,
00027 WId winid, const QRect &win_rect, MythCodecID codec_id);
00028 bool SetDeinterlacingEnabled(bool interlaced);
00029 bool SetupDeinterlace(bool interlaced, const QString& ovrf="");
00030 bool ApproveDeintFilter(const QString& filtername) const;
00031 void ProcessFrame(VideoFrame *frame, OSD *osd,
00032 FilterChain *filterList,
00033 const PIPMap &pipPlayers,
00034 FrameScanType scan);
00035 void PrepareFrame(VideoFrame*, FrameScanType, OSD *osd);
00036 void DrawSlice(VideoFrame*, int x, int y, int w, int h);
00037 void Show(FrameScanType);
00038 void ClearAfterSeek(void);
00039 bool InputChanged(const QSize &video_dim_buf,
00040 const QSize &video_dim_disp,
00041 float aspect,
00042 MythCodecID av_codec_id,
00043 void *codec_private,
00044 bool &aspect_only);
00045 void Zoom(ZoomDirection direction);
00046 void VideoAspectRatioChanged(float aspect);
00047 void EmbedInWidget(const QRect &rect);
00048 void StopEmbedding(void);
00049 void MoveResizeWindow(QRect new_rect);
00050 void DrawUnusedRects(bool sync = true);
00051 void UpdatePauseFrame(int64_t &disp_timecode);
00052 int SetPictureAttribute(PictureAttribute attribute, int newValue);
00053 void InitPictureAttributes(void);
00054 static QStringList GetAllowedRenderers(MythCodecID myth_codec_id,
00055 const QSize &video_dim);
00056 static MythCodecID GetBestSupportedCodec(uint width, uint height,
00057 const QString &decoder,
00058 uint stream_type,
00059 bool no_acceleration);
00060 virtual bool IsPIPSupported(void) const { return true; }
00061 virtual bool IsPBPSupported(void) const { return false; }
00062 virtual bool NeedExtraAudioDecode(void) const
00063 { return codec_is_vdpau(video_codec_id); }
00064 virtual bool hasHWAcceleration(void) const
00065 { return codec_is_vdpau(video_codec_id); }
00066 virtual MythPainter *GetOSDPainter(void);
00067 virtual bool GetScreenShot(int width = 0, int height = 0,
00068 QString filename = "");
00069
00070 virtual bool CanVisualise(AudioPlayer *audio, MythRender *render)
00071 { return VideoOutput::CanVisualise(audio, m_render); }
00072 virtual bool SetupVisualisation(AudioPlayer *audio, MythRender *render,
00073 const QString &name)
00074 { return VideoOutput::SetupVisualisation(audio, m_render, name); }
00075 virtual QStringList GetVisualiserList(void);
00076 virtual void ClearDummyFrame(VideoFrame* frame);
00077 virtual void SetVideoFlip(void);
00078
00079 private:
00080 virtual bool hasFullScreenOSD(void) const { return true; }
00081 void TearDown(void);
00082 bool InitRender(void);
00083 void DeleteRender(void);
00084 bool InitBuffers(void);
00085 bool CreateVideoSurfaces(uint num);
00086 void ClaimVideoSurfaces(void);
00087 void DeleteVideoSurfaces(void);
00088 void DeleteBuffers(void);
00089 void RestoreDisplay(void);
00090 void UpdateReferenceFrames(VideoFrame *frame);
00091 bool FrameIsInUse(VideoFrame *frame);
00092 void ClearReferenceFrames(void);
00093 void DiscardFrame(VideoFrame*);
00094 void DiscardFrames(bool next_frame_keyframe);
00095 void DoneDisplayingFrame(VideoFrame *frame);
00096 void CheckFrameStates(void);
00097 virtual void ShowPIP(VideoFrame *frame,
00098 MythPlayer *pipplayer,
00099 PIPLocation loc);
00100 virtual void RemovePIP(MythPlayer *pipplayer);
00101 bool InitPIPLayer(QSize size);
00102 void DeinitPIPS(void);
00103 void DeinitPIPLayer(void);
00104 void ParseOptions(void);
00105
00106 Window m_win;
00107 MythRenderVDPAU *m_render;
00108
00109 uint m_decoder_buffer_size;
00110 uint m_process_buffer_size;
00111 QVector<uint> m_video_surfaces;
00112 QVector<uint> m_reference_frames;
00113 uint m_pause_surface;
00114 bool m_need_deintrefs;
00115 uint m_video_mixer;
00116 uint m_mixer_features;
00117 bool m_checked_surface_ownership;
00118 bool m_checked_output_surfaces;
00119
00120 uint m_decoder;
00121 int m_pix_fmt;
00122
00123 QMutex m_lock;
00124
00125 uint m_pip_layer;
00126 uint m_pip_surface;
00127 bool m_pip_ready;
00128 QMap<MythPlayer*,vdpauPIP> m_pips;
00129
00130 MythVDPAUPainter *m_osd_painter;
00131
00132 bool m_skip_chroma;
00133 float m_denoise;
00134 float m_sharpen;
00135 int m_colorspace;
00136 };
00137
00138 #endif // VIDEOOUT_VDPAU_H
00139
00140