]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To improve AVI recorder.
authorapo <apo@opencascade.com>
Tue, 6 Dec 2005 09:10:31 +0000 (09:10 +0000)
committerapo <apo@opencascade.com>
Tue, 6 Dec 2005 09:10:31 +0000 (09:10 +0000)
All intermadiate JPEG files should be removed after AVI file creation

src/VVTK/VVTK_MainWindow.cxx
src/VVTK/VVTK_Recorder.cxx

index 6c84a8a9df67b22002792a996b2433d80f12d4f6..1a99a7ba9949f7905cebb577cc412a8c02d9403f 100644 (file)
@@ -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;
   }
index eb9dd83a0fb9e337f3a1f19aba612b2396997002..8781e9363b59537428e7c05abaa7d020b6714ac3 100755 (executable)
@@ -28,7 +28,8 @@
 \r
 #include "VVTK_Recorder.h"\r
 \r
-#include <unistd.h>\r
+#include "VVTK_ImageWriter.h"\r
+#include "VVTK_ImageWriterMgr.h"\r
 \r
 #include <vtkObjectFactory.h>\r
 #include <vtkObject.h>\r
 #include <vtkJPEGWriter.h>\r
 #include <vtkImageData.h>\r
 \r
-#include "VVTK_ImageWriter.h"\r
-#include "VVTK_ImageWriterMgr.h"\r
-//\r
+#include <unistd.h>\r
+#include <qfileinfo.h>\r
+\r
+\r
 static \r
   void GetNameJPEG(const char *pName,  \r
                   const int aIndex,\r
@@ -196,16 +198,17 @@ void VVTK_Recorder::ProcessEvents(vtkObject* vtkNotUsed(theObject),
                               void* theClientData, \r
                               void* vtkNotUsed(theCallData))\r
 {\r
-  if(vtkObject* pObj=reinterpret_cast<vtkObject*>(theClientData)) \r
-    if(VVTK_Recorder* pSelf=reinterpret_cast<VVTK_Recorder*>(pObj)) {\r
+  if(vtkObject* anObj=reinterpret_cast<vtkObject*>(theClientData))\r
+    if(VVTK_Recorder* aSelf=dynamic_cast<VVTK_Recorder*>(anObj)){\r
       if(theEvent==vtkCommand::EndEvent){\r
-       if (pSelf->State()==VVTK_Recorder::VVTK_Recorder_Record){\r
-         pSelf->DoRecord();\r
+       if(aSelf->State() == VVTK_Recorder::VVTK_Recorder_Record){\r
+         aSelf->DoRecord();\r
        }\r
       }\r
     }\r
   }\r
 }\r
+\r
 //===============================================\r
 // function: Record\r
 // purpose :\r
@@ -369,6 +372,17 @@ void VVTK_Recorder::MakeFileAVI()
          myNameAVIMaker, iNbFPS, myNbWrittenFrames, myName, fmt, myName);\r
   //\r
   myErrorStatus=system(aCmd);\r
+\r
+  QFileInfo aFileInfo(myName);\r
+  QString aDirPath = aFileInfo.dirPath(TRUE);\r
+  QString aBaseName = aFileInfo.baseName(TRUE);\r
+  QString aCommand = \r
+    QString("(cd ") + aDirPath + \r
+    "; ls " +\r
+    " | egrep '" + aBaseName + "_[0-9]*.jpeg'" +\r
+    " | xargs rm " +\r
+    ")";\r
+  system(aCommand.latin1());\r
 }\r
 //===============================================\r
 // function: GetNameJPEG\r