Mercurial > libavformat.hg
changeset 2683:153d6efc05b8 libavformat
rename av_crc04C11DB7_update to ff_crc04C11DB7_update and move it to aviobuf.c so it can be reused by other (de)muxers
author | bcoudurier |
---|---|
date | Tue, 30 Oct 2007 00:01:25 +0000 |
parents | 66bd9e2fbcf1 |
children | 3dd4b622f4e3 |
files | avio.h aviobuf.c nut.c nut.h nutdec.c nutenc.c |
diffstat | 6 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/avio.h Mon Oct 29 09:38:37 2007 +0000 +++ b/avio.h Tue Oct 30 00:01:25 2007 +0000 @@ -258,6 +258,7 @@ */ int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer); +unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len); unsigned long get_checksum(ByteIOContext *s); void init_checksum(ByteIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum);
--- a/aviobuf.c Mon Oct 29 09:38:37 2007 +0000 +++ b/aviobuf.c Tue Oct 30 00:01:25 2007 +0000 @@ -20,6 +20,7 @@ */ #include "avformat.h" #include "avio.h" +#include "crc.h" #include <stdarg.h> #define IO_BUFFER_SIZE 32768 @@ -286,6 +287,10 @@ } } +unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len){ + return av_crc(av_crc04C11DB7, checksum, buf, len); +} + unsigned long get_checksum(ByteIOContext *s){ s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr); s->update_checksum= NULL;
--- a/nut.c Mon Oct 29 09:38:37 2007 +0000 +++ b/nut.c Tue Oct 30 00:01:25 2007 +0000 @@ -22,10 +22,6 @@ #include "nut.h" #include "tree.h" -unsigned long av_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len){ - return av_crc(av_crc04C11DB7, checksum, buf, len); -} - void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val){ int i; for(i=0; i<nut->avf->nb_streams; i++){
--- a/nut.h Mon Oct 29 09:38:37 2007 +0000 +++ b/nut.h Tue Oct 30 00:01:25 2007 +0000 @@ -24,7 +24,6 @@ //#include <limits.h> #include "avformat.h" -#include "crc.h" //#include "mpegaudio.h" #include "riff.h" //#include "adler32.h" @@ -93,7 +92,6 @@ struct AVTreeNode *syncpoints; } NUTContext; -unsigned long av_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len); void ff_nut_reset_ts(NUTContext *nut, AVRational time_base, int64_t val); int64_t ff_lsb2full(StreamContext *stream, int64_t lsb); int ff_nut_sp_pos_cmp(syncpoint_t *a, syncpoint_t *b);
--- a/nutdec.c Mon Oct 29 09:38:37 2007 +0000 +++ b/nutdec.c Tue Oct 30 00:01:25 2007 +0000 @@ -104,16 +104,16 @@ // start= url_ftell(bc) - 8; startcode= be2me_64(startcode); - startcode= av_crc04C11DB7_update(0, &startcode, 8); + startcode= ff_crc04C11DB7_update(0, &startcode, 8); - init_checksum(bc, av_crc04C11DB7_update, startcode); + init_checksum(bc, ff_crc04C11DB7_update, startcode); size= get_v(bc); if(size > 4096) get_be32(bc); if(get_checksum(bc) && size > 4096) return -1; - init_checksum(bc, calculate_checksum ? av_crc04C11DB7_update : NULL, 0); + init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0); return size; }
--- a/nutenc.c Mon Oct 29 09:38:37 2007 +0000 +++ b/nutenc.c Tue Oct 30 00:01:25 2007 +0000 @@ -196,14 +196,14 @@ int forw_ptr= dyn_size + 4*calculate_checksum; if(forw_ptr > 4096) - init_checksum(bc, av_crc04C11DB7_update, 0); + init_checksum(bc, ff_crc04C11DB7_update, 0); put_be64(bc, startcode); put_v(bc, forw_ptr); if(forw_ptr > 4096) put_le32(bc, get_checksum(bc)); if(calculate_checksum) - init_checksum(bc, av_crc04C11DB7_update, 0); + init_checksum(bc, ff_crc04C11DB7_update, 0); put_buffer(bc, dyn_buf, dyn_size); if(calculate_checksum) put_le32(bc, get_checksum(bc)); @@ -535,7 +535,7 @@ flags= fc->flags; needed_flags= get_needed_flags(nut, nus, fc, pkt); - init_checksum(bc, av_crc04C11DB7_update, 0); + init_checksum(bc, ff_crc04C11DB7_update, 0); put_byte(bc, frame_code); if(flags & FLAG_CODED){ put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));