33 #pragma code_seg("PAGE") 51 DBGPRINT((
"CMiniportWaveCMI[%p]::ProcessResources(%p)",
this, resourceList));
53 if (resourceList->NumberOfInterrupts() < 1) {
54 DBGPRINT((
"Unknown configuration for wave miniport"));
65 DBGPRINT((
"CMiniportWaveCMI[%p]::newDMAChannel(%p)",
this, dmaChannel));
73 ntStatus = (*dmaChannel)->AllocateBuffer(lDMABufferLength,
NULL);
74 lDMABufferLength >>= 1;
86 DBGPRINT((
"CMiniportWaveCMI[%p]::NonDelegatingQueryInterface",
this));
119 DBGPRINT((
"CMiniportWaveCMI[%p]::~CMiniportWaveCMI",
this));
128 for (
int i=0;
i<3;
i++) {
160 DBGPRINT((
"CMiniportWaveCMI[%p]::Init(%p, %p, %p)",
this, UnknownAdapter,
ResourceList, Port_));
167 DBGPRINT((
"QueryInterface(CMIAdapter) failed"));
179 cm = CMIAdapter->getCMI8738Info();
181 cm->WaveMiniport =
this;
183 loadChannelConfigFromRegistry();
185 for (
int i=0;
i<3;
i++)
187 isStreamRunning[
i] =
false;
192 DBGPRINT((
"NewDmaChannel() failed"));
207 ASSERT(OutDeviceDescriptor);
208 DBGPRINT((
"CMiniportWaveCMI[%p]::GetDeviceDescription(%p)",
this, OutDeviceDescriptor));
212 OutDeviceDescriptor->
Master =
true;
224 ASSERT(OutFilterDescriptor);
225 DBGPRINT((
"CMiniportWaveCMI[%p]::GetDescription(%p)",
this, OutFilterDescriptor));
241 DBGPRINT((
"CMiniportWaveCMI::loadChannelConfigFromRegistry()"));
250 DBGPRINT((
"PcNewRegistryKey() failed"));
258 DBGPRINT((
"DriverKey->NewSubKey() failed"));
288 SettingsKey->Release();
289 DriverKey->Release();
301 DBGPRINT((
"CMiniportWaveCMI::storeChannelConfigToRegistry()"));
310 DBGPRINT((
"PcNewRegistryKey() failed"));
318 DBGPRINT((
"DriverKey->NewSubKey() failed"));
335 SettingsKey->Release();
336 DriverKey->Release();
345 DBGPRINT((
"CMiniportWaveCMI[%p]::powerUp()",
this));
348 for (
int i=0;
i<3;
i++) {
359 for (
int i=0;
i<3;
i++) {
371 DBGPRINT((
"CMiniportWaveCMI[%p]::powerDown()",
this));
384 DBGPRINT((
"CMiniportWaveCMI[%p]::isFormatAllowed(%d, %d, %d)",
this, sampleRate, multiChan, AC3));
387 switch (sampleRate) {
396 switch (sampleRate) {
404 switch (sampleRate) {
417 DBGPRINT((
"CMiniportWaveCMI[%p]::validateFormat(%p, %d, %d)",
this,
format, PinID, capture));
484 DBGPRINT((
"CMiniportWaveCMI[%p]::DataRangeIntersection(%d, %p, %p, %d, %p, %p)",
this, PinId, ClientDataRange, MyDataRange,
OutputBufferLength, ResultantFormat, ResultantFormatLength));
487 bool isAC3Pin =
true;
566 pWaveFormatEx->
cbSize = 0;
607 ULONG sampleRate = 0;
614 if (nMaxChannels & 0x01) {
627 if (sampleRate == 0) {
653 DBGPRINT((
"[[DataRangeIntersection] mono format not supported"));
674 switch (nMaxChannels) {
686 DBGPRINT((
"[DataRangeIntersection] MultiChannel Renderer: SampleRate: %d, ClientDataRange->MaxChans: %d, Channels: %d, BitPerSample: %d, BlockAlign: %d, AvgBytesPerSec: %d, ChannelMask: %08X", WaveFormat->
Format.
nSamplesPerSec, ((
PKSDATARANGE_AUDIO)ClientDataRange)->MaximumChannels, WaveFormat->
Format.
nChannels, WaveFormat->
Format.
wBitsPerSample, WaveFormat->
Format.
nBlockAlign, WaveFormat->
Format.
nAvgBytesPerSec, WaveFormat->
dwChannelMask));
700 if (nMaxChannels > 2) {
727 pWaveFormatEx->
cbSize = 0;
747 DBGPRINT((
"CMiniportWaveCMI[%p]::NewStream(%p, %p, %d, %d, %p)",
this, OutStream, OuterUnknown, PinID,
Capture,
DataFormat));
751 DBGPRINT((
"CMiniportWaveCMI[%p]::NewStream(%p, %p, %p, %d, %d, %p, %p, %p)",
this, OutStream, OuterUnknown,
PoolType, PinID,
Capture,
DataFormat, OutDmaChannel, OutServiceGroup));
760 DBGPRINT((
"invalid stream format"));
763 if (cm->enableSPDIFInMonitor) {
775 if (isStreamRunning[streamIndex]) {
776 DBGPRINT((
"Stream %d running, exiting...", streamIndex));
790 DBGPRINT((
"---StreamNo: %d, Bits: %d, Sample Rate: %d, Channels: %d, AC3: %d", streamIndex,
813 DBGPRINT((
"Failed to create stream"));
821 ntStatus =
stream[streamIndex]->Init(
this, streamIndex,
Capture,
DataFormat, DMAChannel[streamIndex], OutServiceGroup);
824 DBGPRINT((
"Failed to init stream"));
825 stream[streamIndex]->Release();
829 *OutServiceGroup =
NULL;
830 *OutDmaChannel =
NULL;
839 *OutDmaChannel = DMAChannel[streamIndex];
840 DMAChannel[streamIndex]->AddRef();
851 DBGPRINT((
"[PropertyHandler_ChannelConfig]"));
909 DBGPRINT((
"CreateMiniportWaveStreamCMI"));
916 if (*MiniportWaveStreamCMI) {
917 (*MiniportWaveStreamCMI)->AddRef();
927 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::prepareStream()",
this));
1008 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::setDACChannels()",
this));
1018 #if OUT_CHANNEL == 0 1079 #if OUT_CHANNEL == 0 1093 #if OUT_CHANNEL == 0 1100 #if OUT_CHANNEL == 0 1107 #if OUT_CHANNEL == 0 1118 #if OUT_CHANNEL == 0 1123 #if OUT_CHANNEL == 0 1157 #if OUT_CHANNEL == 0 1163 #if OUT_CHANNEL == 0 1190 #if OUT_CHANNEL == 0 1204 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::~CMiniportWaveStreamCMI [streamIndex: %d]",
this,
streamIndex));
1287 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::Init(%p, %d, %d, %p, %p)",
this, Miniport_, streamIndex_, isCaptureStream_,
DataFormat, Port_));
1291 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::Init(%p, %d, %d, %p, %p, %p)",
this, Miniport_, streamIndex_, isCaptureStream_,
DataFormat, DMAChannel_, OutServiceGroup));
1292 DMAChannel = DMAChannel_;
1293 DMAChannel->AddRef();
1296 Miniport = Miniport_;
1299 streamIndex = streamIndex_;
1300 isCaptureStream = isCaptureStream_;
1312 DBGPRINT((
"PcNewServiceGroup() or NewMasterDmaChannel() failed"));
1315 *OutServiceGroup = ServiceGroup;
1316 ServiceGroup->AddRef();
1325 Miniport->isStreamRunning[streamIndex] =
true;
1333 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::SetFormat(%p)",
this,
Format));
1374 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::SetContentId(%d, %p)",
this, contentId, drmRights));
1386 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::AllocateAudioBuffer(0x%x, %p, %p, %p, %p)",
this,
size, userModeBuffer,
bufferSize, bufferOffset, cacheType));
1400 audioBufferMDL =
Port->AllocatePagesForMdl(high,
size);
1402 audioBufferMDL =
Port->AllocateContiguousPagesForMdl(low, high,
size);
1404 if (!audioBufferMDL) {
1405 DBGPRINT((
"AllocateContiguousPagesForMdl()/AllocatePagesForMdl() failed (size: 0x%x)",
size));
1409 dmaAddress =
Port->GetPhysicalPageAddress(audioBufferMDL, 0).LowPart;
1410 dmaMemorySize =
size;
1412 *userModeBuffer = audioBufferMDL;
1424 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::FreeAudioBuffer(%p, %x)",
this,
Mdl,
Size));
1427 audioBufferMDL =
NULL;
1435 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::GetHWLatency(%p)",
this, hwLatency));
1444 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::GetPositionRegister(%p)",
this, hwRegister));
1452 DBGPRINT((
"CMiniportWaveStreamCMI[%p]::GetClockRegister(%p)",
this, hwRegister));
1490 if (
state != NewState) {
1493 DBGPRINT((
"---KSSTATE_ACQUIRE: previous state: %d",
state));
1499 if ((dmaMemorySize == 0) || (dmaAddress == 0)) {
1504 DBGPRINT((
"---dmaAddress: %x, dmaMemorySize: %x, dmaSize: %x", dmaAddress, dmaMemorySize,
dmaSize));
1525 DBGPRINT((
"---DMA Address: HighPart: 0x%08X LowPart: 0x%08X",
DMAChannel->PhysicalAddress().u.HighPart,
DMAChannel->PhysicalAddress().u.LowPart));
1707 if (
Port &&
stream[streamIndex]->ServiceGroup) {
1708 Port->Notify(
stream[streamIndex]->ServiceGroup);
IPortWaveRTStream * PPORTWAVERTSTREAM
IServiceGroup * PSERVICEGROUP
UInt32 requestedChannelCount
#define MAX_SAMPLE_RATE_AC3
return STATUS_NOT_SUPPORTED
IPortWaveRT * PPORTWAVERT
IDmaChannel * PDMACHANNEL
UInt32 currentChannelCount
#define STATUS_INSUFFICIENT_RESOURCES
NTSTATUS NTAPI CreateMiniportWaveCMI(PUNKNOWN *Unknown, REFCLSID, PUNKNOWN UnknownOuter, POOL_TYPE PoolType)
struct _WAVEFORMATEX * PWAVEFORMATEX
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define MIN_SAMPLE_RATE_WMA
NTSTATUS isFormatAllowed(UInt32 sampleRate, BOOLEAN multiChan, BOOLEAN AC3)
#define FMT_480_MULTI_PCM
NTSTATUS processResources(PRESOURCELIST resourceList)
#define STATUS_INVALID_PARAMETER
WAVEFORMATEXTENSIBLE WAVEFORMATPCMEX
#define MIN_BITS_PER_SAMPLE_WMA
NTSTATUS Init(CMiniportWaveCMI *Miniport_, UInt32 streamIndex_, bool isCaptureStream_, PKSDATAFORMAT DataFormat, PDMACHANNEL DMAChannel_, PSERVICEGROUP *OutServiceGroup)
NTSTATUS loadChannelConfigFromRegistry()
IMiniportWaveRTStream * PMINIPORTWAVERTSTREAM
NTSTATUS CreateMiniportWaveStreamCMI(CMiniportWaveStreamCMI **MiniportWaveStreamCMI, PUNKNOWN pUnknownOuter, POOL_TYPE PoolType)
IDrmAudioStream * PDRMAUDIOSTREAM
#define STATUS_INVALID_DEVICE_REQUEST
NTSTATUS validateFormat(PKSDATAFORMAT format, ULONG PinID, BOOLEAN capture)
enum _DMA_WIDTH DMA_WIDTH
IN PVOID IN PVOID IN USHORT IN USHORT Size
_In_opt_ PVOID _In_ ULONG bufferLength
struct tWAVEFORMATEX WAVEFORMATEX
NTSTATUS setupSPDIFPlayback(bool enableSPDIF)
BOOL Init(PUSERCONNECT UserCon)
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
#define MIN_BITS_PER_SAMPLE_AC3
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
#define KSPROPERTY_TYPE_GET
#define MAX_SAMPLE_RATE_MULTI
IMiniportWaveRT * PMINIPORTWAVERT
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
#define KSDATAFORMAT_SUBTYPE_WMA_SPDIF
#define STATUS_BUFFER_TOO_SMALL
#define IsEqualGUIDAligned(guid1, guid2)
PDMACHANNEL DMAChannel[3]
PSERVICEGROUP ServiceGroup
_In_ WDFREQUEST _In_ size_t OutputBufferLength
#define WAVE_FORMAT_DOLBY_AC3_SPDIF
__GNU_EXTENSION typedef __int64 * PLONGLONG
WAVEFORMATEX WaveFormatEx
NTSTATUS NTAPI PropertyHandler_ChannelConfig(PPCPROPERTY_REQUEST PropertyRequest)
static PCFILTER_DESCRIPTOR WaveMiniportFilterDescriptor
UInt32 notificationInterval
#define MAX_BITS_PER_SAMPLE_AC3
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
NTSTATUS newDMAChannel(PDMACHANNEL *dmaChannel, UInt32 bufferLength)
PCMITOPOLOGY TopoMiniport
CMiniportWaveStreamCMI * stream[3]
static KSDATARANGE_AUDIO WavePinDataRangesAC3Stream[]
NTSTATUS setupAC3Passthru()
#define KSDATAFORMAT_SPECIFIER_WILDCARD
~CMiniportWaveStreamCMI()
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
BOOLEAN Dma32BitAddresses
#define FMT_960_MULTI_PCM
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
#define REG_OPTION_NON_VOLATILE
#define KSPROPERTY_TYPE_BASICSUPPORT
#define KSDATAFORMAT_TYPE_WILDCARD
IRegistryKey * PREGISTRYKEY
#define NT_SUCCESS(StatCode)
UInt32 requestedChannelMask
#define RtlFillMemory(Dest, Length, Fill)
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
ULONG MinimumSampleFrequency
IMiniportWaveCyclicStream * PMINIPORTWAVECYCLICSTREAM
CMiniportWaveCMI * Miniport
struct _MINIPORT * PMINIPORT
#define STATUS_UNSUCCESSFUL
#define ExAllocatePoolWithTag(hernya, size, tag)
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
NTSTATUS NTAPI PcNewRegistryKey(OUT PREGISTRYKEY *OutRegistryKey, IN PUNKNOWN OuterUnknown OPTIONAL, IN ULONG RegistryKeyType, IN ACCESS_MASK DesiredAccess, IN PVOID DeviceObject OPTIONAL, IN PVOID SubDevice OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN ULONG CreateOptions OPTIONAL, OUT PULONG Disposition OPTIONAL)
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
enum _DMA_SPEED DMA_SPEED
IResourceList * PRESOURCELIST
NTSTATUS setDACChannels()
IMiniportWaveCyclic * PMINIPORTWAVECYCLIC
union WAVEFORMATEXTENSIBLE::@2980 Samples
#define STATUS_BUFFER_OVERFLOW
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
ULONG MaximumSampleFrequency
#define KSDATAFORMAT_SUBTYPE_WILDCARD
#define MAX_BITS_PER_SAMPLE_WMA
#define MIN_SAMPLE_RATE_AC3
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define MAX_SAMPLE_RATE_WMA
INTERFACE_TYPE InterfaceType
#define FMT_882_MULTI_PCM
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
NTSTATUS NTAPI PcNewServiceGroup(OUT PSERVICEGROUP *OutServiceGroup, IN PUNKNOWN OuterUnknown OPTIONAL)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
bool enableSPDIFInMonitor
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
#define KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF
WAVEFORMATPCMEX * PWAVEFORMATPCMEX
#define STATUS_DEVICE_CONFIGURATION_ERROR
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
#define FMT_441_MULTI_PCM
#define ExFreePoolWithTag(_P, _T)
#define KSPROPERTY_TYPE_SET
IPortWaveCyclic * PPORTWAVECYCLIC
DWORD GetPosition(DWORD private_handle, PMMTIME time, DWORD time_size)
NTSTATUS storeChannelConfigToRegistry()
#define MAXLEN_DMA_BUFFER
#define WAVE_FORMAT_WMA_SPDIF
KSDATAFORMAT * PKSDATAFORMAT
STDMETHODIMP_(void) CMiniportWaveCMI
BOOLEAN NTAPI IoIsWdmVersionAvailable(IN UCHAR MajorVersion, IN UCHAR MinorVersion)