mpv/demux
llyyr e6afc53e7c demux_lavf: get total duration from track durations
Before this change, mpv used to get the total duration from
`avformat_find_stream_info` and used the per-track duration as a
fallback. This change reverses this order of preference.

The timestamps returned by `avformat_find_stream_info` are truncated or
rounded or floored (depending on the decoder) at the 6th decimal place.
For e.g. `avformat_find_stream_info` may return us a duration like
44.138667, whereas the duration we get from the per-track struct has a
higher degree of precision like 44.13866666666... and so on.

This caused various problems such as the playback_pts being a bigger
value than the duration, which would cause time-remaining to be a
negative value in some cases. Or cause you to reach a negative starting
timestamp when looping on an audio file with `gapless-audio`.

Moreover, we already skipped calling `avformat_find_stream_info` for
mp4, so we had already been utilizing this per-track fallback method for
finding the duration for mp4 files. It should be noted that while this
change is only required for audio-only formats, there is no harm in
doing this for videos as well.
2023-09-02 19:02:21 +00:00
..
cache.c various: correctly ignore cache files with --no-config 2023-07-06 13:08:23 +00:00
cache.h demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
codec_tags.c demux/codec_tags: support more WAVEFORMATEXTENSIBLE tags 2022-11-01 09:52:27 -04:00
codec_tags.h
cue.c cue: tolerate NBSP as whitespace 2020-02-03 19:13:44 +01:00
cue.h
demux.c various: fix various typos in the code base 2023-03-28 19:29:44 +00:00
demux.h demux: Move demuxer help to new standard mechanism 2021-03-28 19:46:32 +03:00
demux_cue.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
demux_disc.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
demux_edl.c edl: add a way to add tags 2021-05-11 22:18:40 +02:00
demux_lavf.c demux_lavf: get total duration from track durations 2023-09-02 19:02:21 +00:00
demux_libarchive.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
demux_mf.c demux_mf: utilize stdbool bool for if a format specifier was bad 2023-08-20 20:25:28 +02:00
demux_mkv.c demux_mkv: add missing space to log msg 2023-07-26 11:26:36 +02:00
demux_mkv_timeline.c demux_mkv: warn against some other aspects of mismatching codec data 2020-08-16 01:00:29 +02:00
demux_null.c
demux_playlist.c demux_playlist: default to --directory-mode=lazy 2023-08-30 15:46:57 +00:00
demux_raw.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
demux_timeline.c player: add track-list/N/image sub-property 2021-10-14 15:39:07 +00:00
ebml.c build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
ebml.h build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
matroska.h
packet.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
packet.h demux: add a on-disk cache 2019-09-19 20:37:05 +02:00
stheader.h demux_lavf: report program_id 2023-03-03 23:54:46 -06:00
timeline.c stream, demux: redo origin policy thing 2019-12-20 13:00:39 +01:00
timeline.h edl: make it possible to delay-load files with multiple tracks 2020-02-21 00:19:17 +01:00