📄 cqsrbrd.c
字号:
* USAGE * QRESULT DeleteHardware(DWORD Instance) * DESCRIPTION * DeleteHardware - deletes the instance of DecoderBoard object created by CreateInstance * PARAMETERS * IN DWORD Instance - instance created by a previous call to CreateInstance. * RETURN VALUE * If the function succeeds, the return value is Q_OK. * If the function fails, the return value is: * E_TOO_MANY_INSTANCES - Instance is bigger then MAX_INSTANCES * Q_FAIL - the pointer to the object is null * SEE ALSO * CreateInstance/******************************************************************************/QRESULT DeleteHardware( DWORD BoardInstance ){ IDecoderBoard* pIDecoderBoard; if(BoardInstance >= MAX_INSTANCES ) { pIDecoderBoard = 0; return E_TOO_MANY_INSTANCES; } if(g_pIDecoderBoard[BoardInstance] == NULL) { pIDecoderBoard = 0; return Q_FAIL; } pIDecoderBoard = g_pIDecoderBoard[BoardInstance]; g_pIDecoderBoard[BoardInstance] = NULL; return CQuasarBoard__DeleteObjects(pIDecoderBoard);}/****f* HwLib/QueryInterface * USAGE * HRESULT QueryInterface( DWORD dwInstance, QIID iid, void** ppv) * DESCRIPTION * QueryInterface - returns the pointer to the interface asked * PARAMETERS * IN DWORD Instance - instance created by a previous call to CreateInstance. * IN QIID iid - one of the identifiers: * IID_IDECODERBOARD * IID_IDECODER * IID_ISETI2CPIO * IID_ISIGMATV * IID_ITVENCODER * IID_ISCANCONVERTER * IID_IEEPROM * IID_IANALOGOVERLAY * IID_INOVALITE * IID_II2C * OUT void** ppv - Points to a 32-bit variable that receives the pointer to vtable * RETURN VALUE * If the function succeeds, the return value is NOERROR. * If the function fails, the return value is: * E_NOINTERFACE - Instance is bigger then MAX_INSTANCES or illegal identifier * SEE ALSO * CreateInstance, DeleteHardware/******************************************************************************/HRESULT QueryInterface( DWORD dwInstance, QIID iid, void** ppv){ CQuasarBoard* this; if( dwInstance > MAX_INSTANCES ) return E_NOINTERFACE; this = (CQuasarBoard*)g_pIDecoderBoard[dwInstance]; if ( iid == IID_IDECODERBOARD ) { *ppv = this; } else if ( iid == IID_IDECODER ) { *ppv = this->m_pIDecoder; } else if ( iid == IID_ISETI2CPIO ) { *ppv = this->m_pISetI2CpIO; } else if ( iid == IID_ISIGMATV ) { *ppv = this->m_pISigmaTv; } else if ( iid == IID_ITVENCODER ) { *ppv = this->m_pITvEncoder; } else if ( iid == IID_IEEPROM ) { *ppv = this->m_pIEeprom; } else if ( iid == IID_IANALOGOVERLAY ) { *ppv = this->m_pINova1; } else if ( iid == IID_INOVALITE ) { *ppv = this->m_pINovaLite; } else if ( iid == IID_II2C ) { *ppv = this->m_pII2C; } else if ( iid == IID_ISCANCONVERTER ) { *ppv = this->m_pIScanConverter; } else if ( iid == IID_IVIDEODECODER ) { *ppv = this->m_pIVideoDecoder; } else if ( iid == IID_IMPEGENCODER ) { *ppv = this->m_pIMpegEncoder; } else if ( iid == IID_IDVITRANSMITTER ) { *ppv = this->m_pIDviTransmitter; } else { *ppv = NULL; return E_NOINTERFACE; } return NOERROR;}/****f* HwLib/CQuasarBoard__CreateInstance * USAGE * NOT PRESENT in IDecoderBoard interface * void CQuasarBoard__CreateInstance(void **pv, DWORD dwInstance) * DESCRIPTION * CQuasarBoard__CreateInstance - allocates memory for a new board object * PARAMETERS * IN DWORD dwInstance - instance passed down by CreateInstance. * OUT void** pv - Points to a 32-bit variable that receives the pointer to object * SEE ALSO * CQuasar__CreateInstance/******************************************************************************/void CQuasarBoard__CreateInstance(void **pv, DWORD dwInstance){ CQuasarBoard__New((CQuasarBoard **)pv, TEXT("QuasarBoard"), TRUE, dwInstance);}/****f* HwLib/CQuasarBoard__New * USAGE * NOT PRESENT in IDecoderBoard interface * void CQuasarBoard__New(CQuasarBoard** ppCQuasarBoard, TCHAR *pName, BOOL bAllocate, DWORD dwInstance) * DESCRIPTION * CQuasarBoard__New - allocates memory for a new board object and * it plays the role of the constructor in C++. * PARAMETERS * OUT CQuasarBoard** ppCQuasarBoard - Points to a 32-bit variable that receives the pointer to object * IN TCHAR *pName - pointer to string containing the name of the object - debug purposes. * BOOL bAllocate - usually called with TRUE to allocate memory for object. * - if FALSE ppCQuasarBoard should point to an object already created. * IN DWORD dwInstance - instance passed down by CreateInstance. * SEE ALSO * IDecoderBoard_Delete/******************************************************************************/void CQuasarBoard__New ( CQuasarBoard** ppCQuasarBoard, TCHAR *pName, BOOL bAllocate, DWORD dwInstance){ CQuasarBoard* this = *ppCQuasarBoard; if (bAllocate) { // Allocate CQuasarBoard *ppCQuasarBoard = OSmalloc(sizeof(CQuasarBoard)); this = (CQuasarBoard*) *ppCQuasarBoard; if(this == NULL) return; OSmemset(this, 0, sizeof(CQuasarBoard)); } // Call CObject constructor with bAllocate = FALSE CObject__New ((CObject**)ppCQuasarBoard, pName, FALSE, dwInstance); this->VTable.Delete = CQuasarBoard__Delete; this->VTable.GetDeviceIdSubId = CQuasarBoard__GetDeviceIdSubId; this->VTable.GetBoardVersion = CQuasarBoard__GetBoardVersion; this->VTable.CloseCaptionInterrupt = CQuasarBoard__CloseCaptionInterrupt; this->VTable.CaptureVideoFrame = CQuasarBoard__CaptureVideoFrame; this->VTable.GetDataFifoInfo = CQuasarBoard__GetDataFifoInfo; this->VTable.GetPacketsFifoInfo = CQuasarBoard__GetPacketsFifoInfo; this->VTable.EnableMasterInterrupt = CQuasarBoard__EnableMasterInterrupt; this->VTable.SetCurrentIrqMask = CQuasarBoard__SetCurrentIrqMask; this->VTable.GetCurrentIrqMask = CQuasarBoard__GetCurrentIrqMask; this->VTable.SetFrameEvent = CQuasarBoard__SetFrameEvent; this->VTable.GetFrameEvent = CQuasarBoard__GetFrameEvent; this->VTable.GetFrameCounter = CQuasarBoard__GetFrameCounter; this->VTable.SetAudioFormat = CQuasarBoard__SetAudioFormat; this->VTable.GetAudioFormat = CQuasarBoard__GetAudioFormat; this->VTable.SetAudioOutputEnable = CQuasarBoard__SetAudioOutputEnable; this->VTable.SetAudioNumChannels = CQuasarBoard__SetAudioNumChannels; this->VTable.SetAudioNumBitsPerSample = CQuasarBoard__SetAudioNumBitsPerSample; this->VTable.WriteSCR = CQuasarBoard__WriteSCR; this->VTable.ReadSCR = CQuasarBoard__ReadSCR; this->VTable.ReadHwPts45k = CQuasarBoard__ReadHwPts45k; this->VTable.VideoWriteCommand = CQuasarBoard__VideoWriteCommand; this->VTable.AudioWriteCommand = CQuasarBoard__AudioWriteCommand; this->VTable.OsdWriteCommand = CQuasarBoard__OsdWriteCommand; this->VTable.VideoHwPlay = CQuasarBoard__VideoHwPlay; this->VTable.VideoHwPause = CQuasarBoard__VideoHwPause; this->VTable.VideoHwStop = CQuasarBoard__VideoHwStop; this->VTable.VideoHwBlackFrame = CQuasarBoard__VideoHwBlackFrame; this->VTable.AudioHwPlay = CQuasarBoard__AudioHwPlay; this->VTable.AudioHwPause = CQuasarBoard__AudioHwPause; this->VTable.AudioHwStop = CQuasarBoard__AudioHwStop; this->VTable.GetCapabilities = CQuasarBoard__GetCapabilities; this->VTable.GetHardwareInfo1 = CQuasarBoard__GetHardwareInfo1; this->VTable.VideoSetAttributeEx = CQuasarBoard__VideoSetAttributeEx; this->VTable.VideoSetAttribute = CQuasarBoard__VideoSetAttribute; this->VTable.VideoGetAttributeEx = CQuasarBoard__VideoGetAttributeEx; this->VTable.VideoGetAttribute = CQuasarBoard__VideoGetAttribute; this->VTable.SetRelativeFrameStart = CQuasarBoard__SetRelativeFrameStart; this->VTable.GetRelativeFrameStart = CQuasarBoard__GetRelativeFrameStart; this->VTable.AudioSetAttributeEx = CQuasarBoard__AudioSetAttributeEx; this->VTable.AudioSetAttribute = CQuasarBoard__AudioSetAttribute; this->VTable.AudioGetAttributeEx = CQuasarBoard__AudioGetAttributeEx; this->VTable.AudioGetAttribute = CQuasarBoard__AudioGetAttribute; this->VTable.OverlaySetAllWindows = CQuasarBoard__OverlaySetAllWindows; this->VTable.OverlaySetAcq = CQuasarBoard__OverlaySetAcq; this->VTable.OverlaySetSrc = CQuasarBoard__OverlaySetSrc; this->VTable.OverlaySetDest = CQuasarBoard__OverlaySetDest; this->VTable.OsdSetDest = CQuasarBoard__OsdSetDest; this->VTable.OsdGetDest = CQuasarBoard__OsdGetDest; this->VTable.OsdHiLiSetDest = CQuasarBoard__OsdHiLiSetDest; this->VTable.OsdHiLiGetDest = CQuasarBoard__OsdHiLiGetDest; this->VTable.OverlaySetAttributeEx = CQuasarBoard__OverlaySetAttributeEx; this->VTable.OverlaySetAttribute = CQuasarBoard__OverlaySetAttribute; this->VTable.OverlayGetAttributeEx = CQuasarBoard__OverlayGetAttributeEx; this->VTable.OverlayGetAttribute = CQuasarBoard__OverlayGetAttribute; this->VTable.OsdSetAttributeEx = CQuasarBoard__OsdSetAttributeEx; this->VTable.OsdSetAttribute = CQuasarBoard__OsdSetAttribute; this->VTable.OsdGetAttributeEx = CQuasarBoard__OsdGetAttributeEx; this->VTable.OsdGetAttribute = CQuasarBoard__OsdGetAttribute; this->VTable.InitPtsFifo = CQuasarBoard__InitPtsFifo; this->VTable.PtsFifoEmptiness = CQuasarBoard__PtsFifoEmptiness; this->VTable.InitPacketsFifo = CQuasarBoard__InitPacketsFifo; this->VTable.FlushPacketsFifo = CQuasarBoard__FlushPacketsFifo; this->VTable.PacketsFifoEmptiness = CQuasarBoard__PacketsFifoEmptiness; this->VTable.AddPacketInPacketsFifo = CQuasarBoard__AddPacketInPacketsFifo; this->VTable.FreeConsumedData = CQuasarBoard__FreeConsumedData; this->VTable.WriteData = CQuasarBoard__WriteData; this->VTable.SendVideoPayload = CQuasarBoard__SendVideoPayload; this->VTable.SendAudioPayload = CQuasarBoard__SendAudioPayload; this->VTable.SendSpuPayload = CQuasarBoard__SendSpuPayload; this->VTable.SendOSDPayload = CQuasarBoard__SendOSDPayload; this->VTable.IsIntActive = CQuasarBoard__IsIntActive; this->VTable.PcrInterruptProc = CQuasarBoard__PcrInterruptProc; this->VTable.UpdateHwYuvPalette = CQuasarBoard__UpdateHwYuvPalette; this->VTable.UpdateHwButton = CQuasarBoard__UpdateHwButton; this->VTable.WriteSPCommand = CQuasarBoard__WriteSPCommand; this->VTable.ConvertToSrcWndCoord = CQuasarBoard__ConvertToSrcWndCoord; this->VTable.SetProperty = CQuasarBoard__SetProperty; this->VTable.GetProperty = CQuasarBoard__GetProperty; this->VTable.RegistryUpdate = CQuasarBoard__RegistryUpdate; this->VTable.SelectOutputForVideo = CQuasarBoard__SelectOutputForVideo; this->VTable.SendDataToDecoder = CQuasarBoard__SendDataToDecoder; this->VTable.CheckPendingCommand = CQuasarBoard__CheckPendingCommand; this->VTable.PrepareVideoIn = CNoImpl__PrepareVideoIn; this->VTable.PrepareLBCCapture = CNoImpl__PrepareLBCCapture; this->VTable.WriteDataToLBC = CNoImpl__WriteDataToLBC; this->VTable.ReadDataFromLBC = CNoImpl__ReadDataFromLBC; this->VTable.EnableLBCInterrupt = CNoImpl__EnableLBCInterrupt; this->VTable.SelectVClk = CNoImpl__SelectVClk; this->VTable.VidChangeDisplayResolution = CNoImpl__VidChangeDisplayResolution; this->VTable.OverlaySetVgaKey = CNoImpl__OverlaySetVgaKey; this->VTable.OverlayGetVgaKey = CNoImpl__OverlayGetVgaKey; this->VTable.OverlaySetVgaKey2 = CNoImpl__OverlaySetVgaKey2; this->VTable.OverlaySetMode = CNoImpl__OverlaySetMode; this->VTable.OverlayCalibrate = CNoImpl__OverlayCalibrate; this->VTable.OverlaySetColorCalibration = CNoImpl__OverlaySetColorCalibration; this->VTable.AdjTopBorder = CNoImpl__AdjTopBorder; this->VTable.AdjLeftBorder = CNoImpl__AdjLeftBorder; this->VTable.AdjCorrection = CNoImpl__AdjCorrection; this->VTable.OverlayColorCalibrate = CNoImpl__OverlayColorCalibrate; this->lpVtbl = &this->VTable;}/****f* HwLib/IDecoderBoard_Delete * USAGE * IDecoderBoard_Delete(IDecoderBoard* pIDecoderBoard, BOOL bDeleteObject) * CQuasarBoard__Delete(IDecoderBoard* pIDecoderBoard, BOOL bDeleteObject) * DESCRIPTION * IDecoderBoard_Delete - frees memory for the specified board object. * IDecoderBoard_Delete plays the role of the destructor in C++. * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the object created by a previous * call to CQuasarBoard__CreateInstance or CQuasarBoard__New. * BOOL bDeleteObject - usually called with TRUE to free memory for object. * - if FALSE doesn't free any memory. * SEE ALSO * CQuasarBoard__CreateInstance, CQuasarBoard__New/******************************************************************************/void CQuasarBoard__Delete ( IDecoderBoard* pIDecoderBoard, BOOL bDeleteObject ){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard ; // Sanity check if (this == NULL) return; //Release what we were using // Call CObject Destructor CObject__Delete ((IObject*)this, FALSE); if (bDeleteObject) { // Delete CQuasarBoard OSfree(pIDecoderBoard); }}////////////////////////////////////////////////////////////////////////////////////////////// QuasarBoard functions/****f* HwLib/IDecoderBoard_GetCapabilities * USAGE * DWORD IDecoderBoard_GetCapabilities(IDecoderBoard* pIDecoderBoard) * DWORD CQuasarBoard__GetCapabilities(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * BoardCapabilities = combination of flags defined in mpegcmn.h * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * DWORD BoardCapabilities/******************************************************************************/DWORD CQuasarBoard__GetCapabilities(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; return this->BoardCapabilities;}/****f* HwLib/IDecoderBoard_GetHardwareInfo1 * USAGE * DWORD IDecoderBoard_GetHardwareInfo1(IDecoderBoard* pIDecoderBoard) * DWORD CQuasarBoard__GetHardwareInfo1(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * HardwareInfo1 = combination of flags VGA_CABLE_NOT_CONNECTED, DARK_COLOR_LETTERBOX * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * DWORD HardwareInfo1/******************************************************************************/DWORD CQuasarBoard__GetHardwareInfo1(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; if( this->BoardCapabilities & MPEG_CAPABILITY_VGA_WINDOW )// analog cable connected return 0; return VGA_CABLE_NOT_CONNECTED;}/****f* HwLib/IDecoderBoard_GetDeviceIdSubId * USAGE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -