[wdmaudiodev] AVStream Audio Filter PIn Connection Problem

  • From: "Dale Hill" <daleh@xxxxxxxxxxxxxxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Tue, 5 Apr 2011 10:32:04 -0600

All,

 

I'm developing an AVStream driver that supports two audio pins - one for
capture and one for rendering. To test, I am creating a filter graph with
two instances of the filter and then connecting the output of the first to
the input of the second. When I attempt to connect I am getting the error
message: "The filters cannot agree on a connection. Verify type connection
...." and the error is 0x80040217. I suspect that I don't have the
descriptors set up properly. Below is a list of all the descriptors. Could
someone please take a look to see what might be going wrong here? 

 

Also, I notices that the filter is being created but the pins are not. Are
they only created when a connection is made?

 

TIA!

 

Descriptors:

 

// Filter Descriptors

//

// Pin Data Range

const 

KSDATARANGE_AUDIO

FilterPinDataRange =

{

      {

            sizeof(KSDATARANGE_AUDIO),    // Format Size

            0,                            // Flags

            0,                            // Sample Size

            0,                                        // Reserved

            STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),    // Major Format

            STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM),   // Format Sub Type

            STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX),    // Format
Specifier

      },

      MAX_AUDIO_CHANNELS,                 // Max Channels

      BITS_PER_SAMPLE,                    // Max Bits per sample

      BITS_PER_SAMPLE,                    // Min Bits per sample

      MIN_SAMPLE_FREQ,                    // Min Sample Frequency

      MAX_SAMPLE_FREQ                     // Max Sample Frequency

};

 

const 

PKSDATARANGE 

FilterPinDataRanges[1] = {(PKSDATARANGE)&FilterPinDataRange};

 

// Framing Requirements

DECLARE_SIMPLE_FRAMING_EX(

    FilterPinAllocatorFraming,                  // Structure Name

    STATICGUIDOF(KSMEMORY_TYPE_KERNEL_NONPAGED),// Memory Type

    KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY,     // Flags

      MAX_OUTSTANDING_FRAMES,                   // Frames Outstanding

      1,                                        // Alignment

      FRAME_SIZE,                               // Min Frame Size

      FRAME_SIZE);                              // Max Frame Size

 

// Capture Pin Dispatch Table

const 

KSPIN_DISPATCH 

FilterCapturePinDispatch = 

{

      CFilterCapturePin::DispatchCreate,  // Pin Create

    NULL,                                 // Pin Close

    CFilterCapturePin::DispatchProcess,   // Pin Process

    NULL,                                 // Pin Reset

    CFilterPin::DispatchSetFormat,        // Pin Set Data Format

    CFilterPin::DispatchSetState,         // Pin Set Device State

    NULL,                                 // Pin Connect

    NULL,                                 // Pin Disconnect

    NULL,                                 // Clock Dispatch

    NULL                                  // Allocator Dispatch

};

 

// Render Pin Dispatch Table

const 

KSPIN_DISPATCH 

FilterRenderPinDispatch = 

{

      CFilterRenderPin::DispatchCreate,   // Pin Create

    NULL,                                             // Pin Close

    CFilterRenderPin::DispatchProcess,  // Pin Process

    NULL,                                             // Pin Reset

    CFilterPin::DispatchSetFormat,        // Pin Set Data Format

    CFilterPin::DispatchSetState,         // Pin Set Device State

    NULL,                                 // Pin Connect

    NULL,                                 // Pin Disconnect

    NULL,                                 // Clock Dispatch

    NULL                                  // Allocator Dispatch

};

 

//

// Pin Descriptors

//

const

KSPIN_DESCRIPTOR_EX

FilterPinDescriptors[] = 

{

      // Render Pin

      {

            &FilterRenderPinDispatch,     // Dispatch Table

            NULL,                         // Automatic Table,

            {                             // KSPIN_DESCRIPTOR

                  0,                      // Interface Count

                  NULL,                   // Interfaces

                  0,                      // Media Count

                  NULL,                   // Media Types

                  SIZEOF_ARRAY(FilterPinDataRanges), // Data Range Count

                  FilterPinDataRanges,    // Data Range

                  KSPIN_DATAFLOW_IN,      // Data Flow,

                  KSPIN_COMMUNICATION_BOTH,     // Communications

                  &KSCATEGORY_AUDIO,            // Catagory GUID

                  &KSNODETYPE_LINE_CONNECTOR,   // Pin name GUID

                  0                             // Reserved

            },

            KSPIN_FLAG_DISPATCH_LEVEL_PROCESSING  |   // Flags

            KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING |   // 

            KSPIN_FLAG_GENERATE_MAPPINGS      |       // 

            KSPIN_FLAG_USE_STANDARD_TRANSPORT |       //

            KSPIN_FLAG_RENDERER,                      //                  

            MAX_RENDER_PINS,                          // Instances Possible

            1,                                        // Instances necessary

            &FilterPinAllocatorFraming,               // Frameing 

            NULL                                      // Intersect Handler

      },

 

      // Capture Pin

      {

            &FilterCapturePinDispatch,                // Dispatch Table

            NULL,                                     // Automatic Table,

            {                                         // KSPIN_DESCRIPTOR

                  0,                                  // Interface Count

                  NULL,                               // Interfaces

                  0,                                  // Media Count

                  NULL,                               // Media Types

                  SIZEOF_ARRAY(FilterPinDataRanges), // Data Range Count

                  FilterPinDataRanges,                // Data Ranges

                  KSPIN_DATAFLOW_OUT,                 // Data Flow,

                  KSPIN_COMMUNICATION_BOTH,           // Communications

                  &KSCATEGORY_CAPTURE,                // Catagory GUID

                  &KSNODETYPE_LINE_CONNECTOR,         // Pin name GUID

                  0                                   // Reserved

            },

            KSPIN_FLAG_GENERATE_MAPPINGS |            // Flags

            KSPIN_FLAG_USE_STANDARD_TRANSPORT,       //

            MAX_CAPTURE_PINS,                         // Instances Possible

            1,                                        // Instances necessary

            &FilterPinAllocatorFraming,               // Frameing 

            NULL        

      }

};

 

// Filter Categories

const

GUID

FilterFilterCategories[2] = 

{

      STATICGUIDOF(KSCATEGORY_RENDER),

      STATICGUIDOF(KSCATEGORY_CAPTURE)

};

 

// Filter Dispatch Table

const

KSFILTER_DISPATCH 

FilterFilterDispatch = 

{

      CFilterAudioFilter::DispatchCreate,       // Filter Create

      NULL,                                     // Filter Close

      NULL,                                     // Filter Process

      NULL                                      // Filter Reset

};

 

// Filter Descriptor

const

KSFILTER_DESCRIPTOR

FilterFilterDescriptor = 

{

      &FilterFilterDispatch,              // Dispatch Table

      NULL,                               // Automatic Table

      KSFILTER_DESCRIPTOR_VERSION,  // Version

      0,                                  // Flags

      &KSNAME_Filter,                     // Reference GUID

      DEFINE_KSFILTER_PIN_DESCRIPTORS(FilterPinDescriptors),      // Pin
Count, Size, and Descriptor  

      DEFINE_KSFILTER_CATEGORIES(FilterFilterCategories),         //
Catagory Count and catagories

      DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL,    // Node Count, Size,
Descriptor

      DEFINE_KSFILTER_DEFAULT_CONNECTIONS,      // Connection Count and
Connections

      NULL

};

 

//

// Device and filter Descriptors

//

// FilterFilterDescriptor:

//

// The filter descriptor for the Filter Filter.

DEFINE_KSFILTER_DESCRIPTOR_TABLE (FilterDescriptors) 

{ 

    &FilterFilterDescriptor

};

 

//

// FilterDeviceDispatch:

//

// This is the dispatch table for the Filter Device.  Plug and play

// notifications as well as power management notifications are dispatched

// through this table.

//

const

KSDEVICE_DISPATCH

FilterDeviceDispatch = 

{

    CFilterVirtualSoundCard::DispatchAddDevice,       // Pnp Add Device

    CFilterVirtualSoundCard::DispatchStartDevice,     // Pnp Start

      NULL,                                           // Post-Start

    NULL,                                             // Pnp Query Stop

    NULL,                                             // Pnp Cancel Stop

    NULL,                                             // Pnp Stop

    NULL,                                             // Pnp Query Remove

    NULL,                                             // Pnp Cancel Remove

    NULL,                                             // Pnp Remove

    NULL,                                             // Pnp Query
Capabilities

    NULL,                                             // Pnp Surprise
Removal

    NULL,                                             // Power Query Power

    NULL,                                             // Power Set Power

    NULL                                              // Pnp Query Interface

};

 

//

// FilterDeviceDescriptor:

//

// This is the device descriptor for the Filter Audio device. It
initializies 

// the device's dispatch table.

//

const

KSDEVICE_DESCRIPTOR

FilterDeviceDescriptor = {

    &FilterDeviceDispatch,

    0,

    NULL

};

Other related posts: