diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-04-06 17:40:17 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-04-06 17:40:17 +0000 |
commit | 465e1dadbef7596a3eb87089a66bb4ecdc26d3c4 (patch) | |
tree | 97cb01c13b8b0551f8b20d47063c0ff084e661dc /libavformat/aviobuf.c | |
parent | 4568325a1810ea5d829230dc5e9ef0e56c51632f (diff) | |
download | ffmpeg-465e1dadbef7596a3eb87089a66bb4ecdc26d3c4.tar.gz |
10l (bytes_left() -> url_feof())
10l (updating LRU delta pts for type 1/2 frames)
ensure that checksumming isnt enabled if its not needed
search for next startcode and then search backward to the next valid frame if an inconsistancy is detected
deal with non-frame startcodes in the middle of the stream
Originally committed as revision 2972 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index ebc2f74910..39f45495b6 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -48,7 +48,6 @@ int init_put_byte(ByteIOContext *s, s->eof_reached = 0; s->is_streamed = 0; s->max_packet_size = 0; - s->checksum_ptr= NULL; s->update_checksum= NULL; return 0; } @@ -60,7 +59,7 @@ static void flush_buffer(ByteIOContext *s) if (s->buf_ptr > s->buffer) { if (s->write_packet) s->write_packet(s->opaque, s->buffer, s->buf_ptr - s->buffer); - if(s->checksum_ptr){ + if(s->update_checksum){ s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr); s->checksum_ptr= s->buffer; } @@ -250,7 +249,7 @@ static void fill_buffer(ByteIOContext *s) if (s->eof_reached) return; - if(s->checksum_ptr){ + if(s->update_checksum){ s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_end - s->checksum_ptr); s->checksum_ptr= s->buffer; } @@ -269,14 +268,16 @@ static void fill_buffer(ByteIOContext *s) unsigned long get_checksum(ByteIOContext *s){ s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr); - s->checksum_ptr= NULL; + s->update_checksum= NULL; return s->checksum; } void init_checksum(ByteIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum){ s->update_checksum= update_checksum; - s->checksum= s->update_checksum(checksum, NULL, 0); - s->checksum_ptr= s->buf_ptr; + if(s->update_checksum){ + s->checksum= s->update_checksum(checksum, NULL, 0); + s->checksum_ptr= s->buf_ptr; + } } /* NOTE: return 0 if EOF, so you cannot use it if EOF handling is |