File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
src/AvTranscoder/transcoder Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 6
6
#include < iostream>
7
7
#include < algorithm>
8
8
#include < sstream>
9
+ #include < libavformat/avformat.h>
9
10
10
11
namespace avtranscoder
11
12
{
@@ -310,10 +311,18 @@ void Transcoder::process( IProgress& progress )
310
311
{
311
312
if ( _verbose )
312
313
std::cout << " process frame " << frame << std::endl;
313
- if ( ! processFrame () )
314
- break ;
315
-
316
- if ( progress.progress ( 1 / _outputFps * ( frame ), totalDuration ) == eJobStatusCancel )
314
+
315
+ bool frameProcessed = processFrame ();
316
+ if ( ! frameProcessed )
317
+ break ;
318
+
319
+ int currentDts = _outputFile.getFormatContext ().streams [0 ]->cur_dts ;
320
+ int timebaseNum = _outputFile.getFormatContext ().streams [0 ]->time_base .num ;
321
+ int timebaseDen = _outputFile.getFormatContext ().streams [0 ]->time_base .den ;
322
+
323
+ double duration = (double )currentDts * timebaseNum / timebaseDen;
324
+
325
+ if ( progress.progress ( duration, totalDuration ) == eJobStatusCancel )
317
326
{
318
327
break ;
319
328
}
You can’t perform that action at this time.
0 commit comments