Hello!

I have got a problem improving my bda device driver for multiple instances.
The driver represents a tuner and a capture filter. These filters are
connected through a specific medium. Since the filters are constructed by
static structures there is no possibility to change the Id member of the
medium structure for each device-instance.

According to the msdn there is a possibility changing this Id member by
using the KsEdit() function. I have tried to edit the Id member wihtin the
Create-Pin-Dispatch-Routine, but this doesn't work. It is possible to connect
the filters even if the medium is completly different from each other. It
seems like that the KsEdit() must be applied earlier than within the
CreatePinDispatcher.

Has anybody done this before, or is there an easier way?
Unfortunately there is only very little information / sample source code
available.

Thanks very much for any help / hints!
Best regards,
Norbert Druml

Re: BDA / AVStream Unique Medium ID by Max

Max
Tue Jan 03 10:57:32 CST 2006

Sure, it works.
You just need to KsEdit your mediums before the call to KsInitializeDriver.

The thing is that KS creates registry blob on per filter basis and that's
where mediums go and that's where KS/DirectShow gets them from while trying
to connect pins.
That blob is created by KS during device initialization, so pin creating
stage is way too late.

What I usually do is to KsEdit entire medium structure on per instance basis
and modify IDs there.
One caveat. Make sure that IDs don't change across the boot as some
middleware (VidControl, for instance) cache them and expect them to do be
the same after the reboot. If they change things like Media Center tend to
have No-tuner-found problems.

-- Max.




"Norbert Druml" <n.druml@pionsys.REMOVEME.com> wrote in message
news:C540DF4B-B4FA-4B53-94A2-B649C6C041F2@microsoft.com...
> Hello!
>
> I have got a problem improving my bda device driver for multiple
> instances.
> The driver represents a tuner and a capture filter. These filters are
> connected through a specific medium. Since the filters are constructed by
> static structures there is no possibility to change the Id member of the
> medium structure for each device-instance.
>
> According to the msdn there is a possibility changing this Id member by
> using the KsEdit() function. I have tried to edit the Id member wihtin the
> Create-Pin-Dispatch-Routine, but this doesn't work. It is possible to
> connect
> the filters even if the medium is completly different from each other. It
> seems like that the KsEdit() must be applied earlier than within the
> CreatePinDispatcher.
>
> Has anybody done this before, or is there an easier way?
> Unfortunately there is only very little information / sample source code
> available.
>
> Thanks very much for any help / hints!
> Best regards,
> Norbert Druml



Re: BDA / AVStream Unique Medium ID by n

n
Tue Jan 03 17:46:02 CST 2006

Hello Max!

Thanks very much for your response!

I've got one additional question:
I am calling KsInitializeDriver() from within my DriverEntry function.
Unfortunately I don't have at this point any objectbag available.
Using KsEdit() without specifying an objectbag doesn't seem to work.
How do you use KsEdit() before any Ks-Objects are created? Could you please
post one sample? Are you creating an own objectbag?
Thanks very much for any help!

Enclosed you can find the my very simple DriverEntry function.

Best Regards,
Norbert Druml



extern "C" NTSTATUS DriverEntry(
IN PDRIVER_OBJECT pDriverObject,
IN PUNICODE_STRING pRegistryPath)
{
return KsInitializeDriver(pDriverObject, pRegistryPath, &DeviceDescriptor);
}

Re: BDA / AVStream Unique Medium ID by Tim

Tim
Thu Jan 05 01:10:54 CST 2006

"Norbert Druml" <n.druml@pionsys.REMOVEME.com> wrote:
>
>I have got a problem improving my bda device driver for multiple instances.
>The driver represents a tuner and a capture filter. These filters are
>connected through a specific medium. Since the filters are constructed by
>static structures there is no possibility to change the Id member of the
>medium structure for each device-instance.

The Europa sample contains code to create separate mediums for each
instance.

you can certainly copy your static structure into the heap as required, and
then modify it for each instance.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: BDA / AVStream Unique Medium ID by Max

Max
Thu Jan 05 02:53:57 CST 2006

Sorry, I misspoke a little. Of course, there is no way to modify mediums
before calling KsInitializeDriver, which is called from DriverEntry.
So you have to work a bit harder to make it happen, but not too hard to
worry about it.

What I used to do is to register all filter factories dynamically from
AddDevice callback.
In device description that you provide to KsInitializeDriver specify
AddDevice callback and also zero out filter factories. That way KS won't
register anything for you automatically.
Somewhere you have to have a list of filter factories that your driver
manages. For every device that the driver services walk that list during
AddDevice and customize mediums based on the device instance in question.
Then simply call KsRegisterFilterFactory.

This is very similar to what KS is doing on your behalf when you specify
filter factories in device descriptor.

And no, I can't post any sample code as it belongs to my employer. Sorry.
-- Max.


"Norbert Druml" <n.druml@pionsys.REMOVEME.com> wrote in message
news:96A510A0-4222-467D-A9B0-C4A7DED91121@microsoft.com...
> Hello Max!
>
> Thanks very much for your response!
>
> I've got one additional question:
> I am calling KsInitializeDriver() from within my DriverEntry function.
> Unfortunately I don't have at this point any objectbag available.
> Using KsEdit() without specifying an objectbag doesn't seem to work.
> How do you use KsEdit() before any Ks-Objects are created? Could you
> please
> post one sample? Are you creating an own objectbag?
> Thanks very much for any help!
>
> Enclosed you can find the my very simple DriverEntry function.
>
> Best Regards,
> Norbert Druml
>
>
>
> extern "C" NTSTATUS DriverEntry(
> IN PDRIVER_OBJECT pDriverObject,
> IN PUNICODE_STRING pRegistryPath)
> {
> return KsInitializeDriver(pDriverObject, pRegistryPath,
> &DeviceDescriptor);
> }



RE: BDA / AVStream Unique Medium ID by n

n
Mon Jan 09 18:16:02 CST 2006

Thanks very much for your help!

After getting the newest ddk, the europe example helped me perfectly.
Unfortunately i only had got ddk 3790, where it is not included.

Best regards,
Norbert