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:
wm4
2013-03-01 13:03:30 +01:00
parent 56149ff5ac
commit c82a83d8af
+2 -1
View File
@@ -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: