Commit b7effd4e authored by Anton Khirnov's avatar Anton Khirnov Committed by Ronald S. Bultje

avio: avio_ prefixes for get_* functions

In the name of consistency:
get_byte           -> avio_r8
get_<type>         -> avio_r<type>
get_buffer         -> avio_read

get_partial_buffer will be made private later

get_strz is left out becase I want to change it later to return
something useful.
Signed-off-by: default avatarRonald S. Bultje <rsbultje@gmail.com>
parent f8bed30d
......@@ -54,11 +54,11 @@
#define strk_SIZE 0x28
#define GET_LIST_HEADER() \
fourcc_tag = get_le32(pb); \
size = get_le32(pb); \
fourcc_tag = avio_rl32(pb); \
size = avio_rl32(pb); \
if (fourcc_tag != LIST_TAG) \
return AVERROR_INVALIDDATA; \
fourcc_tag = get_le32(pb);
fourcc_tag = avio_rl32(pb);
typedef struct AudioTrack {
int sample_rate;
......@@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s,
header = av_malloc(header_size);
if (!header)
return AVERROR(ENOMEM);
if (get_buffer(pb, header, header_size) != header_size){
if (avio_read(pb, header, header_size) != header_size){
av_free(header);
return AVERROR(EIO);
}
......@@ -255,7 +255,7 @@ static int fourxm_read_packet(AVFormatContext *s,
while (!packet_read) {
if ((ret = get_buffer(s->pb, header, 8)) < 0)
if ((ret = avio_read(s->pb, header, 8)) < 0)
return ret;
fourcc_tag = AV_RL32(&header[0]);
size = AV_RL32(&header[4]);
......@@ -268,7 +268,7 @@ static int fourxm_read_packet(AVFormatContext *s,
fourxm->video_pts ++;
/* skip the LIST-* tag and move on to the next fourcc */
get_le32(pb);
avio_rl32(pb);
break;
case ifrm_TAG:
......@@ -285,7 +285,7 @@ static int fourxm_read_packet(AVFormatContext *s,
pkt->pts = fourxm->video_pts;
pkt->pos = url_ftell(s->pb);
memcpy(pkt->data, header, 8);
ret = get_buffer(s->pb, &pkt->data[8], size);
ret = avio_read(s->pb, &pkt->data[8], size);
if (ret < 0){
av_free_packet(pkt);
......@@ -294,8 +294,8 @@ static int fourxm_read_packet(AVFormatContext *s,
break;
case snd__TAG:
track_number = get_le32(pb);
out_size= get_le32(pb);
track_number = avio_rl32(pb);
out_size= avio_rl32(pb);
size-=8;
if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
......
......@@ -63,7 +63,7 @@ static int aea_read_header(AVFormatContext *s,
/* Parse the amount of channels and skip to pos 2048(0x800) */
url_fskip(s->pb, 264);
st->codec->channels = get_byte(s->pb);
st->codec->channels = avio_r8(s->pb);
url_fskip(s->pb, 1783);
......
......@@ -54,8 +54,8 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
if (url_feof(pb))
return AVERROR(EIO);
*tag = get_le32(pb);
size = get_be32(pb);
*tag = avio_rl32(pb);
size = avio_rb32(pb);
if (size < 0)
size = 0x7fffffff;
......@@ -74,7 +74,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
return;
}
res = get_buffer(s->pb, str, size);
res = avio_read(s->pb, str, size);
if (res < 0)
return;
......@@ -93,18 +93,18 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
if (size & 1)
size++;
codec->codec_type = AVMEDIA_TYPE_AUDIO;
codec->channels = get_be16(pb);
num_frames = get_be32(pb);
codec->bits_per_coded_sample = get_be16(pb);
codec->channels = avio_rb16(pb);
num_frames = avio_rb32(pb);
codec->bits_per_coded_sample = avio_rb16(pb);
get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
avio_read(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */
codec->sample_rate = sample_rate;
size -= 18;
/* Got an AIFF-C? */
if (version == AIFF_C_VERSION1) {
codec->codec_tag = get_le32(pb);
codec->codec_tag = avio_rl32(pb);
codec->codec_id = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag);
switch (codec->codec_id) {
......@@ -187,7 +187,7 @@ static int aiff_read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
/* AIFF data type */
tag = get_le32(pb);
tag = avio_rl32(pb);
if (tag == MKTAG('A', 'I', 'F', 'F')) /* Got an AIFF file */
version = AIFF;
else if (tag != MKTAG('A', 'I', 'F', 'C')) /* An AIFF-C file then */
......@@ -217,7 +217,7 @@ static int aiff_read_header(AVFormatContext *s,
goto got_sound;
break;
case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */
version = get_be32(pb);
version = avio_rb32(pb);
break;
case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */
get_meta(s, "title" , size);
......@@ -233,8 +233,8 @@ static int aiff_read_header(AVFormatContext *s,
break;
case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
aiff->data_end = url_ftell(pb) + size;
offset = get_be32(pb); /* Offset of sound data */
get_be32(pb); /* BlockSize... don't care */
offset = avio_rb32(pb); /* Offset of sound data */
avio_rb32(pb); /* BlockSize... don't care */
offset += url_ftell(pb); /* Compute absolute data offset */
if (st->codec->block_align) /* Assume COMM already parsed */
goto got_sound;
......@@ -251,7 +251,7 @@ static int aiff_read_header(AVFormatContext *s,
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = size;
get_buffer(pb, st->codec->extradata, size);
avio_read(pb, st->codec->extradata, size);
break;
default: /* Jump */
if (size & 1) /* Always even aligned */
......
......@@ -82,7 +82,7 @@ static int amr_read_header(AVFormatContext *s,
AVStream *st;
uint8_t header[9];
get_buffer(pb, header, 6);
avio_read(pb, header, 6);
st = av_new_stream(s, 0);
if (!st)
......@@ -91,7 +91,7 @@ static int amr_read_header(AVFormatContext *s,
}
if(memcmp(header,AMR_header,6)!=0)
{
get_buffer(pb, header+6, 3);
avio_read(pb, header+6, 3);
if(memcmp(header,AMRWB_header,9)!=0)
{
return -1;
......@@ -128,7 +128,7 @@ static int amr_read_packet(AVFormatContext *s,
}
//FIXME this is wrong, this should rather be in a AVParset
toc=get_byte(s->pb);
toc=avio_r8(s->pb);
mode = (toc >> 3) & 0x0F;
if (enc->codec_id == CODEC_ID_AMR_NB)
......@@ -157,7 +157,7 @@ static int amr_read_packet(AVFormatContext *s,
pkt->pos= url_ftell(s->pb);
pkt->data[0]=toc;
pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
read = get_buffer(s->pb, pkt->data+1, size-1);
read = avio_read(s->pb, pkt->data+1, size-1);
if (read != size-1)
{
......
......@@ -84,16 +84,16 @@ static int read_header(AVFormatContext *s,
int i, ret;
url_fskip(pb, 4); /* magic number */
if (get_le16(pb) != MAX_PAGES) {
if (avio_rl16(pb) != MAX_PAGES) {
av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
return AVERROR_INVALIDDATA;
}
anm->nb_pages = get_le16(pb);
anm->nb_records = get_le32(pb);
anm->nb_pages = avio_rl16(pb);
anm->nb_records = avio_rl32(pb);
url_fskip(pb, 2); /* max records per page */
anm->page_table_offset = get_le16(pb);
if (get_le32(pb) != ANIM_TAG)
anm->page_table_offset = avio_rl16(pb);
if (avio_rl32(pb) != ANIM_TAG)
return AVERROR_INVALIDDATA;
/* video stream */
......@@ -103,32 +103,32 @@ static int read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_ANM;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = get_le16(pb);
st->codec->height = get_le16(pb);
if (get_byte(pb) != 0)
st->codec->width = avio_rl16(pb);
st->codec->height = avio_rl16(pb);
if (avio_r8(pb) != 0)
goto invalid;
url_fskip(pb, 1); /* frame rate multiplier info */
/* ignore last delta record (used for looping) */
if (get_byte(pb)) /* has_last_delta */
if (avio_r8(pb)) /* has_last_delta */
anm->nb_records = FFMAX(anm->nb_records - 1, 0);
url_fskip(pb, 1); /* last_delta_valid */
if (get_byte(pb) != 0)
if (avio_r8(pb) != 0)
goto invalid;
if (get_byte(pb) != 1)
if (avio_r8(pb) != 1)
goto invalid;
url_fskip(pb, 1); /* other recs per frame */
if (get_byte(pb) != 1)
if (avio_r8(pb) != 1)
goto invalid;
url_fskip(pb, 32); /* record_types */
st->nb_frames = get_le32(pb);
av_set_pts_info(st, 64, 1, get_le16(pb));
st->nb_frames = avio_rl32(pb);
av_set_pts_info(st, 64, 1, avio_rl16(pb));
url_fskip(pb, 58);
/* color cycling and palette data */
......@@ -138,7 +138,7 @@ static int read_header(AVFormatContext *s,
ret = AVERROR(ENOMEM);
goto close_and_return;
}
ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
if (ret < 0)
goto close_and_return;
......@@ -149,9 +149,9 @@ static int read_header(AVFormatContext *s,
for (i = 0; i < MAX_PAGES; i++) {
Page *p = &anm->pt[i];
p->base_record = get_le16(pb);
p->nb_records = get_le16(pb);
p->size = get_le16(pb);
p->base_record = avio_rl16(pb);
p->nb_records = avio_rl16(pb);
p->size = avio_rl16(pb);
}
/* find page of first frame */
......@@ -211,7 +211,7 @@ repeat:
tmp = url_ftell(pb);
url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
8 + anm->record * 2, SEEK_SET);
record_size = get_le16(pb);
record_size = avio_rl16(pb);
url_fseek(pb, tmp, SEEK_SET);
/* fetch record */
......
......@@ -35,9 +35,9 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVIOContext *pb = s->pb;
AVStream *st;
get_le32(pb); /* CRYO */
get_le32(pb); /* _APC */
get_le32(pb); /* 1.20 */
avio_rl32(pb); /* CRYO */
avio_rl32(pb); /* _APC */
avio_rl32(pb); /* 1.20 */
st = av_new_stream(s, 0);
if (!st)
......@@ -46,8 +46,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
get_le32(pb); /* number of samples */
st->codec->sample_rate = get_le32(pb);
avio_rl32(pb); /* number of samples */
st->codec->sample_rate = avio_rl32(pb);
st->codec->extradata_size = 2 * 4;
st->codec->extradata = av_malloc(st->codec->extradata_size +
......@@ -56,10 +56,10 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
/* initial predictor values for adpcm decoder */
get_buffer(pb, st->codec->extradata, 2 * 4);
avio_read(pb, st->codec->extradata, 2 * 4);
st->codec->channels = 1;
if (get_le32(pb))
if (avio_rl32(pb))
st->codec->channels = 2;
st->codec->bits_per_coded_sample = 4;
......
......@@ -162,11 +162,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* TODO: Skip any leading junk such as id3v2 tags */
ape->junklength = 0;
tag = get_le32(pb);
tag = avio_rl32(pb);
if (tag != MKTAG('M', 'A', 'C', ' '))
return -1;
ape->fileversion = get_le16(pb);
ape->fileversion = avio_rl16(pb);
if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {
av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10);
......@@ -174,15 +174,15 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
}
if (ape->fileversion >= 3980) {
ape->padding1 = get_le16(pb);
ape->descriptorlength = get_le32(pb);
ape->headerlength = get_le32(pb);
ape->seektablelength = get_le32(pb);
ape->wavheaderlength = get_le32(pb);
ape->audiodatalength = get_le32(pb);
ape->audiodatalength_high = get_le32(pb);
ape->wavtaillength = get_le32(pb);
get_buffer(pb, ape->md5, 16);
ape->padding1 = avio_rl16(pb);
ape->descriptorlength = avio_rl32(pb);
ape->headerlength = avio_rl32(pb);
ape->seektablelength = avio_rl32(pb);
ape->wavheaderlength = avio_rl32(pb);
ape->audiodatalength = avio_rl32(pb);
ape->audiodatalength_high = avio_rl32(pb);
ape->wavtaillength = avio_rl32(pb);
avio_read(pb, ape->md5, 16);
/* Skip any unknown bytes at the end of the descriptor.
This is for future compatibility */
......@@ -190,26 +190,26 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
/* Read header data */
ape->compressiontype = get_le16(pb);
ape->formatflags = get_le16(pb);
ape->blocksperframe = get_le32(pb);
ape->finalframeblocks = get_le32(pb);
ape->totalframes = get_le32(pb);
ape->bps = get_le16(pb);
ape->channels = get_le16(pb);
ape->samplerate = get_le32(pb);
ape->compressiontype = avio_rl16(pb);
ape->formatflags = avio_rl16(pb);
ape->blocksperframe = avio_rl32(pb);
ape->finalframeblocks = avio_rl32(pb);
ape->totalframes = avio_rl32(pb);
ape->bps = avio_rl16(pb);
ape->channels = avio_rl16(pb);
ape->samplerate = avio_rl32(pb);
} else {
ape->descriptorlength = 0;
ape->headerlength = 32;
ape->compressiontype = get_le16(pb);
ape->formatflags = get_le16(pb);
ape->channels = get_le16(pb);
ape->samplerate = get_le32(pb);
ape->wavheaderlength = get_le32(pb);
ape->wavtaillength = get_le32(pb);
ape->totalframes = get_le32(pb);
ape->finalframeblocks = get_le32(pb);
ape->compressiontype = avio_rl16(pb);
ape->formatflags = avio_rl16(pb);
ape->channels = avio_rl16(pb);
ape->samplerate = avio_rl32(pb);
ape->wavheaderlength = avio_rl32(pb);
ape->wavtaillength = avio_rl32(pb);
ape->totalframes = avio_rl32(pb);
ape->finalframeblocks = avio_rl32(pb);
if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
......@@ -217,7 +217,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
}
if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {
ape->seektablelength = get_le32(pb);
ape->seektablelength = avio_rl32(pb);
ape->headerlength += 4;
ape->seektablelength *= sizeof(int32_t);
} else
......@@ -260,7 +260,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
if (ape->seektablelength > 0) {
ape->seektable = av_malloc(ape->seektablelength);
for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
ape->seektable[i] = get_le32(pb);
ape->seektable[i] = avio_rl32(pb);
}
ape->frames[0].pos = ape->firstframe;
......@@ -355,7 +355,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
AV_WL32(pkt->data , nblocks);
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
pkt->pts = ape->frames[ape->currentframe].pts;
pkt->stream_index = 0;
......
......@@ -38,10 +38,10 @@ static int ape_tag_read_field(AVFormatContext *s)
uint32_t size, flags;
int i, c;
size = get_le32(pb); /* field size */
flags = get_le32(pb); /* field flags */
size = avio_rl32(pb); /* field size */
flags = avio_rl32(pb); /* field flags */
for (i = 0; i < sizeof(key) - 1; i++) {
c = get_byte(pb);
c = avio_r8(pb);
if (c < 0x20 || c > 0x7E)
break;
else
......@@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s)
value = av_malloc(size+1);
if (!value)
return AVERROR(ENOMEM);
get_buffer(pb, value, size);
avio_read(pb, value, size);
value[size] = 0;
av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
return 0;
......@@ -76,30 +76,30 @@ void ff_ape_parse_tag(AVFormatContext *s)
url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
get_buffer(pb, buf, 8); /* APETAGEX */
avio_read(pb, buf, 8); /* APETAGEX */
if (strncmp(buf, "APETAGEX", 8)) {
return;
}
val = get_le32(pb); /* APE tag version */
val = avio_rl32(pb); /* APE tag version */
if (val > APE_TAG_VERSION) {
av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION);
return;
}
tag_bytes = get_le32(pb); /* tag size */
tag_bytes = avio_rl32(pb); /* tag size */
if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {
av_log(s, AV_LOG_ERROR, "Tag size is way too big\n");
return;
}
fields = get_le32(pb); /* number of fields */
fields = avio_rl32(pb); /* number of fields */
if (fields > 65536) {
av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
return;
}
val = get_le32(pb); /* flags */
val = avio_rl32(pb); /* flags */
if (val & APE_TAG_FLAG_IS_HEADER) {
av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
return;
......
This diff is collapsed.
......@@ -127,15 +127,15 @@ static int au_read_header(AVFormatContext *s,
AVStream *st;
/* check ".snd" header */
tag = get_le32(pb);
tag = avio_rl32(pb);
if (tag != MKTAG('.', 's', 'n', 'd'))
return -1;
size = get_be32(pb); /* header size */
get_be32(pb); /* data size */
size = avio_rb32(pb); /* header size */
avio_rb32(pb); /* data size */
id = get_be32(pb);
rate = get_be32(pb);
channels = get_be32(pb);
id = avio_rb32(pb);
rate = avio_rb32(pb);
channels = avio_rb32(pb);
codec = ff_codec_get_id(codec_au_tags, id);
......
This diff is collapsed.
......@@ -378,6 +378,25 @@ attribute_deprecated AVIOContext *av_alloc_put_byte(
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
int64_t (*seek)(void *opaque, int64_t offset, int whence));
/**
* @defgroup old_avio_funcs Old put_/get_*() functions
* @deprecated use the avio_ -prefixed functions instead.
* @{
*/
attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
attribute_deprecated int get_byte(AVIOContext *s);
attribute_deprecated unsigned int get_le16(AVIOContext *s);
attribute_deprecated unsigned int get_le24(AVIOContext *s);
attribute_deprecated unsigned int get_le32(AVIOContext *s);
attribute_deprecated uint64_t get_le64(AVIOContext *s);
attribute_deprecated unsigned int get_be16(AVIOContext *s);
attribute_deprecated unsigned int get_be24(AVIOContext *s);
attribute_deprecated unsigned int get_be32(AVIOContext *s);
attribute_deprecated uint64_t get_be64(AVIOContext *s);
/**
* @}
*/
#endif
AVIOContext *avio_alloc_context(
......@@ -477,7 +496,7 @@ void put_flush_packet(AVIOContext *s);
* Read size bytes from AVIOContext into buf.
* @return number of bytes read or AVERROR
*/
int get_buffer(AVIOContext *s, unsigned char *buf, int size);
int avio_read(AVIOContext *s, unsigned char *buf, int size);
/**
* Read size bytes from AVIOContext into buf.
......@@ -489,11 +508,11 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
/** @note return 0 if EOF, so you cannot use it if EOF handling is
necessary */
int get_byte(AVIOContext *s);
unsigned int get_le24(AVIOContext *s);
unsigned int get_le32(AVIOContext *s);
uint64_t get_le64(AVIOContext *s);
unsigned int get_le16(AVIOContext *s);
int avio_r8 (AVIOContext *s);
unsigned int avio_rl16(AVIOContext *s);
unsigned int avio_rl24(AVIOContext *s);
unsigned int avio_rl32(AVIOContext *s);
uint64_t avio_rl64(AVIOContext *s);
/**
* Read a UTF-16 string from pb and convert it to UTF-8.
......@@ -505,10 +524,10 @@ int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen);
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
char *get_strz(AVIOContext *s, char *buf, int maxlen);
unsigned int get_be16(AVIOContext *s);
unsigned int get_be24(AVIOContext *s);
unsigned int get_be32(AVIOContext *s);
uint64_t get_be64(AVIOContext *s);
unsigned int avio_rb16(AVIOContext *s);
unsigned int avio_rb24(AVIOContext *s);
unsigned int avio_rb32(AVIOContext *s);
uint64_t avio_rb64(AVIOContext *s);
uint64_t ff_get_v(AVIOContext *bc);
......
......@@ -298,6 +298,32 @@ void put_strz(AVIOContext *s, const char *str)
{
avio_put_str(s, str);
}
#define GET(name, type) \
type get_be ##name(AVIOContext *s) \
{\
return avio_rb ##name(s);\
}\
type get_le ##name(AVIOContext *s) \
{\
return avio_rl ##name(s);\
}
GET(16, unsigned int)
GET(24, unsigned int)
GET(32, unsigned int)
GET(64, uint64_t)
#undef GET
int get_byte(AVIOContext *s)
{
return avio_r8(s);
}
int get_buffer(AVIOContext *s, unsigned char *buf, int size)
{
return avio_read(s, buf, size);
}
#endif
int avio_put_str(AVIOContext *s, const char *str)
......@@ -457,7 +483,7 @@ void init_checksum(AVIOContext *s,
}
/* XXX: put an inline version */
int get_byte(AVIOContext *s)
int avio_r8(AVIOContext *s)
{
if (s->buf_ptr >= s->buf_end)
fill_buffer(s);
......@@ -475,7 +501,7 @@ int url_fgetc(AVIOContext *s)
return URL_EOF;
}
int get_buffer(AVIOContext *s, unsigned char *buf, int size)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
{
int len, size1;
......@@ -545,58 +571,58 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
return len;
}
unsigned int get_le16(AVIOContext *s)
unsigned int avio_rl16(AVIOContext *s)
{
unsigned int val;
val = get_byte(s);
val |= get_byte(s) << 8;
val = avio_r8(s);
val |= avio_r8(s) << 8;
return val;
}
unsigned int get_le24(AVIOContext *s)
unsigned int avio_rl24(AVIOContext *s)
{
unsigned int val;
val = get_le16(s);
val |= get_byte(s) << 16;
val = avio_rl16(s);
val |= avio_r8(s) << 16;
return val;
}
unsigned int get_le32(AVIOContext *s)
unsigned int avio_rl32(AVIOContext *s)
{
unsigned int val;
val = get_le16(s);
val |= get_le16(s) << 16;
val = avio_rl16(s);
val |= avio_rl16(s) << 16;
return val;
}
uint64_t get_le64(AVIOContext *s)
uint64_t avio_rl64(AVIOContext *s)
{
uint64_t val;
val = (uint64_t)get_le32(s);
val |= (uint64_t)get_le32(s) << 32;
val = (uint64_t)avio_rl32(s);
val |= (uint64_t)avio_rl32(s) << 32;
return val;
}
unsigned int get_be16(AVIOContext *s)
unsigned int avio_rb16(AVIOContext *s)
{
unsigned int val;
val = get_byte(s) << 8;
val |= get_byte(s);
val = avio_r8(s) << 8;
val |= avio_r8(s);
return val;
}