[MPlayer-dev-eng] fast forward / slow motion (?)

Jonas Jermann jjermann at gmx.net
Sun May 12 00:42:05 CEST 2002


Hi

First thing I have to say: I'm not a developer, I can't really 
code, this is my first "try"...

I tried to implement a ff/slow motion function using a 
changeable fps with the input system. This would allow a 
"dynamic playback speed". Video didn't caused any problem,
but I didn't know what to do with audio. I tried _several_
things but nothing helped. :(

Problems:
- Is this a useable idea or just garbage (really could be)?
- It always gives the following message (after some time):
  "DEMUXER: Too many (4096 in 8250628 bytes) audio packets in 
  the buffer!"
- How big can/should the maximal fps values be?
- It plays audio at normal speed -> audio gets out of sync
- Wenn setting fps back audio is still out of sync (I just did a 
  rel_seek_secs-=1)
=> What should be done (audio) when starting ff code?
   What should be done (audio) when going back normal?

Solutions (?):
- Let audio be played at a higher srate fitting to video
  -> How to calculate / set back etc?
- Mute audio and enable it again when setting fps back
  -> needs a resync with video
  -> How should audio be deactivated without causing problems 
     (buffer, no fps change, reinitialisation problems, etc)

input.conf:
fps +-value -> fps+=value
fps 0 -> fps set back

I couldn't find out a useable solution as I don't understand the 
code... Maybe someone could continue my work or bring up new 
ideas. That's all "I" could do.


Regards
    Jonas
-------------- next part --------------
diff -Naur input/input.c input/input.c
--- input/input.c	Sun May 12 00:28:01 2002
+++ input/input.c	Sat May 11 16:28:44 2002
@@ -58,6 +58,7 @@
   { MP_CMD_SATURATION, "saturation",1,  { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} }  },
   { MP_CMD_FRAMEDROPPING, "frame_drop",0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } },
   { MP_CMD_SUB_POS, "sub_pos", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+  { MP_CMD_FPS, "fps", 1, { { MP_CMD_ARG_FLOAT,{0} }, {-1,{0}} } },
 #ifdef USE_TV
   { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1,  { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }},
   { MP_CMD_TV_STEP_NORM, "tv_step_norm",0, { {-1,{0}} }  },
diff -Naur input/input.h input/input.h
--- input/input.h	Sun May 12 00:27:58 2002
+++ input/input.h	Sat May 11 16:18:04 2002
@@ -25,6 +25,7 @@
 #define MP_CMD_VO_FULLSCREEN 20
 #define MP_CMD_SUB_POS 21
 #define MP_CMD_DVDNAV 22
+#define MP_CMD_FPS 23
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
diff -Naur mplayer.c mplayer.c
--- mplayer.c	Sun May 12 00:27:50 2002
+++ mplayer.c	Sun May 12 00:22:15 2002
@@ -2689,6 +2689,27 @@
       }
       break;
     }
+    case MP_CMD_FPS : {
+      float v = cmd->args[0].v.f;
+      if (!force_fps) force_fps=sh_video->fps;
+      if ( (force_fps += v) > 200 ) force_fps = 200;
+      if ( (force_fps += v) < 1 ) force_fps = 1;
+      // going back to normal speed
+      if (v == 0)
+      {
+        force_fps = 0;
+        vo_fps = sh_video->fps;
+        sh_audio=d_audio->sh;
+        rel_seek_secs -= 1; // "resync"
+      }
+      // change speed
+      else
+      {
+        vo_fps = sh_video->fps=force_fps;
+        sh_video->frametime=1.0f/sh_video->fps;
+//        sh_audio=NULL; // fps change doesn't work with this
+      }
+      } break;
 #endif
     default : {
 #ifdef HAVE_NEW_GUI


More information about the MPlayer-dev-eng mailing list