This is libmpeg3-1.5.4
mpeg3cat truncates MPEG video streams
(not program streams, just straight video streams)
The easiest way to see this is something like:
mpeg3cat file.mpg > copy.mpg
file.mpg and copy.mpg _should_ be identical, but
probably won't be
copy.mpg will be truncated.
If several input files are used, each one will be
truncated as it is concatenated.
I've attached a patch that fixes the problem by making
1. mpeg3cat's main loop runs an extra time.
Instead of quiting
right when it sees an EOF condition, it run one
to process everything left in the buffer.
2. mpeg3io_read_data is made to return the number
of bytes it
failed to read on a failure. It still returns
0 on success.
3. mpeg3_read_next_packet to figure out how many
were read by mpeg3io_read_data in the event of
A failure will occur if anything less than the
number of bytes was read, but we need to make sure
we handle a partial read.
4. mpeg3demux_eof only returns EOF if the demuxer's
data_position has hit the end of the demuxer's
IN ADDITION to the underlying stream hitting EOF.
I'm not expert on libmpeg3's design, but I think the most
questionable of these patches in #2. I don't know the
effects of changing the return value of mpeg3io_read_data
like this, but mpeg3_read_next_packet has to handle
partial reads on straight video streams that aren't
neatly buffered like DVDs.