From: apo Date: Tue, 6 Dec 2005 09:10:31 +0000 (+0000) Subject: To improve AVI recorder. X-Git-Tag: TG-D5-38-2003_D2005-20-12~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fdf6fa52ba30463b9e6127cbe7f9f99d1b487a59;p=modules%2Fvisu.git To improve AVI recorder. All intermadiate JPEG files should be removed after AVI file creation --- diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 6c84a8a9..1a99a7ba 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -156,7 +156,7 @@ VVTK_MainWindow void VVTK_MainWindow::OnStartRecording() { //QString aFileName = "/data/pkv/IMAGES/TMP/abc"; - QString aFileName=QFileDialog::getSaveFileName( getenv( "VISU_ROOT_DIR"), "*.avi", this ); + QString aFileName=QFileDialog::getSaveFileName( getenv( "HOME"), "*.avi", this ); if( aFileName.isNull() ){ return; } diff --git a/src/VVTK/VVTK_Recorder.cxx b/src/VVTK/VVTK_Recorder.cxx index eb9dd83a..8781e936 100755 --- a/src/VVTK/VVTK_Recorder.cxx +++ b/src/VVTK/VVTK_Recorder.cxx @@ -28,7 +28,8 @@ #include "VVTK_Recorder.h" -#include +#include "VVTK_ImageWriter.h" +#include "VVTK_ImageWriterMgr.h" #include #include @@ -39,9 +40,10 @@ #include #include -#include "VVTK_ImageWriter.h" -#include "VVTK_ImageWriterMgr.h" -// +#include +#include + + static void GetNameJPEG(const char *pName, const int aIndex, @@ -196,16 +198,17 @@ void VVTK_Recorder::ProcessEvents(vtkObject* vtkNotUsed(theObject), void* theClientData, void* vtkNotUsed(theCallData)) { - if(vtkObject* pObj=reinterpret_cast(theClientData)) { - if(VVTK_Recorder* pSelf=reinterpret_cast(pObj)) { + if(vtkObject* anObj=reinterpret_cast(theClientData)){ + if(VVTK_Recorder* aSelf=dynamic_cast(anObj)){ if(theEvent==vtkCommand::EndEvent){ - if (pSelf->State()==VVTK_Recorder::VVTK_Recorder_Record){ - pSelf->DoRecord(); + if(aSelf->State() == VVTK_Recorder::VVTK_Recorder_Record){ + aSelf->DoRecord(); } } } } } + //=============================================== // function: Record // purpose : @@ -369,6 +372,17 @@ void VVTK_Recorder::MakeFileAVI() myNameAVIMaker, iNbFPS, myNbWrittenFrames, myName, fmt, myName); // myErrorStatus=system(aCmd); + + QFileInfo aFileInfo(myName); + QString aDirPath = aFileInfo.dirPath(TRUE); + QString aBaseName = aFileInfo.baseName(TRUE); + QString aCommand = + QString("(cd ") + aDirPath + + "; ls " + + " | egrep '" + aBaseName + "_[0-9]*.jpeg'" + + " | xargs rm " + + ")"; + system(aCommand.latin1()); } //=============================================== // function: GetNameJPEG