mirror of https://github.com/mpv-player/mpv
demux_mkv: remove --demuxer-mkv-fix-timestamps
While it seemed like a pretty good idea at first, it's just a dead end and works only in the simplest cases. While it may or may not help slightly with audio sync mode, the display-sync mode already compensates this in a better way. The main issue is that timestamps at this layer are not in order, so it can look at single timestamps only.
This commit is contained in:
parent
2dc18a2f82
commit
1356755ad4
|
@ -2245,18 +2245,6 @@ Demuxer
|
|||
file and can make a reliable estimate even without an index present (such
|
||||
as partial files).
|
||||
|
||||
``--demuxer-mkv-fix-timestamps=<yes|no>``
|
||||
Fix rounded Matroska timestamps (disabled by default). Matroska usually
|
||||
stores timestamps rounded to milliseconds. This means timestamps jitter
|
||||
by some amount around the intended timestamp. mpv can correct the timestamps
|
||||
based on the framerate value stored in the file: the timestamp is rounded
|
||||
to the next frame (according to the framerate), unless the new timestamp
|
||||
would deviate more than 1ms from the old one. This should undo the rounding
|
||||
done by the muxer.
|
||||
|
||||
(The allowed deviation can be less than 1ms if the file uses a non-standard
|
||||
timecode scale.)
|
||||
|
||||
``--demuxer-rawaudio-channels=<value>``
|
||||
Number of channels (or channel layout) if ``--demuxer=rawaudio`` is used
|
||||
(default: stereo).
|
||||
|
|
|
@ -203,7 +203,6 @@ struct demux_mkv_opts {
|
|||
double subtitle_preroll_secs;
|
||||
int probe_duration;
|
||||
int probe_start_time;
|
||||
int fix_timestamps;
|
||||
};
|
||||
|
||||
const struct m_sub_options demux_mkv_conf = {
|
||||
|
@ -214,14 +213,12 @@ const struct m_sub_options demux_mkv_conf = {
|
|||
OPT_CHOICE("probe-video-duration", probe_duration, 0,
|
||||
({"no", 0}, {"yes", 1}, {"full", 2})),
|
||||
OPT_FLAG("probe-start-time", probe_start_time, 0),
|
||||
OPT_FLAG("fix-timestamps", fix_timestamps, 0),
|
||||
{0}
|
||||
},
|
||||
.size = sizeof(struct demux_mkv_opts),
|
||||
.defaults = &(const struct demux_mkv_opts){
|
||||
.subtitle_preroll_secs = 1.0,
|
||||
.probe_start_time = 1,
|
||||
.fix_timestamps = 0,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -2362,19 +2359,6 @@ exit:
|
|||
return res;
|
||||
}
|
||||
|
||||
static double fix_timestamp(demuxer_t *demuxer, mkv_track_t *track, double ts)
|
||||
{
|
||||
mkv_demuxer_t *mkv_d = demuxer->priv;
|
||||
if (demuxer->opts->demux_mkv->fix_timestamps && track->default_duration > 0) {
|
||||
// Assume that timestamps have been rounded to the timecode scale.
|
||||
double quant = MPMIN(mkv_d->tc_scale / 1e9, 0.001);
|
||||
double rts = rint(ts / track->default_duration) * track->default_duration;
|
||||
if (fabs(rts - ts) < quant)
|
||||
ts = rts;
|
||||
}
|
||||
return ts;
|
||||
}
|
||||
|
||||
static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
|
||||
{
|
||||
mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
|
||||
|
@ -2397,7 +2381,7 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
current_pts = fix_timestamp(demuxer, track, tc / 1e9) - track->codec_delay;
|
||||
current_pts = tc / 1e9 - track->codec_delay;
|
||||
|
||||
if (track->type == MATROSKA_TRACK_AUDIO) {
|
||||
if (mkv_d->a_skip_to_keyframe)
|
||||
|
|
Loading…
Reference in New Issue