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