ReactOS  0.4.14-dev-50-g13bb5e2
misc.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Configuration of network devices
4  * FILE: dll/directx/dsound_new/misc.c
5  * PURPOSE: Misc support routines
6  *
7  * PROGRAMMERS: Johannes Anderwald (johannes.anderwald@reactos.org)
8  */
9 
10 #include "precomp.h"
11 
12 const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}};
13 const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
14 const GUID KSPROPSETID_Audio = {0x45FFAAA0L, 0x6E1B, 0x11D0, {0xBC, 0xF2, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
15 
16 
17 VOID
19  PUCHAR Buffer,
22  ULONG OldChannels,
23  ULONG NewChannels,
24  ULONG BitsPerSample,
25  PUCHAR Result,
28 {
29  DWORD NewIndex, OldIndex;
30  DWORD NewLength, Skip;
31 
32  if (NewChannels > OldChannels)
33  {
35  ASSERT(0);
36  }
37 
38  /* setup index */
39  NewIndex = 0;
40  OldIndex = 0;
41 
42  /* calculate offsets */
43  NewLength = NewChannels * (BitsPerSample/8);
44  Skip = OldChannels * (BitsPerSample/8);
45 
46  do
47  {
48  if (NewIndex + NewLength>= ResultLength)
49  {
50  NewIndex = ResultLength;
51  break;
52  }
53 
54  if (OldIndex + Skip >= BufferLength)
55  {
56  OldIndex = BufferLength;
57  break;
58  }
59 
60  /* copy first channel */
61  RtlMoveMemory(&Result[NewIndex], &Buffer[OldIndex], NewLength);
62 
63  /* skip other channels */
64  OldIndex += Skip;
65 
66  /* increment offset */
67  NewIndex += NewLength;
68 
69  }while(TRUE);
70 
71  *BytesRead = OldIndex;
72  *BytesWritten = NewIndex;
73 }
74 
75 
76 BOOL
78  IN HANDLE hPin,
79  IN LPWAVEFORMATEX WaveFormatEx)
80 {
81  DWORD dwResult;
84 
85  /* setup connection request */
89 
90  /* setup data format */
91  DataFormat.WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag;
92  DataFormat.WaveFormatEx.nSamplesPerSec = WaveFormatEx->nSamplesPerSec;
93  DataFormat.WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign;
94  DataFormat.WaveFormatEx.cbSize = 0;
95  DataFormat.DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
96  DataFormat.DataFormat.Flags = 0;
97  DataFormat.DataFormat.Reserved = 0;
98  DataFormat.DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
99  DataFormat.DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
100  DataFormat.DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
101  DataFormat.DataFormat.SampleSize = 4;
102  DataFormat.WaveFormatEx.nChannels = WaveFormatEx->nChannels;
103  DataFormat.WaveFormatEx.nAvgBytesPerSec = WaveFormatEx->nAvgBytesPerSec;
104  DataFormat.WaveFormatEx.wBitsPerSample = WaveFormatEx->wBitsPerSample;
105 
107 
108  if (dwResult == ERROR_SUCCESS)
109  return TRUE;
110  else
111  return FALSE;
112 }
113 
114 
115 BOOL
117  HANDLE hFilter,
118  DWORD PinId,
119  DWORD SampleFrequency,
120  LPWAVEFORMATEX WaveFormatEx,
121  DWORD MinimumBitsPerSample,
122  DWORD MaximumBitsPerSample,
123  DWORD MaximumChannels,
124  LPWAVEFORMATEX WaveFormatOut)
125 {
126  DWORD nChannels, nBitsPerSample;
127  KSDATAFORMAT_WAVEFORMATEX WaveFormat;
128  PKSP_PIN Pin;
129  PKSMULTIPLE_ITEM Item;
131  DWORD dwResult;
132 
133  /* allocate request */
135  if (!Pin)
136  {
137  /* no memory */
138  return FALSE;
139  }
140 
141  Item = (PKSMULTIPLE_ITEM)(Pin + 1);
143 
144  /* setup request */
145  Pin->PinId = PinId;
146  Pin->Property.Flags = KSPROPERTY_TYPE_GET;
147  Pin->Property.Set = KSPROPSETID_Pin;
148  Pin->Property.Id = KSPROPERTY_PIN_DATAINTERSECTION;
149  Item->Count = 1;
150  Item->Size = sizeof(KSDATAFORMAT_WAVEFORMATEX);
151 
152 
153  DataFormat->WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag;
154  DataFormat->WaveFormatEx.nSamplesPerSec = SampleFrequency;
155  DataFormat->WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign;
156  DataFormat->WaveFormatEx.cbSize = 0;
157  DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
158  DataFormat->DataFormat.Flags = 0;
159  DataFormat->DataFormat.Reserved = 0;
160  DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
161  DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
162  DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
163  DataFormat->DataFormat.SampleSize = 4;
164 
165  for(nChannels = 1; nChannels <= 2; nChannels++)
166  {
167  for(nBitsPerSample = MinimumBitsPerSample; nBitsPerSample <= MaximumBitsPerSample; nBitsPerSample += 8)
168  {
169  DataFormat->WaveFormatEx.nChannels = nChannels;
170  DataFormat->WaveFormatEx.nAvgBytesPerSec = (nBitsPerSample / 8) * nChannels * SampleFrequency;
171  DataFormat->WaveFormatEx.wBitsPerSample = nBitsPerSample;
172 
173  DPRINT("CurrentFormat: InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\n",
174  nChannels, nBitsPerSample, SampleFrequency);
175 
177  (LPVOID)&WaveFormat, sizeof(KSDATAFORMAT_WAVEFORMATEX), NULL);
178 
179  DPRINT("dwResult %x\n", dwResult);
180 
181 
182  if (dwResult == ERROR_SUCCESS)
183  {
184  /* found a compatible audio range */
185  WaveFormatOut->cbSize = 0;
186  WaveFormatOut->nBlockAlign = WaveFormatEx->nBlockAlign;
187  WaveFormatOut->wFormatTag = WaveFormatEx->wFormatTag;
188  WaveFormatOut->nAvgBytesPerSec = (nBitsPerSample / 8) * nChannels * SampleFrequency;
189  WaveFormatOut->wBitsPerSample = nBitsPerSample;
190  WaveFormatOut->nSamplesPerSec = SampleFrequency;
191  WaveFormatOut->nChannels = nChannels;
192 
193  /* free buffer */
194  HeapFree(GetProcessHeap(), 0, Pin);
195 
196  DPRINT("InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\nOutFormat nChannels %u nBitsPerSample %u nSamplesPerSec %u\n",
197  WaveFormatEx->nChannels, WaveFormatEx->wBitsPerSample, WaveFormatEx->nSamplesPerSec,
198  WaveFormatOut->nChannels, WaveFormatOut->wBitsPerSample, WaveFormatOut->nSamplesPerSec);
199 
200  return TRUE;
201  }
202  }
203  }
204 
205  /* free buffer */
206  HeapFree(GetProcessHeap(), 0, Pin);
207  ASSERT(0);
208  return FALSE;
209 }
210 
211 DWORD
213  HANDLE hFilter,
214  ULONG PinId,
215  LPWAVEFORMATEX WaveFormatEx,
216  PHANDLE hPin,
217  BOOL bLoop)
218 {
219  DWORD Size, Result;
220  PKSPIN_CONNECT PinConnect;
222 
223  /* calculate request size */
224  Size = sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT_WAVEFORMATEX);
225 
226  PinConnect = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Size);
227  if (!PinConnect)
228  {
229  /* not enough memory */
230  return DSERR_OUTOFMEMORY;
231  }
232  /* build pin request */
234 
235  if (bLoop)
237  else
239 
240  PinConnect->Interface.Flags = 0;
241  PinConnect->Medium.Set = KSMEDIUMSETID_Standard;
242  PinConnect->Medium.Id = KSMEDIUM_TYPE_ANYINSTANCE;
243  PinConnect->Medium.Flags = 0;
244  PinConnect->PinToHandle = NULL;
245  PinConnect->PinId = PinId;
247  PinConnect->Priority.PrioritySubClass = 1;
248 
249  DataFormat = (PKSDATAFORMAT_WAVEFORMATEX) (PinConnect + 1);
250 
251  /* initialize data format */
252  DataFormat->WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag;
253  DataFormat->WaveFormatEx.nChannels = WaveFormatEx->nChannels;
254  DataFormat->WaveFormatEx.nSamplesPerSec = WaveFormatEx->nSamplesPerSec;
255  DataFormat->WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign;
256  DataFormat->WaveFormatEx.nAvgBytesPerSec = WaveFormatEx->nAvgBytesPerSec;
257  DataFormat->WaveFormatEx.wBitsPerSample = WaveFormatEx->wBitsPerSample;
258  DataFormat->WaveFormatEx.cbSize = 0;
259  DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
260  DataFormat->DataFormat.Flags = 0;
261  DataFormat->DataFormat.Reserved = 0;
262  DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
263 
264  DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
265  DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
266  DataFormat->DataFormat.SampleSize = 4;
267 
268  Result = KsCreatePin(hFilter, PinConnect, GENERIC_READ | GENERIC_WRITE, hPin);
269 
270  HeapFree(GetProcessHeap(), 0, PinConnect);
271 
272  return Result;
273 }
274 
275 
276 DWORD
279  IN PHANDLE OutHandle)
280 {
281  HANDLE Handle;
282 
283  /* open the filter */
285 
286  /* check for success */
288  {
289  DPRINT("Failed to open Filter %ws\n", lpFileName);
290  return GetLastError();
291  }
292 
293  *OutHandle = Handle;
294  return ERROR_SUCCESS;
295 }
296 
297 DWORD
299  IN HANDLE Handle,
301  IN LPVOID InBuffer,
303  OUT LPVOID OutBuffer,
305  OUT LPDWORD BytesTransferred OPTIONAL)
306 {
307  OVERLAPPED Overlapped;
308  BOOLEAN IoResult;
309  DWORD Transferred = 0;
310 
311  /* Overlapped I/O is done here - this is used for waiting for completion */
312  ZeroMemory(&Overlapped, sizeof(OVERLAPPED));
313  Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
314 
315  if (!Overlapped.hEvent)
316  return GetLastError();
317 
318  /* Talk to the device */
319  IoResult = DeviceIoControl(Handle,
321  InBuffer,
322  InBufferSize,
323  OutBuffer,
325  BytesTransferred,
326  &Overlapped);
327 
328  /* If failure occurs, make sure it's not just due to the overlapped I/O */
329  if (!IoResult)
330  {
331  if ( GetLastError() != ERROR_IO_PENDING )
332  {
333  CloseHandle(Overlapped.hEvent);
334  return GetLastError();
335  }
336  }
337 
338  /* Wait for the I/O to complete */
339  IoResult = GetOverlappedResult(Handle,
340  &Overlapped,
341  &Transferred,
342  TRUE);
343 
344  /* Don't need this any more */
345  CloseHandle(Overlapped.hEvent);
346 
347  if (!IoResult)
348  return GetLastError();
349 
350  if ( BytesTransferred )
351  *BytesTransferred = Transferred;
352 
353  return ERROR_SUCCESS;
354 }
355 
356 DWORD
358  IN HANDLE hFilter,
359  OUT PULONG NumPins)
360 {
361  KSPROPERTY Pin;
362 
363  *NumPins = 0;
364 
365  /* setup the pin request */
367  Pin.Set = KSPROPSETID_Pin;
369 
370  /* query the device */
371  return SyncOverlappedDeviceIoControl(hFilter, IOCTL_KS_PROPERTY, (LPVOID)&Pin, sizeof(KSPROPERTY), (PVOID)NumPins, sizeof(ULONG), NULL);
372 }
373 
374 DWORD
376  IN HANDLE hFilter,
378  OUT PKSMULTIPLE_ITEM *OutMultipleItem)
379 {
381  PKSMULTIPLE_ITEM MultipleItem;
383 
384  /* setup query request */
385  Property.Id = PropertyId;
388 
389  /* query the size */
391 
392  if (Status != ERROR_MORE_DATA)
393  {
394  /* failed */
395  DPRINT("Failed to query PropertyId %lu ErrorCode %lx\n", PropertyId, Status);
396  return Status;
397  }
398 
399  MultipleItem = HeapAlloc(GetProcessHeap(), 0, BytesReturned);
400  if (!MultipleItem)
401  {
402  /* not enough memory */
403  DPRINT("Failed to allocate %u Bytes\n", BytesReturned);
404  return ERROR_OUTOFMEMORY;
405  }
406 
407  /* retrieve data ranges */
409 
410 
411  if (Status != ERROR_SUCCESS)
412  {
413  /* failed to get data ranges */
414  DPRINT("SyncOverlappedDeviceIoControl failed with %lx\n", Status);
415 
416  HeapFree(GetProcessHeap(), 0, MultipleItem);
417  return Status;
418  }
419 
420  /* save result */
421  *OutMultipleItem = MultipleItem;
422  return Status;
423 
424 }
425 
426 DWORD
428  IN HANDLE hFilter,
429  IN ULONG PinId,
430  OUT PKSPIN_COMMUNICATION Communication)
431 {
433 
437  Property.PinId = PinId;
438  Property.Reserved = 0;
439 
440  return SyncOverlappedDeviceIoControl(hFilter, IOCTL_KS_PROPERTY, (LPVOID)&Property, sizeof(KSP_PIN), (LPVOID)Communication, sizeof(KSPIN_COMMUNICATION), NULL);
441 }
442 
443 DWORD
445  IN HANDLE hFilter,
446  IN ULONG PinId,
448 {
450 
454  Property.PinId = PinId;
455  Property.Reserved = 0;
456 
458 }
459 
460 DWORD
462  IN HANDLE hFilter,
463  IN ULONG PinId,
464  IN OUT PKSMULTIPLE_ITEM * OutMultipleItem)
465 {
467  ULONG BytesReturned = 0;
468  DWORD Status;
469  PKSMULTIPLE_ITEM MultipleItem;
470 
471  /* prepare request */
472  Property.Reserved = 0;
473  Property.PinId = PinId;
477 
478  /* retrieve size of data ranges buffer */
480 
481 #if 0
482  if (Status != ERROR_MORE_DATA)
483  {
484  DPRINT("SyncOverlappedDeviceIoControl failed with %lx\n", Status);
485  return Status;
486  }
487 #endif
488 
490  MultipleItem = HeapAlloc(GetProcessHeap(), 0, BytesReturned);
491  if (!MultipleItem)
492  {
493  /* not enough memory */
494  DPRINT("Failed to allocate %u Bytes\n", BytesReturned);
495  return ERROR_OUTOFMEMORY;
496  }
497 
498  /* retrieve data ranges */
500 
501 
502  if (Status != ERROR_SUCCESS)
503  {
504  /* failed to get data ranges */
505  DPRINT("SyncOverlappedDeviceIoControl failed with %lx\n", Status);
506 
507  HeapFree(GetProcessHeap(), 0, MultipleItem);
508  return Status;
509  }
510 
511  /* save result */
512  *OutMultipleItem = MultipleItem;
513  return Status;
514 }
515 
516 BOOL
518  IN HANDLE hFilter,
519  IN DWORD PinId,
520  IN BOOL bLoop,
521  IN LPWAVEFORMATEX WaveFormatEx,
522  OUT LPWAVEFORMATEX WaveFormatOut,
523  OUT PHANDLE hPin)
524 {
525  PKSMULTIPLE_ITEM Item = NULL;
526  PKSDATARANGE_AUDIO AudioRange;
527  DWORD dwResult;
528  DWORD dwIndex, nChannels;
529 
530  dwResult = GetFilterPinDataRanges(hFilter, PinId, &Item);
531 
532  if (dwResult != ERROR_SUCCESS)
533  {
534  /* failed to get data ranges */
535  return FALSE;
536  }
537 
538  CopyMemory(WaveFormatOut, WaveFormatEx, sizeof(WAVEFORMATEX));
539 
540  /* iterate through all dataranges */
541  AudioRange = (PKSDATARANGE_AUDIO)(Item + 1);
542  for(dwIndex = 0; dwIndex < Item->Count; dwIndex++)
543  {
544  if (AudioRange->DataRange.FormatSize != sizeof(KSDATARANGE_AUDIO))
545  {
547  AudioRange = (PKSDATARANGE_AUDIO)((PUCHAR)AudioRange + AudioRange->DataRange.FormatSize);
548  continue;
549  }
550 
551  if (WaveFormatOut->nSamplesPerSec < AudioRange->MinimumSampleFrequency)
552  WaveFormatOut->nSamplesPerSec = AudioRange->MinimumSampleFrequency;
553  else if (WaveFormatOut->nSamplesPerSec > AudioRange->MaximumSampleFrequency)
554  WaveFormatOut->nSamplesPerSec = AudioRange->MaximumSampleFrequency;
555 
556  if (WaveFormatOut->wBitsPerSample < AudioRange->MinimumBitsPerSample)
557  WaveFormatOut->wBitsPerSample = AudioRange->MinimumBitsPerSample;
558  else if (WaveFormatOut->wBitsPerSample > AudioRange->MaximumBitsPerSample)
559  WaveFormatOut->wBitsPerSample = AudioRange->MaximumBitsPerSample;
560 
561  DPRINT("MinimumBitsPerSample %u MaximumBitsPerSample %u MinimumSampleFrequency %u MaximumSampleFrequency %u\n",
562  AudioRange->MinimumBitsPerSample, AudioRange->MaximumBitsPerSample, AudioRange->MinimumSampleFrequency, AudioRange->MaximumSampleFrequency);
563 
564  for(nChannels = 1; nChannels <= AudioRange->MaximumChannels; nChannels++)
565  {
566  WaveFormatOut->nChannels = nChannels;
567 
568  dwResult = OpenPin(hFilter, PinId, WaveFormatOut, hPin, TRUE);
569  if (dwResult == ERROR_SUCCESS)
570  {
571  DPRINT("InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\nOutFormat nChannels %u nBitsPerSample %u nSamplesPerSec %u\n",
572  WaveFormatEx->nChannels, WaveFormatEx->wBitsPerSample, WaveFormatEx->nSamplesPerSec,
573  WaveFormatOut->nChannels, WaveFormatOut->wBitsPerSample, WaveFormatOut->nSamplesPerSec);
574 
575 
576  /* free buffer */
577  HeapFree(GetProcessHeap(), 0, Item);
578  return TRUE;
579  }
580  }
581  AudioRange = (PKSDATARANGE_AUDIO)((PUCHAR)AudioRange + AudioRange->DataRange.FormatSize);
582  }
583 
584  /* free buffer */
585  HeapFree(GetProcessHeap(), 0, Item);
586  return FALSE;
587 }
588 
#define CreateEvent
Definition: winbase.h:3565
ULONG Count
Definition: ks.h:1980
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define IOCTL_KS_PROPERTY
Definition: ks.h:127
#define IN
Definition: typedefs.h:38
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
#define TRUE
Definition: types.h:120
KSPIN_INTERFACE Interface
Definition: ks.h:2601
#define CloseHandle
Definition: compat.h:398
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:921
KSPIN_MEDIUM Medium
Definition: ks.h:2602
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
#define ERROR_SUCCESS
Definition: deptool.c:10
KSDDKAPI DWORD NTAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle)
Definition: ksuser.c:192
ULONG Size
Definition: ks.h:1979
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define KSPRIORITY_NORMAL
Definition: ks.h:1386
_In_ PSTORAGE_PROPERTY_ID PropertyId
Definition: classpnp.h:966
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:204
const GUID KSPROPSETID_Topology
Definition: misc.c:13
DWORD GetFilterPinCommunication(IN HANDLE hFilter, IN ULONG PinId, OUT PKSPIN_COMMUNICATION Communication)
Definition: misc.c:427
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
ULONG MaximumBitsPerSample
Definition: ksmedia.h:582
unsigned char * PUCHAR
Definition: retypes.h:3
WORD nChannels
Definition: mmreg.h:79
#define KSINTERFACESETID_Standard
Definition: ks.h:280
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG OutBufferSize
Definition: classpnp.h:429
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
ULONG PriorityClass
Definition: ks.h:1391
#define KSMEDIUMSETID_Standard
Definition: ks.h:306
#define ERROR_IO_PENDING
Definition: dderror.h:15
int nChannels
Definition: pcmconverter.c:96
#define KSPROPERTY_TYPE_GET
Definition: dmksctrl.h:42
GUID Set
Definition: dmksctrl.h:76
#define KSPROPSETID_Connection
Definition: ks.h:346
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define KSDATAFORMAT_SPECIFIER_WAVEFORMATEX
Definition: ksmedia.h:931
static USHORT USHORT * NewLength
BOOL DoDataIntersection(HANDLE hFilter, DWORD PinId, DWORD SampleFrequency, LPWAVEFORMATEX WaveFormatEx, DWORD MinimumBitsPerSample, DWORD MaximumBitsPerSample, DWORD MaximumChannels, LPWAVEFORMATEX WaveFormatOut)
Definition: misc.c:116
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
ULONG PinId
Definition: ks.h:2603
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE PinToHandle
Definition: ks.h:2604
_In_ ULONG BufferLength
Definition: usbdlib.h:225
#define GENERIC_WRITE
Definition: nt_native.h:90
KSDATARANGE DataRange
Definition: ksmedia.h:579
HANDLE hEvent
Definition: winbase.h:792
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
enum KSPIN_COMMUNICATION * PKSPIN_COMMUNICATION
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
#define OPEN_EXISTING
Definition: compat.h:426
KSPIN_DATAFLOW
Definition: ks.h:1248
ULONG PrioritySubClass
Definition: ks.h:1392
DWORD OpenPin(HANDLE hFilter, ULONG PinId, LPWAVEFORMATEX WaveFormatEx, PHANDLE hPin, BOOL bLoop)
Definition: misc.c:212
_In_ HANDLE Handle
Definition: extypes.h:390
_In_ PIRP _In_ ULONG _In_ ULONG _In_ ULONG InBufferSize
Definition: classpnp.h:429
#define GetProcessHeap()
Definition: compat.h:395
Definition: ks.h:642
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
ULONG Id
Definition: dmksctrl.h:77
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:415
DWORD GetFilterPinCount(IN HANDLE hFilter, OUT PULONG NumPins)
Definition: misc.c:357
ULONG MinimumSampleFrequency
Definition: ksmedia.h:583
#define CopyMemory
Definition: winbase.h:1633
BOOL CreateCompatiblePin(IN HANDLE hFilter, IN DWORD PinId, IN BOOL bLoop, IN LPWAVEFORMATEX WaveFormatEx, OUT LPWAVEFORMATEX WaveFormatOut, OUT PHANDLE hPin)
Definition: misc.c:517
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG MaximumChannels
Definition: ksmedia.h:580
struct KSDATARANGE_AUDIO * PKSDATARANGE_AUDIO
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG Flags
Definition: ntfs.h:532
WORD wFormatTag
Definition: mmreg.h:78
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
ULONG Flags
Definition: dmksctrl.h:78
static const WCHAR L[]
Definition: oid.c:1250
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
DWORD SyncOverlappedDeviceIoControl(IN HANDLE Handle, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, OUT LPVOID OutBuffer, IN DWORD OutBufferSize, OUT LPDWORD BytesTransferred OPTIONAL)
Definition: misc.c:298
struct KSMULTIPLE_ITEM * PKSMULTIPLE_ITEM
#define GENERIC_READ
Definition: compat.h:124
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define KSDATAFORMAT_TYPE_AUDIO
Definition: ksmedia.h:883
#define ERROR_MORE_DATA
Definition: dderror.h:13
Status
Definition: gdiplustypes.h:24
_In_ DWORD Property
Definition: setupapi.h:1545
struct KSDATAFORMAT_WAVEFORMATEX * PKSDATAFORMAT_WAVEFORMATEX
KSPIN_COMMUNICATION
Definition: ks.h:1253
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define KSMEDIUM_TYPE_ANYINSTANCE
Definition: ks.h:301
ULONG MaximumSampleFrequency
Definition: ksmedia.h:584
WORD cbSize
Definition: mmreg.h:84
_In_ FILTER_INFORMATION_CLASS _In_ ULONG _Out_ PULONG BytesReturned
Definition: fltkernel.h:1716
unsigned int * PULONG
Definition: retypes.h:1
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CreateFileW
Definition: compat.h:400
ULONG MinimumBitsPerSample
Definition: ksmedia.h:581
const GUID KSPROPSETID_Pin
Definition: misc.c:12
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nBlockAlign
Definition: mmreg.h:82
#define OUT
Definition: typedefs.h:39
uint32_t * LPDWORD
Definition: typedefs.h:57
WORD wBitsPerSample
Definition: mmreg.h:83
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
KSPRIORITY Priority
Definition: ks.h:2605
DWORD GetFilterPinDataRanges(IN HANDLE hFilter, IN ULONG PinId, IN OUT PKSMULTIPLE_ITEM *OutMultipleItem)
Definition: misc.c:461
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
DataFlow
DWORD OpenFilter(IN LPCWSTR lpFileName, IN PHANDLE OutHandle)
Definition: misc.c:277
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
DWORD GetFilterNodeProperty(IN HANDLE hFilter, IN ULONG PropertyId, OUT PKSMULTIPLE_ITEM *OutMultipleItem)
Definition: misc.c:375
Property(long _type, long _tag, INREAL _value)
Definition: reader.h:125
#define HeapFree(x, y, z)
Definition: compat.h:394
enum KSPIN_DATAFLOW * PKSPIN_DATAFLOW
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
BOOL SetPinFormat(IN HANDLE hPin, IN LPWAVEFORMATEX WaveFormatEx)
Definition: misc.c:77
_In_ LPCSTR lpFileName
Definition: winbase.h:3011
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
const GUID KSPROPSETID_Audio
Definition: misc.c:14
DWORD GetFilterPinDataFlow(IN HANDLE hFilter, IN ULONG PinId, OUT PKSPIN_DATAFLOW DataFlow)
Definition: misc.c:444
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
VOID PerformChannelConversion(PUCHAR Buffer, ULONG BufferLength, PULONG BytesRead, ULONG OldChannels, ULONG NewChannels, ULONG BitsPerSample, PUCHAR Result, ULONG ResultLength, PULONG BytesWritten)
Definition: misc.c:18