Multiple output pins of same type (KSPIN_DESCRIPTOR_EX)

Hello,

I’m using the AvStream mini driver with Pin-Centric processing. My device
has four DMA channels. One or more DMA channels can be used at a time. I
want to associate each of these DMA channels with a pin. The way I thought
it makes sense to do this is to create one *pin type* for the filter and
indicate that up to 4 *pin instances* can be created. The structure I used
to this is the KSPIN_DESCRIPTOR_EX structure below:

typedef struct {
const KSPIN_DISPATCH* Dispatch;
const KSAUTOMATION_TABLE* AutomationTable;
KSPIN_DESCRIPTOR PinDescriptor;
ULONG Flags;
ULONG InstancesPossible;
ULONG InstancesNecessary;
const KSALLOCATOR_FRAMING_EX* AllocatorFraming;
PFNKSINTERSECTHANDLEREX IntersectHandler;
} KSPIN_DESCRIPTOR_EX, *PKSPIN_DESCRIPTOR_EX;

Here, I set InstancesPossible to 4, and InstancesNecessary to 1.

When I built this driver, I was a little surprised about the following:

1 Graph edit shows only one pin initially. If I connect this one pin,
another pin appears, up to my InstancesPossible amount. I was hoping all
four would be present.

2 Graph edit only automatically renders the initial pin. In other
words, if I right click on the first pin and select “render pin” it connects
up the graph. Graph edit than shows a second pin. If I click on the second
pin and select “render pin” nothing happens. I was hoping intelligent
connect would work for all pins.

3 There doesn’t seem to be any way to enumerate the number of
*possible* pin instances without iteratively connecting each pin. In other
words, IEnumPins only returns 1 pin initially. If I connect that pin and
rerun IEnumPins, I get another pin and so on.

I’m willing to accept this is just the way it is, but I was hoping someone
out there might have some insight into the proper way to associate each of
my DMA channels with a pin?

Perhaps I should create 4 identical KSPIN_DESCRIPTOR_EX entries instead,
with InstancesPossible=1 and InstancesNecessary=0 for each?

Jason

Jason Peck wrote:

Hello,

I’m using the AvStream mini driver with Pin-Centric processing. My device
has four DMA channels. One or more DMA channels can be used at a time. I
want to associate each of these DMA channels with a pin. The way I thought
it makes sense to do this is to create one *pin type* for the filter and
indicate that up to 4 *pin instances* can be created. The structure I used
to this is the KSPIN_DESCRIPTOR_EX structure below:

Here, I set InstancesPossible to 4, and InstancesNecessary to 1.

When I built this driver, I was a little surprised about the following:

1 Graph edit shows only one pin initially. If I connect this one pin,
another pin appears, up to my InstancesPossible amount. I was hoping all
four would be present.

No, this is exactly how InstancesPossible is supposed to work: extra
pins are created dynamically. Since InstancesNecessary is 1, it will
always try to get away with as few as possible.

2 Graph edit only automatically renders the initial pin. In other
words, if I right click on the first pin and select “render pin” it connects
up the graph. Graph edit than shows a second pin. If I click on the second
pin and select “render pin” nothing happens. I was hoping intelligent
connect would work for all pins.

That’s odd. It SHOULD work for all pins, as long as the media types are
set up correctly. If you right-click on the second pin and pick
Properties, does the media type match what you expect?

Perhaps I should create 4 identical KSPIN_DESCRIPTOR_EX entries instead,
with InstancesPossible=1 and InstancesNecessary=0 for each?

If you want your device to always offer exactly 4 pins, then yes, this
is what you need to do. You probably want the first one to have
InstancesNecessary=1.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.