Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygentunerequest.cpp
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS BDA Proxy 00004 * FILE: dll/directx/msvidctl/tuningspace.cpp 00005 * PURPOSE: ITuningRequest interface 00006 * 00007 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org) 00008 */ 00009 #include "precomp.h" 00010 00011 class CTuneRequest : public IDVBTuneRequest 00012 { 00013 public: 00014 STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); 00015 00016 STDMETHODIMP_(ULONG) AddRef() 00017 { 00018 InterlockedIncrement(&m_Ref); 00019 return m_Ref; 00020 } 00021 STDMETHODIMP_(ULONG) Release() 00022 { 00023 InterlockedDecrement(&m_Ref); 00024 if (!m_Ref) 00025 { 00026 OutputDebugStringW(L"CTuneRequest::Release : delete\n"); 00027 00028 WCHAR Buffer[100]; 00029 swprintf(Buffer, L"CTuneRequest::Release : m_TuningSpace %p delete\n", m_TuningSpace); 00030 OutputDebugStringW(Buffer); 00031 00032 00033 m_TuningSpace->Release(); 00034 //delete this; 00035 return 0; 00036 } 00037 return m_Ref; 00038 } 00039 00040 //IDispatch methods 00041 HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo); 00042 HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo); 00043 HRESULT STDMETHODCALLTYPE GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId); 00044 HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); 00045 00046 //ITuneRequest methods 00047 HRESULT STDMETHODCALLTYPE get_TuningSpace(ITuningSpace **TuningSpace); 00048 HRESULT STDMETHODCALLTYPE get_Components(IComponents **Components); 00049 HRESULT STDMETHODCALLTYPE Clone(ITuneRequest **NewTuneRequest); 00050 HRESULT STDMETHODCALLTYPE get_Locator(ILocator **Locator); 00051 HRESULT STDMETHODCALLTYPE put_Locator(ILocator *Locator); 00052 00053 //IDVBTuneRequest methods 00054 HRESULT STDMETHODCALLTYPE get_ONID(long *ONID); 00055 HRESULT STDMETHODCALLTYPE put_ONID(long ONID); 00056 HRESULT STDMETHODCALLTYPE get_TSID(long *TSID); 00057 HRESULT STDMETHODCALLTYPE put_TSID(long TSID); 00058 HRESULT STDMETHODCALLTYPE get_SID(long *SID); 00059 HRESULT STDMETHODCALLTYPE put_SID(long SID); 00060 00061 CTuneRequest(ITuningSpace * TuningSpace) : m_Ref(0), m_ONID(-1), m_TSID(-1), m_SID(-1), m_Locator(0), m_TuningSpace(TuningSpace) 00062 { 00063 m_TuningSpace->AddRef(); 00064 }; 00065 00066 CTuneRequest(ITuningSpace * TuningSpace, LONG ONID, LONG TSID, LONG SID, ILocator * Locator) : m_Ref(1), m_ONID(ONID), m_TSID(TSID), m_SID(SID), m_Locator(Locator), m_TuningSpace(TuningSpace) 00067 { 00068 if (m_Locator) 00069 m_Locator->AddRef(); 00070 00071 m_TuningSpace->AddRef(); 00072 }; 00073 00074 virtual ~CTuneRequest(){}; 00075 00076 protected: 00077 LONG m_Ref; 00078 LONG m_ONID; 00079 LONG m_TSID; 00080 LONG m_SID; 00081 ILocator * m_Locator; 00082 ITuningSpace * m_TuningSpace; 00083 }; 00084 00085 00086 HRESULT 00087 STDMETHODCALLTYPE 00088 CTuneRequest::QueryInterface( 00089 IN REFIID refiid, 00090 OUT PVOID* Output) 00091 { 00092 if (IsEqualGUID(refiid, IID_IUnknown)) 00093 { 00094 *Output = PVOID(this); 00095 reinterpret_cast<IUnknown*>(*Output)->AddRef(); 00096 return NOERROR; 00097 } 00098 00099 if (IsEqualGUID(refiid, IID_ITuneRequest)) 00100 { 00101 *Output = (ITuneRequest*)this; 00102 reinterpret_cast<ITuneRequest*>(*Output)->AddRef(); 00103 return NOERROR; 00104 } 00105 00106 if (IsEqualGUID(refiid, IID_IDVBTuneRequest)) 00107 { 00108 *Output = (IDVBTuneRequest*)this; 00109 reinterpret_cast<IDVBTuneRequest*>(*Output)->AddRef(); 00110 return NOERROR; 00111 } 00112 00113 WCHAR Buffer[MAX_PATH]; 00114 LPOLESTR lpstr; 00115 StringFromCLSID(refiid, &lpstr); 00116 swprintf(Buffer, L"CTuneRequest::QueryInterface: NoInterface for %s", lpstr); 00117 OutputDebugStringW(Buffer); 00118 CoTaskMemFree(lpstr); 00119 00120 00121 return E_NOINTERFACE; 00122 } 00123 00124 //------------------------------------------------------------------- 00125 // IDispatch methods 00126 // 00127 HRESULT 00128 STDMETHODCALLTYPE 00129 CTuneRequest::GetTypeInfoCount(UINT *pctinfo) 00130 { 00131 OutputDebugStringW(L"CTuneRequest::GetTypeInfoCount : NotImplemented\n"); 00132 return E_NOTIMPL; 00133 } 00134 00135 HRESULT 00136 STDMETHODCALLTYPE 00137 CTuneRequest::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) 00138 { 00139 OutputDebugStringW(L"CTuneRequest::GetTypeInfo : NotImplemented\n"); 00140 return E_NOTIMPL; 00141 } 00142 HRESULT 00143 STDMETHODCALLTYPE 00144 CTuneRequest::GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 00145 { 00146 OutputDebugStringW(L"CTuneRequest::GetIDsOfNames : NotImplemented\n"); 00147 return E_NOTIMPL; 00148 } 00149 HRESULT 00150 STDMETHODCALLTYPE 00151 CTuneRequest::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 00152 { 00153 OutputDebugStringW(L"CTuneRequest::Invoke : NotImplemented\n"); 00154 return E_NOTIMPL; 00155 } 00156 00157 //------------------------------------------------------------------- 00158 // ITuneRequest interface 00159 // 00160 00161 HRESULT 00162 STDMETHODCALLTYPE 00163 CTuneRequest::get_TuningSpace(ITuningSpace **TuningSpace) 00164 { 00165 #ifdef MSVIDCTL_TRACE 00166 OutputDebugStringW(L"CTuneRequest::get_TuningSpace\n"); 00167 #endif 00168 00169 *TuningSpace = m_TuningSpace; 00170 m_TuningSpace->AddRef(); 00171 00172 return S_OK; 00173 } 00174 00175 HRESULT 00176 STDMETHODCALLTYPE 00177 CTuneRequest::get_Components(IComponents **Components) 00178 { 00179 OutputDebugStringW(L"CTuneRequest::get_Components : NotImplemented\n"); 00180 return E_NOTIMPL; 00181 } 00182 00183 HRESULT 00184 STDMETHODCALLTYPE 00185 CTuneRequest::Clone(ITuneRequest **NewTuneRequest) 00186 { 00187 #ifdef MSVIDCTL_TRACE 00188 WCHAR Buffer[100]; 00189 swprintf(Buffer, L"CTuneRequest::Clone %p\n", NewTuneRequest); 00190 OutputDebugStringW(Buffer); 00191 #endif 00192 00193 *NewTuneRequest = new CTuneRequest(m_TuningSpace, m_ONID, m_TSID, m_SID, m_Locator); 00194 00195 if (!*NewTuneRequest) 00196 return E_OUTOFMEMORY; 00197 00198 return S_OK; 00199 } 00200 00201 HRESULT 00202 STDMETHODCALLTYPE 00203 CTuneRequest::get_Locator(ILocator **Locator) 00204 { 00205 OutputDebugStringW(L"CTuneRequest::get_Locator : NotImplemented\n"); 00206 return E_NOTIMPL; 00207 } 00208 00209 HRESULT 00210 STDMETHODCALLTYPE 00211 CTuneRequest::put_Locator(ILocator *Locator) 00212 { 00213 OutputDebugStringW(L"CTuneRequest::put_Locator : stub\n"); 00214 m_Locator = Locator; 00215 00216 return S_OK; 00217 } 00218 00219 //------------------------------------------------------------------- 00220 // IDVBTuneRequest interface 00221 // 00222 00223 HRESULT 00224 STDMETHODCALLTYPE 00225 CTuneRequest::get_ONID(long *ONID) 00226 { 00227 #ifdef MSVIDCTL_TRACE 00228 OutputDebugStringW(L"CTuneRequest::get_ONID\n"); 00229 #endif 00230 00231 *ONID = m_ONID; 00232 return S_OK; 00233 } 00234 00235 HRESULT 00236 STDMETHODCALLTYPE 00237 CTuneRequest::put_ONID(long ONID) 00238 { 00239 #ifdef MSVIDCTL_TRACE 00240 WCHAR Buffer[100]; 00241 swprintf(Buffer, L"CTuneRequest::put_ONID : %lu\n", ONID); 00242 OutputDebugStringW(Buffer); 00243 #endif 00244 00245 m_ONID = ONID; 00246 return S_OK; 00247 } 00248 00249 HRESULT 00250 STDMETHODCALLTYPE 00251 CTuneRequest::get_TSID(long *TSID) 00252 { 00253 #ifdef MSVIDCTL_TRACE 00254 OutputDebugStringW(L"CTuneRequest::get_TSID\n"); 00255 #endif 00256 00257 *TSID = m_TSID; 00258 return S_OK; 00259 } 00260 00261 HRESULT 00262 STDMETHODCALLTYPE 00263 CTuneRequest::put_TSID(long TSID) 00264 { 00265 #ifdef MSVIDCTL_TRACE 00266 WCHAR Buffer[100]; 00267 swprintf(Buffer, L"CTuneRequest::put_TSID : %lu\n", TSID); 00268 OutputDebugStringW(Buffer); 00269 #endif 00270 00271 m_TSID = TSID; 00272 return S_OK; 00273 } 00274 00275 HRESULT 00276 STDMETHODCALLTYPE 00277 CTuneRequest::get_SID(long *SID) 00278 { 00279 #ifdef MSVIDCTL_TRACE 00280 OutputDebugStringW(L"CTuneRequest::get_SID\n"); 00281 #endif 00282 00283 *SID = m_SID; 00284 return S_OK; 00285 } 00286 00287 HRESULT 00288 STDMETHODCALLTYPE 00289 CTuneRequest::put_SID(long SID) 00290 { 00291 #ifdef MSVIDCTL_TRACE 00292 WCHAR Buffer[100]; 00293 swprintf(Buffer, L"CTuneRequest::put_SID : %lu\n", SID); 00294 OutputDebugStringW(Buffer); 00295 #endif 00296 00297 m_SID = SID; 00298 return S_OK; 00299 } 00300 00301 HRESULT 00302 WINAPI 00303 CTuneRequest_fnConstructor( 00304 IUnknown *pUnknown, 00305 ITuningSpace * TuningSpace, 00306 REFIID riid, 00307 LPVOID * ppv) 00308 { 00309 // construct device control 00310 CTuneRequest * request = new CTuneRequest(TuningSpace); 00311 00312 #ifdef MSVIDCTL_TRACE 00313 WCHAR Buffer[MAX_PATH]; 00314 LPOLESTR lpstr; 00315 StringFromCLSID(riid, &lpstr); 00316 swprintf(Buffer, L"CTuneRequest_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown); 00317 OutputDebugStringW(Buffer); 00318 #endif 00319 00320 if (!request) 00321 return E_OUTOFMEMORY; 00322 00323 if (FAILED(request->QueryInterface(riid, ppv))) 00324 { 00325 /* not supported */ 00326 delete request; 00327 return E_NOINTERFACE; 00328 } 00329 00330 return NOERROR; 00331 } Generated on Sat May 26 2012 04:20:26 for ReactOS by
1.7.6.1
|