diff options
author | Reinhard Nißl <rnissl@gmx.de> | 2007-04-11 23:27:25 +0200 |
---|---|---|
committer | Reinhard Nißl <rnissl@gmx.de> | 2007-04-11 23:27:25 +0200 |
commit | 5e58a3c2f6a02dbd198369d1132366c49f5345fe (patch) | |
tree | 10388ad480a4340d32ebc2feb195745e232631f0 | |
parent | 47d88e8447b5b86f7eca03d302f2d17d2a4c9c26 (diff) | |
download | xine-lib-5e58a3c2f6a02dbd198369d1132366c49f5345fe.tar.gz xine-lib-5e58a3c2f6a02dbd198369d1132366c49f5345fe.tar.bz2 |
Special handling of sequence end code to improve still frames.
The current code emits a frame when a non slice start code is seen.
For still frames, this is typically a sequence end code. But the
current code doesn't call parse_chunk() immediately because it waits
for a further start code to determine the chunk of data to pass to
parse_chunk(). But there isn't such a further start code for still
frames after the sequence end code and thus, the still frame will
not be emitted.
As sequence end code is the only start code which has no data
according to the MPEG specification, let's use this information
to call parse_chunk() immediately.
-rw-r--r-- | src/libmpeg2/decode.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 3233fb9b4..c3ba6ea4d 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -606,6 +606,18 @@ static inline uint8_t * copy_chunk (mpeg2dec_t * mpeg2dec, uint8_t * limit; uint8_t byte; + /* sequence end code 0xb7 doesn't have any data and there might be the case + * that no start code will follow this code for quite some time (e. g. in case + * of a still image. + * Therefore, return immediately with a chunk_size of 0. Setting code to 0xb4 + * will eat up any trailing garbage next time. + */ + if (mpeg2dec->code == 0xb7) { + mpeg2dec->code = 0xb4; + mpeg2dec->chunk_size = 0; + return current; + } + shift = mpeg2dec->shift; chunk_ptr = mpeg2dec->chunk_ptr; limit = current + (mpeg2dec->chunk_buffer + BUFFER_SIZE - chunk_ptr); @@ -657,7 +669,7 @@ int mpeg2_decode_data (mpeg2dec_t * mpeg2dec, uint8_t * current, uint8_t * end, if (pts) mpeg2dec->pts = pts; - while (current != end) { + while (current != end || mpeg2dec->code == 0xb7) { code = mpeg2dec->code; current = copy_chunk (mpeg2dec, current, end); if (current == NULL) |