Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenproperty.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS Configuration of network devices 00004 * FILE: dll/directx/dsound_new/secondary.c 00005 * PURPOSE: Secondary IDirectSoundBuffer8 implementation 00006 * 00007 * PROGRAMMERS: Johannes Anderwald (janderwald@reactos.org) 00008 */ 00009 00010 00011 #include "precomp.h" 00012 00013 typedef struct 00014 { 00015 IKsPropertySetVtbl *lpVtbl; 00016 LONG ref; 00017 00018 }CKsPropertySetImpl, *LPCKsPropertySetImpl; 00019 00020 HRESULT 00021 WINAPI 00022 KSPropertySetImpl_fnQueryInterface( 00023 LPKSPROPERTYSET iface, 00024 REFIID riid, 00025 LPVOID * ppobj) 00026 { 00027 LPOLESTR pStr; 00028 LPCKsPropertySetImpl This = (LPCKsPropertySetImpl)CONTAINING_RECORD(iface, CKsPropertySetImpl, lpVtbl); 00029 00030 00031 if (IsEqualIID(riid, &IID_IUnknown) || 00032 IsEqualIID(riid, &IID_IKsPropertySet)) 00033 { 00034 *ppobj = (LPVOID)&This->lpVtbl; 00035 InterlockedIncrement(&This->ref); 00036 return S_OK; 00037 } 00038 00039 if (SUCCEEDED(StringFromIID(riid, &pStr))) 00040 { 00041 DPRINT("No Interface for riid %s\n", pStr); 00042 CoTaskMemFree(pStr); 00043 } 00044 return E_NOINTERFACE; 00045 } 00046 00047 ULONG 00048 WINAPI 00049 KSPropertySetImpl_fnAddRef( 00050 LPKSPROPERTYSET iface) 00051 { 00052 ULONG ref; 00053 LPCKsPropertySetImpl This = (LPCKsPropertySetImpl)CONTAINING_RECORD(iface, CKsPropertySetImpl, lpVtbl); 00054 00055 ref = InterlockedIncrement(&This->ref); 00056 00057 return ref; 00058 } 00059 00060 ULONG 00061 WINAPI 00062 KSPropertySetImpl_fnRelease( 00063 LPKSPROPERTYSET iface) 00064 { 00065 ULONG ref; 00066 LPCKsPropertySetImpl This = (LPCKsPropertySetImpl)CONTAINING_RECORD(iface, CKsPropertySetImpl, lpVtbl); 00067 00068 ref = InterlockedDecrement(&(This->ref)); 00069 00070 if (!ref) 00071 { 00072 HeapFree(GetProcessHeap(), 0, This); 00073 } 00074 00075 return ref; 00076 } 00077 00078 00079 HRESULT 00080 WINAPI 00081 KSPropertySetImpl_Get( 00082 LPKSPROPERTYSET iface, 00083 REFGUID guidPropSet, 00084 ULONG dwPropID, 00085 LPVOID pInstanceData, 00086 ULONG cbInstanceData, 00087 LPVOID pPropData, 00088 ULONG cbPropData, 00089 PULONG pcbReturned ) 00090 { 00091 LPOLESTR pStr; 00092 //HRESULT hr; 00093 MMRESULT Result; 00094 WAVEINCAPSW CapsIn; 00095 WAVEOUTCAPSW CapsOut; 00096 00097 GUID DeviceGuid; 00098 LPFILTERINFO Filter = NULL; 00099 PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA Desc; 00100 00101 StringFromIID(guidPropSet, &pStr); 00102 00103 //DPRINT("Requested Property %ws dwPropID %u pInstanceData %p cbInstanceData %u pPropData %p cbPropData %u pcbReturned %p\n", 00104 // pStr, dwPropID, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned); 00105 CoTaskMemFree(pStr); 00106 00107 if (!IsEqualGUID(guidPropSet, &DSPROPSETID_DirectSoundDevice)) 00108 { 00109 /* unsupported property set */ 00110 return E_PROP_ID_UNSUPPORTED; 00111 } 00112 00113 if (dwPropID == DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) 00114 { 00115 if (cbPropData < sizeof(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA)) 00116 { 00117 /* invalid parameter */ 00118 return DSERR_INVALIDPARAM; 00119 } 00120 00121 Desc = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA)pPropData; 00122 00123 if (IsEqualGUID(&Desc->DeviceId, &GUID_NULL)) 00124 { 00125 if (Desc->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) 00126 { 00127 DPRINT("Using default capture guid\n"); 00128 CopyMemory(&DeviceGuid, &DSDEVID_DefaultCapture, sizeof(GUID)); 00129 } 00130 else 00131 { 00132 DPRINT("Using default playback guid\n"); 00133 CopyMemory(&DeviceGuid, &DSDEVID_DefaultPlayback, sizeof(GUID)); 00134 } 00135 } 00136 else 00137 { 00138 /* use provided guid */ 00139 CopyMemory(&DeviceGuid, &Desc->DeviceId, sizeof(GUID)); 00140 } 00141 00142 if (GetDeviceID(&DeviceGuid, &Desc->DeviceId) != DS_OK) 00143 { 00144 DPRINT("Unknown device guid\n"); 00145 return DSERR_INVALIDPARAM; 00146 } 00147 00148 /* sanity check */ 00149 ASSERT(FindDeviceByGuid(&Desc->DeviceId, &Filter)); 00150 ASSERT(Filter != NULL); 00151 00152 /* fill in description */ 00153 if (IsEqualGUID(&Desc->DeviceId, &Filter->DeviceGuid[0])) 00154 { 00155 /* capture device */ 00156 Desc->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; 00157 Desc->WaveDeviceId = Filter->MappedId[0]; 00158 00159 Result = waveInGetDevCapsW(Filter->MappedId[0], &CapsIn, sizeof(WAVEINCAPSW)); 00160 if (Result != MMSYSERR_NOERROR) 00161 { 00162 CapsIn.szPname[0] = 0; 00163 DPRINT("waveInGetDevCaps Device %u failed with %x\n", Filter->MappedId[0], Result); 00164 } 00165 00166 CapsIn.szPname[MAXPNAMELEN-1] = 0; 00167 wcscpy(Desc->DescriptionW, CapsIn.szPname); 00168 WideCharToMultiByte(CP_ACP, 0, CapsIn.szPname, -1, Desc->DescriptionA, sizeof(Desc->DescriptionA), NULL, NULL); 00169 00170 } 00171 else 00172 { 00173 /* render device */ 00174 Desc->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; 00175 Desc->WaveDeviceId = Filter->MappedId[1]; 00176 00177 Result = waveOutGetDevCapsW(Filter->MappedId[1], &CapsOut, sizeof(WAVEOUTCAPSW)); 00178 if (Result != MMSYSERR_NOERROR) 00179 { 00180 CapsOut.szPname[0] = 0; 00181 DPRINT("waveOutGetDevCaps Device %u failed with %x\n", Filter->MappedId[1], Result); 00182 } 00183 00184 CapsOut.szPname[MAXPNAMELEN-1] = 0; 00185 wcscpy(Desc->DescriptionW, CapsOut.szPname); 00186 WideCharToMultiByte(CP_ACP, 0, CapsOut.szPname, -1, Desc->DescriptionA, sizeof(Desc->DescriptionA), NULL, NULL); 00187 } 00188 00189 /* ReactOS doesnt support vxd or emulated */ 00190 Desc->Type = DIRECTSOUNDDEVICE_TYPE_WDM; 00191 Desc->ModuleA[0] = 0; 00192 Desc->ModuleW[0] = 0; 00193 00194 *pcbReturned = sizeof(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA); 00195 return S_OK; 00196 } 00197 00198 00199 UNIMPLEMENTED 00200 return E_PROP_ID_UNSUPPORTED; 00201 } 00202 00203 HRESULT 00204 WINAPI 00205 KSPropertySetImpl_Set( 00206 LPKSPROPERTYSET iface, 00207 REFGUID guidPropSet, 00208 ULONG dwPropID, 00209 LPVOID pInstanceData, 00210 ULONG cbInstanceData, 00211 LPVOID pPropData, 00212 ULONG cbPropData ) 00213 { 00214 UNIMPLEMENTED 00215 return E_PROP_ID_UNSUPPORTED; 00216 } 00217 00218 HRESULT 00219 WINAPI 00220 KSPropertySetImpl_QuerySupport( 00221 LPKSPROPERTYSET iface, 00222 REFGUID guidPropSet, 00223 ULONG dwPropID, 00224 PULONG pTypeSupport ) 00225 { 00226 UNIMPLEMENTED 00227 return E_PROP_ID_UNSUPPORTED; 00228 } 00229 00230 static IKsPropertySetVtbl vt_KsPropertySet = 00231 { 00232 /* IUnknown methods */ 00233 KSPropertySetImpl_fnQueryInterface, 00234 KSPropertySetImpl_fnAddRef, 00235 KSPropertySetImpl_fnRelease, 00236 /* IKsPropertySet methods */ 00237 KSPropertySetImpl_Get, 00238 KSPropertySetImpl_Set, 00239 KSPropertySetImpl_QuerySupport 00240 }; 00241 00242 HRESULT 00243 CALLBACK 00244 NewKsPropertySet( 00245 IUnknown* pUnkOuter, 00246 REFIID riid, 00247 LPVOID* ppvObject) 00248 { 00249 LPOLESTR pStr; 00250 LPCKsPropertySetImpl This; 00251 00252 /* check requested interface */ 00253 if (!IsEqualIID(riid, &IID_IUnknown) && !IsEqualIID(riid, &IID_IKsPropertySet)) 00254 { 00255 *ppvObject = 0; 00256 StringFromIID(riid, &pStr); 00257 DPRINT("KsPropertySet does not support Interface %ws\n", pStr); 00258 CoTaskMemFree(pStr); 00259 return E_NOINTERFACE; 00260 } 00261 00262 /* allocate object */ 00263 This = HeapAlloc(GetProcessHeap(), 0, sizeof(CKsPropertySetImpl)); 00264 if (!This) 00265 return E_OUTOFMEMORY; 00266 00267 /* initialize object */ 00268 This->ref = 1; 00269 This->lpVtbl = &vt_KsPropertySet; 00270 *ppvObject = (LPVOID)&This->lpVtbl; 00271 00272 return S_OK; 00273 } Generated on Thu May 24 2012 04:21:54 for ReactOS by
1.7.6.1
|