summaryrefslogtreecommitdiffstats
path: root/demux/demux_mpg.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-26 00:38:36 +0100
committerwm4 <wm4@nowhere>2013-02-26 02:01:48 +0100
commit72bdc5d3af22735753e1487fd251db09f8a20194 (patch)
tree4a1d47258e767023b2dc09d5db4a8fc386412896 /demux/demux_mpg.c
parent70346d3be623bc5edc31a15bd1ca205c33050219 (diff)
downloadmpv-72bdc5d3af22735753e1487fd251db09f8a20194.tar.bz2
mpv-72bdc5d3af22735753e1487fd251db09f8a20194.tar.xz
core: use playback time to determine playback percent position
The percent position is used for the OSD, the status line, and for the OSD bar (shown on seeks). By default, the PTS of the last demuxed packet was used to calculate it. This led to a "jumpy" display when the percentage value (casted to int) was changing. The reasons for this were the presence of video frame reordering (packet PTS is not monotonic), or getting PTS values from different streams (like audio/subs). Since these rely on PTS values and correct file durations anyway, simplify it by calculating it with the current playback position in mplayer.c instead.
Diffstat (limited to 'demux/demux_mpg.c')
-rw-r--r--demux/demux_mpg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/demux/demux_mpg.c b/demux/demux_mpg.c
index 8dea97ae28..ab157be748 100644
--- a/demux/demux_mpg.c
+++ b/demux/demux_mpg.c
@@ -1074,9 +1074,9 @@ static int demux_mpg_control(demuxer_t *demuxer, int cmd, void *arg)
}
return DEMUXER_CTRL_DONTKNOW;
- case DEMUXER_CTRL_GET_PERCENT_POS:
+ case DEMUXER_CTRL_GET_START_TIME:
if (mpg_d && mpg_d->has_valid_timestamps && mpg_d->first_to_final_pts_len > 0.0) {
- *((int *)arg)=(int)(100 * (mpg_d->last_pts-mpg_d->first_pts) / mpg_d->first_to_final_pts_len);
+ *((float *)arg)=mpg_d->first_pts;
return DEMUXER_CTRL_OK;
}
return DEMUXER_CTRL_DONTKNOW;