mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-24 04:05:46 +08:00
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:
+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