📄 cqsrbrd.c
字号:
* VideoHwSeekToFrame + frame number in Event - VIDEO_DECODETOEVENT * VideoHwSeekToPts + Pts in Event - VIDEO_DECODETOEVENT * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * PLAY_OPTIONS PlayOptions * DWORDLONG Event - frame number or Pts where the decoder will pause * RETURN VALUE * If the function succeeds, the return value is Q_OK. If it fails the return value is either * E_NOT_SUPPORTED or E_VIDEO_WRITE_COMMAND_FAILED, if microcode cannot take the command in 100ms * SEE ALSO * IDecoderBoard_VideoHwPause, IDecoderBoard_VideoHwStop, IDecoderBoard_VideoHwBlackFrame/******************************************************************************/QRESULT CQuasarBoard__VideoHwPlay(IDecoderBoard* pIDecoderBoard, PLAY_OPTIONS PlayOptions, DWORDLONG Event){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; CommonSymbolTable* pQ = (CommonSymbolTable*)this->pQ; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT("VideoHwPlay")));#ifdef TEST_CC if( this->QuasarVersion < EM847XA_Q4 ) { g_VSyncIntCounter = IDecoder_ReadDM(this->m_pIDecoder, pQ->VSyncIntCnt.addr); }#endif // set encoder for ntsc or pal if we are displaying on Tv on analog overlay boards if(this->TvOut == SET_TV) { if(this->TvAsSource == SET_TV_AS_SOURCE) { if(this->VideoMode == MPEG_ATTRIBUTE_VIDEO_PAL) // PAL input this->Standard_TvOut = SET_PAL; else this->Standard_TvOut = SET_NTSC; } if( (this->Standard_TvOut != ITvEncoder_GetCurrentTVStandard(this->m_pITvEncoder)) || (!ITvEncoder_IsVideoOnTv(this->m_pITvEncoder)) ) { // for TV we need field synchronization if( !(this->OverlayFlags & SPECIAL_IGS_STANDARD) ) // add for Ventura2000 + IGS with specific resolutions for TV { QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("ReprogramTvEncoder: call VidSetTV for TV field synchronization"))); IDecoderBoard_VidSetVGATV(pIDecoderBoard, RST_DC | this->TvDacsState, this->TvOut); } } } if (this->bSpeedMotion || this->bIFrameMotion) ITvEncoder_HideCloseCaption(this->m_pITvEncoder); else ITvEncoder_ShowCloseCaption(this->m_pITvEncoder); // if playing after a stop clear the frames skipped if( this->VideoState == VideoStopped ) IDecoder_WriteDM(this->m_pIDecoder, FRAMES_SKIPPED_ADDRESS, 0); this->VideoState = VideoPlaying; switch (PlayOptions) { case VideoHwPlayToEvent: IDecoder_SetFrameEvent(this->m_pIDecoder, DWORDLONG_Cast_DWORD(Event)); return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_PLAYTOEVENT); case VideoHwPlayNormal: return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_PLAY); case VideoHwPlayIFrame: return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_PLAYFAST); case VideoHwPlaySyncFaster: return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_PLAY_SYNC_FASTER); case VideoHwPlayYUV: return IDecoder_VideoWriteCommand(this->m_pIDecoder, VDIRECTCMD_PLAY); case VideoHwPlayVOBUReverse: return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_PLAY_VOBU_REVERSE); case VideoHwPlayIFrameReverse: return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_PLAYFAST_REVERSE); case VideoHwSeekToFrame: IDecoder_WriteDM(this->m_pIDecoder, pQ->DICOM_DisplayFieldId.addr, this->FieldFrameAtPause); IDecoder_WriteDM(this->m_pIDecoder, pQ->EventType.addr, 1); IDecoder_SetFrameEvent(this->m_pIDecoder, DWORDLONG_Cast_DWORD(Event)); return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_DECODETOEVENT); case VideoHwSeekToPts: { DWORD Pts45k = DWORDLONG_ShiftRight(Event, 1); IDecoder_WriteDM(this->m_pIDecoder, pQ->DICOM_DisplayFieldId.addr, this->FieldFrameAtPause); IDecoder_WriteDM(this->m_pIDecoder, pQ->EventType.addr, 0); IDecoder_WriteDM(this->m_pIDecoder, pQ->VPTSEventHi.addr, HIWORD(Pts45k)); IDecoder_WriteDM(this->m_pIDecoder, pQ->VPTSEventLo.addr, LOWORD(Pts45k)); return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_DECODETOEVENT); } default: return Q_FAIL; }}/****f* HwLib/IDecoderBoard_VideoHwPause * USAGE * QRESULT IDecoderBoard_VideoHwPause(IDecoderBoard* pIDecoderBoard) * QRESULT CQuasarBoard__VideoHwPause(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * IDecoderBoard_VideoHwPause - send to microcode the command VIDEO_PAUSE * When the current video PCI transfer is done the command will be accepted. * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * If the function succeeds, the return value is Q_OK. If it fails the return value is either * E_NOT_SUPPORTED or E_VIDEO_WRITE_COMMAND_FAILED, if microcode cannot take the command in 100ms * SEE ALSO * IDecoderBoard_VideoHwPlay, IDecoderBoard_VideoHwStop/******************************************************************************/QRESULT CQuasarBoard__VideoHwPause(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT("VideoHwPause"))); this->VideoState = VideoPaused; return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_PAUSE);}/****f* HwLib/IDecoderBoard_VideoHwStop * USAGE * QRESULT IDecoderBoard_VideoHwStop(IDecoderBoard* pIDecoderBoard) * QRESULT CQuasarBoard__VideoHwStop(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * IDecoderBoard_VideoHwStop - initialize PTS fifo for VIDEO and SUBPICTURE * initialize CloseCaption and send to microcode the command VIDEO_STOP. * VIDEO_STOP command will reset all the Rd/Wr pointers to hardware buffers * for VIDEO and SUBPICTURE. * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * If the function succeeds, the return value is Q_OK. If it fails the return value is either * E_NOT_SUPPORTED or E_VIDEO_WRITE_COMMAND_FAILED, if microcode cannot take the command in 100ms * SEE ALSO * IDecoderBoard_VideoHwPlay, IDecoderBoard_VideoHwPause, IDecoderBoard_VideoHwBlackFrame/******************************************************************************/QRESULT CQuasarBoard__VideoHwStop(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; CommonSymbolTable* pQ = (CommonSymbolTable*)this->pQ; QRESULT qr; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT("[VideoHwStop]"))); IDecoder_InitPtsFifo(this->m_pIDecoder, VIDEO); IDecoder_InitPtsFifo(this->m_pIDecoder, SUBPICTURE); // video stop is stopping the subpicture too IDecoder_InitCloseCaption(this->m_pIDecoder); ITvEncoder_HideCloseCaption(this->m_pITvEncoder); this->FirstSystemSCR = TRUE; this->VideoByteCounter = 0xFFFFFFFF; if( this->BoardCapabilities & MPEG_CAPABILITY_AUDIO_VCXO ) { // reset the VCXO and the PPM filter if ( (this->HwVcxo >= eHwVcxoPio0) && (this->HwVcxo <= eHwVcxoPio15) ) { DWORD temp; IDecoder_ReadPIO(this->m_pIDecoder, PIO0 + (this->HwVcxo-eHwVcxoPio0), &temp); // tristate } OSmemset(this->iPpmCoef, 0, sizeof(this->iPpmCoef)); this->iPpmIndex = 0; this->iPpmAvg = 0; this->iDeltaSCR_APTS = 0; } this->VideoState = VideoStopped; qr = IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_STOP);// per Vincent request - initialize speed and bSpeedMotion to 0.// QDbgLog((QLOG_TRACE, QDebugLevelWarning, TEXT("[VideoHwStop - initialize speed to nominal]")));// CQuasarBoard__VideoSetAttributeEx (pIDecoderBoard, MpegAttrVideoSpeed, &Speed, sizeof(Speed));// By initializing the speed the Mpeg4 playback this->bSpeedMotion = 0; return qr;}/****f* HwLib/IDecoderBoard_VideoHwBlackFrame * USAGE * QRESULT IDecoderBoard_VideoHwBlackFrame(IDecoderBoard* pIDecoderBoard) * QRESULT CQuasarBoard__VideoHwBlackFrame(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * IDecoderBoard_VideoHwBlackFrame - send to microcode the command VIDEO_BLACKFRAME, * this will blackout the frame displayed, in packed form. * In order to draw some bitmaps in the displayed frame use VIDEO_BLACKFRAME_UNPACKED. * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * If the function succeeds, the return value is Q_OK. If it fails the return value is either * E_NOT_SUPPORTED or E_VIDEO_WRITE_COMMAND_FAILED, if microcode cannot take the command in 100ms * SEE ALSO * IDecoderBoard_VideoHwPlay, IDecoderBoard_VideoHwPause, IDecoderBoard_VideoHwStop/******************************************************************************/QRESULT CQuasarBoard__VideoHwBlackFrame (IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; CommonSymbolTable* pQ = (CommonSymbolTable*)this->pQ; // problem to investigate this->VideoState = VideoBlackFrame; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT("Write SP_Status 0 in VideoHwBlackFrame"))); IDecoder_WriteDM(this->m_pIDecoder, pQ->SP_Status.addr, 0 ); return IDecoder_VideoWriteCommand(this->m_pIDecoder, VIDEO_BLACKFRAME);}/****f* HwLib/IDecoderBoard_AudioHwPlay * USAGE * QRESULT IDecoderBoard_AudioHwPlay(IDecoderBoard* pIDecoderBoard) * QRESULT CQuasarBoard__AudioHwPlay(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * IDecoderBoard_AudioHwPlay - send to microcode the command AUDIO_PLAY * Make sure to set AudioFormat (Mpeg, Ac3, Dts, Pcm), AudioSampleRate, AudioMode(stereo,mono) * before you give the play command. * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * If the function succeeds, the return value is Q_OK. If it fails the return value is either * E_NOT_SUPPORTED or E_AUDIO_WRITE_COMMAND_FAILED, if microcode cannot take the command in 100ms * SEE ALSO * IDecoderBoard_AudioHwPause, IDecoderBoard_AudioHwStop/******************************************************************************/QRESULT CQuasarBoard__AudioHwPlay(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT("[AudioHwPlay]"))); return IDecoder_AudioWriteCommand(this->m_pIDecoder, AUDIO_PLAY);}/****f* HwLib/IDecoderBoard_AudioHwPause * USAGE * QRESULT IDecoderBoard_AudioHwPause(IDecoderBoard* pIDecoderBoard) * QRESULT CQuasarBoard__AudioHwPause(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * IDecoderBoard_AudioHwPause - send to microcode the command AUDIO_PAUSE. * When the current audio PCI transfer is done the command will be accepted. * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * If the function succeeds, the return value is Q_OK. If it fails the return value is either * E_NOT_SUPPORTED or E_AUDIO_WRITE_COMMAND_FAILED, if microcode cannot take the command in 100ms * SEE ALSO * IDecoderBoard_AudioHwPlay, IDecoderBoard_AudioHwStop/******************************************************************************/QRESULT CQuasarBoard__AudioHwPause(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT("[AudioHwPause]"))); return IDecoder_AudioWriteCommand(this->m_pIDecoder, AUDIO_PAUSE);}/****f* HwLib/IDecoderBoard_AudioHwStop * USAGE * QRESULT IDecoderBoard_AudioHwStop(IDecoderBoard* pIDecoderBoard) * QRESULT CQuasarBoard__AudioHwStop(IDecoderBoard* pIDecoderBoard) * DESCRIPTION * IDecoderBoard_AudioHwStop - initialize PTS fifo for AUDIO and send to microcode * the command AUDIO_STOP.This will reset all the Rd/Wr pointers to hardware buffers * PARAMETERS * IN IDecoderBoard* pIDecoderBoard - pointer to the board object * RETURN VALUE * If the function succeeds, the return value is Q_OK. If it fails the return value is either * E_NOT_SUPPORTED or E_AUDIO_WRITE_COMMAND_FAILED, if microcode cannot take the command in 100ms * SEE ALSO * IDecoderBoard_AudioHwPlay, IDecoderBoard_AudioHwPause/******************************************************************************/QRESULT CQuasarBoard__AudioHwStop(IDecoderBoard* pIDecoderBoard){ CQuasarBoard *this = (CQuasarBoard*) pIDecoderBoard; QDbgLog((QLOG_TRACE, QDebugLevelTrace, TEXT("[AudioHwStop]"))); IDecoder_InitPtsFifo(this->m_pIDecoder, AUDIO); //xx I need a different one ?? this->FirstSystemSCR = TRUE; this->AudioByteCounter = 0xFFFFFFFF;// IDecoder_AudioWriteCommand(this->m_pIDecoder, AUDIO_STOP);// IDecoder_AudioWriteCommand(this->m_pIDecoder, AUDIO_PAUSE); return IDecoder_AudioWriteCommand(this->m_pIDecoder, AUDIO_STOP);}/****f* HwLib/CQuasarBoard__LimitDestByScreen * USAGE * NOT PRESENT in IDecoderBoard interface * BOOL CQuasarBoard__LimitDestByScreen(WND* pVisWnd, LONG ScreenWidth, LONG ScreenHeight) * DESCRIPTION * CQuasarBoard__LimitDestByScreen - used to limit the destination window * to the size of physical screen (VGA or TV monitor) * PARAMETERS * IN OUT WND* pVisWnd - coordinates of visible window * IN LONG ScreenWidth, LONG ScreenHeight - maximum width/height of physical screen * RETURN VALUE * The return value is FALSE if size of VisWnd is less then 8x8 or if position is * completly outside the screen./******************************************************************************/BOOL CQuasarBoard__LimitDestByScreen(WND* pVisWnd, WND* pOsdWnd, LONG ScreenWidth, LONG ScreenHeight){ if(pVisWnd) { if ( (pVisWnd->x > ScreenWidth + 2) || ((pVisWnd->x + pVisWnd->w) <= 0) || (pVisWnd->w < 8) || (pVisWnd->y > ScreenHeight - 1) || ((pVisWnd->y + pVisWnd->h) <= 0) || (pVisWnd->h < 8) ) { return FALSE; } if (pVisWnd->x < 0) { pVisWnd->w += pVisWnd->x; // decrease the width by the amount cropped at left pVisWnd->x = 0; } if (pVisWnd->x + pVisWnd->w > ScreenWidth ) pVisWnd->w = ScreenWidth - pVisWnd->x;// crop the right margin if (pVisWnd->y < 0) { pVisWnd->h += pVisWnd->y; // decrease the height by the amount cropped at top pVisWnd->y = 0; } if (pVisWnd->y + pVisWnd->h > ScreenHeight ) pVisWnd->h = ScreenHeight - pVisWnd->y;// crop the bottom margin } // check for OSD if(pOsdWnd) { if (pOsdWnd->x < 0) { pOsdWnd->w += pOsdWnd->x; // decrease the width by the amount cropped at left pOsdWnd->x = 0; if (pOsdWnd->w < 0) pOsdWnd->w = 0; } if (pOsdWnd->x + pOsdWnd->w > ScreenWidth ) pOsdWnd->w = ScreenWidth - pOsdWnd->x;// crop the right margin if (pOsdWnd->y < 0) { pOsdWnd->h += pOsdWnd->y; // decrease the height by the amount cropped at top pOsdWnd->y = 0; if (pOsdWnd->h < 0) pOsdWnd->h = 0; } if (pOsdWnd->y + pOsdWnd->h > ScreenHeight ) pOsdWnd->h = ScreenHeight - pOsdWnd->y;// crop the bottom margin } return TRUE;}/****f* HwLib/CQuasarBoard__ZoomCalc * USAGE * NOT PRESENT in IDecoderBoard interface * void CQuasarBoard__ZoomCalc(IDeco
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -