changeset 19794:0951c3e8864b

Avoid division by zero DEMUXER_CTRL_GET_PERCENT_POS with only one frame by just returning DONTKNOW. A better formula to calculate position would probably be a better fix though.
author reimar
date Mon, 11 Sep 2006 19:01:20 +0000
parents 6c98f3566af1
children 04343b1270a0
files libmpdemux/demux_mf.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mf.c	Mon Sep 11 18:41:14 2006 +0000
+++ b/libmpdemux/demux_mf.c	Mon Sep 11 19:01:20 2006 +0000
@@ -150,6 +150,8 @@
       return DEMUXER_CTRL_OK;
 
     case DEMUXER_CTRL_GET_PERCENT_POS:
+      if (mf->nr_of_files <= 1)
+        return DEMUXER_CTRL_DONTKNOW;
       *((int *)arg) = 100 * mf->curr_frame / (mf->nr_of_files - 1);
       return DEMUXER_CTRL_OK;