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

📄 vpstrm.cpp

📁 传说中的 视频抓取驱动源码 啊啊啊啊啊啊啊啊啊啊啊啊啊
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        {
            // Indexes are correlated to the implementation of KSPROPERTY_VPCONFIG_GETCONNECTINFO
            ULONG Index = *(PULONG)pSpd->PropertyInfo;
            switch (Index)
            {
            case 0:
                m_pDevice->Set16BitDataStream(FALSE);
                break;

#ifdef BT829_SUPPORT_16BIT
            case 1:
                m_pDevice->Set16BitDataStream(TRUE);
                break;
#endif

            default:
                pSrb->Status = STATUS_INVALID_PARAMETER;
            }

        } 
        break;

    case KSPROPERTY_VPCONFIG_INVERTPOLARITY :
        m_pDevice->SetHighOdd(!m_pDevice->IsHighOdd());
        break;

    case KSPROPERTY_VPCONFIG_SETVIDEOFORMAT :
        ASSERT (nS >= sizeof(ULONG));

        //
        // pSrb->CommandData.PropertInfo->PropertyInfo
        // points to a ULONG which is an index into the array of
        // VIDEOFORMAT structs returned to the caller from the
        // Get call to FORMATINFO
        //
        // Since the sample only supports one FORMAT type right
        // now, we will ensure that the requested index is 0.
        //

        switch (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo)
        {
        case 0:

            //
            // at this point, we would program the hardware to use
            // the right connection information for the videoport.
            // since we are only supporting one connection, we don't
            // need to do anything, so we will just indicate success
            //

            break;

        default:

            pSrb->Status = STATUS_NO_MATCH;
            break;
        }

        break;

    case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
        ASSERT (nS >= sizeof(DDPIXELFORMAT));

        // This would be supported if we wanted to be informed of the available formats
        pSrb->Status = STATUS_NOT_IMPLEMENTED;
        break;

    case KSPROPERTY_VPCONFIG_SCALEFACTOR :
        ASSERT (nS >= sizeof(KS_AMVPSIZE));
        {
            PKS_AMVPSIZE    pAMVPSize;

            pAMVPSize = (PKS_AMVPSIZE)(pSrb->CommandData.PropertyInfo->PropertyInfo);

            MRect t(0, 0,   pAMVPSize->dwWidth, pAMVPSize->dwHeight);

            m_pDevice->SetRect(t);
        }
        break;

    case KSPROPERTY_VPCONFIG_SURFACEPARAMS :
        ASSERT(nS >= sizeof(KSVPSURFACEPARAMS));

        m_pDevice->ConfigVPSurfaceParams((PKSVPSURFACEPARAMS)pSpd->PropertyInfo);
        break;

    default:
        TRAP();
        pSrb->Status = STATUS_NOT_IMPLEMENTED;
        break;
    }
}




VOID CWDMVideoPortStream::SetVideoPortVBIProperty(PHW_STREAM_REQUEST_BLOCK pSrb)
{
    PSTREAM_PROPERTY_DESCRIPTOR pSpd = pSrb->CommandData.PropertyInfo;
    ULONG Id  = pSpd->Property->Id;             // index of the property
    ULONG nS  = pSpd->PropertyOutputSize;       // size of data supplied

    pSrb->Status = STATUS_SUCCESS;

    ASSERT (m_pDevice != NULL);
    switch (Id)
    {
    case KSPROPERTY_VPCONFIG_DDRAWHANDLE:
        ASSERT (nS >= sizeof(ULONG_PTR));

        if (!m_pVideoPort->ConfigDirectDrawHandle(*(PULONG_PTR)pSpd->PropertyInfo)) {
            pSrb->Status = STATUS_UNSUCCESSFUL;
            break;
        }

        if (!m_Registered) {
            m_Registered = m_pVideoPort->RegisterForDirectDrawEvents(this);
            if (!m_Registered) {
                pSrb->Status = STATUS_UNSUCCESSFUL;
                break;
            }
        }
        break;

    case KSPROPERTY_VPCONFIG_VIDEOPORTID:
        ASSERT (nS >= sizeof(ULONG));

        if (!m_pVideoPort->ConfigVideoPortHandle(*(PULONG)pSpd->PropertyInfo)) {
            pSrb->Status = STATUS_UNSUCCESSFUL;
        }
        break;

    case KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE:
        ASSERT (nS >= sizeof(ULONG_PTR));
        {
            // This sample does not use the surface kernel handles,
            // but the validation is as follows.
            ULONG_PTR cHandles = *(PULONG_PTR)pSpd->PropertyInfo;
            if (nS != (cHandles + 1) * sizeof(ULONG_PTR)) {

                pSrb->Status = STATUS_INVALID_BUFFER_SIZE;
                break;
            }

            m_pVideoDecoder->ResetEvents();
        }
        break;

    case KSPROPERTY_VPCONFIG_SETCONNECTINFO :
        ASSERT (nS >= sizeof(ULONG));
        {
            // Indexes are correlated to the implementation of KSPROPERTY_VPCONFIG_GETCONNECTINFO
            ULONG Index = *(PULONG)pSpd->PropertyInfo;
            switch (Index)
            {
            case 0:
                m_pDevice->Set16BitDataStream(FALSE);
                break;

#ifdef BT829_SUPPORT_16BIT
            case 1:
                m_pDevice->Set16BitDataStream(TRUE);
                break;
#endif

            default:
                pSrb->Status = STATUS_INVALID_PARAMETER;
            }
        } 
        break;

    case KSPROPERTY_VPCONFIG_INVERTPOLARITY :
        m_pDevice->SetHighOdd(!m_pDevice->IsHighOdd());
        break;

    case KSPROPERTY_VPCONFIG_SETVIDEOFORMAT :
        ASSERT (nS >= sizeof(ULONG));

        //
        // pSrb->CommandData.PropertInfo->PropertyInfo
        // points to a ULONG which is an index into the array of
        // VIDEOFORMAT structs returned to the caller from the
        // Get call to FORMATINFO
        //
        // Since the sample only supports one FORMAT type right
        // now, we will ensure that the requested index is 0.
        //

        switch (*(PULONG)pSrb->CommandData.PropertyInfo->PropertyInfo)
        {
        case 0:

            //
            // at this point, we would program the hardware to use
            // the right connection information for the videoport.
            // since we are only supporting one connection, we don't
            // need to do anything, so we will just indicate success
            //

            break;

        default:

            pSrb->Status = STATUS_NO_MATCH;
            break;
        }

        break;

    case KSPROPERTY_VPCONFIG_INFORMVPINPUT:
        ASSERT (nS >= sizeof(DDPIXELFORMAT));

        // This would be supported if we wanted to be informed of the available formats
        pSrb->Status = STATUS_NOT_IMPLEMENTED;
        break;

    case KSPROPERTY_VPCONFIG_SCALEFACTOR :
        ASSERT (nS >= sizeof(KS_AMVPSIZE));

        // TBD
        pSrb->Status = STATUS_NOT_IMPLEMENTED;
        break;

    case KSPROPERTY_VPCONFIG_SURFACEPARAMS :
        ASSERT(nS >= sizeof(KSVPSURFACEPARAMS));

        m_pDevice->ConfigVPVBISurfaceParams((PKSVPSURFACEPARAMS)pSpd->PropertyInfo);
        break;

    default:
        TRAP();
        pSrb->Status = STATUS_NOT_IMPLEMENTED;
        break;
    }
}


VOID CWDMVideoPortStream::PreResChange()
{
    DBGTRACE(("DDNOTIFY_PRERESCHANGE; stream = %d\n", m_pStreamObject->StreamNumber));

    m_pVideoDecoder->SetPreEvent();
}


VOID CWDMVideoPortStream::PostResChange()
{
    DBGTRACE(("DDNOTIFY_POSTRESCHANGE; stream = %d\n", m_pStreamObject->StreamNumber));

    m_pVideoDecoder->SetPostEvent();
    DBGTRACE(("Before Attempted Renegotiation due to DDNOTIFY_POSTRESCHANGE\n"));
    AttemptRenegotiation();
    DBGTRACE(("Afer Attempted Renegotiation due to DDNOTIFY_POSTRESCHANGE\n"));
}




VOID CWDMVideoPortStream::PreDosBox()
{
    DBGTRACE(("DDNOTIFY_PREDOSBOX; stream = %d\n", m_pStreamObject->StreamNumber));

    m_pVideoDecoder->SetPreEvent();
}



VOID CWDMVideoPortStream::PostDosBox()
{
    DBGTRACE(("DDNOTIFY_POSTDOSBOX; stream = %d\n", m_pStreamObject->StreamNumber));

    m_pVideoDecoder->SetPostEvent();
    DBGTRACE(("Before Attempted Renegotiation due to DDNOTIFY_POSTDOSBOX\n"));
    AttemptRenegotiation();
    DBGTRACE(("After Attempted Renegotiation due to DDNOTIFY_POSTDOSBOX\n"));
}

NTSTATUS STREAMAPI VPStreamEventProc (PHW_EVENT_DESCRIPTOR pEvent)
{
    CWDMVideoPortStream* pstrm=(CWDMVideoPortStream*)pEvent->StreamObject->HwStreamExtension;
    pstrm->StreamEventProc(pEvent);
    return STATUS_SUCCESS;
}

NTSTATUS STREAMAPI VPVBIStreamEventProc (PHW_EVENT_DESCRIPTOR pEvent)
{
    CWDMVideoPortStream* pstrm=(CWDMVideoPortStream*)pEvent->StreamObject->HwStreamExtension;
    pstrm->StreamEventProc(pEvent);
    return STATUS_SUCCESS;
}

⌨️ 快捷键说明

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