svvitch
digital signage player
D:/vs_workspace/switch_sf/src/svvitch/FlashSink.cpp
Go to the documentation of this file.
00001 #include "FlashSink.h"
00002 #include "Common.h"
00003 
00004 FlashSink::FlashSink() {
00005 }
00006 
00007 FlashSink::‾FlashSink() {
00008 }
00009 
00010 HRESULT FlashSink::Init(ShockwaveFlashObjects::IShockwaveFlash* flash) {
00011     //m_pFlashPlayer = pFlashPlayer;
00012     //m_pFlashPlayer->m_nCOMCount++;
00013 
00014     HRESULT hr = NOERROR;
00015     LPCONNECTIONPOINTCONTAINER cpc = NULL;
00016     if ((flash->QueryInterface(IID_IConnectionPointContainer, (void**)&cpc) == S_OK) &&
00017         (cpc->FindConnectionPoint(__uuidof(ShockwaveFlashObjects::_IShockwaveFlashEvents), &_cp) == S_OK))          
00018     {
00019         IDispatch* dispatch = NULL;
00020         QueryInterface(__uuidof(IDispatch), (void**)&dispatch);
00021         if (dispatch != NULL) {
00022             hr = _cp->Advise((LPUNKNOWN)dispatch, &_cookie);
00023             dispatch->Release();
00024         }
00025     }
00026     if (cpc) cpc->Release();
00027     return hr;
00028 }
00029 
00030 HRESULT FlashSink::Shutdown() {
00031     HRESULT hr = S_OK;
00032     if (_cp) {
00033         if (_cookie) {
00034             hr = _cp->Unadvise(_cookie);
00035             _cookie = 0;
00036         }
00037         SAFE_RELEASE(_cp);
00038     }
00039     return hr;
00040 }
00041 
00042 
00043 HRESULT STDMETHODCALLTYPE FlashSink::QueryInterface(REFIID riid, LPVOID* ppv) {
00044     *ppv = NULL;
00045 
00046     if (riid == IID_IUnknown) {
00047         *ppv = (LPUNKNOWN)this;
00048         AddRef();
00049         return S_OK;
00050     } else if (riid == IID_IDispatch) {
00051         *ppv = (IDispatch*)this;
00052         AddRef();
00053         return S_OK;
00054     } else if (riid == __uuidof(ShockwaveFlashObjects::_IShockwaveFlashEvents)) {
00055         *ppv = (ShockwaveFlashObjects::_IShockwaveFlashEvents*)this;
00056         AddRef();
00057         return S_OK;
00058     } else {   
00059         return E_NOTIMPL;
00060     }
00061 }
00062 
00063 ULONG STDMETHODCALLTYPE FlashSink::AddRef() {
00064     return ++_ref;
00065 }
00066 
00067 ULONG STDMETHODCALLTYPE FlashSink::Release() {
00068     int ref = --_ref;
00069     if (ref == 0) delete this;
00070     return ref;
00071 }
00072 
00073 
00074 HRESULT STDMETHODCALLTYPE FlashSink::GetTypeInfoCount(UINT* pctinfo) {
00075     return E_NOTIMPL;
00076 }
00077 
00078 HRESULT STDMETHODCALLTYPE FlashSink::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) {
00079     return E_NOTIMPL; 
00080 }
00081 
00082 HRESULT STDMETHODCALLTYPE FlashSink::GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid,DISPID* rgDispId) {
00083     return E_NOTIMPL; 
00084 }
00085 
00086 HRESULT STDMETHODCALLTYPE FlashSink::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, ::DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, ::EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr) {
00087     switch(dispIdMember) {
00088     case 0x7a6:         
00089         break;
00090     case 0x96:          
00091         if ((pDispParams->cArgs == 2) && (pDispParams->rgvarg[0].vt == VT_BSTR) && (pDispParams->rgvarg[1].vt == VT_BSTR))
00092         {
00093             FSCommand(pDispParams->rgvarg[1].bstrVal, pDispParams->rgvarg[0].bstrVal);
00094         }
00095         break;
00096     case DISPID_READYSTATECHANGE:                   
00097         break;
00098     default:            
00099         return DISP_E_MEMBERNOTFOUND;
00100     } 
00101     
00102     return NOERROR;
00103 }
00104 
00105 HRESULT FlashSink::OnReadyStateChange(long newState) {  
00106     return S_OK;
00107 }
00108 
00109 HRESULT FlashSink::OnProgress(long percentDone) {       
00110     return S_OK;
00111 }
00112 
00113 HRESULT FlashSink::FSCommand(_bstr_t command, _bstr_t args) {
00114     //if (m_pFlashPlayer->m_pFlashListener != NULL)
00115     //  m_pFlashPlayer->m_pFlashListener->FlashCommand((char*) command, (char*) args);
00116     return S_OK;
00117 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines