File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -291,4 +291,13 @@ void OutputFile::setProfile( const ProfileLoader::Profile& profile )
291
291
}
292
292
}
293
293
294
+ double OutputFile::getProgressDuration ()
295
+ {
296
+ AVStream* firstOutputStream = _formatContext->streams [0 ];
297
+ if ( firstOutputStream == NULL )
298
+ throw std::runtime_error ( " at least one stream must be set to get the progress duration" );
299
+ double duration = av_q2d ( firstOutputStream->time_base ) * firstOutputStream->cur_dts ;
300
+ return duration;
301
+ }
302
+
294
303
}
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ class AvExport OutputFile
109
109
110
110
virtual void setVerbose ( bool verbose = false ){ _verbose = verbose; }
111
111
112
- AVFormatContext& getFormatContext () { return *_formatContext; }
112
+ double getProgressDuration ();
113
113
114
114
private:
115
115
std::vector<AvOutputStream*> _outputStreams;
Original file line number Diff line number Diff line change @@ -317,10 +317,7 @@ void Transcoder::process( IProgress& progress )
317
317
if ( ! frameProcessed )
318
318
break ;
319
319
320
- AVStream* firstOutputStream = _outputFile.getFormatContext ().streams [0 ];
321
- double duration = av_q2d ( firstOutputStream->time_base ) * firstOutputStream->cur_dts ;
322
-
323
- if ( progress.progress ( duration, totalDuration ) == eJobStatusCancel )
320
+ if ( progress.progress ( _outputFile.getProgressDuration (), totalDuration ) == eJobStatusCancel )
324
321
{
325
322
break ;
326
323
}
You can’t perform that action at this time.
0 commit comments