MythTV  0.26-pre
videoout_d3d.h
Go to the documentation of this file.
00001 // -*- Mode: c++ -*-
00002 
00003 #ifndef VIDEOOUT_D3D_H_
00004 #define VIDEOOUT_D3D_H_
00005 
00006 // MythTV headers
00007 #include "videooutbase.h"
00008 #include "mythrender_d3d9.h"
00009 #include "mythpainter_d3d9.h"
00010 
00011 #ifdef USING_DXVA2
00012 #include "dxva2decoder.h"
00013 #endif
00014 
00015 class VideoOutputD3D : public VideoOutput
00016 {
00017   public:
00018     static void GetRenderOptions(render_opts &opts, QStringList &cpudeints);
00019     VideoOutputD3D();
00020    ~VideoOutputD3D();
00021 
00022     bool Init(int width, int height, float aspect,
00023               WId winid, const QRect &win_rect, MythCodecID codec_id);
00024     void PrepareFrame(VideoFrame *buffer, FrameScanType, OSD *osd);
00025     void ProcessFrame(VideoFrame *frame, OSD *osd,
00026                       FilterChain *filterList,
00027                       const PIPMap &pipPlayers,
00028                       FrameScanType scan);
00029     void Show(FrameScanType );
00030     void WindowResized(const QSize &new_size);
00031     bool InputChanged(const QSize &input_size,
00032                       float        aspect,
00033                       MythCodecID  av_codec_id,
00034                       void        *codec_private,
00035                       bool        &aspect_only);
00036     void MoveResizeWindow(QRect new_rect) {;}
00037     void UpdatePauseFrame(int64_t &disp_timecode);
00038     virtual void DrawUnusedRects(bool) {;} // VideoOutput
00039     void Zoom(ZoomDirection direction);
00040     void EmbedInWidget(const QRect &rect);
00041     void StopEmbedding(void);
00042     bool hasFullScreenOSD(void) const { return true; }
00043     static QStringList GetAllowedRenderers(MythCodecID myth_codec_id,
00044                                            const QSize &video_dim);
00045     static MythCodecID GetBestSupportedCodec(uint width, uint height,
00046                                              const QString &decoder,
00047                                              uint stream_type,
00048                                              bool no_acceleration,
00049                                              PixelFormat &pix_fmt);
00050 
00051     void ShowPIP(VideoFrame  *frame,
00052                  MythPlayer  *pipplayer,
00053                  PIPLocation  loc);
00054     void RemovePIP(MythPlayer *pipplayer);
00055     bool IsPIPSupported(void) const { return true; }
00056     virtual MythPainter *GetOSDPainter(void);
00057     bool hasHWAcceleration(void) const { return !codec_is_std(video_codec_id); }
00058     virtual bool ApproveDeintFilter(const QString& filtername) const;
00059     virtual void* GetDecoderContext(unsigned char* buf, uint8_t*& id);
00060 
00061     virtual bool CanVisualise(AudioPlayer *audio, MythRender *render)
00062         { return VideoOutput::CanVisualise(audio, (MythRender*)m_render); }
00063     virtual bool SetupVisualisation(AudioPlayer *audio, MythRender *render,
00064                                     const QString &name)
00065         { return VideoOutput::SetupVisualisation(audio, (MythRender*)m_render, name); }
00066 
00067   private:
00068     void TearDown(void);
00069     bool SetupContext(void);
00070     bool CreateBuffers(void);
00071     bool InitBuffers(void);
00072     bool CreatePauseFrame(void);
00073     void SetProfile(void);
00074     void DestroyContext(void);
00075     void UpdateFrame(VideoFrame *frame, D3D9Image *img);
00076 
00077   private:
00078     VideoFrame              m_pauseFrame;
00079     QMutex                  m_lock;
00080     HWND                    m_hWnd;
00081     HWND                    m_hEmbedWnd;
00082     MythRenderD3D9         *m_render;
00083     D3D9Image              *m_video;
00084     bool                    m_render_valid;
00085     bool                    m_render_reset;
00086 
00087     QMap<MythPlayer*,D3D9Image*> m_pips;
00088     QMap<MythPlayer*,bool>       m_pip_ready;
00089     D3D9Image                   *m_pip_active;
00090 
00091     MythD3D9Painter        *m_osd_painter;
00092 
00093     bool CreateDecoder(void);
00094     void DeleteDecoder(void);
00095 #ifdef USING_DXVA2
00096     DXVA2Decoder *m_decoder;
00097 #endif
00098     void         *m_pause_surface;
00099 };
00100 
00101 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends