File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
src/AvTranscoder/properties Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,9 @@ float FileProperties::getDuration() const
186
186
{
187
187
if (!_avFormatContext)
188
188
throw std::runtime_error (" unknown format context" );
189
+ const size_t duration = _avFormatContext->duration ;
190
+ if (duration == (size_t )AV_NOPTS_VALUE)
191
+ return 0 ;
189
192
return 1.0 * _avFormatContext->duration / AV_TIME_BASE;
190
193
}
191
194
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class AvExport FileProperties
46
46
47
47
size_t getProgramsCount () const ;
48
48
double getStartTime () const ;
49
- float getDuration () const ; // /< in seconds
49
+ float getDuration () const ; // /< in seconds, 0 if not available
50
50
size_t getBitRate () const ; // /< total stream bitrate in bit/s, 0 if not available (result of a computation by ffmpeg)
51
51
size_t getPacketSize () const ;
52
52
You can’t perform that action at this time.
0 commit comments