aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-10-30 00:01:25 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-10-30 00:01:25 +0000
commit992e78f5f2724bf4649211aaceb353fc0e22f7ee (patch)
tree3e55120770abe0c86cbc13a97646de384985f44d
parent990e989f242ff0413aa207bc2a760c1b119ae6af (diff)
downloadffmpeg-992e78f5f2724bf4649211aaceb353fc0e22f7ee.tar.gz
rename av_crc04C11DB7_update to ff_crc04C11DB7_update and move it to aviobuf.c so it can be reused by other (de)muxers
Originally committed as revision 10873 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/avio.h1
-rw-r--r--libavformat/aviobuf.c5
-rw-r--r--libavformat/nut.c4
-rw-r--r--libavformat/nut.h2
-rw-r--r--libavformat/nutdec.c6
-rw-r--r--libavformat/nutenc.c6
6 files changed, 12 insertions, 12 deletions
diff --git a/libavformat/avio.h b/libavformat/avio.h
index eb93e47e5d..6a9cbae539 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -258,6 +258,7 @@ int url_open_dyn_packet_buf(ByteIOContext *s, int max_packet_size);
*/
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);
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 6370f57be6..c186aa2ea3 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -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 @@ static void fill_buffer(ByteIOContext *s)
}
}
+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;
diff --git a/libavformat/nut.c b/libavformat/nut.c
index e329a510d1..034934dc9d 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -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++){
diff --git a/libavformat/nut.h b/libavformat/nut.h
index 74492cd9ad..1636527ed2 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -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 @@ typedef struct {
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);
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 91b13009ea..e3b117d8bf 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -104,16 +104,16 @@ static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_ch
// 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;
}
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index b28566100c..f0ae12a2f8 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -196,14 +196,14 @@ static void put_packet(NUTContext *nut, ByteIOContext *bc, ByteIOContext *dyn_bc
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 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
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));