bool DecodeBitstreamCommand::execute( GitlCommandParameter& rcInputArg, GitlCommandParameter& rcOutputArg ) { ModelLocator* pModel = ModelLocator::getInstance(); /// *****STEP 0 : Request***** QVariant vValue; vValue = rcInputArg.getParameter("filename"); QString strFilename = vValue.toString(); vValue = rcInputArg.getParameter("version"); int iVersion = vValue.toInt(); vValue = rcInputArg.getParameter("skip_decode"); bool bSkipDecode = vValue.toBool(); QString strDecoderPath = "./decoders"; QString strDecoderOutputPath = pModel->getPreferences().getCacheFolder(); int iSequenceIndex = pModel->getSequenceManager().getAllSequences().size(); strDecoderOutputPath += QString("/%1").arg(iSequenceIndex); /// show busy dialog GitlUpdateUIEvt evt; evt.setParameter("busy_dialog_visible", true); evt.dispatch(); /// hide busy dialog when scope exit SCOPE_EXIT(GitlUpdateUIEvt evt; evt.setParameter("busy_dialog_visible", false); evt.dispatch(); );
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 CloseBitstreamCommand::execute( GitlCommandParameter &rcInputArg, GitlCommandParameter &rcOutputArg ) { QString strSequencePath = rcInputArg.getParameter("sequence_path").toString(); ModelLocator* pModel = ModelLocator::getInstance(); SequenceManager& rcSequenceManager = pModel->getSequenceManager(); ComSequence* pcSequence = rcSequenceManager.getSequenceByFilename(strSequencePath); if( rcSequenceManager.getAllSequences().size() > 1 && /// TODO do not allow close if there is only one sequence rcSequenceManager.delSequence(pcSequence) ) { ComSequence* pcLatestSequence = rcSequenceManager.getAllSequences().back(); GitlIvkCmdEvt cSwitchSeq("switch_sequence"); cSwitchSeq.setParameter("sequence", QVariant::fromValue((void*)pcLatestSequence)); cSwitchSeq.dispatch(); return true; } else { qDebug() << "Cannot close the last bitstream..."; } return false; }
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; }