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

📄 prop.cpp

📁 windows 底层驱动
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*+++ *******************************************************************\
*
*   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 merchantability and/or fitness for a
*       particular purpose.
*
*       Copyright (c) 1999-2000 Conexant Systems, Inc.
*       All Rights Reserved.
*       ---------------------------------------------------------------
*
*
*   Abstract:
*
*       This module is responsible for handling all adapter property sets.
*
\******************************************************************* ---*/

extern "C" {

//
// Make sure we compile the MS headers at warning level 3. Restore the
// previous warning level when we're done.
//
#pragma warning( push, 3 )
    #include <strmini.h>
    #include <ksmedia.h>
#pragma warning( pop )

}

#include "tuner.h"
#include "debug.h"
#include "prop.h"
#include "drv2user.h"
#include "drv2002.h"


// -------------------------------------------------------------------
// A few notes about property set handling
//
// Property sets used in Testcap are of two varieties, those that have
// default values, ranges, and stepping, such as VideoProcAmp,
// and those which don't have defaults and ranges, such as TvAudio.
//
// Default values and stepping are established by tables in capprop.h,
// no code is required to implement this other than initally creating the tables.
//
// Many of the property sets require the ability to modify a number
// of input parameters.  Since KS doesn't allow this inherently, you'll
// note that some property sets require copying the provided input parameters
// to the ouput parameter list, effectively creating a "read, modify, write"
// capability.  For this reason, the input and output parameter lists
// use identical structures.
//
// On an SRB_GET_DEVICE_PROPERTY, read-only input data to the driver is provided as:
//      pSrb->CommandData.PropertyInfo
//
// ... while the output data pointer is:
//      pSrb->CommandData.PropertyInfo.PropertyInfo
//

/*++ ********************************************************************\
*
*   Function:
*
*       void AdapterGetTunerProperty( PHW_STREAM_REQUEST_BLOCK pSrb )
*
*   Purpose:
*
*       Get the property value
*
*   Return:
*
*       None
*
*   History:
*
*
\******************************************************************** --*/
void
AdapterGetTunerProperty( PHW_STREAM_REQUEST_BLOCK pSrb )
{
    PTUNER_DATA_EXTENSION   pTunerDataExt = (PTUNER_DATA_EXTENSION)pSrb->HwDeviceExtension;
    PSTREAM_PROPERTY_DESCRIPTOR pSPD = pSrb->CommandData.PropertyInfo;

    //DbgLogTrace(("AdapterGetTunerProperty(%x))\n", pSrb));

    pSrb->ActualBytesTransferred = 0;

    switch( pSPD->Property->Id )
    {
        // Assume success for now
        pSrb->Status = STATUS_SUCCESS;

        // tuner capabilities
        case KSPROPERTY_TUNER_CAPS:
        {
            //Get the board ID
            ULONG board_id = 0;
            BTTUNERINTERFACE tuner_interface;
            tuner_interface.ulCommand = BTUNER_COMMAND_GET_BOARD_ID;

            if(SendCommand(&tuner_interface, pTunerDataExt->pPDO))
            {
                board_id = tuner_interface.board_id;
            }

            PKSPROPERTY_TUNER_CAPS_S pCaps = (PKSPROPERTY_TUNER_CAPS_S)pSPD->Property;
            pCaps =(PKSPROPERTY_TUNER_CAPS_S)pSPD->PropertyInfo;
            pCaps->ModesSupported = pTunerDataExt->ulSupportedModes;
            pCaps->VideoMedium = TVTunerMediums[ 0 ];
            pCaps->VideoMedium.Id = board_id;
            pCaps->TVAudioMedium = TVTunerMediums[ 1 ];
            pCaps->TVAudioMedium.Id = board_id;
            pCaps->RadioAudioMedium.Set = GUID_NULL;
            pCaps->RadioAudioMedium.Id = 0;
            pCaps->RadioAudioMedium.Flags = 0;
            pSrb->ActualBytesTransferred = sizeof( KSPROPERTY_TUNER_CAPS_S );
            break;
        }

        // current tuner mode
        case KSPROPERTY_TUNER_MODE:
        {
            PKSPROPERTY_TUNER_MODE_S pMode = (PKSPROPERTY_TUNER_MODE_S)pSPD->PropertyInfo;
            pMode->Mode = pTunerDataExt->ulTunerMode;
            pSrb->ActualBytesTransferred = sizeof(KSPROPERTY_TUNER_MODE_S);
            break;
        }

        // tuner mode capabilites
        //
        // For this property, we are given one of the supported modes in the input buffer, and
        // are requested to fill in the capabilities for that mode in the output buffer.
        case KSPROPERTY_TUNER_MODE_CAPS:
        {
            //Make sure the requested mode is supported.
            PKSPROPERTY_TUNER_MODE_CAPS_S input_buffer = (PKSPROPERTY_TUNER_MODE_CAPS_S)pSPD->Property;
            if(!input_buffer->Mode & pTunerDataExt->ulSupportedModes)
            {
                pSrb->Status = STATUS_INVALID_PARAMETER;
                break;
            }

            //Fill in the output buffer
            PKSPROPERTY_TUNER_MODE_CAPS_S pCaps =(PKSPROPERTY_TUNER_MODE_CAPS_S)pSPD->PropertyInfo;
            switch(input_buffer->Mode)
            {
            case KSPROPERTY_TUNER_MODE_FM_RADIO:
                pCaps->StandardsSupported = 0;  //N/A
                if ( pTunerDataExt->uiTunerType == PHILIPS_FM1286_MK3 )
                {
                    pCaps->MinFrequency = FM_LOW_1286MK3;   // 75.90 MHz
                    pCaps->MaxFrequency = FM_HIGH_1286MK3;  // 90.00 MHz
                }
                else
                {
                    pCaps->MinFrequency = FM_LOW;           //  86.50 MHz
                    pCaps->MaxFrequency = FM_HIGH;          // 108.50 MHz
                }
                pCaps->TuningGranularity = 50000;
                pCaps->SettlingTime = 150;
                pCaps->Strategy = KS_TUNER_STRATEGY_PLL;
                //NOTE: Although the strategy is PLL, the OS seems to ignore the PLL value
                // and uses the signal strength value instead.

                //Fill in the number of inputs.  Only tuners supporting FM are included
                switch(pTunerDataExt->uiTunerType)
                {
                case NTSC_M:
                case PAL_B:
                case TEMIC_4_IN_1:
                case TEMIC_4039:
                case PHILIPS_FM1216_MK3:
                case PHILIPS_FM1236_MK3:
                case PHILIPS_FM1286_MK3:
                case PHILIPS_FMD1216_ME:
                    pCaps->NumberOfInputs = 2;
                    break;

                default:
                    pCaps->NumberOfInputs = 1;
                    break;
                }

                break;

            case KSPROPERTY_TUNER_MODE_ATSC:
                //Only one tuner (NTSC_M_ATSC) supports this mode for the moment
                //These values are for it. . .
                pCaps->StandardsSupported = KS_AnalogVideo_NTSC_M;
                pCaps->MinFrequency = 55250000;
                pCaps->MaxFrequency = 801250000;
                pCaps->TuningGranularity = 62500;
                pCaps->NumberOfInputs = 2;
                pCaps->SettlingTime = 150;
                pCaps->Strategy = KS_TUNER_STRATEGY_DRIVER_TUNES;
                break;

            case KSPROPERTY_TUNER_MODE_TV:
                //Fields common to all tuners
                pCaps->TuningGranularity = 62500;
                pCaps->SettlingTime = 150;
                pCaps->Strategy = KS_TUNER_STRATEGY_PLL;

                //Fill in pCaps->StandardsSupported
                switch(pTunerDataExt->uiTunerType)
                {
                case NTSC_M:
                case NTSC_M_ATSC:
                case TEMIC_4039:
                case TEMIC_4136:
                case THOMSON_DTT761x:
                    pCaps->StandardsSupported = KS_AnalogVideo_NTSC_M;
                    break;
                case PHILIPS_FM1236_MK3:
                case PHILIPS_FQ1236_MK3:
                case PHILIPS_FI1236_MK3:
                    pCaps->StandardsSupported = KS_AnalogVideo_NTSC_M |
                                                KS_AnalogVideo_PAL_N_COMBO;
                    break;
                case PHILIPS_FM1286_MK3:
                    pCaps->StandardsSupported = KS_AnalogVideo_NTSC_M_J;
                    break;
                case PAL_B:
                    pCaps->StandardsSupported = KS_AnalogVideo_PAL_B;
                    break;
                case PAL_I:
                    pCaps->StandardsSupported = KS_AnalogVideo_PAL_I;
                    break;
                case PAL_D:
                    pCaps->StandardsSupported = KS_AnalogVideo_PAL_D;
                    break;
                case SECAM:
                    pCaps->StandardsSupported = KS_AnalogVideo_SECAM_L | KS_AnalogVideo_SECAM_L1;
                    break;
                case TEMIC_4_IN_1:
                case PHILIPS_FM1216_MK3:
                case PHILIPS_FQ1216_MK3:
                case PHILIPS_FMD1216_ME:
                    pCaps->StandardsSupported = KS_AnalogVideo_PAL_B   |
                                                KS_AnalogVideo_PAL_G   |
                                                KS_AnalogVideo_PAL_D   |
                                                KS_AnalogVideo_PAL_I   |
                                                KS_AnalogVideo_SECAM_L |
                                                KS_AnalogVideo_SECAM_L1;

                    break;

                case XUGUANG_126:   // XuGuang JS-2S/126 tuner support PAL D/K and I, no radio
                    pCaps->StandardsSupported = KS_AnalogVideo_PAL_D   |
                                                KS_AnalogVideo_PAL_I;
                    break;
				
				case TCL_2002_MI3:  // TCL2002MI-3 tuner support PAL D/K and I, no radio
                    pCaps->StandardsSupported = KS_AnalogVideo_PAL_D   |
                                                KS_AnalogVideo_PAL_I;
                    break;
                }

                //Fill in the number of inputs on the tuner
                switch(pTunerDataExt->uiTunerType)
                {
                case NTSC_M:
                case PAL_B:
                case NTSC_M_ATSC:
                case TEMIC_4_IN_1:
                case TEMIC_4039:
                case PHILIPS_FM1216_MK3:
                case PHILIPS_FM1236_MK3:
                case PHILIPS_FM1286_MK3:
                case PHILIPS_FMD1216_ME:
                    pCaps->NumberOfInputs = 2;
                    break;

                default:
                    pCaps->NumberOfInputs = 1;
                    break;
                }

                //Fill in the tuner min and max frequencies for TV mode.
                switch(pTunerDataExt->uiTunerType)
                {
                case PHILIPS_FM1216_MK3:
                case PHILIPS_FQ1216_MK3:
                    pCaps->MinFrequency = BAND_LOW_1216;
                    pCaps->MaxFrequency = BAND_HIGH_1216;
                    break;
                case PHILIPS_FM1286_MK3:
                    pCaps->MinFrequency = BAND_LOW_1286MK3;
                    pCaps->MaxFrequency = BAND_HIGH_1286MK3;

⌨️ 快捷键说明

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