ReactOS  0.4.13-dev-479-gec9c8fd
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 Samples;
30  DWORD NewIndex, OldIndex;
31  DWORD NewLength, Skip;
32 
33  Samples = BufferLength / (BitsPerSample / 8) / OldChannels;
34 
35  if (NewChannels > OldChannels)
36  {
38  ASSERT(0);
39  }
40 
41  /* setup index */
42  NewIndex = 0;
43  OldIndex = 0;
44 
45  /* calculate offsets */
46  NewLength = NewChannels * (BitsPerSample/8);
47  Skip = OldChannels * (BitsPerSample/8);
48 
49  do
50  {
51  if (NewIndex + NewLength>= ResultLength)
52  {
53  NewIndex = ResultLength;
54  break;
55  }
56 
57  if (OldIndex + Skip >= BufferLength)
58  {
59  OldIndex = BufferLength;
60  break;
61  }
62 
63  /* copy first channel */
64  RtlMoveMemory(&Result[NewIndex], &Buffer[OldIndex], NewLength);
65 
66  /* skip other channels */
67  OldIndex += Skip;
68 
69  /* increment offset */
70  NewIndex += NewLength;
71 
72  }while(TRUE);
73 
74  *BytesRead = OldIndex;
75  *BytesWritten = NewIndex;
76 }
77 
78 
79 BOOL
81  IN HANDLE hPin,
82  IN LPWAVEFORMATEX WaveFormatEx)
83 {
84  DWORD dwResult;
87 
88  /* setup connection request */
92 
93  /* setup data format */
94  DataFormat.WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag;
95  DataFormat.WaveFormatEx.nSamplesPerSec = WaveFormatEx->nSamplesPerSec;
96  DataFormat.WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign;
97  DataFormat.WaveFormatEx.cbSize = 0;
98  DataFormat.DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
99  DataFormat.DataFormat.Flags = 0;
100  DataFormat.DataFormat.Reserved = 0;
101  DataFormat.DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
102  DataFormat.DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
103  DataFormat.DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
104  DataFormat.DataFormat.SampleSize = 4;
105  DataFormat.WaveFormatEx.nChannels = WaveFormatEx->nChannels;
106  DataFormat.WaveFormatEx.nAvgBytesPerSec = WaveFormatEx->nAvgBytesPerSec;
107  DataFormat.WaveFormatEx.wBitsPerSample = WaveFormatEx->wBitsPerSample;
108 
110 
111  if (dwResult == ERROR_SUCCESS)
112  return TRUE;
113  else
114  return FALSE;
115 }
116 
117 
118 BOOL
120  HANDLE hFilter,
121  DWORD PinId,
122  DWORD SampleFrequency,
123  LPWAVEFORMATEX WaveFormatEx,
124  DWORD MinimumBitsPerSample,
125  DWORD MaximumBitsPerSample,
126  DWORD MaximumChannels,
127  LPWAVEFORMATEX WaveFormatOut)
128 {
129  DWORD nChannels, nBitsPerSample;
130  KSDATAFORMAT_WAVEFORMATEX WaveFormat;
131  PKSP_PIN Pin;
132  PKSMULTIPLE_ITEM Item;
134  DWORD dwResult;
135 
136  /* allocate request */
138  if (!Pin)
139  {
140  /* no memory */
141  return FALSE;
142  }
143 
144  Item = (PKSMULTIPLE_ITEM)(Pin + 1);
146 
147  /* setup request */
148  Pin->PinId = PinId;
149  Pin->Property.Flags = KSPROPERTY_TYPE_GET;
150  Pin->Property.Set = KSPROPSETID_Pin;
151  Pin->Property.Id = KSPROPERTY_PIN_DATAINTERSECTION;
152  Item->Count = 1;
153  Item->Size = sizeof(KSDATAFORMAT_WAVEFORMATEX);
154 
155 
156  DataFormat->WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag;
157  DataFormat->WaveFormatEx.nSamplesPerSec = SampleFrequency;
158  DataFormat->WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign;
159  DataFormat->WaveFormatEx.cbSize = 0;
160  DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
161  DataFormat->DataFormat.Flags = 0;
162  DataFormat->DataFormat.Reserved = 0;
163  DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
164  DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
165  DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
166  DataFormat->DataFormat.SampleSize = 4;
167 
168  for(nChannels = 1; nChannels <= 2; nChannels++)
169  {
170  for(nBitsPerSample = MinimumBitsPerSample; nBitsPerSample <= MaximumBitsPerSample; nBitsPerSample += 8)
171  {
172  DataFormat->WaveFormatEx.nChannels = nChannels;
173  DataFormat->WaveFormatEx.nAvgBytesPerSec = (nBitsPerSample / 8) * nChannels * SampleFrequency;
174  DataFormat->WaveFormatEx.wBitsPerSample = nBitsPerSample;
175 
176  DPRINT("CurrentFormat: InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\n",
177  nChannels, nBitsPerSample, SampleFrequency);
178 
180  (LPVOID)&WaveFormat, sizeof(KSDATAFORMAT_WAVEFORMATEX), NULL);
181 
182  DPRINT("dwResult %x\n", dwResult);
183 
184 
185  if (dwResult == ERROR_SUCCESS)
186  {
187  /* found a compatible audio range */
188  WaveFormatOut->cbSize = 0;
189  WaveFormatOut->nBlockAlign = WaveFormatEx->nBlockAlign;
190  WaveFormatOut->wFormatTag = WaveFormatEx->wFormatTag;
191  WaveFormatOut->nAvgBytesPerSec = (nBitsPerSample / 8) * nChannels * SampleFrequency;
192  WaveFormatOut->wBitsPerSample = nBitsPerSample;
193  WaveFormatOut->nSamplesPerSec = SampleFrequency;
194  WaveFormatOut->nChannels = nChannels;
195 
196  /* free buffer */
197  HeapFree(GetProcessHeap(), 0, Pin);
198 
199  DPRINT("InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\nOutFormat nChannels %u nBitsPerSample %u nSamplesPerSec %u\n",
200  WaveFormatEx->nChannels, WaveFormatEx->wBitsPerSample, WaveFormatEx->nSamplesPerSec,
201  WaveFormatOut->nChannels, WaveFormatOut->wBitsPerSample, WaveFormatOut->nSamplesPerSec);
202 
203  return TRUE;
204  }
205  }
206  }
207 
208  /* free buffer */
209  HeapFree(GetProcessHeap(), 0, Pin);
210  ASSERT(0);
211  return FALSE;
212 }
213 
214 DWORD
216  HANDLE hFilter,
217  ULONG PinId,
218  LPWAVEFORMATEX WaveFormatEx,
219  PHANDLE hPin,
220  BOOL bLoop)
221 {
222  DWORD Size, Result;
223  PKSPIN_CONNECT PinConnect;
225 
226  /* calculate request size */
227  Size = sizeof(KSPIN_CONNECT) + sizeof(KSDATAFORMAT_WAVEFORMATEX);
228 
229  PinConnect = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Size);
230  if (!PinConnect)
231  {
232  /* not enough memory */
233  return DSERR_OUTOFMEMORY;
234  }
235  /* build pin request */
237 
238  if (bLoop)
240  else
242 
243  PinConnect->Interface.Flags = 0;
244  PinConnect->Medium.Set = KSMEDIUMSETID_Standard;
245  PinConnect->Medium.Id = KSMEDIUM_TYPE_ANYINSTANCE;
246  PinConnect->Medium.Flags = 0;
247  PinConnect->PinToHandle = NULL;
248  PinConnect->PinId = PinId;
250  PinConnect->Priority.PrioritySubClass = 1;
251 
252  DataFormat = (PKSDATAFORMAT_WAVEFORMATEX) (PinConnect + 1);
253 
254  /* initialize data format */
255  DataFormat->WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag;
256  DataFormat->WaveFormatEx.nChannels = WaveFormatEx->nChannels;
257  DataFormat->WaveFormatEx.nSamplesPerSec = WaveFormatEx->nSamplesPerSec;
258  DataFormat->WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign;
259  DataFormat->WaveFormatEx.nAvgBytesPerSec = WaveFormatEx->nAvgBytesPerSec;
260  DataFormat->WaveFormatEx.wBitsPerSample = WaveFormatEx->wBitsPerSample;
261  DataFormat->WaveFormatEx.cbSize = 0;
262  DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
263  DataFormat->DataFormat.Flags = 0;
264  DataFormat->DataFormat.Reserved = 0;
265  DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
266 
267  DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
268  DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
269  DataFormat->DataFormat.SampleSize = 4;
270 
271  Result = KsCreatePin(hFilter, PinConnect, GENERIC_READ | GENERIC_WRITE, hPin);
272 
273  HeapFree(GetProcessHeap(), 0, PinConnect);
274 
275  return Result;
276 }
277 
278 
279 DWORD
282  IN PHANDLE OutHandle)
283 {
284  HANDLE Handle;
285 
286  /* open the filter */
288 
289  /* check for success */
291  {
292  DPRINT("Failed to open Filter %ws\n", lpFileName);
293  return GetLastError();
294  }
295 
296  *OutHandle = Handle;
297  return ERROR_SUCCESS;
298 }
299 
300 DWORD
302  IN HANDLE Handle,
304  IN LPVOID InBuffer,
306  OUT LPVOID OutBuffer,
308  OUT LPDWORD BytesTransferred OPTIONAL)
309 {
310  OVERLAPPED Overlapped;
311  BOOLEAN IoResult;
312  DWORD Transferred = 0;
313 
314  /* Overlapped I/O is done here - this is used for waiting for completion */
315  ZeroMemory(&Overlapped, sizeof(OVERLAPPED));
316  Overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
317 
318  if (!Overlapped.hEvent)
319  return GetLastError();
320 
321  /* Talk to the device */
322  IoResult = DeviceIoControl(Handle,
324  InBuffer,
325  InBufferSize,
326  OutBuffer,
328  BytesTransferred,
329  &Overlapped);
330 
331  /* If failure occurs, make sure it's not just due to the overlapped I/O */
332  if (!IoResult)
333  {
334  if ( GetLastError() != ERROR_IO_PENDING )
335  {
336  CloseHandle(Overlapped.hEvent);
337  return GetLastError();
338  }
339  }
340 
341  /* Wait for the I/O to complete */
342  IoResult = GetOverlappedResult(Handle,
343  &Overlapped,
344  &Transferred,
345  TRUE);
346 
347  /* Don't need this any more */
348  CloseHandle(Overlapped.hEvent);
349 
350  if (!IoResult)
351  return GetLastError();
352 
353  if ( BytesTransferred )
354  *BytesTransferred = Transferred;
355 
356  return ERROR_SUCCESS;
357 }
358 
359 DWORD
361  IN HANDLE hFilter,
362  OUT PULONG NumPins)
363 {
364  KSPROPERTY Pin;
365 
366  *NumPins = 0;
367 
368  /* setup the pin request */
370  Pin.Set = KSPROPSETID_Pin;
372 
373  /* query the device */
374  return SyncOverlappedDeviceIoControl(hFilter, IOCTL_KS_PROPERTY, (LPVOID)&Pin, sizeof(KSPROPERTY), (PVOID)NumPins, sizeof(ULONG), NULL);
375 }
376 
377 DWORD
379  IN HANDLE hFilter,
381  OUT PKSMULTIPLE_ITEM *OutMultipleItem)
382 {
384  PKSMULTIPLE_ITEM MultipleItem;
386 
387  /* setup query request */
388  Property.Id = PropertyId;
391 
392  /* query the size */
394 
395  if (Status != ERROR_MORE_DATA)
396  {
397  /* failed */
398  DPRINT("Failed to query PropertyId %lu ErrorCode %lx\n", PropertyId, Status);
399  return Status;
400  }
401 
402  MultipleItem = HeapAlloc(GetProcessHeap(), 0, BytesReturned);
403  if (!MultipleItem)
404  {
405  /* not enough memory */
406  DPRINT("Failed to allocate %u Bytes\n", BytesReturned);
407  return ERROR_OUTOFMEMORY;
408  }
409 
410  /* retrieve data ranges */
412 
413 
414  if (Status != ERROR_SUCCESS)
415  {
416  /* failed to get data ranges */
417  DPRINT("SyncOverlappedDeviceIoControl failed with %lx\n", Status);
418 
419  HeapFree(GetProcessHeap(), 0, MultipleItem);
420  return Status;
421  }
422 
423  /* save result */
424  *OutMultipleItem = MultipleItem;
425  return Status;
426 
427 }
428 
429 DWORD
431  IN HANDLE hFilter,
432  IN ULONG PinId,
433  OUT PKSPIN_COMMUNICATION Communication)
434 {
436 
440  Property.PinId = PinId;
441  Property.Reserved = 0;
442 
443  return SyncOverlappedDeviceIoControl(hFilter, IOCTL_KS_PROPERTY, (LPVOID)&Property, sizeof(KSP_PIN), (LPVOID)Communication, sizeof(KSPIN_COMMUNICATION), NULL);
444 }
445 
446 DWORD
448  IN HANDLE hFilter,
449  IN ULONG PinId,
451 {
453 
457  Property.PinId = PinId;
458  Property.Reserved = 0;
459 
461 }
462 
463 DWORD
465  IN HANDLE hFilter,
466  IN ULONG PinId,
467  IN OUT PKSMULTIPLE_ITEM * OutMultipleItem)
468 {
470  ULONG BytesReturned = 0;
471  DWORD Status;
472  PKSMULTIPLE_ITEM MultipleItem;
473 
474  /* prepare request */
475  Property.Reserved = 0;
476  Property.PinId = PinId;
480 
481  /* retrieve size of data ranges buffer */
483 
484 #if 0
485  if (Status != ERROR_MORE_DATA)
486  {
487  DPRINT("SyncOverlappedDeviceIoControl failed with %lx\n", Status);
488  return Status;
489  }
490 #endif
491 
493  MultipleItem = HeapAlloc(GetProcessHeap(), 0, BytesReturned);
494  if (!MultipleItem)
495  {
496  /* not enough memory */
497  DPRINT("Failed to allocate %u Bytes\n", BytesReturned);
498  return ERROR_OUTOFMEMORY;
499  }
500 
501  /* retrieve data ranges */
503 
504 
505  if (Status != ERROR_SUCCESS)
506  {
507  /* failed to get data ranges */
508  DPRINT("SyncOverlappedDeviceIoControl failed with %lx\n", Status);
509 
510  HeapFree(GetProcessHeap(), 0, MultipleItem);
511  return Status;
512  }
513 
514  /* save result */
515  *OutMultipleItem = MultipleItem;
516  return Status;
517 }
518 
519 BOOL
521  IN HANDLE hFilter,
522  IN DWORD PinId,
523  IN BOOL bLoop,
524  IN LPWAVEFORMATEX WaveFormatEx,
525  OUT LPWAVEFORMATEX WaveFormatOut,
526  OUT PHANDLE hPin)
527 {
528  PKSMULTIPLE_ITEM Item = NULL;
529  PKSDATARANGE_AUDIO AudioRange;
530  DWORD dwResult;
531  DWORD dwIndex, nChannels;
532 
533  dwResult = GetFilterPinDataRanges(hFilter, PinId, &Item);
534 
535  if (dwResult != ERROR_SUCCESS)
536  {
537  /* failed to get data ranges */
538  return FALSE;
539  }
540 
541  CopyMemory(WaveFormatOut, WaveFormatEx, sizeof(WAVEFORMATEX));
542 
543  /* iterate through all dataranges */
544  AudioRange = (PKSDATARANGE_AUDIO)(Item + 1);
545  for(dwIndex = 0; dwIndex < Item->Count; dwIndex++)
546  {
547  if (AudioRange->DataRange.FormatSize != sizeof(KSDATARANGE_AUDIO))
548  {
550  AudioRange = (PKSDATARANGE_AUDIO)((PUCHAR)AudioRange + AudioRange->DataRange.FormatSize);
551  continue;
552  }
553 
554  if (WaveFormatOut->nSamplesPerSec < AudioRange->MinimumSampleFrequency)
555  WaveFormatOut->nSamplesPerSec = AudioRange->MinimumSampleFrequency;
556  else if (WaveFormatOut->nSamplesPerSec > AudioRange->MaximumSampleFrequency)
557  WaveFormatOut->nSamplesPerSec = AudioRange->MaximumSampleFrequency;
558 
559  if (WaveFormatOut->wBitsPerSample < AudioRange->MinimumBitsPerSample)
560  WaveFormatOut->wBitsPerSample = AudioRange->MinimumBitsPerSample;
561  else if (WaveFormatOut->wBitsPerSample > AudioRange->MaximumBitsPerSample)
562  WaveFormatOut->wBitsPerSample = AudioRange->MaximumBitsPerSample;
563 
564  DPRINT("MinimumBitsPerSample %u MaximumBitsPerSample %u MinimumSampleFrequency %u MaximumSampleFrequency %u\n",
565  AudioRange->MinimumBitsPerSample, AudioRange->MaximumBitsPerSample, AudioRange->MinimumSampleFrequency, AudioRange->MaximumSampleFrequency);
566 
567  for(nChannels = 1; nChannels <= AudioRange->MaximumChannels; nChannels++)
568  {
569  WaveFormatOut->nChannels = nChannels;
570 
571  dwResult = OpenPin(hFilter, PinId, WaveFormatOut, hPin, TRUE);
572  if (dwResult == ERROR_SUCCESS)
573  {
574  DPRINT("InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\nOutFormat nChannels %u nBitsPerSample %u nSamplesPerSec %u\n",
575  WaveFormatEx->nChannels, WaveFormatEx->wBitsPerSample, WaveFormatEx->nSamplesPerSec,
576  WaveFormatOut->nChannels, WaveFormatOut->wBitsPerSample, WaveFormatOut->nSamplesPerSec);
577 
578 
579  /* free buffer */
580  HeapFree(GetProcessHeap(), 0, Item);
581  return TRUE;
582  }
583  }
584  AudioRange = (PKSDATARANGE_AUDIO)((PUCHAR)AudioRange + AudioRange->DataRange.FormatSize);
585  }
586 
587  /* free buffer */
588  HeapFree(GetProcessHeap(), 0, Item);
589  return FALSE;
590 }
591 
#define CreateEvent
Definition: winbase.h:3562
ULONG Count
Definition: ks.h:2010
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define IOCTL_KS_PROPERTY
Definition: ks.h:150
#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:2630
#define CloseHandle
Definition: compat.h:398
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:921
KSPIN_MEDIUM Medium
Definition: ks.h:2631
_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:2009
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define KSPRIORITY_NORMAL
Definition: ks.h:1416
_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:430
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:310
_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:1421
#define KSMEDIUMSETID_Standard
Definition: ks.h:336
#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:376
#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:119
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
ULONG PinId
Definition: ks.h:2632
unsigned int BOOL
Definition: ntddk_ex.h:94
HANDLE PinToHandle
Definition: ks.h:2633
_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:1278
ULONG PrioritySubClass
Definition: ks.h:1422
DWORD OpenPin(HANDLE hFilter, ULONG PinId, LPWAVEFORMATEX WaveFormatEx, PHANDLE hPin, BOOL bLoop)
Definition: misc.c:215
_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:672
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:360
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:520
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:520
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:301
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:1283
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:331
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:2634
DWORD GetFilterPinDataRanges(IN HANDLE hFilter, IN ULONG PinId, IN OUT PKSMULTIPLE_ITEM *OutMultipleItem)
Definition: misc.c:464
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
DataFlow
DWORD OpenFilter(IN LPCWSTR lpFileName, IN PHANDLE OutHandle)
Definition: misc.c:280
#define KSPROPERTY_TYPE_SET
Definition: dmksctrl.h:43
DWORD GetFilterNodeProperty(IN HANDLE hFilter, IN ULONG PropertyId, OUT PKSMULTIPLE_ITEM *OutMultipleItem)
Definition: misc.c:378
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:80
_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:447
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