mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[USBAUDIO]
- partly implement UsbAudioPinDataIntersect svn path=/trunk/; revision=72970
This commit is contained in:
parent
4b5428d521
commit
1c43c34853
3 changed files with 77 additions and 0 deletions
|
@ -448,7 +448,10 @@ USBAudioPinBuildDescriptors(
|
|||
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 */
|
||||
|
|
|
@ -1074,3 +1074,65 @@ USBAudioPinSetDeviceState(
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -253,6 +253,18 @@ USBAudioPnPSetPower(
|
|||
|
||||
/* pin.c*/
|
||||
|
||||
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(
|
||||
|
|
Loading…
Reference in a new issue