[Avidemux-svn-commit] r5007 - branches/avidemux_2.6_branch_mean/avidemux/common

mean at BerliOS mean at mail.berlios.de
Mon Jul 6 20:11:45 CEST 2009


Author: mean
Date: 2009-07-06 20:11:45 +0200 (Mon, 06 Jul 2009)
New Revision: 5007

Modified:
   branches/avidemux_2.6_branch_mean/avidemux/common/gui_savenew.cpp
Log:
[UI] Add a progress bar for pass1 too

Modified: branches/avidemux_2.6_branch_mean/avidemux/common/gui_savenew.cpp
===================================================================
--- branches/avidemux_2.6_branch_mean/avidemux/common/gui_savenew.cpp	2009-07-06 18:11:44 UTC (rev 5006)
+++ branches/avidemux_2.6_branch_mean/avidemux/common/gui_savenew.cpp	2009-07-06 18:11:45 UTC (rev 5007)
@@ -137,7 +137,17 @@
 ADM_coreVideoEncoder *admSaver::handleFirstPass(ADM_coreVideoEncoder *pass1)
 {
 #define BUFFER_SIZE 1920*1800*3
+ADM_coreVideoFilter  *last;
+                int sze=chain->size();
+                ADM_assert(sze);
+                last=(*chain)[sze-1]; // Grab last filter
 
+
+uint64_t videoDuration=last->getInfo()->totalDuration;
+
+
+
+                if(videoDuration<5000) videoDuration=5000;
                 printf("[Save] Performing Pass one,using %s as log file\n",logFileName);
                 pass1->setPassAndLogFile(1,logFileName);
                 if(false==pass1->setup())
@@ -151,11 +161,20 @@
                 uint8_t *buffer=new uint8_t[BUFFER_SIZE];
                 bitstream.data=buffer;
                 bitstream.bufferSize=BUFFER_SIZE;
-                
+                DIA_workingBase  *encoding=createWorking("Pass1");
+             
                 while(pass1->encode(&bitstream))
                 {
-
+                    if(bitstream.pts!=ADM_NO_PTS)
+                    {
+                        float f=100;
+                        f/=videoDuration;
+                        f*=bitstream.pts;
+                        uint32_t percent=(uint32_t)f;
+                        encoding->update(percent);
+                    }
                 }
+                delete encoding;
                 delete [] buffer;
                 printf("[Save] Pass 1 done, restarting for pass 2\n");
                 // Destroy filter chain & create the new encoder
@@ -170,7 +189,6 @@
                 }
                 int sz=chain->size();
                 ADM_assert(sz);
-                ADM_coreVideoFilter  *last;
                 last=(*chain)[sz-1]; // Grab last filter
                 ADM_coreVideoEncoder *pass2=createVideoEncoderFromIndex(last,videoEncoderIndex);
                 if(!pass2) 




More information about the Avidemux-svn-commit mailing list