changeset 14197:2ae224195625

Use demuxer_get_percent_pos for the OSD position bar
author reimar
date Tue, 21 Dec 2004 12:25:59 +0000
parents 8d870bffcb88
children 5558b7dfb4b1
files libmpdemux/demuxer.c mplayer.c
diffstat 2 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Tue Dec 21 08:45:22 2004 +0000
+++ b/libmpdemux/demuxer.c	Tue Dec 21 12:25:59 2004 +0000
@@ -1642,6 +1642,7 @@
 extern int demux_ogg_control(demuxer_t *demuxer, int cmd, void *arg);
 extern int demux_real_control(demuxer_t *demuxer, int cmd, void *arg);
 extern int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg);
+extern int demux_mov_control(demuxer_t *demuxer, int cmd, void *arg);
 
 int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
     switch(demuxer->type) {
@@ -1678,6 +1679,8 @@
         case DEMUXER_TYPE_LAVF:
 	    return demux_lavf_control(demuxer, cmd, arg);
 #endif
+        case DEMUXER_TYPE_MOV:
+   	    return demux_mov_control(demuxer, cmd, arg);
 
 	default:
 	    return DEMUXER_CTRL_NOTIMPL;
@@ -1695,10 +1698,11 @@
 }
 
 int demuxer_get_percent_pos(demuxer_t *demuxer){     
-    int ans;     
-    if (demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans)<=0)  {
-        ans=0;     
-    }
+    int ans = 0;
+    int res = demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans);
+    int len = (demuxer->movi_end - demuxer->movi_start) / 100;
+    if (res == DEMUXER_CTRL_NOTIMPL && len > 0)
+      ans = (demuxer->filepos - demuxer->movi_start) / len;
     if (ans>100 || ans<0) ans=0;
     return ans;
 }
--- a/mplayer.c	Tue Dec 21 08:45:22 2004 +0000
+++ b/mplayer.c	Tue Dec 21 12:25:59 2004 +0000
@@ -3754,11 +3754,10 @@
 #else
 	  if( 1 ) { // Let the compiler optimize this out
 #endif
-	  int len=((demuxer->movi_end-demuxer->movi_start)>>8);
-	  if (len>0 && sh_video){
+	  if (sh_video) {
 	    osd_visible=sh_video->fps; // 1 sec
 	    vo_osd_progbar_type=0;
-	    vo_osd_progbar_value=(demuxer->filepos-demuxer->movi_start)/len;
+	    vo_osd_progbar_value=demuxer_get_percent_pos(demuxer) * 256 / 100;
 	    vo_osd_changed(OSDTYPE_PROGBAR);
 	  }
 	}