Two filters in one AVStream driver

Discussion in 'Windows Vista Drivers' started by Andrey, Jun 19, 2006.

  1. Andrey

    Andrey Guest

    Hello, All.

    I'm working on AVStream minidriver. And I want to create minidriver
    that will provides DirectShow filter to the user mode application all
    time while device is connected to the system and another one filter type
    that will be seen by system only then my device is switched in special state
    (looking at hardware state). And another one requirement is that these
    filers have different category (I mean category like "Video Capture
    source").

    In AVStream documentation I have found two ways to implement additional
    filter type from same device. The first one is to implement two filter
    factories
    in one minidriver and to create filters of each type separately from driver.
    Does system notifies appications about new filters arrival in this case?
    Does there is possibility to point system that these filters have different
    categories (capture and decode, for example).

    The second way is to create AVStream child device. But it is not clear for
    me
    what driver will serves this child device.

    Please help me to clear these questions.

    Andrey
     
    Andrey, Jun 19, 2006
    #1
    1. Advertisements

  2. Andrey

    Tim Roberts Guest

    How are you going to know when this state transition occurs? If this is
    just some bit in a register, the operating system is never going to notice
    it.

    If you get an interrupt, then you can certainly have your ISR fire off a
    DPC to create another filter.
    Doesn't matter. Your filters can be in whatever categories you need.
    Notify how? There is no particular notification scheme for new filters.
    An application may search through whatever categories it wishes. Capture
    applications looks through the video capture and audio capture categories.
     
    Tim Roberts, Jun 20, 2006
    #2
    1. Advertisements

  3. Andrey

    Andrey Guest

    Hello.
    Thank you for an answer.
    It is not problem. I'll use interrupt.
    I can't to find there to specify GUID of filter's category. Please point me
    how to do it.
    Sorry. I have in my mind notification of device change in Windows API.
    Registering to by notified on device of particular category I have
    possibility
    to know when my device is arrival in the system. But of course it is device
    notification
    but not filter. And I though that something similar can be realized for
    additional
    filter types.
    I want to register for notification messages for two categories to know
    exactly
    what filter becomes available in the system.

    Andrey
     
    Andrey, Jun 20, 2006
    #3
  4. Andrey

    Tim Roberts Guest

    Really? I'd expected you to find it by now. In the KSFILTER_DESCRIPTOR,
    the Categories member points to an array of GUIDs. The
    DEFINE_KSFILTER_CATEGORIES macro is used to create them in a static data
    structure.
    No. Filters are not expected to be dynamic. You create a graph, you use a
    graph.
    I'm not aware of any way to do tha.
     
    Tim Roberts, Jun 22, 2006
    #4
  5. Andrey

    Andrey Guest

    Hello,

    Thank you, Tim.
    I have found Category GUID in filter descriptor few days ago. So I know
    now how to declare filter's category. And taked a lot of time to understand
    how to use reference GUID with category GUID to make filter
    visible in DirectShow under correct category.

    About notifications. It seems that thare is not way to use standard
    Windows notifications to know when my filter will arrive.
    So I plan to declare KSEVENT in the main filter and use fire it
    every time when number of filters will change. I'll implement this
    KSEVENT in the 'main' filter, that will be accessible all time while
    device is accessible in the system.
     
    Andrey, Jun 22, 2006
    #5
  6. Andrey

    Tim Roberts Guest

    Be sure to notice that this is a LIST of GUIDs. A filter can (and often
    does) register in many categories.
    And then what? I'm not clear how you intend to use this. Is your app
    going to tear down the graph and rebuild it with different components?
     
    Tim Roberts, Jun 24, 2006
    #6
  7. Andrey

    Max Paklin Guest

    Your scheme is fundamentally flawed.
    You don't create filters, applications do. Your driver advertises itself as
    capable of serving requests to create filters and then it is up to the
    application to use that capability of the driver.

    If you want to add another filter to the list of filters that your driver
    advertises you can't do it on the fly easily.
    Typically AVStream drivers create the list of filter factories statically
    (or dynamically on startup) and use the same thing throughout the lifetime
    of the driver. If you want to dynamically change that list you'd have to do
    some work, but why?

    IMO it is much easier to always advertise all filters and fail to create
    some. If you control the application you can make it in such a way that it
    can gracefully deal with the failure and assume the right thing, e.g. that
    your filter isn't available and it should try later. Or you can succeed in
    creating the filter and fail pin connection or fail state transition or
    whatever. You can use some sort of event scheme between your app and your
    driver to signal new state when the filter can be meaningfully used.

    -- Max.




     
    Max Paklin, Jun 26, 2006
    #7
  8. Andrey

    Andrey Guest

    Gentlemen,
    Thank you both for suggestions.

    Max, probably I have used wrong terms.
    I'll not create filters in the driver, but add and remove
    additional filter factories in the driver. And it will
    be a main filter that will always present when driver is
    loaded. And this 'static' filter will signals application
    about changes in the filter factory scheme. I think that
    it is similar to the way you have offered.

    The problem is that we already have application that
    use these additional filters. But in previous implementation
    they was implementes as separate drivers. So application's
    code is developed to use existing filters from custom
    category. And I want to minimize application's code
    changing. I'll just add into application code event handler
    that will calls existing code of enumeration of filters of
    my category.
    But if it will be a really hard to implement
    filter's factory changing I'll follow your suggestion

    Andrey.
     
    Andrey, Jun 27, 2006
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.