[MPlayer-dev-eng] [PATCH] audio dropping

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Nov 6 19:24:22 CET 2006


Hello,
On Mon, Nov 06, 2006 at 08:04:49PM +0200, Oded Shimon wrote:
> On Mon, Nov 06, 2006 at 06:52:23PM +0100, Reimar Döffinger wrote:
> >  static int force_srate=0;
> >  static int audio_output_format=0;
> > +       int audio_dropping=1;
> 
> Why not static?...

Thought it would not work with it. Obviously thought wrong.

> > Index: cfg-mplayer.h
> > ===================================================================
> > --- cfg-mplayer.h	(revision 20725)
> > +++ cfg-mplayer.h	(working copy)
> > @@ -305,6 +305,8 @@
> >  	{"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL},
> >  	{"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL},
> >  	{"noframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL},
> > +	{"audiodrop", &audio_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL},
> > +	{"noaudiodrop", &audio_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL},
> 
> And doc this up...

Done (in a minimal way).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: mplayer.c
===================================================================
--- mplayer.c	(revision 20725)
+++ mplayer.c	(working copy)
@@ -312,6 +312,7 @@
        float force_fps=0;
 static int force_srate=0;
 static int audio_output_format=0;
+static int audio_dropping=1;
        int frame_dropping=0; // option  0=no drop  1= drop vo  2= drop decode
 static int play_n_frames=-1;
 static int play_n_frames_mf=-1;
@@ -4093,6 +4096,9 @@
       }
       break;
     }
+    if (audio_dropping && (playback_speed*audio_out->get_delay() - sh_audio->delay) > 1.0)
+      sh_audio->delay+=playback_speed*ret/(double)ao_data.bps;
+    else
     sh_audio->a_out_buffer_len+=ret;
   }
   t=GetTimer()-t;
Index: cfg-mplayer.h
===================================================================
--- cfg-mplayer.h	(revision 20725)
+++ cfg-mplayer.h	(working copy)
@@ -305,6 +305,8 @@
 	{"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2, NULL},
 	{"noframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+	{"audiodrop", &audio_dropping, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"noaudiodrop", &audio_dropping, CONF_TYPE_FLAG, 0, 1, 0, NULL},
 
 	{"autoq", &auto_quality, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
 
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1	(revision 20725)
+++ DOCS/man/en/mplayer.1	(working copy)
@@ -690,6 +690,11 @@
 .SH "PLAYER OPTIONS (MPLAYER ONLY)"
 .
 .TP
+.B \-(no)audiodrop
+Skip audio playback if audio is too far behind video.
+Useful especially with large \-delay values.
+.
+.TP
 .B \-autoq <quality> (use with \-vf [s]pp)
 Dynamically changes the level of postprocessing depending on the available spare
 CPU time.


More information about the MPlayer-dev-eng mailing list