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

📄 crossbarprop.h

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

#ifndef _CROSSBAR_PROP_H_
#define _CROSSBAR_PROP_H_

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

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


class Device;

//Pin Types
typedef enum{
        VIDEO_INPUT_SVIDEO,         //0
        VIDEO_INPUT_TUNER,          //1
        VIDEO_INPUT_COMPOSITE,      //2 
        AUDIO_INPUT_TUNER,          //3
        AUDIO_INPUT_LINE,           //4
        VIDEO_INPUT_TUNER_YC,       //5  Tuner through separate luma and chroma signals
        VIDEO_INPUT_COMPOSITE_YC,   //6  Composite through separate luma and chroma signals
        VIDEO_INPUT_COMPONENT,      //7
        AUDIO_INPUT_MUTE,           //8
        VIDEO_INPUT_DIF_TUNER,      //9
        AUDIO_INPUT_DIF_TUNER,      //10
        VIDEO_INPUT_BDA             //11
}PIN_INPUT_TYPE;

/////////////////////////////////////////////////////////////////////////////////////////
//Class CrossbarProperties
//
//This is a base class, meant to have a child class derrived from it describing the 
//supported set of input pins for the crossbar.
//
//The supported set of output pins is currently fixed at Audio decoder out and 
//video decoder out.  If that ever needs to change for some pinset, the output pin
//information would have to go in a child class as well.
//
//This class is the implementation of all the crossbar properties, including such things
//as getPinInfo, getRoute, setRoute, and canRoute.  SetRoute() is virtual since it requires
//knowledge of the input pin in order to set the route correctly.  As is getInputPinInfo. 
//
//Most other properties are handled entirely by the base class.
//
/////////////////////////////////////////////////////////////////////////////////////////

typedef struct _CROSSBAR_PIN_PROPERTIES
{    
    ULONG          type; 
    ULONG          related_pin_index;
    KSPIN_MEDIUM   medium;
}CROSSBAR_PIN_PROPERTIES, *PCROSSBAR_PIN_PROPERTIES;


class CrossbarProperties
{
public:
    CrossbarProperties(PDEVICE_OBJECT pdo);
    virtual ~CrossbarProperties();

    static CrossbarProperties* allocate(
        Device* p_device,
        PDEVICE_OBJECT p_pdo);

    NTSTATUS registerFilter(PDEVICE_OBJECT p_physical_device, DWORD medium_id);

    //Static entry points called by the system.
    //These are the actual property handlers.
    static NTSTATUS static_getCapabilities(
        PIRP p_irp,
        PKSPROPERTY_CROSSBAR_CAPS_S p_request,
        PKSPROPERTY_CROSSBAR_CAPS_S p_data);

    static NTSTATUS static_getPinInfo(
        PIRP p_irp,
        PKSPROPERTY_CROSSBAR_PININFO_S p_request,
        PKSPROPERTY_CROSSBAR_PININFO_S p_data);

    static NTSTATUS static_canRoute(
        PIRP p_irp,
        PKSPROPERTY_CROSSBAR_ROUTE_S p_request,
        PKSPROPERTY_CROSSBAR_ROUTE_S p_data);

    static NTSTATUS static_getRoute(
        PIRP p_irp,
        PKSPROPERTY_CROSSBAR_ROUTE_S p_request,
        PKSPROPERTY_CROSSBAR_ROUTE_S p_data);

    static NTSTATUS static_setRoute(
        PIRP p_irp,
        PKSPROPERTY_CROSSBAR_ROUTE_S p_request,
        PKSPROPERTY_CROSSBAR_ROUTE_S p_data);

    //Virtual functions to be overridden by a class representing an input pin set
public:
    virtual ULONG getNumInputPins() = 0;

    virtual BOOLEAN isAudioPin(ULONG pin_index) = 0;
    virtual BOOLEAN isVideoPin(ULONG pin_index) = 0;

    virtual NTSTATUS getInputPinInfo(
        ULONG index, 
        PCROSSBAR_PIN_PROPERTIES p_pin_info) = 0;
    
    virtual NTSTATUS setRoute(
        ULONG input_pin_index, 
        ULONG output_pin_index) = 0;

public:
    BOOLEAN canRoute(
        ULONG input_pin_index, 
        ULONG output_pin_index);
    
    NTSTATUS getRoute(
        ULONG  output_pin_index, 
        PULONG input_pin_index);

protected:
    //Output pin indexes
    typedef enum{
        XBAR_OUTPIN_VIDEO_DECODER       =0,
        XBAR_OUTPIN_AUDIO_DECODER       =1
    }CROSSBAR_OUTPUT_PINS;

    //Output pin information
    enum{
        XBAR_MAX_VIDEO_OUTPUT_PIN       =0,
        XBAR_NUM_OUTPINS                =2
    };

    //Accessors for the current routes
    ULONG& selectedVideoInput();
    ULONG& selectedAudioInput();

    BOOLEAN isValidPin(ULONG pin_index, BOOLEAN is_in_pin);

private:
    //Current routes
    ULONG   _selected_video_input;
    ULONG   _selected_audio_input;

    PDEVICE_OBJECT _pdo;

    //Output pin info.  Currently the same for all pin sets
    static CROSSBAR_PIN_PROPERTIES _output_pin_info[XBAR_NUM_OUTPINS];

};


inline ULONG& CrossbarProperties::selectedVideoInput()
{
    return _selected_video_input;
}
inline ULONG& CrossbarProperties::selectedAudioInput()
{
    return _selected_audio_input;
}

inline BOOLEAN CrossbarProperties::isValidPin(ULONG pin_index, BOOLEAN is_in_pin)
{
    if(is_in_pin)
    {
        return ((pin_index == 0xFFFFFFFF) || (pin_index < getNumInputPins()));
    }
    else
    {
        return (pin_index < XBAR_NUM_OUTPINS);
    }
}


#endif

⌨️ 快捷键说明

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