aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-03-17 13:04:38 +0100
committerAnton Khirnov <anton@khirnov.net>2011-03-30 07:48:55 +0200
commitb64030f26d2ace99b9c782f5d5e264802d2d80a0 (patch)
tree49ce67b68837e15966dee71b24cabcecd57919c0
parentd09cc22d9c2dd2843179e7d11a1b564387f62dd2 (diff)
downloadffmpeg-b64030f26d2ace99b9c782f5d5e264802d2d80a0.tar.gz
avio: make get_checksum() internal.
-rw-r--r--libavformat/avio.h3
-rw-r--r--libavformat/avio_internal.h1
-rw-r--r--libavformat/aviobuf.c6
-rw-r--r--libavformat/nutdec.c12
-rw-r--r--libavformat/nutenc.c8
-rw-r--r--libavformat/oggenc.c2
6 files changed, 18 insertions, 14 deletions
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 22f7a2c9c3..12fa2d586b 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -455,6 +455,7 @@ attribute_deprecated int udp_get_local_port(URLContext *h);
attribute_deprecated void init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum);
+attribute_deprecated unsigned long get_checksum(AVIOContext *s);
#endif
AVIOContext *avio_alloc_context(
@@ -675,8 +676,6 @@ int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
*/
int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
-unsigned long get_checksum(AVIOContext *s);
-
#if FF_API_UDP_GET_FILE
int udp_get_file_handle(URLContext *h);
#endif
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 243b16dc52..916de8fcc7 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -77,6 +77,7 @@ int ff_udp_get_local_port(URLContext *h);
void ffio_init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum);
+unsigned long ffio_get_checksum(AVIOContext *s);
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
unsigned int len);
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 7399905e89..2e7ee15b2a 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -412,6 +412,10 @@ void init_checksum(AVIOContext *s,
{
ffio_init_checksum(s, update_checksum, checksum);
}
+unsigned long get_checksum(AVIOContext *s)
+{
+ return ffio_get_checksum(s);
+}
#endif
int avio_put_str(AVIOContext *s, const char *str)
@@ -554,7 +558,7 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len);
}
-unsigned long get_checksum(AVIOContext *s)
+unsigned long ffio_get_checksum(AVIOContext *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/nutdec.c b/libavformat/nutdec.c
index 1191962b50..ac17e86123 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -108,7 +108,7 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec
size= ffio_read_varlen(bc);
if(size > 4096)
avio_rb32(bc);
- if(get_checksum(bc) && size > 4096)
+ if(ffio_get_checksum(bc) && size > 4096)
return -1;
ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
@@ -285,7 +285,7 @@ static int decode_main_header(NUTContext *nut){
assert(nut->header_len[0]==0);
}
- if(skip_reserved(bc, end) || get_checksum(bc)){
+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n");
return AVERROR_INVALIDDATA;
}
@@ -374,7 +374,7 @@ static int decode_stream_header(NUTContext *nut){
ffio_read_varlen(bc); // samplerate_den
GET_V(st->codec->channels, tmp > 0)
}
- if(skip_reserved(bc, end) || get_checksum(bc)){
+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
av_log(s, AV_LOG_ERROR, "stream header %d checksum mismatch\n", stream_id);
return -1;
}
@@ -469,7 +469,7 @@ static int decode_info_header(NUTContext *nut){
}
}
- if(skip_reserved(bc, end) || get_checksum(bc)){
+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
return -1;
}
@@ -493,7 +493,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count);
- if(skip_reserved(bc, end) || get_checksum(bc)){
+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
return -1;
}
@@ -590,7 +590,7 @@ static int find_and_decode_index(NUTContext *nut){
}
}
- if(skip_reserved(bc, end) || get_checksum(bc)){
+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
av_log(s, AV_LOG_ERROR, "index checksum mismatch\n");
goto fail;
}
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 8a2a6faba1..a72e510d81 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -289,13 +289,13 @@ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, in
avio_wb64(bc, startcode);
ff_put_v(bc, forw_ptr);
if(forw_ptr > 4096)
- avio_wl32(bc, get_checksum(bc));
+ avio_wl32(bc, ffio_get_checksum(bc));
if(calculate_checksum)
ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
avio_write(bc, dyn_buf, dyn_size);
if(calculate_checksum)
- avio_wl32(bc, get_checksum(bc));
+ avio_wl32(bc, ffio_get_checksum(bc));
av_free(dyn_buf);
}
@@ -818,8 +818,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul);
if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx);
- if(flags & FLAG_CHECKSUM) avio_wl32(bc, get_checksum(bc));
- else get_checksum(bc);
+ if(flags & FLAG_CHECKSUM) avio_wl32(bc, ffio_get_checksum(bc));
+ else ffio_get_checksum(bc);
avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
nus->last_flags= flags;
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 036d21c6a4..e0dc5332ae 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -68,7 +68,7 @@ typedef struct {
static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
{
int64_t pos = avio_tell(pb);
- uint32_t checksum = get_checksum(pb);
+ uint32_t checksum = ffio_get_checksum(pb);
avio_seek(pb, crc_offset, SEEK_SET);
avio_wb32(pb, checksum);
avio_seek(pb, pos, SEEK_SET);