📄 basetopo.cpp
字号:
/*++
Copyright (c) 1997-2000 Microsoft Corporation All Rights Reserved
Module Name:
basetopo.cpp
Abstract:
Implementation of topology miniport. This the base class for
all MSVAD samples
--*/
#include <msvad.h>
#include "common.h"
#include "basetopo.h"
//=============================================================================
#pragma code_seg("PAGE")
CMiniportTopologyMSVAD::CMiniportTopologyMSVAD
(
void
)
/*++
Routine Description:
Topology miniport constructor
Arguments:
Return Value:
void
--*/
{
PAGED_CODE();
DPF_ENTER(("[CMiniportTopologyMSVAD::CMiniportTopologyMSVAD]"));
m_AdapterCommon = NULL;
m_FilterDescriptor = NULL;
} // CMiniportTopologyMSVAD
CMiniportTopologyMSVAD::~CMiniportTopologyMSVAD
(
void
)
/*++
Routine Description:
Topology miniport destructor
Arguments:
Return Value:
void
--*/
{
PAGED_CODE();
DPF_ENTER(("[CMiniportTopologyMSVAD::~CMiniportTopologyMSVAD]"));
if (m_AdapterCommon)
{
m_AdapterCommon->Release();
}
} // ~CMiniportTopologyMSVAD
//=============================================================================
NTSTATUS
CMiniportTopologyMSVAD::DataRangeIntersection
(
IN ULONG PinId,
IN PKSDATARANGE ClientDataRange,
IN PKSDATARANGE MyDataRange,
IN ULONG OutputBufferLength,
OUT PVOID ResultantFormat OPTIONAL,
OUT PULONG ResultantFormatLength
)
/*++
Routine Description:
The DataRangeIntersection function determines the highest
quality intersection of two data ranges. Topology miniport does nothing.
Arguments:
PinId - Pin for which data intersection is being determined.
ClientDataRange - Pointer to KSDATARANGE structure which contains the data range
submitted by client in the data range intersection property
request
MyDataRange - Pin's data range to be compared with client's data range
OutputBufferLength - Size of the buffer pointed to by the resultant format
parameter
ResultantFormat - Pointer to value where the resultant format should be
returned
ResultantFormatLength - Actual length of the resultant format that is placed
at ResultantFormat. This should be less than or equal
to OutputBufferLength
Return Value:
NT status code.
--*/
{
PAGED_CODE();
DPF_ENTER(("[CMiniportTopologyMSVAD::DataRangeIntersection]"));
return (STATUS_NOT_IMPLEMENTED);
} // DataRangeIntersection
//=============================================================================
NTSTATUS
CMiniportTopologyMSVAD::GetDescription
(
OUT PPCFILTER_DESCRIPTOR * OutFilterDescriptor
)
/*++
Routine Description:
The GetDescription function gets a pointer to a filter description.
It provides a location to deposit a pointer in miniport's description
structure. This is the placeholder for the FromNode or ToNode fields in
connections which describe connections to the filter's pins
Arguments:
OutFilterDescriptor - Pointer to the filter description.
Return Value:
NT status code.
--*/
{
PAGED_CODE();
ASSERT(OutFilterDescriptor);
DPF_ENTER(("[CMiniportTopologyMSVAD::GetDescription]"));
*OutFilterDescriptor = m_FilterDescriptor;
return (STATUS_SUCCESS);
} // GetDescription
//=============================================================================
NTSTATUS
CMiniportTopologyMSVAD::Init
(
IN PUNKNOWN UnknownAdapter_,
IN PPORTTOPOLOGY Port_
)
/*++
Routine Description:
Initializes the topology miniport.
Arguments:
UnknownAdapter -
Port_ - Pointer to topology port
Return Value:
NT status code.
--*/
{
PAGED_CODE();
ASSERT(UnknownAdapter_);
ASSERT(Port_);
DPF_ENTER(("[CMiniportTopologyMSVAD::Init]"));
NTSTATUS ntStatus;
ntStatus =
UnknownAdapter_->QueryInterface
(
IID_IAdapterCommon,
(PVOID *) &m_AdapterCommon
);
if (NT_SUCCESS(ntStatus))
{
m_AdapterCommon->MixerReset();
}
if (!NT_SUCCESS(ntStatus))
{
// clean up AdapterCommon
if (m_AdapterCommon)
{
m_AdapterCommon->Release();
m_AdapterCommon = NULL;
}
}
return ntStatus;
} // Init
//=============================================================================
NTSTATUS
CMiniportTopologyMSVAD::PropertyHandlerBasicSupportVolume
(
IN PPCPROPERTY_REQUEST PropertyRequest
)
/*++
Routine Description:
Handles BasicSupport for Volume nodes.
Arguments:
PropertyRequest - property request structure
Return Value:
NT status code.
--*/
{
PAGED_CODE();
NTSTATUS ntStatus = STATUS_SUCCESS;
ULONG cbFullProperty =
sizeof(KSPROPERTY_DESCRIPTION) +
sizeof(KSPROPERTY_MEMBERSHEADER) +
sizeof(KSPROPERTY_STEPPING_LONG);
if(PropertyRequest->ValueSize >= (sizeof(KSPROPERTY_DESCRIPTION)))
{
PKSPROPERTY_DESCRIPTION PropDesc =
PKSPROPERTY_DESCRIPTION(PropertyRequest->Value);
PropDesc->AccessFlags = KSPROPERTY_TYPE_ALL;
PropDesc->DescriptionSize = cbFullProperty;
PropDesc->PropTypeSet.Set = KSPROPTYPESETID_General;
PropDesc->PropTypeSet.Id = VT_I4;
PropDesc->PropTypeSet.Flags = 0;
PropDesc->MembersListCount = 1;
PropDesc->Reserved = 0;
// if return buffer can also hold a range description, return it too
if(PropertyRequest->ValueSize >= cbFullProperty)
{
// fill in the members header
PKSPROPERTY_MEMBERSHEADER Members =
PKSPROPERTY_MEMBERSHEADER(PropDesc + 1);
Members->MembersFlags = KSPROPERTY_MEMBER_STEPPEDRANGES;
Members->MembersSize = sizeof(KSPROPERTY_STEPPING_LONG);
Members->MembersCount = 1;
Members->Flags = 0;
// fill in the stepped range
PKSPROPERTY_STEPPING_LONG Range =
PKSPROPERTY_STEPPING_LONG(Members + 1);
// BUGBUG these are from SB16 driver.
// Are these valid.
Range->Bounds.SignedMaximum = 0xE0000; // 14 (dB) * 0x10000
Range->Bounds.SignedMinimum = 0xFFF20000; // -14 (dB) * 0x10000
Range->SteppingDelta = 0x20000; // 2 (dB) * 0x10000
Range->Reserved = 0;
// set the return value size
PropertyRequest->ValueSize = cbFullProperty;
}
else
{
PropertyRequest->ValueSize = 0;
ntStatus = STATUS_BUFFER_TOO_SMALL;
}
}
else if(PropertyRequest->ValueSize >= sizeof(ULONG))
{
// if return buffer can hold a ULONG, return the access flags
PULONG AccessFlags = PULONG(PropertyRequest->Value);
PropertyRequest->ValueSize = sizeof(ULONG);
*AccessFlags = KSPROPERTY_TYPE_ALL;
}
else if (PropertyRequest->ValueSize == 0)
{
// Send the caller required value size.
PropertyRequest->ValueSize = cbFullProperty;
ntStatus = STATUS_BUFFER_OVERFLOW;
}
else
{
PropertyRequest->ValueSize = 0;
ntStatus = STATUS_BUFFER_TOO_SMALL;
}
return ntStatus;
} // PropertyHandlerBasicSupportVolume
//=============================================================================
NTSTATUS
CMiniportTopologyMSVAD::PropertyHandlerCpuResources
(
IN PPCPROPERTY_REQUEST PropertyRequest
)
/*++
Routine Description:
Processes KSPROPERTY_AUDIO_CPURESOURCES
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -