12const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}};
13const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
14const GUID KSPROPSETID_Audio = {0x45FFAAA0L, 0x6E1B, 0x11D0, {0xBC, 0xF2, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}};
29 DWORD NewIndex, OldIndex;
32 if (NewChannels > OldChannels)
43 NewLength = NewChannels * (BitsPerSample/8);
44 Skip = OldChannels * (BitsPerSample/8);
91 DataFormat.WaveFormatEx.wFormatTag = WaveFormatEx->wFormatTag;
92 DataFormat.WaveFormatEx.nSamplesPerSec = WaveFormatEx->nSamplesPerSec;
93 DataFormat.WaveFormatEx.nBlockAlign = WaveFormatEx->nBlockAlign;
102 DataFormat.WaveFormatEx.nChannels = WaveFormatEx->nChannels;
103 DataFormat.WaveFormatEx.nAvgBytesPerSec = WaveFormatEx->nAvgBytesPerSec;
104 DataFormat.WaveFormatEx.wBitsPerSample = WaveFormatEx->wBitsPerSample;
119 DWORD SampleFrequency,
121 DWORD MinimumBitsPerSample,
122 DWORD MaximumBitsPerSample,
123 DWORD MaximumChannels,
154 DataFormat->WaveFormatEx.nSamplesPerSec = SampleFrequency;
167 for(nBitsPerSample = MinimumBitsPerSample; nBitsPerSample <= MaximumBitsPerSample; nBitsPerSample += 8)
170 DataFormat->WaveFormatEx.nAvgBytesPerSec = (nBitsPerSample / 8) *
nChannels * SampleFrequency;
171 DataFormat->WaveFormatEx.wBitsPerSample = nBitsPerSample;
173 DPRINT(
"CurrentFormat: InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\n",
174 nChannels, nBitsPerSample, SampleFrequency);
179 DPRINT(
"dwResult %x\n", dwResult);
185 WaveFormatOut->
cbSize = 0;
196 DPRINT(
"InFormat nChannels %u wBitsPerSample %u nSamplesPerSec %u\nOutFormat nChannels %u nBitsPerSample %u nSamplesPerSec %u\n",
245 PinConnect->
PinId = PinId;
309 DWORD Transferred = 0;
414 DPRINT(
"SyncOverlappedDeviceIoControl failed with %lx\n",
Status);
421 *OutMultipleItem = MultipleItem;
484 DPRINT(
"SyncOverlappedDeviceIoControl failed with %lx\n",
Status);
505 DPRINT(
"SyncOverlappedDeviceIoControl failed with %lx\n",
Status);
512 *OutMultipleItem = MultipleItem;
542 for(dwIndex = 0; dwIndex <
Item->Count; dwIndex++)
561 DPRINT(
"MinimumBitsPerSample %u MaximumBitsPerSample %u MinimumSampleFrequency %u MaximumSampleFrequency %u\n",
568 dwResult =
OpenPin(hFilter, PinId, WaveFormatOut, hPin,
TRUE);
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);
static USHORT USHORT * NewLength
_In_ PSTORAGE_PROPERTY_ID PropertyId
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)
const GUID KSPROPSETID_Audio
const GUID KSPROPSETID_Pin
DWORD SyncOverlappedDeviceIoControl(IN HANDLE Handle, IN DWORD IoControlCode, IN LPVOID InBuffer, IN DWORD InBufferSize, OUT LPVOID OutBuffer, IN DWORD OutBufferSize, OUT LPDWORD BytesTransferred OPTIONAL)
DWORD GetFilterPinCommunication(IN HANDLE hFilter, IN ULONG PinId, OUT PKSPIN_COMMUNICATION Communication)
DWORD GetFilterPinDataRanges(IN HANDLE hFilter, IN ULONG PinId, IN OUT PKSMULTIPLE_ITEM *OutMultipleItem)
VOID PerformChannelConversion(PUCHAR Buffer, ULONG BufferLength, PULONG BytesRead, ULONG OldChannels, ULONG NewChannels, ULONG BitsPerSample, PUCHAR Result, ULONG ResultLength, PULONG BytesWritten)
DWORD OpenPin(HANDLE hFilter, ULONG PinId, LPWAVEFORMATEX WaveFormatEx, PHANDLE hPin, BOOL bLoop)
DWORD OpenFilter(IN LPCWSTR lpFileName, IN PHANDLE OutHandle)
BOOL CreateCompatiblePin(IN HANDLE hFilter, IN DWORD PinId, IN BOOL bLoop, IN LPWAVEFORMATEX WaveFormatEx, OUT LPWAVEFORMATEX WaveFormatOut, OUT PHANDLE hPin)
DWORD GetFilterPinCount(IN HANDLE hFilter, OUT PULONG NumPins)
DWORD GetFilterNodeProperty(IN HANDLE hFilter, IN ULONG PropertyId, OUT PKSMULTIPLE_ITEM *OutMultipleItem)
const GUID KSPROPSETID_Topology
DWORD GetFilterPinDataFlow(IN HANDLE hFilter, IN ULONG PinId, OUT PKSPIN_DATAFLOW DataFlow)
BOOL DoDataIntersection(HANDLE hFilter, DWORD PinId, DWORD SampleFrequency, LPWAVEFORMATEX WaveFormatEx, DWORD MinimumBitsPerSample, DWORD MaximumBitsPerSample, DWORD MaximumChannels, LPWAVEFORMATEX WaveFormatOut)
BOOL SetPinFormat(IN HANDLE hPin, IN LPWAVEFORMATEX WaveFormatEx)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
#define DSERR_OUTOFMEMORY
#define KSPROPERTY_TYPE_SET
#define KSPROPERTY_TYPE_GET
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
#define KSPRIORITY_NORMAL
#define KSMEDIUM_TYPE_ANYINSTANCE
@ KSPROPERTY_CONNECTION_DATAFORMAT
#define KSMEDIUMSETID_Standard
#define IOCTL_KS_PROPERTY
@ KSPROPERTY_PIN_COMMUNICATION
@ KSPROPERTY_PIN_DATAINTERSECTION
@ KSPROPERTY_PIN_DATARANGES
@ KSPROPERTY_PIN_DATAFLOW
enum KSPIN_DATAFLOW * PKSPIN_DATAFLOW
#define KSPROPSETID_Connection
@ KSINTERFACE_STANDARD_STREAMING
@ KSINTERFACE_STANDARD_LOOPED_STREAMING
struct KSMULTIPLE_ITEM * PKSMULTIPLE_ITEM
#define KSINTERFACESETID_Standard
enum KSPIN_COMMUNICATION * PKSPIN_COMMUNICATION
KSDDKAPI DWORD NTAPI KsCreatePin(HANDLE FilterHandle, PKSPIN_CONNECT Connect, ACCESS_MASK DesiredAccess, PHANDLE ConnectionHandle)
#define FILE_FLAG_OVERLAPPED
_In_ UCHAR _In_ ULONG _Out_ PUCHAR _Outptr_result_bytebuffer_ OutBufferLength PVOID * OutBuffer
PULONG MinorVersion OPTIONAL
ULONG MinimumBitsPerSample
ULONG MaximumBitsPerSample
ULONG MaximumSampleFrequency
ULONG MinimumSampleFrequency
KSPIN_INTERFACE Interface
Property(long _type, long _tag, INREAL _value)
#define RtlMoveMemory(Destination, Source, Length)
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesReturned
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _In_ PWDF_USB_CONTROL_SETUP_PACKET _In_opt_ PWDF_MEMORY_DESCRIPTOR _Out_opt_ PULONG BytesTransferred
DWORD WINAPI GetLastError(void)
_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