bool SwitchSequenceCommand::execute( GitlCommandParameter& rcInputArg, GitlCommandParameter& rcOutputArg ) { bool bIs16Bit = false; if(rcInputArg.hasParameter("is_16_bit")) { bIs16Bit = rcInputArg.getParameter("is_16_bit").toBool(); } QString strYUVFilename = "decoder_yuv.yuv"; if(rcInputArg.hasParameter("YUV_filename")) strYUVFilename = rcInputArg.getParameter("YUV_filename").toString(); ComSequence* pcSequence = (ComSequence*)(rcInputArg.getParameter("sequence").value<void*>()); ModelLocator* pModel = ModelLocator::getInstance(); pModel->getSequenceManager().setCurrentSequence(pcSequence); // int iWidth = pcSequence->getWidth(); int iHeight = pcSequence->getHeight(); pModel->getFrameBuffer().openYUVFile(pcSequence->getDecodingFolder()+"/"+strYUVFilename, iWidth, iHeight, bIs16Bit); int iPoc = pModel->getFrameBuffer().getPoc(); int iMaxPoc = pModel->getSequenceManager().getCurrentSequence().getTotalFrames()-1; int iMinPoc = 0; iPoc = VALUE_CLIP(iMinPoc, iMaxPoc, iPoc); QPixmap* pcFramePixmap = pModel->getFrameBuffer().getFrame(iPoc); ///< Read Frame Buffer /// re-load & re-init filters pModel->getDrawEngine().getFilterLoader().reinitAllFilters(); pcFramePixmap = pModel->getDrawEngine().drawFrame(&(pModel->getSequenceManager().getCurrentSequence()), iPoc, pcFramePixmap); ///< Draw Frame Buffer ///notify rcOutputArg.setParameter("picture", QVariant::fromValue((void*)(pcFramePixmap))); rcOutputArg.setParameter("current_frame_poc", iPoc); rcOutputArg.setParameter("total_frame_num", pModel->getSequenceManager().getCurrentSequence().getTotalFrames()); QVector<ComSequence*>* ppcSequences = &(pModel->getSequenceManager().getAllSequences()); rcOutputArg.setParameter("sequences",QVariant::fromValue((void*)ppcSequences)); rcOutputArg.setParameter("current_sequence",QVariant::fromValue((void*)pcSequence)); return true; }
bool FilterMousePressCommand::execute(GitlCommandParameter &rcInputArg, GitlCommandParameter &rcOutputArg) { QPointF cScaledPoint = rcInputArg.getParameter("scaled_point").toPointF(); Qt::MouseButton eMouseBtn = static_cast<Qt::MouseButton>(rcInputArg.getParameter("mouse_button").toInt()); ModelLocator* pModel = ModelLocator::getInstance(); pModel->getDrawEngine().mousePress(&cScaledPoint, eMouseBtn); GitlIvkCmdEvt cRefreshEvt("refresh_screen"); cRefreshEvt.dispatch(); return true; }
bool ReloadFiltersCommand::execute( GitlCommandParameter& rcInputArg, GitlCommandParameter& rcOutputArg ) { ModelLocator* pModel = ModelLocator::getInstance(); FilterLoader* pFilterLoader = &pModel->getDrawEngine().getFilterLoader(); pFilterLoader->reloadAllFilters(); /// refresh screen GitlIvkCmdEvt cRefresh("refresh_screen"); cRefresh.dispatch(); /// rcOutputArg.setParameter("filter_names", QVariant::fromValue(pFilterLoader->getFilterNames()) ); rcOutputArg.setParameter("filter_status", QVariant::fromValue(pFilterLoader->getEnableStatus()) ); return true; }
bool PrevFrameCommand::execute( GitlCommandParameter& rcInputArg, GitlCommandParameter& rcOutputArg ) { ModelLocator* pModel = ModelLocator::getInstance(); ComSequence *pcCurSeq = pModel->getSequenceManager().getCurrentSequence(); if(pcCurSeq == NULL) return false; int iCurBufPoc = pModel->getFrameBuffer().getFrameCount(); int iPredPoc = iCurBufPoc - 1; if( iPredPoc < 0) return false; QPixmap* pcFramePixmap = pModel->getFrameBuffer().getFrame(iPredPoc); ///< Read Frame Buffer pcFramePixmap = pModel->getDrawEngine().drawFrame(pcCurSeq, iPredPoc, pcFramePixmap); ///< Draw Frame Buffer /// rcOutputArg.setParameter("picture", QVariant::fromValue((void*)(pcFramePixmap))); rcOutputArg.setParameter("current_frame_poc", iPredPoc); rcOutputArg.setParameter("total_frame_num", pcCurSeq->getTotalFrames()); return true; }