diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-10-03 02:42:01 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-10-03 02:42:01 +0000 |
commit | 7000a175420359dfed50555cb66b6e304bf40d9e (patch) | |
tree | 1c6c78a3378ab901b8b378a57187f0932c88ba6a /libavformat/utils.c | |
parent | d8b5abfa70586490c56d34af3cc7731f6108aafb (diff) | |
download | ffmpeg-7000a175420359dfed50555cb66b6e304bf40d9e.tar.gz |
SCR timestamp fix try #1
Originally committed as revision 3550 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index c1ac6d14b4..f8223a0d0a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -264,6 +264,34 @@ void fifo_write(FifoBuffer *f, uint8_t *buf, int size, uint8_t **wptr_ptr) *wptr_ptr = wptr; } +/* get data from the fifo (return -1 if not enough data) */ +int put_fifo(ByteIOContext *pb, FifoBuffer *f, int buf_size, uint8_t **rptr_ptr) +{ + uint8_t *rptr = *rptr_ptr; + int size, len; + + if (f->wptr >= rptr) { + size = f->wptr - rptr; + } else { + size = (f->end - rptr) + (f->wptr - f->buffer); + } + + if (size < buf_size) + return -1; + while (buf_size > 0) { + len = f->end - rptr; + if (len > buf_size) + len = buf_size; + put_buffer(pb, rptr, len); + rptr += len; + if (rptr >= f->end) + rptr = f->buffer; + buf_size -= len; + } + *rptr_ptr = rptr; + return 0; +} + int filename_number_test(const char *filename) { char buf[1024]; |