[MPlayer-dev-eng] [PATCH] demux_lavf: do not treat AV_NOPTS_VALUE as a valid duration value

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Jul 26 20:56:37 CEST 2006


Hello,
currently demux_lavf thinks AV_NOPTS_VALUE is a valid duration values,
resulting in weird total length values if the demuxer does not give a
duration.
Attached patch fixes it.

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpdemux/demux_lavf.c
===================================================================
--- libmpdemux/demux_lavf.c	(revision 19186)
+++ libmpdemux/demux_lavf.c	(working copy)
@@ -394,14 +394,14 @@
     
     switch (cmd) {
         case DEMUXER_CTRL_GET_TIME_LENGTH:
-	    if (priv->avfc->duration == 0)
+	    if (priv->avfc->duration == 0 || priv->avfc->duration == AV_NOPTS_VALUE)
 	        return DEMUXER_CTRL_DONTKNOW;
 	    
 	    *((double *)arg) = (double)priv->avfc->duration / AV_TIME_BASE;
 	    return DEMUXER_CTRL_OK;
 
 	case DEMUXER_CTRL_GET_PERCENT_POS:
-	    if (priv->avfc->duration == 0)
+	    if (priv->avfc->duration == 0 || priv->avfc->duration == AV_NOPTS_VALUE)
 	        return DEMUXER_CTRL_DONTKNOW;
 	    
 	    *((int *)arg) = (int)((priv->last_pts - priv->avfc->start_time)*100 / priv->avfc->duration);


More information about the MPlayer-dev-eng mailing list