mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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
This commit is contained in:
parent
990e989f24
commit
992e78f5f2
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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++){
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user