summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authorcorey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-02-21 09:39:22 +0000
committercorey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-02-21 09:39:22 +0000
commit960b978a037702e3c684b66b6ab2cdd4d62c5162 (patch)
treeca292bc48860e8d135f9e1ef3bc1c10acf52e633 /libmpdemux
parent14d023a2ee8ccc35d0c0e46a8a9dc3da41328c9d (diff)
downloadmpv-960b978a037702e3c684b66b6ab2cdd4d62c5162.tar.bz2
mpv-960b978a037702e3c684b66b6ab2cdd4d62c5162.tar.xz
Fix video delay when encoding with B-frames.
Encoding delay is adjusted for on-the-fly during encoding. Decoding delay is compensated for by setting an appropriate dwStart on the audio stream (only in muxer_avi at this point). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17660 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/muxer_avi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libmpdemux/muxer_avi.c b/libmpdemux/muxer_avi.c
index 7b3a32413e..9bd367df0b 100644
--- a/libmpdemux/muxer_avi.c
+++ b/libmpdemux/muxer_avi.c
@@ -665,10 +665,19 @@ static void avifile_write_index(muxer_t *muxer){
}
}
+static void avifile_fix_parameters(muxer_stream_t *s){
+ /* adjust audio_delay_fix according to individual stream delay */
+ if (s->type == MUXER_TYPE_AUDIO)
+ s->muxer->audio_delay_fix -= (float)s->decoder_delay * s->h.dwScale/s->h.dwRate;
+ if (s->type == MUXER_TYPE_VIDEO)
+ s->muxer->audio_delay_fix += (float)s->decoder_delay * s->h.dwScale/s->h.dwRate;
+}
+
int muxer_init_muxer_avi(muxer_t *muxer){
muxer->cont_new_stream = &avifile_new_stream;
muxer->cont_write_chunk = &avifile_write_chunk;
muxer->cont_write_header = &avifile_write_header;
muxer->cont_write_index = &avifile_write_index;
+ muxer->fix_stream_parameters = &avifile_fix_parameters;
return 1;
}