void QuickFindMux::searchPrevious() { LOG(logDEBUG) << "QuickFindMux::searchPrevious"; if ( currentDirection_ == Forward ) searchBackward(); else searchForward(); }
uint8_t EncoderRequant::encode (uint32_t frame, ADMBitstream *out) { uint8_t ret = 0; out->dtsFrame = frame; if (frame >= _total) { printf ("[Requant]: Going out of bound %d/%d\n", frame, _total); // Stuff with emptyness out->len=0; return 1; } out->flags=0; /* First frame ? */ // No B frames, take as is if (!video_body->isReordered (frameStart + frame)) { ret =code(_frameStart + frame, out->data, &out->len); out->ptsFrame = frame; return ret; } // it has PTS/DTS stuff so we need to reorder it video_body->getFlags (frameStart + frame, &(out->flags)); if (out->flags & AVI_B_FRAME) { // search if we have to send a I/P frame in adance aprintf ("\tIt is a B frame\n"); uint32_t forward; forward = searchForward (_frameStart + frame); // if we did not sent it, do it now if (forward != _lastIPFrameSent) { aprintf ("\tP Frame not sent, sending it :%lu\n", forward); ret =code(forward, out->data, &out->len); //ret = video_body->getRaw (forward, out->data, &out->len); _lastIPFrameSent = forward; out->ptsFrame = forward - _frameStart; } else { // we already sent it :) // send n-1 aprintf ("\tP Frame already, sending :%lu\n", frameStart + frame - 1); ret =code(_frameStart + frame - 1, out->data, &out->len); // ret =video_body->getFrameNoAlloc (_frameStart + frame - 1, out->data, // &out->len,&out->flags); out->ptsFrame = frame - 1; } } else // it is not a B frame and we have nothing on hold, sent it.. { // send n-1 if we reach the fwd reference frame if ((frame + frameStart) == _lastIPFrameSent) { aprintf ("\tSending Last B-frame :(%lu)\n", _frameStart + frame - 1); //ret=video_body->getFrameNoAlloc (_frameStart+frame - 1,out->data,&out->len,&out->flags); ret =code(_frameStart + frame - 1, out->data, &out->len); out->ptsFrame = frame - 1; } else { aprintf ("\tJust sending it :(%lu)-(%lu)\n", _frameStart + frame, _lastIPFrameSent); ret =code(_frameStart + frame , out->data, &out->len); // ret=video_body->getFrameNoAlloc (_frameStart+frame, out->data,&out->len,&out->flags); out->ptsFrame = frame; if(!frame) // First frame ? { // It does not start by a seqstart, add it if possible if(!(_buffer[0]==0 && _buffer[1]==0 && _buffer[2]==1 && _buffer[3]==0xb3)) { uint8_t buf[10*1024]; uint32_t seq; video_body->getRawStart (frameStart, buf, &seq); printf("Adding seq header (%lu)\n",seq); memmove(_buffer+seq,_buffer,out->len); memcpy(_buffer,buf,seq); out->len+=seq; } } } } if (!ret) printf ("Get frame error for frame %d+%d\n", frameStart, frame); return ret; }
//___________________________________________________ uint8_t ADM_ogmWriteCopy::writeVideo(uint32_t frame) { uint32_t len,flags; uint32_t forward; uint8_t ret1=0; ADMCompressedImage img; img.data=_videoBuffer; // Check for B_frames if(!video_body->isReordered(frameStart+frame)) { if(! video_body->getFrameNoAlloc (frameStart+frame,&img))// _videoBuffer, &len, &flags)) return 0; encoding_gui->setFrame(frame,img.dataLength,0,_togo); return videoStream->write(img.dataLength,img.data,img.flags,frame); } // we DO have b frame // video_body->getFlags (frameStart + frame, &flags); if(flags & AVI_B_FRAME) { // search if we have to send a I/P frame in adance uint32_t forward; forward=searchForward(frameStart+frame); // if we did not sent it, do it now if(forward!=_lastIPFrameSent) { aprintf("\tP Frame not sent, sending it :%lu\n",forward); ret1 = video_body->getFrameNoAlloc (forward,&img);// _videoBuffer, &len,&flags); _lastIPFrameSent=forward; } else { // we already sent it :) // send n-1 aprintf("\tP Frame already, sending :%lu\n",frameStart+frame-1); ret1 = video_body->getFrameNoAlloc (frameStart+frame-1,&img);// _videoBuffer, &len,&flags); } } else // it is not a B frame and we have nothing on hold, sent it.. { // send n-1 if we reach the fwd reference frame if((frame+frameStart)==_lastIPFrameSent) { aprintf("\tSending Last B-frame :(%lu)\n",frameStart + frame-1); ret1 = video_body->getFrameNoAlloc (frameStart + frame-1, &img);//_videoBuffer, &len, &flags); } else { aprintf("\tJust sending it :(%lu)-(%lu)\n",frameStart + frame,_lastIPFrameSent); ret1 = video_body->getFrameNoAlloc (frameStart + frame,&img);// _videoBuffer, &len, &flags); } } encoding_gui->setFrame(frame,img.dataLength,0,_togo); return videoStream->write(img.dataLength,img.data,img.flags,frame); return ret1; }
uint8_t EncoderCopy::encode (uint32_t frame, ADMBitstream *out) { uint8_t ret = 0; out->dtsFrame = frame; if (frame >= _total) { printf ("EncCopy: Going out of bound %d/%d\n", frame, _total); return 0; } // No B frames, take as is ADMCompressedImage img; img.data=out->data; if (!video_body->isReordered (frameStart + frame)) { ret =video_body->getFrameNoAlloc (_frameStart + frame, &img); out->len=img.dataLength; out->flags=img.flags; if(video_body->hasPtsDts(frameStart+frame)) { out->ptsFrame = frame+video_body->ptsDtsDelta(frameStart+frame); }else out->ptsFrame = frame; return ret; } // it has PTS/DTS stuff so we need to reorder it video_body->getFlags (frameStart + frame, &(out->flags)); if (out->flags & AVI_B_FRAME) { // search if we have to send a I/P frame in adance aprintf ("\tIt is a B frame\n"); uint32_t forward; forward = searchForward (_frameStart + frame); // if we did not sent it, do it now if (forward != _lastIPFrameSent) { aprintf ("\tP Frame not sent, sending it :%lu\n", forward); ret = video_body->getFrameNoAlloc (forward, &img); out->len=img.dataLength; out->flags=img.flags; _lastIPFrameSent = forward; out->ptsFrame = forward - _frameStart; } else { // we already sent it :) // send n-1 aprintf ("\tP Frame already, sending :%lu\n", frameStart + frame - 1); ret =video_body->getFrameNoAlloc (_frameStart + frame - 1, &img); out->len=img.dataLength; out->flags=img.flags; out->ptsFrame = frame - 1; } } else // it is not a B frame and we have nothing on hold, sent it.. { // send n-1 if we reach the fwd reference frame if ((frame + frameStart) == _lastIPFrameSent) { aprintf ("\tSending Last B-frame :(%lu)\n", _frameStart + frame - 1); ret=video_body->getFrameNoAlloc (_frameStart+frame - 1,&img); out->len=img.dataLength; out->flags=img.flags; out->ptsFrame = frame - 1; } else { aprintf ("\tJust sending it :(%lu)-(%lu)\n", _frameStart + frame, _lastIPFrameSent); ret=video_body->getFrameNoAlloc (_frameStart+frame, &img); out->len=img.dataLength; out->flags=img.flags; out->ptsFrame = frame; } } if (!ret) printf ("Get frame error for frame %d+%d\n", frameStart, frame); return ret; }
virtual void customSetup(void) { QMenu *edit = toMainWidget()->getEditMenu(); edit->addSeparator(); IncMenu = edit->addMenu( qApp->translate("toEditExtensionTool", "Incremental Search")); IncrementalSearch = IncMenu->addAction(qApp->translate("toEditExtensionTool", "Forward"), &toEditExtensionsSingle::Instance(), SLOT(searchForward())); IncrementalSearch->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S); ReverseSearch = IncMenu->addAction(qApp->translate("toEditExtensionTool", "Backward"), &toEditExtensionsSingle::Instance(), SLOT(searchBackward())); ReverseSearch->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_R); // ------------------------------ indentation menu IndentMenu = edit->addMenu( qApp->translate("toEditExtensionTool", "Auto Indent")); IndentBlock = IndentMenu->addAction(qApp->translate( "toEditExtensionTool", "Selection"), &toEditExtensionsSingle::Instance(), SLOT(autoIndentBlock())); IndentBlock->setShortcut(Qt::CTRL + + Qt::ALT + Qt::Key_I); IndentBuffer = IndentMenu->addAction(qApp->translate( "toEditExtensionTool", "Editor"), &toEditExtensionsSingle::Instance(), SLOT(autoIndentBuffer())); IndentBuffer->setShortcut(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_I); IndentMenu->addSeparator(); ObsBlock = IndentMenu->addAction(qApp->translate( "toEditExtensionTool", "Obfuscate Selection"), &toEditExtensionsSingle::Instance(), SLOT(obfuscateBlock())); ObsBuffer = IndentMenu->addAction(qApp->translate("toEditExtensionTool", "Obfuscate Editor"), &toEditExtensionsSingle::Instance(), SLOT(obfuscateBuffer())); // ------------------------------ case menu CaseMenu = edit->addMenu( qApp->translate("toEditExtensionTool", "Modify Case")); UpperCase = CaseMenu->addAction(qApp->translate("toEditExtensionTool", "Upper"), &toEditExtensionsSingle::Instance(), SLOT(upperCase())); UpperCase->setShortcut(Qt::CTRL + Qt::Key_U); LowerCase = CaseMenu->addAction(qApp->translate("toEditExtensionTool", "Lower"), &toEditExtensionsSingle::Instance(), SLOT(lowerCase())); LowerCase->setShortcut(Qt::CTRL + Qt::Key_L); // bookmark menu BookmarkMenu = edit->addMenu(qApp->translate("toEditExtensionTool", "Bookmarks")); BookmarkSwitchAct = BookmarkMenu->addAction("Add/Remove Bookmark", &toEditExtensionsSingle::Instance(), SLOT(bookmarkSwitch())); BookmarkSwitchAct->setShortcut(Qt::CTRL + Qt::Key_B); BookmarkPrevAct = BookmarkMenu->addAction("Go to previous Bookmark", &toEditExtensionsSingle::Instance(), SLOT(bookmarkPrev())); BookmarkPrevAct->setShortcut(Qt::ALT + Qt::Key_PageUp); BookmarkNextAct = BookmarkMenu->addAction("Go to next Bookmark", &toEditExtensionsSingle::Instance(), SLOT(bookmarkNext())); BookmarkNextAct->setShortcut(Qt::ALT + Qt::Key_PageDown); // EOL menu EolMenu = edit->addMenu(qApp->translate("toEditExtensionTool", "Convert End of Lines to")); EolUnixAct = EolMenu->addAction("UNIX", &toEditExtensionsSingle::Instance(), SLOT(convertEol())); EolMacAct = EolMenu->addAction("Mac OS X", &toEditExtensionsSingle::Instance(), SLOT(convertEol())); EolWindowsAct = EolMenu->addAction("MS Windows", &toEditExtensionsSingle::Instance(), SLOT(convertEol())); // ------------------------------ etc Indent = edit->addAction( QIcon(QPixmap(const_cast<const char**>(indent_xpm))), qApp->translate("toEditExtensionTool", "Indent Block"), &toEditExtensionsSingle::Instance(), SLOT(indentBlock())); #ifndef Q_WS_MAC Indent->setShortcut(Qt::ALT + Qt::Key_Right); #endif Deindent = edit->addAction( QIcon(QPixmap(const_cast<const char**>(deindent_xpm))), qApp->translate("toEditExtensionTool", "De-indent Block"), &toEditExtensionsSingle::Instance(), SLOT(deindentBlock())); #ifndef Q_WS_MAC Deindent->setShortcut(Qt::ALT + Qt::Key_Left); #endif Quote = edit->addAction(qApp->translate("toEditExtensionTool", "Quote Selection"), &toEditExtensionsSingle::Instance(), SLOT(quoteBlock())); UnQuote = edit->addAction(qApp->translate("toEditExtensionTool", "UnQuote Selection"), &toEditExtensionsSingle::Instance(), SLOT(unquoteBlock())); Comment = edit->addAction(qApp->translate("toEditExtensionTool", "Comment or Uncomment"), &toEditExtensionsSingle::Instance(), SLOT(handleComment()), Qt::CTRL + Qt::Key_D); GotoLine = edit->addAction(qApp->translate("toEditExtensionTool", "Goto Line"), &toEditExtensionsSingle::Instance(), SLOT(gotoLine())); GotoLine->setShortcut(Qt::CTRL + Qt::Key_G); AutoComplete = edit->addAction( qApp->translate("toEditExtensionTool", "Complete"), &toEditExtensionsSingle::Instance(), SLOT(autoComplete())); AutoComplete->setShortcut(Qt::CTRL + Qt::Key_Space); // add buttons to main window // disabled due the problems in the state of toolbars // toMainWidget()->addButtonApplication(Deindent); // toMainWidget()->addButtonApplication(Indent); toEditExtensionsSingle::Instance().receivedFocus(NULL); connect(toMainWidget(), SIGNAL(editEnabled(bool)), &toEditExtensionsSingle::Instance(), SLOT(editEnabled(bool))); }
// copy mode // Basically ask a video frame and send it to writter // If it contains b frame and frames have been re-ordered // reorder them back ... uint8_t GenericAviSaveCopy::writeVideoChunk (uint32_t frame) { uint32_t len; uint8_t ret1; if(!video_body->isReordered(frameStart+frame)) { ret1 = video_body->getFrameNoAlloc (frameStart + frame, vbuffer, &len, &_videoFlag); } else { // we are async... video_body->getFlags (frameStart + frame, &_videoFlag); if(_videoFlag & AVI_B_FRAME) { // search if we have to send a I/P frame in adance aprintf("\tIt is a B frame\n"); uint32_t forward; forward=searchForward(frameStart+frame); // if we did not sent it, do it now if(forward!=_lastIPFrameSent) { aprintf("\tP Frame not sent, sending it :%lu\n",forward); ret1 = video_body->getFrameNoAlloc (forward, vbuffer, &len, &_videoFlag); _lastIPFrameSent=forward; } else { // we already sent it :) // send n-1 aprintf("\tP Frame already, sending :%lu\n",frameStart+frame-1); ret1 = video_body->getFrameNoAlloc (frameStart+frame-1, vbuffer, &len, &_videoFlag); } } else // it is not a B frame and we have nothing on hold, sent it.. { // send n-1 if we reach the fwd reference frame if((frame+frameStart)==_lastIPFrameSent) { aprintf("\tSending Last B-frame :(%lu)\n",frameStart + frame-1); ret1 = video_body->getFrameNoAlloc (frameStart + frame-1, vbuffer, &len, &_videoFlag); } else { aprintf("\tJust sending it :(%lu)-(%lu)\n",frameStart + frame,_lastIPFrameSent); ret1 = video_body->getFrameNoAlloc (frameStart + frame, vbuffer, &len, &_videoFlag); } } } if (!ret1) return 0; // check for split // check for auto split // if so, we re-write the last I frame if(muxSize) { // we overshot the limit and it is a key frame // start a new chunk if(handleMuxSize() && (_videoFlag & AVI_KEY_FRAME)) { uint8_t *extraData; uint32_t extraLen; video_body->getExtraHeaderData(&extraLen,&extraData); if(!reigniteChunk(extraLen,extraData)) return 0; } } return writter->saveVideoFrame (len, _videoFlag, vbuffer); }