[wdmaudiodev] Re: How to implement KSPROPSETID_AudioSignalProcessing Property Set in AVstream mini-driver

  • From: "Matthew van Eerde" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "Matthew.van.Eerde" for DMARC)
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Mon, 8 May 2017 14:55:05 +0000

Windows is not giving you a buffer because it doesn’t know how big of a buffer 
to give you.

For documentation on writing kernel streaming property handlers directly, see 
https://docs.microsoft.com/en-us/windows-hardware/drivers/audio/audio-property-handlers
 - in particular

Before submitting a get-property request to retrieve a property value, the 
client should allocate an output buffer into which the miniport driver's 
property handler can write the property value. For some properties, the size of 
the output buffer is device-dependent and the client must query the property 
handler for the required buffer size. In these cases, the client submits an 
initial property request with a zero-length output buffer. The handler responds 
by returning the required buffer size along with the status code 
STATUS_BUFFER_OVERFLOW. (The handler writes the required size into the 
ValueSize member of the PCPROPERTY_REQUEST structure.) The client then 
retrieves the property value by allocating an output buffer of the specified 
size and sending this buffer in a second get-property request.

From: Yudi Cao<mailto:yudi.cao@xxxxxxxxx>
Sent: Monday, May 8, 2017 1:40 AM
To: wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subject: [wdmaudiodev] How to implement KSPROPSETID_AudioSignalProcessing 
Property Set in AVstream mini-driver

Hello,


I'm working on an AVstream audio driver for USB Headset (add some extra formats 
comparing to inbox usbaudio.sys).

To integrate APO DLL to my driver package, I need implement the 
KSPROPSETID_AudioSignalProcessing property set.



The property set AutomationTable definitions are below:

DEFINE_KSPROPERTY_TABLE(AudioFilterPropertySetTable)

{

        DEFINE_KSPROPERTY_ITEM

        (

                KSPROPERTY_AUDIOSIGNALPROCESSING_MODES,      // property item 
defined in ksmedia.h

                CCaptureRenderFilter::FILTERPROP_PropertyAudioSignalProcessing,

                sizeof(KSP_PIN),             // minimum buffer length for 
property

                0,       // minimum buffer length for returned data

                NULL,

                NULL,                           // default values

                0,                              // related properties

                NULL,

                
CCaptureRenderFilter::FILTERPROP_PropertyAudioSignalProcessingBasicSupport,

                0                               // don't serialize

        )

};





DEFINE_KSPROPERTY_SET_TABLE(AudioFilterProperties)

{

        DEFINE_KSPROPERTY_SET

        (

                &KSPROPSETID_AudioSignalProcessing,                     // 
property set defined in ksmedia.h

                SIZEOF_ARRAY(AudioFilterPropertySetTable),    // the properties 
supported

                AudioFilterPropertySetTable,

                0,                                      // reserved

                NULL                                    // reserved

        )

};





DEFINE_KSAUTOMATION_TABLE(AudioFilterAutomationTable) {

        DEFINE_KSAUTOMATION_PROPERTIES(AudioFilterProperties),

                DEFINE_KSAUTOMATION_METHODS_NULL,

                DEFINE_KSAUTOMATION_EVENTS_NULL

};



        m_KSFilterDesc.AutomationTable = &AudioFilterAutomationTable;

The function declared as below:

NTSTATUS CCaptureRenderFilter::FILTERPROP_PropertyAudioSignalProcessing(IN PIRP 
pIrp, IN PKSP_PIN pKSP_Pin, IN OUT PKSMULTIPLE_ITEM pData)

NTSTATUS 
CCaptureRenderFilter::FILTERPROP_PropertyAudioSignalProcessingBasicSupport(IN 
PIRP pIrp, IN PKSP_PIN  Request, IN OUT PVOID  Data)



The problem is:

The system will call FILTERPROP_PropertyAudioSignalProcessing() for several 
times with the pData==NULL. Why the pData is always null?



What's wrong with my code? Is there anywhere to get some sample code for 
AVStream mini-driver to support KSPROPSETID_AudioSignalProcessing?



Thank you for your help,

Hunter


Other related posts: