svvitch
digital signage player
|
00001 #pragma once 00002 00003 #include <streams.h> 00004 #include "Renderer.h" 00005 #include <vmr9.h> 00006 #include <Dvdmedia.h> 00007 00008 #include <Poco/Mutex.h> 00009 00010 00015 class VideoTextureAllocator: public IVMRSurfaceAllocator9, IVMRImagePresenter9, public IVMRImageCompositor9 00016 { 00017 private: 00018 Poco::Logger& _log; 00019 long _refCount; 00020 Renderer& _renderer; 00021 Poco::FastMutex _lock; 00022 LPDIRECT3DTEXTURE9 _texture; 00023 int _w; 00024 int _h; 00025 D3DFORMAT _format; 00026 bool _presenting; 00027 00028 public: 00029 VideoTextureAllocator(Renderer& renderer); 00030 virtual ‾VideoTextureAllocator(); 00031 00033 LPDIRECT3DTEXTURE9 getTexture(); 00034 00035 float getDisplayAspectRatio(); 00036 00037 // IVMRSurfaceAllocator9 00039 virtual HRESULT STDMETHODCALLTYPE InitializeDevice(DWORD_PTR userID, VMR9AllocationInfo* info, DWORD* buffers); 00040 00042 virtual HRESULT STDMETHODCALLTYPE TerminateDevice(DWORD_PTR userID); 00043 00044 virtual HRESULT STDMETHODCALLTYPE GetSurface(DWORD_PTR userID, DWORD index, DWORD SurfaceFlags, LPDIRECT3DSURFACE9* surface); 00045 00046 virtual HRESULT STDMETHODCALLTYPE AdviseNotify(IVMRSurfaceAllocatorNotify9 *lpIVMRSurfAllocNotify); 00047 00048 // IVMRImagePresenter9 00050 virtual HRESULT STDMETHODCALLTYPE StartPresenting(DWORD_PTR dwUserID); 00051 00053 virtual HRESULT STDMETHODCALLTYPE StopPresenting(DWORD_PTR dwUserID); 00054 00055 virtual HRESULT STDMETHODCALLTYPE PresentImage(DWORD_PTR dwUserID, VMR9PresentationInfo *lpPresInfo); 00056 00057 // IVMRImageCompositor9 00058 HRESULT STDMETHODCALLTYPE InitCompositionDevice(IUnknown* pD3DDevice); 00059 00060 HRESULT STDMETHODCALLTYPE TermCompositionDevice(IUnknown* pD3DDevice); 00061 00062 HRESULT STDMETHODCALLTYPE SetStreamMediaType(DWORD streamID, AM_MEDIA_TYPE* pmt, BOOL fTexture); 00063 00064 HRESULT STDMETHODCALLTYPE CompositeImage(IUnknown *pD3DDevice, IDirect3DSurface9 *pddsRenderTarget, AM_MEDIA_TYPE *pmtRenderTarget, REFERENCE_TIME rtStart, REFERENCE_TIME rtEnd, D3DCOLOR dwClrBkGnd, VMR9VideoStreamInfo *pVideoStreamInfo, UINT cStreams); 00065 00066 // IUnknown 00067 HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); 00068 00069 ULONG STDMETHODCALLTYPE AddRef(); 00070 ULONG STDMETHODCALLTYPE Release(); 00071 }; 00072 00073 typedef VideoTextureAllocator* VideoTextureAllocatorPtr;