Skip to content

Commit 53d90bc

Browse files
author
Valentin Noel
committed
Progress: into OutputFile, add getProgressDuration method to compute progress
1 parent 0e8513a commit 53d90bc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/AvTranscoder/file/OutputFile.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,13 @@ void OutputFile::setProfile( const ProfileLoader::Profile& profile )
291291
}
292292
}
293293

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+
294303
}

src/AvTranscoder/file/OutputFile.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class AvExport OutputFile
110110
virtual void setVerbose( bool verbose = false ){ _verbose = verbose; }
111111

112112
AVFormatContext& getFormatContext() { return *_formatContext; }
113+
double getProgressDuration();
113114

114115
private:
115116
std::vector<AvOutputStream*> _outputStreams;

0 commit comments

Comments
 (0)