⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cpp

📁 完整的基于Conxant平台的USB电视棒的WIN驱动程序。
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/*+++ *******************************************************************\ 
* 
*  Copyright and Disclaimer: 
*  
*     --------------------------------------------------------------- 
*     This software is provided "AS IS" without warranty of any kind, 
*     either expressed or implied, including but not limited to the 
*     implied warranties of noninfringement, merchantability and/or 
*     fitness for a particular purpose.
*     --------------------------------------------------------------- 
*   
*     Copyright (c) 2008 Conexant Systems, Inc. 
*     All rights reserved. 
*
\******************************************************************* ---*/ 

#include "Device.h"
#include "CaptureFilter.h"
#include "TvAudioFilter.h"
#include "BasePin.h"
#include "VideoPin.h"
#include "VbiPin.h"
#include "audioPin.h"
#include "VideoInputPin.h"
#include "SlicedCCPin.h"
#include "ts_pin.h"
#include "PinDataRanges.h"
#include "debug.h" 
#include "BdaTunerFilter.h"
#include "commonguid.h"

extern "C"
{
    #include <wdm.h>
}

#include <windef.h>
#include <ks.h>
#include <ksmedia.h>

KSPIN_MEDIUM AudioInputPinMedium = { XBAR_AUDIO_OUT_GUID, 0, 0 };


/////////////////////////////////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////////////////////////////////////////
//***************************************************************************************
//Capture Filter Descriptor
//***************************************************************************************
/////////////////////////////////////////////////////////////////////////////////////////

//
// CaptureFilterCategories:
//
// The list of category GUIDs for the capture filter.
//
static
const
GUID
CaptureFilterCategories[] = 
{
    STATICGUIDOF (KSCATEGORY_VIDEO),
    STATICGUIDOF (KSCATEGORY_CAPTURE),
};


//
// CaptureFilterPinDescriptors:
//
// The list of pin descriptors on the capture filter.

KSPIN_DESCRIPTOR_EX
CaptureFilterPinDescriptors[] = 
{

    // Analog Video Input pin
    {
        &VideoInputPinDispatch,                             // Dispatch                     
        NULL,                             // AutomationTable              
        {                                                                 
            0,                            // Interfaces count             
            NULL,                         // Interfaces                   
            1,                            // Mediums count       
            &VideoInputPinMedium,         // Mediums             
            VIDEO_INPUT_PIN_RANGE_COUNT,  // Range Count    
            VideoInputPinDataRanges,      // Ranges         
            KSPIN_DATAFLOW_IN,            // Dataflow                     
            KSPIN_COMMUNICATION_BOTH,     // Communication                
            &PINNAME_VIDEO_ANALOGVIDEOIN, // Category                   
            &PINNAME_VIDEO_ANALOGVIDEOIN, // Name                       
            0                             // Reserved                     
        },                                                              
        KSPIN_FLAG_USE_STANDARD_TRANSPORT,// Flag for channel change info!
        1,                                // Instances Possible           
        1,                                // Instances Necessary          
        NULL,                             // Allocator Framing            
        NULL                              // IntersectHandler    
    },
    // Analog Audio Input pin

    {
    NULL,                                 // Dispatch               
    NULL,                                 // AutomationTable        
    {                                                               
        0,                                // Interfaces count       
        NULL,                             // Interfaces             
        1,                                // Mediums count
        &AudioInputPinMedium,             // Mediums      
        AUDIO_INPUT_PIN_RANGE_COUNT,      // Range Count
        AudioInputPinDataRanges,          // Ranges     
        KSPIN_DATAFLOW_IN,                // Dataflow               
        KSPIN_COMMUNICATION_BOTH,         // Communication          
        &PINNAME_VIDEO_ANALOGAUDIOIN,     // Category               
        &PINNAME_VIDEO_ANALOGAUDIOIN,     // Name                   
        0                                 // Reserved               
    },                                                              
    0,                                    // Flags                  
    1,                                    // Instances Possible     
    0,                                    // Instances Necessary    
    NULL,                                 // Allocator Framing      
    NULL                                  // IntersectHandler       
    },

    // Capture Pin
    {
        &VideoPinDispatch,
        &PIN_AUTOMATION_TABLE,
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            SIZEOF_ARRAY( CapturePinDataRanges ), // Range Count
            CapturePinDataRanges,           // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_BOTH,       // Communication
            &PINNAME_VIDEO_CAPTURE,         // Category
            &PINNAME_VIDEO_CAPTURE,         // Name
            0                               // Reserved
        },

        KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING,       // Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        &PIN_ALLOCATOR_FRAMING,        // Allocator Framing
        reinterpret_cast <PFNKSINTERSECTHANDLEREX>
            (VideoPin::intersectRange)
    },

    //
    // Audio Output Pin
    //
    {
        &g_audio_pin_dispatch,
        NULL,             
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            SIZEOF_ARRAY(g_audio_pin_data_ranges), // Range Count
            g_audio_pin_data_ranges,        // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_BOTH,       // Communication (both source and sink)
            &PINNAME_CAPTURE,               // Category 
            (GUID*)&PINNAME_AUDIO_OUT,      // Name
            0                               // Reserved
        },
        
        KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING, //Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        &PIN_ALLOCATOR_FRAMING,             // Allocator Framing
        (PFNKSINTERSECTHANDLEREX)AudioPin::static_IntersectHandler
    },
     // VBI Pin
    {
        &VbiPinDispatch,
        &PIN_AUTOMATION_TABLE,
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            SIZEOF_ARRAY( VBIPinDataRanges ),// Range Count
            VBIPinDataRanges,               // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_BOTH,       // Communication
            &PINNAME_VIDEO_VBI,             // Category
            &PINNAME_VIDEO_VBI,             // Name
            0                               // Reserved
        },

        KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING, // Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        &PIN_ALLOCATOR_FRAMING,        // Allocator Framing
        reinterpret_cast <PFNKSINTERSECTHANDLEREX>
            (VbiPin::intersectRange)
    },
     // Sliced CC Pin
    {
        &g_sliced_cc_pin_dispatch,
        &PIN_AUTOMATION_TABLE,
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            SIZEOF_ARRAY(g_sliced_cc_pin_data_ranges),// Range Count
            g_sliced_cc_pin_data_ranges,    // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_BOTH,       // Communication
            &PINNAME_VIDEO_CC,              // Category
            &PINNAME_VIDEO_CC,              // Name
            0                               // Reserved
        },

        KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING, // Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        &PIN_ALLOCATOR_FRAMING,        // Allocator Framing
        reinterpret_cast <PFNKSINTERSECTHANDLEREX>
            (SlicedCCPin::static_IntersectHandler)
    }
};
/////////////////////////////////////////////////////////////////////////////////////////
KSPIN_DESCRIPTOR_EX
CaptureFilterEnableHANCAudioOutPinDescriptors[] = 
{

    // Analog Video Input pin
    {
        &VideoInputPinDispatch,                             // Dispatch                     
        NULL,                             // AutomationTable              
        {                                                                 
            0,                            // Interfaces count             
            NULL,                         // Interfaces                   
            1,                            // Mediums count       
            &VideoInputPinMedium,         // Mediums             
            VIDEO_INPUT_PIN_RANGE_COUNT,  // Range Count    
            VideoInputPinDataRanges,      // Ranges         
            KSPIN_DATAFLOW_IN,            // Dataflow                     
            KSPIN_COMMUNICATION_BOTH,     // Communication                
            &PINNAME_VIDEO_ANALOGVIDEOIN, // Category                   
            &PINNAME_VIDEO_ANALOGVIDEOIN, // Name                       
            0                             // Reserved                     
        },                                                              
        KSPIN_FLAG_USE_STANDARD_TRANSPORT,// Flag for channel change info!
        1,                                // Instances Possible           
        1,                                // Instances Necessary          
        NULL,                             // Allocator Framing            
        NULL                              // IntersectHandler    
    },
    // Analog Audio Input pin

    {
    NULL,                                 // Dispatch               
    NULL,                                 // AutomationTable        
    {                                                               
        0,                                // Interfaces count       
        NULL,                             // Interfaces             
        1,                                // Mediums count
        &AudioInputPinMedium,             // Mediums      
        AUDIO_INPUT_PIN_RANGE_COUNT,      // Range Count
        AudioInputPinDataRanges,          // Ranges     
        KSPIN_DATAFLOW_IN,                // Dataflow               
        KSPIN_COMMUNICATION_BOTH,         // Communication          
        &PINNAME_VIDEO_ANALOGAUDIOIN,     // Category               
        &PINNAME_VIDEO_ANALOGAUDIOIN,     // Name                   
        0                                 // Reserved               
    },                                                              
    0,                                    // Flags                  
    1,                                    // Instances Possible     
    0,                                    // Instances Necessary    
    NULL,                                 // Allocator Framing      
    NULL                                  // IntersectHandler       
    },

    // Capture Pin
    {
        &VideoPinDispatch,
        &PIN_AUTOMATION_TABLE,
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            SIZEOF_ARRAY( CapturePinDataRanges ), // Range Count
            CapturePinDataRanges,           // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_BOTH,       // Communication
            &PINNAME_VIDEO_CAPTURE,         // Category
            &PINNAME_VIDEO_CAPTURE,         // Name
            0                               // Reserved
        },

        KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING,       // Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        &PIN_ALLOCATOR_FRAMING,        // Allocator Framing
        reinterpret_cast <PFNKSINTERSECTHANDLEREX>
            (VideoPin::intersectRange)
    },

    //
    // Audio Output Pin
    //
    {
        &g_audio_pin_dispatch,
        NULL,             
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            SIZEOF_ARRAY(g_audio_pin_data_ranges), // Range Count
            g_audio_pin_data_ranges,        // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_BOTH,       // Communication (both source and sink)
            &PINNAME_CAPTURE,               // Category 
            (GUID*)&PINNAME_AUDIO_OUT,      // Name
            0                               // Reserved
        },
        
        KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING, //Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        &PIN_ALLOCATOR_FRAMING,             // Allocator Framing
        (PFNKSINTERSECTHANDLEREX)AudioPin::static_IntersectHandler
    },
     // VBI Pin
    {
        &VbiPinDispatch,
        &PIN_AUTOMATION_TABLE,
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            SIZEOF_ARRAY( VBIPinDataRanges ),// Range Count
            VBIPinDataRanges,               // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_BOTH,       // Communication
            &PINNAME_VIDEO_VBI,             // Category
            &PINNAME_VIDEO_VBI,             // Name
            0                               // Reserved
        },

        KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING, // Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        &PIN_ALLOCATOR_FRAMING,        // Allocator Framing

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -