avio: make init_checksum() internal.
This commit is contained in:
parent
ce02f9becf
commit
4c4427a75d
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user