diff libmpdemux/demux_nut.c @ 21023:f5180197d7ad

fix demux_nut to give proper (estimate) of percent position after a seek
author ods15
date Sat, 18 Nov 2006 20:44:22 +0000
parents fbf3f8cd0bf6
children a804f969af97
line wrap: on
line diff
--- a/libmpdemux/demux_nut.c	Sat Nov 18 20:13:18 2006 +0000
+++ b/libmpdemux/demux_nut.c	Sat Nov 18 20:44:22 2006 +0000
@@ -260,8 +260,10 @@
 		                       priv->s[0].time_base.den;
 
 	while ((ret = nut_seek(nut, time_pos, nutflags, tmp)) == NUT_ERR_EAGAIN);
+	priv->last_pts = -1;
 	if (ret) mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n", nut_error(ret));
 	if (sh_audio) resync_audio_stream(sh_audio);
+	demuxer->filepos = stream_tell(demuxer->stream);
 }
 
 static int demux_control_nut(demuxer_t * demuxer, int cmd, void * arg) {
@@ -273,7 +275,7 @@
 				        priv->s[0].time_base.den;
 			return DEMUXER_CTRL_OK;
 		case DEMUXER_CTRL_GET_PERCENT_POS:
-			if (priv->s[0].max_pts == 0)
+			if (priv->s[0].max_pts == 0 || priv->last_pts == -1)
 				return DEMUXER_CTRL_DONTKNOW;
 			*((int *)arg) = priv->last_pts * 100 /
 			                (double)priv->s[0].max_pts;