Author: janderwald
Date: Fri Oct 14 13:26:22 2016
New Revision: 72970
URL:
http://svn.reactos.org/svn/reactos?rev=72970&view=rev
Log:
[USBAUDIO]
- partly implement UsbAudioPinDataIntersect
Modified:
trunk/reactos/drivers/usb/usbaudio/filter.c
trunk/reactos/drivers/usb/usbaudio/pin.c
trunk/reactos/drivers/usb/usbaudio/usbaudio.h
Modified: trunk/reactos/drivers/usb/usbaudio/filter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/filte…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/filter.c [iso-8859-1] Fri Oct 14 13:26:22 2016
@@ -448,7 +448,10 @@
Pins[Index].PinDescriptor.DataFlow = KSPIN_DATAFLOW_IN;
}
-
+ /* data intersect handler */
+ Pins[Index].IntersectHandler = UsbAudioPinDataIntersect;
+
+ /* pin flags */
Pins[Index].Flags = KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY |
KSFILTER_FLAG_CRITICAL_PROCESSING;
/* irp sinks / sources can be instantiated */
Modified: trunk/reactos/drivers/usb/usbaudio/pin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/pin.c…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/pin.c [iso-8859-1] Fri Oct 14 13:26:22 2016
@@ -1074,3 +1074,65 @@
return Status;
}
+
+
+NTSTATUS
+NTAPI
+UsbAudioPinDataIntersect(
+ _In_ PVOID Context,
+ _In_ PIRP Irp,
+ _In_ PKSP_PIN Pin,
+ _In_ PKSDATARANGE DataRange,
+ _In_ PKSDATARANGE MatchingDataRange,
+ _In_ ULONG DataBufferSize,
+ _Out_ PVOID Data,
+ _Out_ PULONG DataSize)
+{
+ PKSFILTER Filter;
+ PKSPIN_DESCRIPTOR_EX PinDescriptor;
+ PKSDATAFORMAT_WAVEFORMATEX DataFormat;
+ PKSDATARANGE_AUDIO DataRangeAudio;
+
+ /* get filter from irp*/
+ Filter = KsGetFilterFromIrp(Irp);
+ if (!Filter)
+ {
+ /* no match*/
+ return STATUS_NO_MATCH;
+ }
+
+ /* get pin descriptor */
+ PinDescriptor = &Filter->Descriptor->PinDescriptors[Pin->PinId];
+
+ *DataSize = sizeof(KSDATAFORMAT_WAVEFORMATEX);
+ if (DataBufferSize == 0)
+ {
+ /* buffer too small */
+ return STATUS_BUFFER_OVERFLOW;
+ }
+
+ /* sanity checks*/
+ ASSERT(PinDescriptor->PinDescriptor.DataRangesCount >= 0);
+ ASSERT(PinDescriptor->PinDescriptor.DataRanges[0]->FormatSize ==
sizeof(KSDATARANGE_AUDIO));
+
+ DataRangeAudio = (PKSDATARANGE_AUDIO)PinDescriptor->PinDescriptor.DataRanges[0];
+
+ DataFormat = Data;
+ DataFormat->WaveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
+ DataFormat->WaveFormatEx.nChannels = DataRangeAudio->MaximumChannels;
+ DataFormat->WaveFormatEx.nSamplesPerSec =
DataRangeAudio->MaximumSampleFrequency;
+ DataFormat->WaveFormatEx.nAvgBytesPerSec =
DataRangeAudio->MaximumSampleFrequency * (DataRangeAudio->MaximumBitsPerSample / 8)
* DataRangeAudio->MaximumChannels;
+ DataFormat->WaveFormatEx.nBlockAlign = (DataRangeAudio->MaximumBitsPerSample /
8) * DataRangeAudio->MaximumChannels;
+ DataFormat->WaveFormatEx.wBitsPerSample =
DataRangeAudio->MaximumBitsPerSample;
+ DataFormat->WaveFormatEx.cbSize = 0;
+
+ DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
+ DataFormat->DataFormat.Flags = 0;
+ DataFormat->DataFormat.Reserved = 0;
+ DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
+ DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
+ DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
+ DataFormat->DataFormat.SampleSize = (DataRangeAudio->MaximumBitsPerSample / 8)
* DataRangeAudio->MaximumChannels;
+
+ return STATUS_SUCCESS;
+}
Modified: trunk/reactos/drivers/usb/usbaudio/usbaudio.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbaudio/usbau…
==============================================================================
--- trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbaudio/usbaudio.h [iso-8859-1] Fri Oct 14 13:26:22 2016
@@ -255,6 +255,18 @@
NTSTATUS
NTAPI
+UsbAudioPinDataIntersect(
+ _In_ PVOID Context,
+ _In_ PIRP Irp,
+ _In_ PKSP_PIN Pin,
+ _In_ PKSDATARANGE DataRange,
+ _In_ PKSDATARANGE MatchingDataRange,
+ _In_ ULONG DataBufferSize,
+ _Out_ PVOID Data,
+ _Out_ PULONG DataSize);
+
+NTSTATUS
+NTAPI
UsbAudioCaptureComplete(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,