[wdmaudiodev] Re: KSPROPERTY_JACK_DESCRIPTION

  • From: "Daniel E. Germann" <deg@xxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Mon, 19 Mar 2007 20:01:00 -0500

Hi, Mitch.

Thanks for this example.  It helped a lot!

I have two follow-up questions I hope you can answer.

1. The docs for KSMULTIPLE_ITEM say:
    Size
        Specifies the size in bytes of this header and the property data
that follows.
    Count
        Specifies the number of buffers that follow this header.

In your example, ->Size appears to be the size of each item being returned
(sizeof(KSJACK_DESCRIPTION)).  The "videocap\usbintel" sample (prpget.c),
which also uses KSMULTIPLE_ITEM, sets ->Size to the total size of all items
being returned, excluding the KSMULTIPLE_ITEM header (Count * sizeof(item)).

I'm doing what your example did, and it works.  But I thought I'd better
double-check to make sure I don't get a surprise in the future, since the
examples and docs don't seem to match.  Is what you did in your example the
correct usage when returning KSJACK_DESCRIPTION information?

2. The docs for KSJACK_DESCRIPTION indicate that the ChannelMapping field is
one of the enumeration values from EChannelMapping.  But it sure seems to
act more like a straight channel bitmap (bit 0 = left, bit 1 = right, bit 2
= center, etc.; similar to other audio APIs (e.g., SPEAKER_FRONT_LEFT,
SPEAKER_FRONT_RIGHT, etc.)) and 0 means "undefined / unknown"
(KSAUDIO_SPEAKER_DIRECTOUT).  That kind of makes sense, since ChannelMapping
is defined as a DWORD, and all the other fields that are enumeration values
are defined as the enum's typedef.

For example, when I set ChannelMapping to 5 (ePcxChanMap_Unknown), my jack
info shows up as "L C".  That doesn't match "unknown", but it does make
sense for a location bitmap of 5 (Left + Center).  And when I set it to 0
(ePcxChanMap_FL_FR), my jack info is blank.  Again, that doesn't match the
"FL/FR" location specified by the enum, but it is what I'd expect for a
location bitmap of 0 (undefined or unknown location).

Is what I'm seeing correct?  Or is it supposed to really be an
EChannelMapping enumeration value?

Thanks very much!

-Dan


-----Original Message-----
From: Mitchell Rundle
Date: Mon, 12 Mar 2007 12:09:59 -0700
Subject: [wdmaudiodev] Re: Fwd: Re: KSPROPERTY_JACK_DESCRIPTION

Nikolay, sorry for the delay.
Starting with the MSVAD "simple" sample in the WDK, here's what it takes to
add support for KSPROPERTY_JACK_DESCRIPTION.

<portion of original email deleted for clarity>

3)  In MinTopo.cpp, implement the property handler:

NTSTATUS
CMiniportTopology::PropertyHandlerJackDescription
(
    IN PPCPROPERTY_REQUEST      PropertyRequest
)
{
    PAGED_CODE();

    ASSERT(PropertyRequest);

    DPF_ENTER(("[PropertyHandlerJackDescription]"));

    NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST;
    ULONG    nPinId = (ULONG)-1;

    if (PropertyRequest->InstanceSize >= sizeof(ULONG))
    {
        nPinId = *(PULONG(PropertyRequest->Instance));

        if ((nPinId < ARRAYSIZE(JackDescriptions)) &&
(JackDescriptions[nPinId] != NULL))
        {
            if (PropertyRequest->Verb & KSPROPERTY_TYPE_BASICSUPPORT)
            {
                ntStatus =
                    PropertyHandler_BasicSupport
                    (
                        PropertyRequest,
                        KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET,
                        VT_ILLEGAL
                    );
            }
            else
            {
                ULONG cJacks = <number of jacks associated with this pin
(nPinId) >
                ULONG cbNeeded = sizeof(KSMULTIPLE_ITEM) +
sizeof(KSJACK_DESCRIPTION) * cJacks;

                if (PropertyRequest->ValueSize == 0)
                {
                    PropertyRequest->ValueSize = cbNeeded;
                    ntStatus = STATUS_BUFFER_OVERFLOW;
                }
                else if (PropertyRequest->ValueSize < cbNeeded)
                {
                    ntStatus = STATUS_BUFFER_TOO_SMALL;
                }
                else
                {
                    if (PropertyRequest->Verb & KSPROPERTY_TYPE_GET)
                    {
                        PKSMULTIPLE_ITEM pMI =
(PKSMULTIPLE_ITEM)PropertyRequest->Value;
                        PKSJACK_DESCRIPTION pDesc =
(PKSJACK_DESCRIPTION)(pMI+1);

                        pMI->Size = sizeof(KSJACK_DESCRIPTION);
                        pMI->Count = cJacks;

                        // TODO:  copy jack info struct(s) into pDesc...

                        ntStatus = STATUS_SUCCESS;
                    }
                }
            }
        }
    }

    return ntStatus;
}

<portion of original email deleted for clarity>

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: