[MPlayer-dev-eng] Enhancement patch for slavemode

Stefan Huelswitt s.huelswitt at gmx.de
Sun Sep 1 15:58:32 CEST 2002


Hi,
I'm working on a frontend application for MPlayer which uses the
slavemode "-slave" (to be exact, it's the MPlayer plugin for VDR).

The slavemode works very well to control MPlayer, but it lacks
completely any feedback to the frontend (like playtime and
position).

The included patch outputs the information about playtime and
position to the console. The output can be parsed by the frontend
to display a proper progressbar.

I think it could be usefull, to include more things (like total
length of the video, the filename, volumen level), but my
knowledge about the MPlayer sources is to bad to find the need
informations. May be someone else could extend the patch.

It would be nice to have this included into the main source.

TIA

--- mplayer.c.orig	Mon Aug  5 20:37:14 2002
+++ mplayer.c	Fri Aug 30 16:53:54 2002
@@ -2913,6 +2913,25 @@
   current_module=NULL;
 }
 
+#if 1
+  if(slave_mode){
+    float position=0.0;
+    float time=0.0;
+    if(demuxer->file_format==DEMUXER_TYPE_AVI && sh_video->video.dwLength>2) {
+      // get pos from frame number / total frames
+      position=(float)d_video->pack_no*100.0/(float)sh_video->video.dwLength;
+      }
+    else {
+      off_t len = ( demuxer->movi_end - demuxer->movi_start );
+      off_t pos = ( demuxer->file_format == DEMUXER_TYPE_AUDIO?stream->pos:demuxer->filepos );
+      if(len>0) position=( pos - demuxer->movi_start ) * 100.0 / len;
+      }
+    if(sh_video) time=d_video->pts;
+    else if(sh_audio) time=sh_audio->timer;
+    mp_msg(MSGT_OSD,MSGL_ERR,"SLAVE: time=%.2f position=%.2f\r",time,position);
+    }
+#endif
+
 #ifdef HAVE_NEW_GUI
       if(use_gui){
         guiEventHandling();


-- 
Stefan Huelswitt
huels at iname.com  | http://home.pages.de/~nathan



More information about the MPlayer-dev-eng mailing list