aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-03-17 12:56:25 +0100
committerAnton Khirnov <anton@khirnov.net>2011-03-30 07:47:08 +0200
commit4c4427a75da1cbb81f3097e0a0fbd6755516bc0d (patch)
tree029c58e33df34304098af90a94b87f549f281b86 /libavformat
parentce02f9becfc2e89bf552a86303b00d0b36323cdf (diff)
downloadffmpeg-4c4427a75da1cbb81f3097e0a0fbd6755516bc0d.tar.gz
avio: make init_checksum() internal.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avio.h7
-rw-r--r--libavformat/avio_internal.h3
-rw-r--r--libavformat/aviobuf.c8
-rw-r--r--libavformat/nutdec.c4
-rw-r--r--libavformat/nutenc.c7
-rw-r--r--libavformat/oggenc.c2
6 files changed, 21 insertions, 10 deletions
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 07a893e312..bce2fc9682 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -451,6 +451,10 @@ attribute_deprecated int url_ferror(AVIOContext *s);
attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
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);
#endif
AVIOContext *avio_alloc_context(
@@ -674,9 +678,6 @@ int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
unsigned int len);
unsigned long get_checksum(AVIOContext *s);
-void init_checksum(AVIOContext *s,
- unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
- unsigned long checksum);
#if FF_API_UDP_GET_FILE
int udp_get_file_handle(URLContext *h);
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index 6eee947383..c50514d833 100644
--- a/libavformat/avio_internal.h
+++ b/libavformat/avio_internal.h
@@ -74,5 +74,8 @@ int64_t ffio_read_seek (AVIOContext *h, int stream_index,
int ff_udp_set_remote_url(URLContext *h, const char *uri);
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);
#endif // AVFORMAT_AVIO_INTERNAL_H
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index bb417e0506..7399905e89 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -406,6 +406,12 @@ int64_t av_url_read_fseek(AVIOContext *s, int stream_index,
{
return ffio_read_seek(s, stream_index, timestamp, flags);
}
+void init_checksum(AVIOContext *s,
+ unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
+ unsigned long checksum)
+{
+ ffio_init_checksum(s, update_checksum, checksum);
+}
#endif
int avio_put_str(AVIOContext *s, const char *str)
@@ -555,7 +561,7 @@ unsigned long get_checksum(AVIOContext *s)
return s->checksum;
}
-void init_checksum(AVIOContext *s,
+void ffio_init_checksum(AVIOContext *s,
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
unsigned long checksum)
{
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 0968faf39c..1191962b50 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -104,14 +104,14 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec
startcode= av_be2ne64(startcode);
startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8);
- init_checksum(bc, ff_crc04C11DB7_update, startcode);
+ ffio_init_checksum(bc, ff_crc04C11DB7_update, startcode);
size= ffio_read_varlen(bc);
if(size > 4096)
avio_rb32(bc);
if(get_checksum(bc) && size > 4096)
return -1;
- init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
+ ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
return size;
}
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 89cfb97381..8a2a6faba1 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -24,6 +24,7 @@
#include "libavcodec/mpegaudiodata.h"
#include "nut.h"
#include "internal.h"
+#include "avio_internal.h"
static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){
int sample_rate= c->sample_rate;
@@ -284,14 +285,14 @@ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, in
int forw_ptr= dyn_size + 4*calculate_checksum;
if(forw_ptr > 4096)
- init_checksum(bc, ff_crc04C11DB7_update, 0);
+ ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
avio_wb64(bc, startcode);
ff_put_v(bc, forw_ptr);
if(forw_ptr > 4096)
avio_wl32(bc, get_checksum(bc));
if(calculate_checksum)
- init_checksum(bc, ff_crc04C11DB7_update, 0);
+ ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
avio_write(bc, dyn_buf, dyn_size);
if(calculate_checksum)
avio_wl32(bc, get_checksum(bc));
@@ -806,7 +807,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
needed_flags= get_needed_flags(nut, nus, fc, pkt);
header_idx= fc->header_idx;
- init_checksum(bc, ff_crc04C11DB7_update, 0);
+ ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
avio_w8(bc, frame_code);
if(flags & FLAG_CODED){
ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 03e2f6caa2..036d21c6a4 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -85,7 +85,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
ret = url_open_dyn_buf(&pb);
if (ret < 0)
return ret;
- init_checksum(pb, ff_crc04C11DB7_update, 0);
+ ffio_init_checksum(pb, ff_crc04C11DB7_update, 0);
ffio_wfourcc(pb, "OggS");
avio_w8(pb, 0);
avio_w8(pb, page->flags | extra_flags);