[MPlayer-dev-eng] [PATCH] muxer frame buffering for mencoder [patch version 4]
Corey Hickey
bugfood-ml at fatooh.org
Sat Nov 19 07:26:19 CET 2005
This patch inserts a frame buffering function above the muxers as
discussed on mplayer-advusers in the thread "[BUG] mencoder floating
point exception with -of lavf" started by myself on 2005-11-04. Most of
the reasoning behind this patch is in that thread, but I'll summarize here.
Presently, mencoder attempts to write the header of the output file
before knowing the characteristics of the video stream. This causes a
floating point exception with the lavf muxer. The best solution offered
to me was to write a buffering layer that stores frames until a video
frame is seen, then write the header and send the stored frames to the
actual muxer.
The attached patch is the fourth version of my attempt at making this
work. I have addressed most (if not all) of Nico's concerns, and this
version should be at least close to finished. Significant differences
from the previous patch:
* frame data that need to be stored are now in a separate structure
* there is no hard limit to the number of frames that can be buffered
* frame storage is realloc()ed instead of being statically allocated
* frames are buffered until at least one frame from each stream is seen
* cleaner, I think
Each individual muxer had to be modified in order to move the timer
updating into a centralized location. This was easy and non-intrusive
for all but the mpeg muxer. My approach was simply "remove what needs to
be removed and see if it still works." As far as I can tell it still
does, but there could be a problem I don't know about.
I've run about 45 regression tests comparing an unpatched mplayer to a
patched one. See my long post to mplayer-advusers on 2005-11-13; I can
list them again if necessary. Here's a summary broken down by muxer.
muxer_avi: all tests identical (diff old.avi new.avi)
muxer_lavf: Since this wasn't working before, I can't test to see if the
files are identical; however, everything I've tried that I was able to
encode/play with cvs from the last working date still encodes/plays with
my patched version.
muxer_mpeg: The mpeg muxer didn't update the timer when passed an empty
frame; my buffering function updates the timer regardless. As far as I
know the behavior of my patched version is more correct. Files that
encoded/played correctly with the unpatched version still seem to
encode/play.
muxer_rawaudio: all tests identical
muxer_rawvideo: all tests identical
Let me know what needs to be corrected in this patch. Once I submit a
version that is deemed acceptable and applied to cvs, I'll send a few
follow-up patches that don't need to be part of this one:
* change avi-specific messages
* reduce the number of times muxer_avi writes header
* change muxer_write_chunk() to int so it can return failure (maybe)
-Corey
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: muxer-buffer-try4.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20051118/d063d469/attachment.txt>
More information about the MPlayer-dev-eng
mailing list