File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
src/AvTranscoder/properties Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ Rational StreamProperties::getTimeBase() const
66
66
float StreamProperties::getDuration () const
67
67
{
68
68
const Rational timeBase = getTimeBase ();
69
- return av_q2d (timeBase) * _formatContext->streams [_streamIndex]->duration ;
69
+ const size_t duration = _formatContext->streams [_streamIndex]->duration ;
70
+ if (duration == (size_t )AV_NOPTS_VALUE)
71
+ return 0 ;
72
+ return av_q2d (timeBase) * duration;
70
73
}
71
74
72
75
AVMediaType StreamProperties::getStreamType () const
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class AvExport StreamProperties
19
19
size_t getStreamIndex () const { return _streamIndex; }
20
20
size_t getStreamId () const ;
21
21
Rational getTimeBase () const ;
22
- float getDuration () const ; // /< in seconds
22
+ float getDuration () const ; // /< in seconds, 0 if not available
23
23
AVMediaType getStreamType () const ;
24
24
25
25
size_t getCodecId () const ;
You can’t perform that action at this time.
0 commit comments