00001 //=========================================================================== 00002 //Copyright (C) 2004 Zentaro Kavanagh 00003 // 00004 //Redistribution and use in source and binary forms, with or without 00005 //modification, are permitted provided that the following conditions 00006 //are met: 00007 // 00008 //- Redistributions of source code must retain the above copyright 00009 // notice, this list of conditions and the following disclaimer. 00010 // 00011 //- Redistributions in binary form must reproduce the above copyright 00012 // notice, this list of conditions and the following disclaimer in the 00013 // documentation and/or other materials provided with the distribution. 00014 // 00015 //- Neither the name of Zentaro Kavanagh nor the names of contributors 00016 // may be used to endorse or promote products derived from this software 00017 // without specific prior written permission. 00018 // 00019 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00020 //``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 //LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00022 //PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR 00023 //CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00024 //EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00025 //PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00026 //PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00027 //LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00028 //NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 //=========================================================================== 00031 00032 #pragma once 00033 #include "subtitledllstuff.h" 00034 #include <d3d9.h> 00035 #include <vmr9.h> 00036 #include <tchar.h> 00037 #include <string> 00038 //Debug only 00039 #include <fstream> 00040 // 00041 using namespace std; 00042 00043 #define TRANSPARENCY_VALUE (0.8f) 00044 00045 #define PURE_WHITE RGB(255,255,255) 00046 #define ALMOST_WHITE RGB(250,250,250) 00047 00048 #define BLEND_TEXT TEXT("This is a demonstration of alpha-blended dynamic text.\0") 00049 #define DYNAMIC_TEXT_SIZE 255 00050 00051 #define DEFAULT_FONT_NAME TEXT("Impact\0") 00052 #define DEFAULT_FONT_STYLE TEXT("Regular\0") 00053 #define DEFAULT_FONT_SIZE 12 00054 #define DEFAULT_FONT_COLOR RGB(255,0,0) 00055 #define MAX_FONT_SIZE 25 00056 00057 class SubtitleVMR9OutputPin; 00058 00059 class SubtitleVMR9Filter 00060 : public CBaseRenderer 00061 { 00062 public: 00063 DECLARE_IUNKNOWN 00064 static CUnknown* WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr); 00065 SubtitleVMR9Filter(void); 00066 virtual ~SubtitleVMR9Filter(void); 00067 00068 //Base Filter Implementation 00069 virtual int GetPinCount(void); 00070 virtual CBasePin* GetPin(int inPinNo); 00071 00072 HRESULT CheckMediaType(const CMediaType* inMediaType); 00073 HRESULT DoRenderSample(IMediaSample *pMediaSample); 00074 00075 //IMediaFilter OVerride - This lets us tell the graph we may not produce data in pause state so don't block. 00076 virtual STDMETHODIMP GetState(DWORD dw, FILTER_STATE *pState); 00077 00078 00079 //AKLSJFDLAKSJDL:ASKJD:LKAJSDL:KJSAD:KLJS 00080 //This method is disabling the filter... 00081 HRESULT SubtitleVMR9Filter::Receive(IMediaSample *pMediaSample); 00082 //asdfasdfasdfaskldjf;lkasjdfl;kasjdf;kl 00083 00084 00085 protected: 00086 void SetColorRef(VMR9AlphaBitmap& bmpInfo); 00087 HRESULT mHR; 00088 //SubtitleVMR9OutputPin* mOutputPin; 00089 virtual HRESULT SetSubtitle(wstring inSubtitle); 00090 IVideoWindow* mVideoWindow; 00091 IVMRMixerBitmap9* mBitmapMixer; 00092 IVMRWindowlessControl9* mWindowLess; 00093 VMR9AlphaBitmap mAlphaBitmap; 00094 00095 //debug only 00096 //fstream debugLog; 00097 // 00098 };