svvitch
digital signage player
D:/vs_workspace/switch_sf/src/svvitch/DSVideoRenderer.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "Renderer.h"
00004 #include <streams.h>
00005 #include <dvdmedia.h>
00006 #include <Poco/format.h>
00007 #include <Poco/Logger.h>
00008 #include <Poco/Mutex.h>
00009 #include <queue>
00010 
00011 using std::queue;
00012 
00013 
00014 struct __declspec(uuid("{71771540-2017-11cf-ae26-0020afd79767}")) CLSID_DSVideoRenderer;
00015 
00016 
00021 class DSVideoRenderer: public CBaseVideoRenderer {
00022 private:
00023     Poco::Logger& _log;
00024 
00025     Poco::FastMutex _lock;
00026 
00027     Renderer& _renderer;
00028 
00029     bool _supportYUV2;
00030     D3DFORMAT _format;
00031 
00032     long _w;
00033     long _h;
00034     LPDIRECT3DTEXTURE9 _texture;
00035 
00036     DWORD _current;
00037     PerformanceTimer _readTimer;
00038     DWORD _readTime;
00039 
00040 
00042     void releaseTexture();
00043 
00045     bool getMediaTypeName(const CMediaType* pmt, string& type, D3DFORMAT* format);
00046 
00048     void convertYUY2_RGB(LPBYTE dst, LPBYTE src, size_t len);
00049 
00050 public:
00051     DSVideoRenderer(Renderer& renderer, bool supportYUV2, LPUNKNOWN unk, HRESULT* result);
00052     virtual ‾DSVideoRenderer();
00053 
00054     HRESULT CheckMediaType(const CMediaType* pmt);
00055     HRESULT SetMediaType(const CMediaType* pmt);
00056     HRESULT DoRenderSample(IMediaSample* sample);
00057 
00058     LPDIRECT3DTEXTURE9 getTexture();
00059 
00060     DWORD currentTime();
00061 
00062     DWORD readTime();
00063 
00065     long width();
00066 
00068     long height();
00069 
00071     float getDisplayAspectRatio();
00072 
00074     void draw(const int x, const int y, int w = -1, int h = -1, int aspectMode = 0, int flipMode = 0, DWORD col = 0xffffffff, int tx = 0, int ty = 0, int tw = -1, int th = -1);
00075 };
00076 
00077 typedef DSVideoRenderer* DSVideoRendererPtr;
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines