On Nov 3, 2005, at 8:50 AM, Anja Colgan wrote:
> I'm trying to write BufferedImages to a videofile and came across the
> MovieEncoder. It works brilliantly, except that the last of the
> images does not appear in the movie file.
Good catch, Anja! I believe the problem is that the underlying
MovieDataStream thread spin-waits for 25ms and on read it first
checks to see if we've told it to finish, at which time it shuts down
and cleans up. Which means if you added an image and called stop(),
all within 25ms, it may not bother grabbing the last image and
instead will just clean up. We never see this problem in MASON
because the simulation drawing time generally exceeds that.
I think I've fixed it -- before we check for finishing we first see
if there's anything in the buffer left to write. Tell me if you find
any problems with the following code revision: