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

📄 tunerfilter.cpp

📁 完整的基于Conxant平台的USB电视棒的WIN驱动程序。
💻 CPP
字号:
/*+++ *******************************************************************\ 
* 
*  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 "tunerfilter.h"
#include "Sidewindertunerprop.h"
#include "commonguid.h"

#include "itunerproperties.h"
/**************************************************************************

    DESCRIPTOR AND DISPATCH LAYOUT

**************************************************************************/

//
// g_tuner_filter_pin_descriptors:
//
// The list of pin descriptors on the filter.  
//
// These pin descriptors are ignored by the system.  There is only one here, and it's a 
// dummy pin.  Tuner pins are defined in the tuner property set.  See 
// ITunerProperties::static_getCaps.
//
const KSPIN_DESCRIPTOR_EX g_tuner_filter_pin_descriptors[] = 
{
    //Pin 0: dummy pin
    {
        NULL,                               //Pin dispatch
        NULL,             
        {
            NULL,                           // Interfaces (NULL, 0 == default)
            0,
            NULL,                           // Mediums (NULL, 0 == default)
            0,
            0,                              // Range Count
            NULL,                           // Ranges
            KSPIN_DATAFLOW_OUT,             // Dataflow
            KSPIN_COMMUNICATION_NONE,       // Communication (both source and sink)
            NULL,                           // Category 
            NULL,                           // Name
            0                               // Reserved
        },
        
        KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT |
        KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING, //Pin Flags
        1,                                  // Instances Possible
        0,                                  // Instances Necessary
        NULL,                               // Allocator Framing
        NULL                                // Intersect handler
    }
};


/////////////////////////////////////////////////////////////////////////////////////////
//Tuner property sets and automation table.
//
//The following table defines the property sets supported by the tuner.
//Note that the handlers for each property are defined in the table.  If a handler 
// is NULL, it means that that get or set property is not supported.
//
DEFINE_KSPROPERTY_TABLE(g_tuner_properties)
{
    // tuner capabilities - modes supported, video medium, tv audio medium,
    // radio audio medium
    DEFINE_KSPROPERTY_ITEM
    (
        KSPROPERTY_TUNER_CAPS,
        ITunerProperties::static_getCaps,        // Get property handler
        sizeof(KSPROPERTY_TUNER_CAPS_S),        // MinProperty
        sizeof(KSPROPERTY_TUNER_CAPS_S),        // MinData
        FALSE,                                  // Set property handler
        NULL,                                   // Values
        0,                                      // RelationsCount
        NULL,                                   // Relations
        NULL,                                   // SupportHandler
        0                                       // SerializedSize
    ),

    // tuner mode capabilities - TV, FM Radio, ATSC
    DEFINE_KSPROPERTY_ITEM
    (
        KSPROPERTY_TUNER_MODE_CAPS,
        ITunerProperties::static_getModeCaps,    // Get property handler
        sizeof(KSPROPERTY_TUNER_MODE_CAPS_S),   // MinProperty
        sizeof(KSPROPERTY_TUNER_MODE_CAPS_S),   // MinData
        NULL,                                   // Set property handler
        NULL,                                   // Values
        0,                                      // RelationsCount
        NULL,                                   // Relations
        NULL,                                   // SupportHandler
        0                                       // SerializedSize
    ),

    // current tuner mode
    DEFINE_KSPROPERTY_ITEM
    (
        KSPROPERTY_TUNER_MODE,                  
        ITunerProperties::static_getMode,        // Get property handler
        sizeof(KSPROPERTY_TUNER_MODE_S),        // MinProperty
        sizeof(KSPROPERTY_TUNER_MODE_S),        // MinData
        ITunerProperties::static_setMode,        // Set property handler
        NULL,                                   // Values
        0,                                      // RelationsCount
        NULL,                                   // Relations
        NULL,                                   // SupportHandler
        0                                       // SerializedSize
    ),

    // tuner standard - NTSC, PAL, SECAM
    DEFINE_KSPROPERTY_ITEM
    (
        KSPROPERTY_TUNER_STANDARD,
        ITunerProperties::static_getStandard,    // Get property handler
        sizeof(KSPROPERTY_TUNER_STANDARD_S),    // MinProperty
        sizeof(KSPROPERTY_TUNER_STANDARD_S),    // MinData
        ITunerProperties::static_setStandard,    // Set property handler
        NULL,                                   // Values
        0,                                      // RelationsCount
        NULL,                                   // Relations
        NULL,                                   // SupportHandler
        sizeof(KSPROPERTY_TUNER_STANDARD_S)     // SerializedSize
    ),

    // tuner frequency
    DEFINE_KSPROPERTY_ITEM
    (
        KSPROPERTY_TUNER_FREQUENCY,
        ITunerProperties::static_getFrequency,   // Get property handler
        sizeof(KSPROPERTY_TUNER_FREQUENCY_S),   // MinProperty
        sizeof(KSPROPERTY_TUNER_FREQUENCY_S),   // MinData
        ITunerProperties::static_setFrequency,   // Set property handler
        NULL,                                   // Values
        0,                                      // RelationsCount
        NULL,                                   // Relations
        NULL,                                   // SupportHandler
        sizeof(KSPROPERTY_TUNER_FREQUENCY_S)    // SerializedSize
    ),

    // tuner index number, some tuners have more than one input
    DEFINE_KSPROPERTY_ITEM
    (
        KSPROPERTY_TUNER_INPUT,
        ITunerProperties::static_getInput,       // Get property handler
        sizeof(KSPROPERTY_TUNER_INPUT_S),       // MinProperty
        sizeof(KSPROPERTY_TUNER_INPUT_S),       // MinData
        ITunerProperties::static_setInput,       // Set property handler
        NULL,                                   // Values
        0,                                      // RelationsCount
        NULL,                                   // Relations
        NULL,                                   // SupportHandler
        sizeof(KSPROPERTY_TUNER_INPUT_S)        // SerializedSize
    ),

    // tuner status - current freq, PLL offset, Signal Strength, Busy
    DEFINE_KSPROPERTY_ITEM
    (
        KSPROPERTY_TUNER_STATUS,
        ITunerProperties::static_getStatus,      // Get property handler
        sizeof(KSPROPERTY_TUNER_STATUS_S),      // MinProperty
        sizeof(KSPROPERTY_TUNER_STATUS_S),      // MinData
        NULL,                                   // Set property handler
        NULL,                                   // Values
        0,                                      // RelationsCount
        NULL,                                   // Relations
        NULL,                                   // SupportHandler
        sizeof(KSPROPERTY_TUNER_STATUS_S)       // SerializedSize
    )
};

/////////////////////////////////////////////////////////////////////////////////////////
//Tuner property set table.
//
DEFINE_KSPROPERTY_SET_TABLE(g_tuner_property_sets)
{
    DEFINE_KSPROPERTY_SET
    (
        &PROPSETID_TUNER,                           // Set
        SIZEOF_ARRAY(g_tuner_properties),           // PropertiesCount
        g_tuner_properties,                         // PropertyItems
        0,                                          // FastIoCount
        NULL                                        // FastIoTable
    )
};

/////////////////////////////////////////////////////////////////////////////////////////
//Tuner automation table.
//

DEFINE_KSAUTOMATION_TABLE(g_tuner_automation_table)
{
    DEFINE_KSAUTOMATION_PROPERTIES(g_tuner_property_sets),
    DEFINE_KSAUTOMATION_METHODS_NULL,
    DEFINE_KSAUTOMATION_EVENTS_NULL
};

//
// g_tuner_filter_descriptor:
//
// The descriptor for the tuner filter.  
//
//Note that the "Reference GUID" parameter must match the one in the INF file
// in the "Interfaces" section unless a different reference string is supplied 
// in KsCreateFilterFactory.
//

const KSFILTER_DESCRIPTOR g_tuner_filter_descriptor = 
{
    NULL,                                   // Dispatch Table
    &g_tuner_automation_table,              // Automation Table
    KSFILTER_DESCRIPTOR_VERSION,            // Version
    0,                                      // Flags
    &TUNER_REFERENCE_GUID,                  // Reference GUID
    DEFINE_KSFILTER_PIN_DESCRIPTORS(g_tuner_filter_pin_descriptors),
    DEFINE_KSFILTER_CATEGORY(KSCATEGORY_TVTUNER),
    DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL,
    DEFINE_KSFILTER_DEFAULT_CONNECTIONS,
    NULL                                    // Component ID
};

⌨️ 快捷键说明

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