changeset 2893:c31c50af40c5 libavformat

improve CRC API - don't export any global var - provide either generated or hardcoded tables
author aurel
date Fri, 04 Jan 2008 23:09:58 +0000
parents 0d82fdf4fa94
children 35cc09bfab21
files aviobuf.c mpegts.c mpegtsenc.c
diffstat 3 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/aviobuf.c	Fri Jan 04 20:09:48 2008 +0000
+++ b/aviobuf.c	Fri Jan 04 23:09:58 2008 +0000
@@ -318,7 +318,7 @@
 }
 
 unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len){
-    return av_crc(av_crc04C11DB7, checksum, buf, len);
+    return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len);
 }
 
 unsigned long get_checksum(ByteIOContext *s){
--- a/mpegts.c	Fri Jan 04 20:09:48 2008 +0000
+++ b/mpegts.c	Fri Jan 04 23:09:58 2008 +0000
@@ -262,7 +262,8 @@
     if (tss->section_h_size != -1 && tss->section_index >= tss->section_h_size) {
         tss->end_of_section_reached = 1;
         if (!tss->check_crc ||
-            av_crc(av_crc04C11DB7, -1, tss->section_buf, tss->section_h_size) == 0)
+            av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1,
+                   tss->section_buf, tss->section_h_size) == 0)
             tss->section_cb(tss1, tss->section_buf, tss->section_h_size);
     }
 }
--- a/mpegtsenc.c	Fri Jan 04 20:09:48 2008 +0000
+++ b/mpegtsenc.c	Fri Jan 04 23:09:58 2008 +0000
@@ -43,7 +43,7 @@
     unsigned char *q;
     int first, b, len1, left;
 
-    crc = bswap_32(av_crc(av_crc04C11DB7, -1, buf, len - 4));
+    crc = bswap_32(av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1, buf, len - 4));
     buf[len - 4] = (crc >> 24) & 0xff;
     buf[len - 3] = (crc >> 16) & 0xff;
     buf[len - 2] = (crc >> 8) & 0xff;