diff -ur main.orig/cfg-common.h main.patchtest/cfg-common.h --- main.orig/cfg-common.h 2006-02-06 15:43:30.000000000 -0800 +++ main.patchtest/cfg-common.h 2006-02-16 22:53:59.000000000 -0800 @@ -150,6 +150,10 @@ // set a-v distance {"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL}, + // ignore header-specified delay (dwStart) + {"ignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"noignore-start", &ignore_start, CONF_TYPE_FLAG, 0, 1, 0, NULL}, + #ifdef USE_LIBA52 {"a52drc", &a52_drc_level, CONF_TYPE_FLOAT, CONF_RANGE, 0, 1, NULL}, #endif diff -ur main.orig/DOCS/man/en/mplayer.1 main.patchtest/DOCS/man/en/mplayer.1 --- main.orig/DOCS/man/en/mplayer.1 2006-02-16 19:26:10.000000000 -0800 +++ main.patchtest/DOCS/man/en/mplayer.1 2006-02-16 22:53:59.000000000 -0800 @@ -1101,6 +1101,18 @@ with \-ovc copy; use \-audio-delay instead. . .TP +.B \-ignore-start +Ignore the specified starting time for streams in AVI files. +In MPlayer, this nullifies stream delays in files encoded with +the \-audio-delay option. +During encoding, this option prevents MEncoder from transferring +original stream start times to the new file; the \-audio-delay option is +not affected. +Note that MEncoder sometimes adjusts stream starting times +automatically to compensate for anticipated decoding delays, so don't +use this option for encoding without testing it first. +. +.TP .B \-demuxer <[+]name> Force demuxer type. Use a '+' before the name to force it, this will skip some checks! diff -ur main.orig/mencoder.c main.patchtest/mencoder.c --- main.orig/mencoder.c 2006-02-16 19:26:10.000000000 -0800 +++ main.patchtest/mencoder.c 2006-02-16 22:53:59.000000000 -0800 @@ -156,6 +156,7 @@ static float audio_preload=0.5; static float audio_delay_fix=0.0; static float audio_delay=0.0; +static int ignore_start=0; static int audio_density=2; float force_fps=0; @@ -866,6 +867,7 @@ mux_v->bih->biCompression, (char *)&mux_v->bih->biCompression); } +if (! ignore_start) muxer->audio_delay_fix -= sh_video->stream_delay; //if(demuxer->file_format!=DEMUXER_TYPE_AVI) pts_from_bps=0; // it must be 0 for mpeg/asf! @@ -961,6 +963,7 @@ if (verbose>1) print_wave_header(mux_a->wf); +if (! ignore_start) muxer->audio_delay_fix += sh_audio->stream_delay; } // if(sh_audio) diff -ur main.orig/mplayer.c main.patchtest/mplayer.c --- main.orig/mplayer.c 2006-02-16 18:59:32.000000000 -0800 +++ main.patchtest/mplayer.c 2006-02-16 22:53:59.000000000 -0800 @@ -294,6 +294,7 @@ static float max_pts_correction=0;//default_max_pts_correction; static float c_total=0; float audio_delay=0; +static int ignore_start=0; static int softsleep=0; @@ -2524,9 +2525,11 @@ if(sh_video){ sh_video->timer=0; + if (! ignore_start) audio_delay += sh_video->stream_delay; } if(sh_audio){ + if (! ignore_start) audio_delay -= sh_audio->stream_delay; sh_audio->delay=-audio_delay; }