patches/mplayer-1.0cvs20070302-slavemode.diff
author nathan
Sun, 06 Dec 2009 08:48:57 +0800
branchtrunk
changeset 34 afc13760179b
parent 0 474a1293c3c0
permissions -rw-r--r--
fixed gcc 4.4.1 const errors
nathan@0
     1
--- mplayer/mplayer.c.orig	2007-03-02 13:20:05.000000000 -0800
nathan@0
     2
+++ mplayer/mplayer.c	2007-03-02 13:20:39.000000000 -0800
nathan@0
     3
@@ -3549,6 +3549,25 @@
nathan@0
     4
   edl_decision = 0;
nathan@0
     5
 }
nathan@0
     6
 
nathan@0
     7
+#if 1
nathan@0
     8
+  if(slave_mode){
nathan@0
     9
+    float position=0.0;
nathan@0
    10
+    float time=0.0;
nathan@0
    11
+    if(mpctx->demuxer->file_format==DEMUXER_TYPE_AVI && mpctx->sh_video->video.dwLength>2) {
nathan@0
    12
+      // get pos from frame number / total frames
nathan@0
    13
+      position=(float)mpctx->d_video->pack_no*100.0/(float)mpctx->sh_video->video.dwLength;
nathan@0
    14
+      }
nathan@0
    15
+    else {
nathan@0
    16
+      off_t len = ( mpctx->demuxer->movi_end - mpctx->demuxer->movi_start );
nathan@0
    17
+      off_t pos = ( mpctx->demuxer->file_format == DEMUXER_TYPE_AUDIO?mpctx->stream->pos:mpctx->demuxer->filepos );
nathan@0
    18
+      if(len>0) position=( pos - mpctx->demuxer->movi_start ) * 100.0 / len;
nathan@0
    19
+      }
nathan@0
    20
+    if(mpctx->sh_video) time=mpctx->d_video->pts;
nathan@0
    21
+    else if(mpctx->sh_audio) time=mpctx->sh_audio->delay;
nathan@0
    22
+    mp_msg(MSGT_OSD,MSGL_ERR,"SLAVE: time=%.2f position=%.2f\r",time,position);
nathan@0
    23
+    }
nathan@0
    24
+#endif
nathan@0
    25
+
nathan@0
    26
 #ifdef HAVE_NEW_GUI
nathan@0
    27
       if(use_gui){
nathan@0
    28
         guiEventHandling();