[cosmetic] cleanup copyright headers
[vuplus_xbmc] / xbmc / cores / dvdplayer / DVDCodecs / Video / DXVAHD.h
1 /*
2  *      Copyright (C) 2005-2013 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, see
17  *  <http://www.gnu.org/licenses/>.
18  *
19  */
20 #pragma once
21
22 #include "DllAvCodec.h"
23 #include "DVDCodecs/Video/DVDVideoCodecFFmpeg.h"
24 #include "guilib/D3DResource.h"
25 #include "threads/Event.h"
26 #include "DVDResource.h"
27 #include "DXVA.h"
28 #include <dxva2api.h>
29 #include <deque>
30 #include <vector>
31 #include "settings/VideoSettings.h"
32 #include "guilib/Geometry.h"
33 #include <dxvahd.h>
34
35 namespace DXVA {
36
37 // ProcAmp filters
38 const DXVAHD_FILTER PROCAMP_FILTERS[] =
39 {
40     DXVAHD_FILTER_BRIGHTNESS,
41     DXVAHD_FILTER_CONTRAST,
42     DXVAHD_FILTER_HUE,
43     DXVAHD_FILTER_SATURATION
44 };
45
46 const DWORD NUM_FILTERS = ARRAYSIZE(PROCAMP_FILTERS);
47
48 class CProcessorHD
49   : public CProcessor
50 {
51 public:
52   CProcessorHD();
53  ~CProcessorHD();
54
55   virtual bool           PreInit();
56   virtual void           UnInit();
57   virtual bool           Open(UINT width, UINT height, unsigned int flags, unsigned int format, unsigned int extended_format);
58   virtual void           Close();
59   virtual REFERENCE_TIME Add(DVDVideoPicture* picture);
60   virtual bool           Render(CRect src, CRect dst, IDirect3DSurface9* target, const REFERENCE_TIME time, DWORD flags);
61   virtual unsigned       Size() { if (m_pDXVAHD) return m_size; return 0; }
62
63   virtual void OnCreateDevice()  {}
64   virtual void OnDestroyDevice() { CSingleLock lock(m_section); UnInit(); }
65   virtual void OnLostDevice()    { CSingleLock lock(m_section); UnInit(); }
66   virtual void OnResetDevice()   { CSingleLock lock(m_section); Close(); }
67
68 protected:
69   virtual bool UpdateSize(const DXVA2_VideoDesc& dsc);
70   virtual bool ReInit();
71   virtual bool CreateSurfaces();
72   virtual bool OpenProcessor();
73   virtual bool ApplyFilter(DXVAHD_FILTER filter, int value, int min, int max, int def);
74
75   IDXVAHD_Device          *m_pDXVAHD;      // DXVA-HD device.
76   IDXVAHD_VideoProcessor  *m_pDXVAVP;      // DXVA-HD video processor.
77   DXVAHD_VPDEVCAPS         m_caps;
78   DXVAHD_VPCAPS            m_VPCaps;
79   GUID                     m_device;
80   unsigned int             m_width;
81   unsigned int             m_height;
82   D3DFORMAT                m_format;
83   REFERENCE_TIME           m_frame;
84   unsigned int             m_flags;
85   unsigned int             m_renderFormat;
86
87   struct ProcAmpInfo
88   {
89     bool                      bSupported;
90     DXVAHD_FILTER_RANGE_DATA  Range;
91   };
92   ProcAmpInfo              m_Filters[NUM_FILTERS];
93
94   struct SFrame
95   {
96     IDirect3DSurface9*     pSurface;
97     CSurfaceContext*       context;
98     unsigned int           index;
99     unsigned               format;
100   };
101   typedef std::deque<SFrame> SFrames;
102   SFrames                  m_frames;
103
104   CSurfaceContext*         m_context;
105   unsigned                 m_size;
106   unsigned                 m_max_back_refs;
107   unsigned                 m_max_fwd_refs;
108   unsigned                 m_index;
109
110   LPDIRECT3DSURFACE9*      m_surfaces;
111   CCriticalSection         m_section;
112 };
113
114 };