demux_lavf: fix percentage display with some file formats
AVFormatContext.start_time is sometimes AV_NOPTS_VALUE, such as when playing FLAC files. (For most other file formats it's set to 0, even if the format doesn't support arbitrary start times.)
This commit is contained in:
1 parent
56149ff5ac
commit
c82a83d8af
1 file changed
+2
-1
+2
-1
@@ -768,7 +768,8 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
|
||||
return DEMUXER_CTRL_OK;
|
||||
|
||||
case DEMUXER_CTRL_GET_START_TIME:
|
||||
*((double *)arg) = (double)priv->avfc->start_time / AV_TIME_BASE;
|
||||
*((double *)arg) = priv->avfc->start_time == AV_NOPTS_VALUE ?
|
||||
0 : (double)priv->avfc->start_time / AV_TIME_BASE;
|
||||
return DEMUXER_CTRL_OK;
|
||||
|
||||
case DEMUXER_CTRL_SWITCH_AUDIO:
|
||||
|
||||
Reference in new issue
Block a user