[FFmpeg-devel] [PATCH 2/4] lavf: add avio_ prefix to get* functions
Anton Khirnov
anton
Sun Feb 6 14:13:54 CET 2011
Deprecate the unprefixed versions.
get_strz is left out, because I want to change it later to return
something useful.
---
libavformat/4xm.c | 18 +-
libavformat/aea.c | 2 +-
libavformat/aiffdec.c | 26 ++--
libavformat/amr.c | 8 +-
libavformat/anm.c | 38 ++--
libavformat/apc.c | 14 +-
libavformat/ape.c | 60 +++---
libavformat/apetag.c | 18 +-
libavformat/asfdec.c | 260 ++++++++++++------------
libavformat/au.c | 12 +-
libavformat/avidec.c | 152 +++++++-------
libavformat/avio.h | 34 ++-
libavformat/aviobuf.c | 86 +++++---
libavformat/avs.c | 24 +-
libavformat/bethsoftvid.c | 30 ++--
libavformat/bfi.c | 32 ++--
libavformat/bink.c | 30 ++--
libavformat/c93.c | 18 +-
libavformat/cafdec.c | 36 ++--
libavformat/daud.c | 4 +-
libavformat/dsicin.c | 30 ++--
libavformat/dv.c | 10 +-
libavformat/dxa.c | 30 ++--
libavformat/eacdata.c | 4 +-
libavformat/electronicarts.c | 44 ++--
libavformat/ffmdec.c | 144 +++++++-------
libavformat/ffmetadec.c | 4 +-
libavformat/filmstripdec.c | 14 +-
libavformat/flacdec.c | 6 +-
libavformat/flic.c | 10 +-
libavformat/flvdec.c | 52 +++---
libavformat/gxf.c | 70 +++---
libavformat/id3v1.c | 2 +-
libavformat/id3v2.c | 30 ++--
libavformat/idcin.c | 18 +-
libavformat/idroqdec.c | 10 +-
libavformat/iff.c | 30 ++--
libavformat/img2.c | 2 +-
libavformat/ingenientdec.c | 14 +-
libavformat/ipmovie.c | 22 +-
libavformat/isom.c | 16 +-
libavformat/iss.c | 4 +-
libavformat/iv8.c | 12 +-
libavformat/ivfdec.c | 22 +-
libavformat/libnut.c | 2 +-
libavformat/lmlm4.c | 6 +-
libavformat/lxfdec.c | 10 +-
libavformat/matroskadec.c | 26 ++--
libavformat/mm.c | 18 +-
libavformat/mmf.c | 26 ++--
libavformat/mov.c | 474 +++++++++++++++++++++---------------------
libavformat/mp3dec.c | 18 +-
libavformat/mpc.c | 14 +-
libavformat/mpc8.c | 10 +-
libavformat/mpeg.c | 78 ++++----
libavformat/mpegts.c | 30 ++--
libavformat/msnwc_tcp.c | 8 +-
libavformat/mtv.c | 20 +-
libavformat/mvi.c | 30 ++--
libavformat/mxfdec.c | 122 ++++++------
libavformat/mxg.c | 2 +-
libavformat/ncdec.c | 6 +-
libavformat/nsvdec.c | 54 +++---
libavformat/nutdec.c | 32 ++--
libavformat/nuv.c | 52 +++---
libavformat/oggdec.c | 14 +-
libavformat/oma.c | 2 +-
libavformat/psxstr.c | 4 +-
libavformat/pva.c | 26 ++--
libavformat/qcp.c | 28 ++--
libavformat/r3d.c | 78 ++++----
libavformat/rawdec.c | 2 +-
libavformat/rdt.c | 12 +-
libavformat/riff.c | 44 ++--
libavformat/rl2.c | 26 ++--
libavformat/rmdec.c | 206 +++++++++---------
libavformat/rpl.c | 6 +-
libavformat/rsodec.c | 8 +-
libavformat/rtpdec_asf.c | 4 +-
libavformat/rtpdec_qt.c | 8 +-
libavformat/rtsp.c | 2 +-
libavformat/sauce.c | 20 +-
libavformat/segafilm.c | 14 +-
libavformat/sierravmd.c | 10 +-
libavformat/siff.c | 40 ++--
libavformat/smacker.c | 50 +++---
libavformat/sol.c | 12 +-
libavformat/soxdec.c | 20 +-
libavformat/spdifdec.c | 8 +-
libavformat/swfdec.c | 44 ++--
libavformat/thp.c | 46 ++--
libavformat/tiertexseq.c | 14 +-
libavformat/tmv.c | 14 +-
libavformat/tta.c | 16 +-
libavformat/tty.c | 6 +-
libavformat/txd.c | 6 +-
libavformat/utils.c | 6 +-
libavformat/vc1test.c | 20 +-
libavformat/vocdec.c | 24 +-
libavformat/vqf.c | 16 +-
libavformat/wav.c | 32 ++--
libavformat/wc3movie.c | 20 +-
libavformat/westwood.c | 12 +-
libavformat/wtv.c | 56 +++---
libavformat/wv.c | 50 +++---
libavformat/xa.c | 12 +-
libavformat/yop.c | 14 +-
libavformat/yuv4mpeg.c | 4 +-
108 files changed, 1817 insertions(+), 1779 deletions(-)
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 6f737e3..7c32f10 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -54,11 +54,11 @@
#define strk_SIZE 0x28
#define GET_LIST_HEADER() \
- fourcc_tag = get_le32(pb); \
- size = get_le32(pb); \
+ fourcc_tag = avio_get_le32(pb); \
+ size = avio_get_le32(pb); \
if (fourcc_tag != LIST_TAG) \
return AVERROR_INVALIDDATA; \
- fourcc_tag = get_le32(pb);
+ fourcc_tag = avio_get_le32(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_get_buffer(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_get_buffer(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_get_le32(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_get_buffer(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_get_le32(pb);
+ out_size= avio_get_le32(pb);
size-=8;
if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
diff --git a/libavformat/aea.c b/libavformat/aea.c
index 6816506..c0360f3 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -62,7 +62,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_get_byte(s->pb);
url_fskip(s->pb, 1783);
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index b841023..0aa432b 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -54,8 +54,8 @@ static int get_tag(ByteIOContext *pb, uint32_t * tag)
if (url_feof(pb))
return AVERROR(EIO);
- *tag = get_le32(pb);
- size = get_be32(pb);
+ *tag = avio_get_le32(pb);
+ size = avio_get_be32(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_get_buffer(s->pb, str, size);
if (res < 0)
return;
@@ -93,18 +93,18 @@ static unsigned int get_aiff_header(ByteIOContext *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_get_be16(pb);
+ num_frames = avio_get_be32(pb);
+ codec->bits_per_coded_sample = avio_get_be16(pb);
- get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
+ avio_get_buffer(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_get_le32(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_get_le32(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_get_be32(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_get_be32(pb); /* Offset of sound data */
+ avio_get_be32(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_get_buffer(pb, st->codec->extradata, size);
break;
default: /* Jump */
if (size & 1) /* Always even aligned */
diff --git a/libavformat/amr.c b/libavformat/amr.c
index 400b5f3..860e315 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -82,7 +82,7 @@ static int amr_read_header(AVFormatContext *s,
AVStream *st;
uint8_t header[9];
- get_buffer(pb, header, 6);
+ avio_get_buffer(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_get_buffer(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_get_byte(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_get_buffer(s->pb, pkt->data+1, size-1);
if (read != size-1)
{
diff --git a/libavformat/anm.c b/libavformat/anm.c
index dbe1b68..6e4e2b6 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -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_get_le16(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_get_le16(pb);
+ anm->nb_records = avio_get_le32(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_get_le16(pb);
+ if (avio_get_le32(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_get_le16(pb);
+ st->codec->height = avio_get_le16(pb);
+ if (avio_get_byte(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_get_byte(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_get_byte(pb) != 0)
goto invalid;
- if (get_byte(pb) != 1)
+ if (avio_get_byte(pb) != 1)
goto invalid;
url_fskip(pb, 1); /* other recs per frame */
- if (get_byte(pb) != 1)
+ if (avio_get_byte(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_get_le32(pb);
+ av_set_pts_info(st, 64, 1, avio_get_le16(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_get_buffer(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_get_le16(pb);
+ p->nb_records = avio_get_le16(pb);
+ p->size = avio_get_le16(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_get_le16(pb);
url_fseek(pb, tmp, SEEK_SET);
/* fetch record */
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 942a4cf..20f931c 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -35,9 +35,9 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
ByteIOContext *pb = s->pb;
AVStream *st;
- get_le32(pb); /* CRYO */
- get_le32(pb); /* _APC */
- get_le32(pb); /* 1.20 */
+ avio_get_le32(pb); /* CRYO */
+ avio_get_le32(pb); /* _APC */
+ avio_get_le32(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_get_le32(pb); /* number of samples */
+ st->codec->sample_rate = avio_get_le32(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_get_buffer(pb, st->codec->extradata, 2 * 4);
st->codec->channels = 1;
- if (get_le32(pb))
+ if (avio_get_le32(pb))
st->codec->channels = 2;
st->codec->bits_per_coded_sample = 4;
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 327e1a9..d73c664 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -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_get_le32(pb);
if (tag != MKTAG('M', 'A', 'C', ' '))
return -1;
- ape->fileversion = get_le16(pb);
+ ape->fileversion = avio_get_le16(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_get_le16(pb);
+ ape->descriptorlength = avio_get_le32(pb);
+ ape->headerlength = avio_get_le32(pb);
+ ape->seektablelength = avio_get_le32(pb);
+ ape->wavheaderlength = avio_get_le32(pb);
+ ape->audiodatalength = avio_get_le32(pb);
+ ape->audiodatalength_high = avio_get_le32(pb);
+ ape->wavtaillength = avio_get_le32(pb);
+ avio_get_buffer(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_get_le16(pb);
+ ape->formatflags = avio_get_le16(pb);
+ ape->blocksperframe = avio_get_le32(pb);
+ ape->finalframeblocks = avio_get_le32(pb);
+ ape->totalframes = avio_get_le32(pb);
+ ape->bps = avio_get_le16(pb);
+ ape->channels = avio_get_le16(pb);
+ ape->samplerate = avio_get_le32(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_get_le16(pb);
+ ape->formatflags = avio_get_le16(pb);
+ ape->channels = avio_get_le16(pb);
+ ape->samplerate = avio_get_le32(pb);
+ ape->wavheaderlength = avio_get_le32(pb);
+ ape->wavtaillength = avio_get_le32(pb);
+ ape->totalframes = avio_get_le32(pb);
+ ape->finalframeblocks = avio_get_le32(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_get_le32(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_get_le32(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_get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
pkt->pts = ape->frames[ape->currentframe].pts;
pkt->stream_index = 0;
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index d30c132..1676e2a 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -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_get_le32(pb); /* field size */
+ flags = avio_get_le32(pb); /* field flags */
for (i = 0; i < sizeof(key) - 1; i++) {
- c = get_byte(pb);
+ c = avio_get_byte(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_get_buffer(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_get_buffer(pb, buf, 8); /* APETAGEX */
if (strncmp(buf, "APETAGEX", 8)) {
return;
}
- val = get_le32(pb); /* APE tag version */
+ val = avio_get_le32(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_get_le32(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_get_le32(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_get_le32(pb); /* flags */
if (val & APE_TAG_FLAG_IS_HEADER) {
av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
return;
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 35e892c..14121f6 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -100,7 +100,7 @@ static void print_guid(const ff_asf_guid *g)
void ff_get_guid(ByteIOContext *s, ff_asf_guid *g)
{
assert(sizeof(*g) == 16);
- get_buffer(s, *g, sizeof(*g));
+ avio_get_buffer(s, *g, sizeof(*g));
}
static int asf_probe(AVProbeData *pd)
@@ -114,10 +114,10 @@ static int asf_probe(AVProbeData *pd)
static int get_value(ByteIOContext *pb, int type){
switch(type){
- case 2: return get_le32(pb);
- case 3: return get_le32(pb);
- case 4: return get_le64(pb);
- case 5: return get_le16(pb);
+ case 2: return avio_get_le32(pb);
+ case 3: return avio_get_le32(pb);
+ case 4: return avio_get_le64(pb);
+ case 5: return avio_get_le16(pb);
default:return INT_MIN;
}
}
@@ -167,16 +167,16 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
ff_get_guid(pb, &g);
if (ff_guidcmp(&g, &ff_asf_header))
return -1;
- get_le64(pb);
- get_le32(pb);
- get_byte(pb);
- get_byte(pb);
+ avio_get_le64(pb);
+ avio_get_le32(pb);
+ avio_get_byte(pb);
+ avio_get_byte(pb);
memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
for(;;) {
uint64_t gpos= url_ftell(pb);
int ret;
ff_get_guid(pb, &g);
- gsize = get_le64(pb);
+ gsize = avio_get_le64(pb);
av_dlog(s, "%08"PRIx64": ", gpos);
print_guid(&g);
av_dlog(s, " size=0x%"PRIx64"\n", gsize);
@@ -194,17 +194,17 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
if (!ff_guidcmp(&g, &ff_asf_file_header)) {
ff_get_guid(pb, &asf->hdr.guid);
- asf->hdr.file_size = get_le64(pb);
- asf->hdr.create_time = get_le64(pb);
- asf->nb_packets = get_le64(pb);
- asf->hdr.play_time = get_le64(pb);
- asf->hdr.send_time = get_le64(pb);
- asf->hdr.preroll = get_le32(pb);
- asf->hdr.ignore = get_le32(pb);
- asf->hdr.flags = get_le32(pb);
- asf->hdr.min_pktsize = get_le32(pb);
- asf->hdr.max_pktsize = get_le32(pb);
- asf->hdr.max_bitrate = get_le32(pb);
+ asf->hdr.file_size = avio_get_le64(pb);
+ asf->hdr.create_time = avio_get_le64(pb);
+ asf->nb_packets = avio_get_le64(pb);
+ asf->hdr.play_time = avio_get_le64(pb);
+ asf->hdr.send_time = avio_get_le64(pb);
+ asf->hdr.preroll = avio_get_le32(pb);
+ asf->hdr.ignore = avio_get_le32(pb);
+ asf->hdr.flags = avio_get_le32(pb);
+ asf->hdr.min_pktsize = avio_get_le32(pb);
+ asf->hdr.max_pktsize = avio_get_le32(pb);
+ asf->hdr.max_bitrate = avio_get_le32(pb);
s->packet_size = asf->hdr.max_pktsize;
} else if (!ff_guidcmp(&g, &ff_asf_stream_header)) {
enum AVMediaType type;
@@ -256,14 +256,14 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
ff_get_guid(pb, &g);
- total_size = get_le64(pb);
- type_specific_size = get_le32(pb);
- get_le32(pb);
- st->id = get_le16(pb) & 0x7f; /* stream id */
+ total_size = avio_get_le64(pb);
+ type_specific_size = avio_get_le32(pb);
+ avio_get_le32(pb);
+ st->id = avio_get_le16(pb) & 0x7f; /* stream id */
// mapping of asf ID to AV stream ID;
asf->asfid2avid[st->id] = s->nb_streams - 1;
- get_le32(pb);
+ avio_get_le32(pb);
if (test_for_ext_stream_audio) {
ff_get_guid(pb, &g);
@@ -271,11 +271,11 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
type = AVMEDIA_TYPE_AUDIO;
is_dvr_ms_audio=1;
ff_get_guid(pb, &g);
- get_le32(pb);
- get_le32(pb);
- get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
ff_get_guid(pb, &g);
- get_le32(pb);
+ avio_get_le32(pb);
}
}
@@ -296,11 +296,11 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* We have to init the frame size at some point .... */
pos2 = url_ftell(pb);
if (gsize >= (pos2 + 8 - pos1 + 24)) {
- asf_st->ds_span = get_byte(pb);
- asf_st->ds_packet_size = get_le16(pb);
- asf_st->ds_chunk_size = get_le16(pb);
- get_le16(pb); //ds_data_size
- get_byte(pb); //ds_silence_data
+ asf_st->ds_span = avio_get_byte(pb);
+ asf_st->ds_packet_size = avio_get_le16(pb);
+ asf_st->ds_chunk_size = avio_get_le16(pb);
+ avio_get_le16(pb); //ds_data_size
+ avio_get_byte(pb); //ds_silence_data
}
//printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n",
// asf_st->ds_packet_size, asf_st->ds_chunk_size,
@@ -332,24 +332,24 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
} else if (type == AVMEDIA_TYPE_VIDEO &&
gsize - (url_ftell(pb) - pos1 + 24) >= 51) {
- get_le32(pb);
- get_le32(pb);
- get_byte(pb);
- size = get_le16(pb); /* size */
- sizeX= get_le32(pb); /* size */
- st->codec->width = get_le32(pb);
- st->codec->height = get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_byte(pb);
+ size = avio_get_le16(pb); /* size */
+ sizeX= avio_get_le32(pb); /* size */
+ st->codec->width = avio_get_le32(pb);
+ st->codec->height = avio_get_le32(pb);
/* not available for asf */
- get_le16(pb); /* panes */
- st->codec->bits_per_coded_sample = get_le16(pb); /* depth */
- tag1 = get_le32(pb);
+ avio_get_le16(pb); /* panes */
+ st->codec->bits_per_coded_sample = avio_get_le16(pb); /* depth */
+ tag1 = avio_get_le32(pb);
url_fskip(pb, 20);
// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
size= sizeX;
if (size > 40) {
st->codec->extradata_size = size - 40;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
+ avio_get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
}
/* Extract palette from extradata if bpp <= 8 */
@@ -385,18 +385,18 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
} else if (!ff_guidcmp(&g, &ff_asf_comment_header)) {
int len1, len2, len3, len4, len5;
- len1 = get_le16(pb);
- len2 = get_le16(pb);
- len3 = get_le16(pb);
- len4 = get_le16(pb);
- len5 = get_le16(pb);
+ len1 = avio_get_le16(pb);
+ len2 = avio_get_le16(pb);
+ len3 = avio_get_le16(pb);
+ len4 = avio_get_le16(pb);
+ len5 = avio_get_le16(pb);
get_tag(s, "title" , 0, len1);
get_tag(s, "author" , 0, len2);
get_tag(s, "copyright", 0, len3);
get_tag(s, "comment" , 0, len4);
url_fskip(pb, len5);
} else if (!ff_guidcmp(&g, &stream_bitrate_guid)) {
- int stream_count = get_le16(pb);
+ int stream_count = avio_get_le16(pb);
int j;
// av_log(s, AV_LOG_ERROR, "stream bitrate properties\n");
@@ -404,18 +404,18 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(j = 0; j < stream_count; j++) {
int flags, bitrate, stream_id;
- flags= get_le16(pb);
- bitrate= get_le32(pb);
+ flags= avio_get_le16(pb);
+ bitrate= avio_get_le32(pb);
stream_id= (flags & 0x7f);
// av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate);
asf->stream_bitrates[stream_id]= bitrate;
}
} else if (!ff_guidcmp(&g, &ff_asf_language_guid)) {
int j;
- int stream_count = get_le16(pb);
+ int stream_count = avio_get_le16(pb);
for(j = 0; j < stream_count; j++) {
char lang[6];
- unsigned int lang_len = get_byte(pb);
+ unsigned int lang_len = avio_get_byte(pb);
if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len)
url_fskip(pb, lang_len - ret);
if (j < 128)
@@ -424,18 +424,18 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
} else if (!ff_guidcmp(&g, &ff_asf_extended_content_header)) {
int desc_count, i;
- desc_count = get_le16(pb);
+ desc_count = avio_get_le16(pb);
for(i=0;i<desc_count;i++) {
int name_len,value_type,value_len;
char name[1024];
- name_len = get_le16(pb);
+ name_len = avio_get_le16(pb);
if (name_len%2) // must be even, broken lavf versions wrote len-1
name_len += 1;
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
url_fskip(pb, name_len - ret);
- value_type = get_le16(pb);
- value_len = get_le16(pb);
+ value_type = avio_get_le16(pb);
+ value_len = avio_get_le16(pb);
if (!value_type && value_len%2)
value_len += 1;
/**
@@ -451,21 +451,21 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
} else if (!ff_guidcmp(&g, &ff_asf_metadata_header)) {
int n, stream_num, name_len, value_len, value_type, value_num;
- n = get_le16(pb);
+ n = avio_get_le16(pb);
for(i=0;i<n;i++) {
char name[1024];
- get_le16(pb); //lang_list_index
- stream_num= get_le16(pb);
- name_len= get_le16(pb);
- value_type= get_le16(pb);
- value_len= get_le32(pb);
+ avio_get_le16(pb); //lang_list_index
+ stream_num= avio_get_le16(pb);
+ name_len= avio_get_le16(pb);
+ value_type= avio_get_le16(pb);
+ value_len= avio_get_le32(pb);
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
url_fskip(pb, name_len - ret);
//av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
- value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
+ value_num= avio_get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
url_fskip(pb, value_len - 2);
if(stream_num<128){
@@ -478,39 +478,39 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
uint32_t ext_d, leak_rate, stream_num;
unsigned int stream_languageid_index;
- get_le64(pb); // starttime
- get_le64(pb); // endtime
- leak_rate = get_le32(pb); // leak-datarate
- get_le32(pb); // bucket-datasize
- get_le32(pb); // init-bucket-fullness
- get_le32(pb); // alt-leak-datarate
- get_le32(pb); // alt-bucket-datasize
- get_le32(pb); // alt-init-bucket-fullness
- get_le32(pb); // max-object-size
- get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
- stream_num = get_le16(pb); // stream-num
-
- stream_languageid_index = get_le16(pb); // stream-language-id-index
+ avio_get_le64(pb); // starttime
+ avio_get_le64(pb); // endtime
+ leak_rate = avio_get_le32(pb); // leak-datarate
+ avio_get_le32(pb); // bucket-datasize
+ avio_get_le32(pb); // init-bucket-fullness
+ avio_get_le32(pb); // alt-leak-datarate
+ avio_get_le32(pb); // alt-bucket-datasize
+ avio_get_le32(pb); // alt-init-bucket-fullness
+ avio_get_le32(pb); // max-object-size
+ avio_get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
+ stream_num = avio_get_le16(pb); // stream-num
+
+ stream_languageid_index = avio_get_le16(pb); // stream-language-id-index
if (stream_num < 128)
asf->streams[stream_num].stream_language_index = stream_languageid_index;
- get_le64(pb); // avg frametime in 100ns units
- stream_ct = get_le16(pb); //stream-name-count
- payload_ext_ct = get_le16(pb); //payload-extension-system-count
+ avio_get_le64(pb); // avg frametime in 100ns units
+ stream_ct = avio_get_le16(pb); //stream-name-count
+ payload_ext_ct = avio_get_le16(pb); //payload-extension-system-count
if (stream_num < 128)
bitrate[stream_num] = leak_rate;
for (i=0; i<stream_ct; i++){
- get_le16(pb);
- ext_len = get_le16(pb);
+ avio_get_le16(pb);
+ ext_len = avio_get_le16(pb);
url_fseek(pb, ext_len, SEEK_CUR);
}
for (i=0; i<payload_ext_ct; i++){
ff_get_guid(pb, &g);
- ext_d=get_le16(pb);
- ext_len=get_le32(pb);
+ ext_d=avio_get_le16(pb);
+ ext_len=avio_get_le32(pb);
url_fseek(pb, ext_len, SEEK_CUR);
}
@@ -520,32 +520,32 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
} else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) {
int v1, v2;
ff_get_guid(pb, &g);
- v1 = get_le32(pb);
- v2 = get_le16(pb);
+ v1 = avio_get_le32(pb);
+ v2 = avio_get_le16(pb);
continue;
} else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
int i, count, name_len;
char name[1024];
- get_le64(pb); // reserved 16 bytes
- get_le64(pb); // ...
- count = get_le32(pb); // markers count
- get_le16(pb); // reserved 2 bytes
- name_len = get_le16(pb); // name length
+ avio_get_le64(pb); // reserved 16 bytes
+ avio_get_le64(pb); // ...
+ count = avio_get_le32(pb); // markers count
+ avio_get_le16(pb); // reserved 2 bytes
+ name_len = avio_get_le16(pb); // name length
for(i=0;i<name_len;i++){
- get_byte(pb); // skip the name
+ avio_get_byte(pb); // skip the name
}
for(i=0;i<count;i++){
int64_t pres_time;
int name_len;
- get_le64(pb); // offset, 8 bytes
- pres_time = get_le64(pb); // presentation time
- get_le16(pb); // entry length
- get_le32(pb); // send time
- get_le32(pb); // flags
- name_len = get_le32(pb); // name length
+ avio_get_le64(pb); // offset, 8 bytes
+ pres_time = avio_get_le64(pb); // presentation time
+ avio_get_le16(pb); // entry length
+ avio_get_le32(pb); // send time
+ avio_get_le32(pb); // flags
+ name_len = avio_get_le32(pb); // name length
if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)
url_fskip(pb, name_len - ret);
ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
@@ -568,9 +568,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
url_fseek(pb, gpos + gsize, SEEK_SET);
}
ff_get_guid(pb, &g);
- get_le64(pb);
- get_byte(pb);
- get_byte(pb);
+ avio_get_le64(pb);
+ avio_get_byte(pb);
+ avio_get_byte(pb);
if (url_feof(pb))
return -1;
asf->data_offset = url_ftell(pb);
@@ -615,9 +615,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
#define DO_2BITS(bits, var, defval) \
switch (bits & 3) \
{ \
- case 3: var = get_le32(pb); rsize += 4; break; \
- case 2: var = get_le16(pb); rsize += 2; break; \
- case 1: var = get_byte(pb); rsize++; break; \
+ case 3: var = avio_get_le32(pb); rsize += 4; break; \
+ case 2: var = avio_get_le16(pb); rsize += 2; break; \
+ case 1: var = avio_get_byte(pb); rsize++; break; \
default: var = defval; break; \
}
@@ -642,7 +642,7 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
c=d=e=-1;
while(off-- > 0){
c=d; d=e;
- e= get_byte(pb);
+ e= avio_get_byte(pb);
if(c == 0x82 && !d && !e)
break;
}
@@ -665,8 +665,8 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
return -1;
}
- c= get_byte(pb);
- d= get_byte(pb);
+ c= avio_get_byte(pb);
+ d= avio_get_byte(pb);
rsize+=3;
}else{
url_fseek(pb, -1, SEEK_CUR); //FIXME
@@ -689,12 +689,12 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
return -1;
}
- asf->packet_timestamp = get_le32(pb);
- get_le16(pb); /* duration */
+ asf->packet_timestamp = avio_get_le32(pb);
+ avio_get_le16(pb); /* duration */
// rsize has at least 11 bytes which have to be present
if (asf->packet_flags & 0x01) {
- asf->packet_segsizetype = get_byte(pb); rsize++;
+ asf->packet_segsizetype = avio_get_byte(pb); rsize++;
asf->packet_segments = asf->packet_segsizetype & 0x3f;
} else {
asf->packet_segments = 1;
@@ -715,7 +715,7 @@ static int ff_asf_get_packet(AVFormatContext *s, ByteIOContext *pb)
static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
ASFContext *asf = s->priv_data;
int rsize = 1;
- int num = get_byte(pb);
+ int num = avio_get_byte(pb);
int64_t ts0, ts1;
asf->packet_segments--;
@@ -727,21 +727,21 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
//printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size);
if (asf->packet_replic_size >= 8) {
- asf->packet_obj_size = get_le32(pb);
+ asf->packet_obj_size = avio_get_le32(pb);
if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){
av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n");
return -1;
}
- asf->packet_frag_timestamp = get_le32(pb); // timestamp
+ asf->packet_frag_timestamp = avio_get_le32(pb); // timestamp
if(asf->packet_replic_size >= 8+38+4){
// for(i=0; i<asf->packet_replic_size-8; i++)
-// av_log(s, AV_LOG_DEBUG, "%02X ",get_byte(pb));
+// av_log(s, AV_LOG_DEBUG, "%02X ",avio_get_byte(pb));
// av_log(s, AV_LOG_DEBUG, "\n");
url_fskip(pb, 10);
- ts0= get_le64(pb);
- ts1= get_le64(pb);
+ ts0= avio_get_le64(pb);
+ ts1= avio_get_le64(pb);
url_fskip(pb, 12);
- get_le32(pb);
+ avio_get_le32(pb);
url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4);
if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
else asf->packet_frag_timestamp= AV_NOPTS_VALUE;
@@ -754,7 +754,7 @@ static int asf_read_frame_header(AVFormatContext *s, ByteIOContext *pb){
asf->packet_frag_offset = 0;
asf->packet_frag_timestamp = asf->packet_timestamp;
- asf->packet_time_delta = get_byte(pb);
+ asf->packet_time_delta = avio_get_byte(pb);
rsize++;
}else if(asf->packet_replic_size!=0){
av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size);
@@ -839,7 +839,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *
// frag_offset is here used as the beginning timestamp
asf->packet_frag_timestamp = asf->packet_time_start;
asf->packet_time_start += asf->packet_time_delta;
- asf->packet_obj_size = asf->packet_frag_size = get_byte(pb);
+ asf->packet_obj_size = asf->packet_frag_size = avio_get_byte(pb);
asf->packet_size_left--;
asf->packet_multi_size--;
if (asf->packet_multi_size < asf->packet_obj_size)
@@ -899,7 +899,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, ByteIOContext *pb, AVPacket *
continue;
}
- ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
+ ret = avio_get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
asf->packet_frag_size);
if (ret != asf->packet_frag_size) {
if (ret < 0 || asf->packet_frag_offset + ret == 0)
@@ -1106,7 +1106,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
/* the data object can be followed by other top-level objects,
skip them until the simple index object is reached */
while (ff_guidcmp(&g, &index_guid)) {
- int64_t gsize= get_le64(s->pb);
+ int64_t gsize= avio_get_le64(s->pb);
if (gsize < 24 || url_feof(s->pb)) {
url_fseek(s->pb, current_pos, SEEK_SET);
return;
@@ -1118,16 +1118,16 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
{
int64_t itime, last_pos=-1;
int pct, ict;
- int64_t av_unused gsize= get_le64(s->pb);
+ int64_t av_unused gsize= avio_get_le64(s->pb);
ff_get_guid(s->pb, &g);
- itime=get_le64(s->pb);
- pct=get_le32(s->pb);
- ict=get_le32(s->pb);
+ itime=avio_get_le64(s->pb);
+ pct=avio_get_le32(s->pb);
+ ict=avio_get_le32(s->pb);
av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);
for (i=0;i<ict;i++){
- int pktnum=get_le32(s->pb);
- int pktct =get_le16(s->pb);
+ int pktnum=avio_get_le32(s->pb);
+ int pktct =avio_get_le16(s->pb);
int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum;
int64_t index_pts= av_rescale(itime, i, 10000);
diff --git a/libavformat/au.c b/libavformat/au.c
index cb1b93b..d3f7229 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -127,15 +127,15 @@ static int au_read_header(AVFormatContext *s,
AVStream *st;
/* check ".snd" header */
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
if (tag != MKTAG('.', 's', 'n', 'd'))
return -1;
- size = get_be32(pb); /* header size */
- get_be32(pb); /* data size */
+ size = avio_get_be32(pb); /* header size */
+ avio_get_be32(pb); /* data size */
- id = get_be32(pb);
- rate = get_be32(pb);
- channels = get_be32(pb);
+ id = avio_get_be32(pb);
+ rate = avio_get_be32(pb);
+ channels = avio_get_be32(pb);
codec = ff_codec_get_id(codec_au_tags, id);
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 27a9d1f..7109247 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -108,10 +108,10 @@ static int get_riff(AVFormatContext *s, ByteIOContext *pb)
int i;
/* check RIFF header */
- get_buffer(pb, header, 4);
- avi->riff_end = get_le32(pb); /* RIFF chunk size */
+ avio_get_buffer(pb, header, 4);
+ avi->riff_end = avio_get_le32(pb); /* RIFF chunk size */
avi->riff_end += url_ftell(pb); /* RIFF chunk end */
- get_buffer(pb, header+4, 4);
+ avio_get_buffer(pb, header+4, 4);
for(i=0; avi_headers[i][0]; i++)
if(!memcmp(header, avi_headers[i], 8))
@@ -128,12 +128,12 @@ static int get_riff(AVFormatContext *s, ByteIOContext *pb)
static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
AVIContext *avi = s->priv_data;
ByteIOContext *pb = s->pb;
- int longs_pre_entry= get_le16(pb);
- int index_sub_type = get_byte(pb);
- int index_type = get_byte(pb);
- int entries_in_use = get_le32(pb);
- int chunk_id = get_le32(pb);
- int64_t base = get_le64(pb);
+ int longs_pre_entry= avio_get_le16(pb);
+ int index_sub_type = avio_get_byte(pb);
+ int index_type = avio_get_byte(pb);
+ int entries_in_use = avio_get_le32(pb);
+ int chunk_id = avio_get_le32(pb);
+ int64_t base = avio_get_le64(pb);
int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0');
AVStream *st;
AVIStream *ast;
@@ -154,7 +154,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
if(index_sub_type)
return -1;
- get_le32(pb);
+ avio_get_le32(pb);
if(index_type && longs_pre_entry != 2)
return -1;
@@ -171,8 +171,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
for(i=0; i<entries_in_use; i++){
if(index_type){
- int64_t pos= get_le32(pb) + base - 8;
- int len = get_le32(pb);
+ int64_t pos= avio_get_le32(pb) + base - 8;
+ int len = avio_get_le32(pb);
int key= len >= 0;
len &= 0x7FFFFFFF;
@@ -192,9 +192,9 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
}else{
int64_t offset, pos;
int duration;
- offset = get_le64(pb);
- get_le32(pb); /* size */
- duration = get_le32(pb);
+ offset = avio_get_le64(pb);
+ avio_get_le32(pb); /* size */
+ duration = avio_get_le32(pb);
if(url_feof(pb))
return -1;
@@ -257,7 +257,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t
value = av_malloc(size+1);
if (!value)
return -1;
- get_buffer(pb, value, size);
+ avio_get_buffer(pb, value, size);
value[size]=0;
AV_WL32(key, tag);
@@ -269,8 +269,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t
static void avi_read_info(AVFormatContext *s, uint64_t end)
{
while (url_ftell(s->pb) < end) {
- uint32_t tag = get_le32(s->pb);
- uint32_t size = get_le32(s->pb);
+ uint32_t tag = avio_get_le32(s->pb);
+ uint32_t size = avio_get_le32(s->pb);
avi_read_tag(s, NULL, tag, size);
}
}
@@ -300,17 +300,17 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date)
static void avi_read_nikon(AVFormatContext *s, uint64_t end)
{
while (url_ftell(s->pb) < end) {
- uint32_t tag = get_le32(s->pb);
- uint32_t size = get_le32(s->pb);
+ uint32_t tag = avio_get_le32(s->pb);
+ uint32_t size = avio_get_le32(s->pb);
switch (tag) {
case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */
uint64_t tag_end = url_ftell(s->pb) + size;
while (url_ftell(s->pb) < tag_end) {
- uint16_t tag = get_le16(s->pb);
- uint16_t size = get_le16(s->pb);
+ uint16_t tag = avio_get_le16(s->pb);
+ uint16_t size = avio_get_le16(s->pb);
const char *name = NULL;
char buffer[64] = {0};
- size -= get_buffer(s->pb, buffer,
+ size -= avio_get_buffer(s->pb, buffer,
FFMIN(size, sizeof(buffer)-1));
switch (tag) {
case 0x03: name = "maker"; break;
@@ -363,8 +363,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
for(;;) {
if (url_feof(pb))
goto fail;
- tag = get_le32(pb);
- size = get_le32(pb);
+ tag = avio_get_le32(pb);
+ size = avio_get_le32(pb);
print_tag("tag", tag, size);
@@ -372,7 +372,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
case MKTAG('L', 'I', 'S', 'T'):
list_end = url_ftell(pb) + size;
/* Ignored, except at start of video packets. */
- tag1 = get_le32(pb);
+ tag1 = avio_get_le32(pb);
print_tag("list", tag1, 0);
@@ -392,7 +392,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
case MKTAG('I', 'D', 'I', 'T'): {
unsigned char date[64] = {0};
size += (size & 1);
- size -= get_buffer(pb, date, FFMIN(size, sizeof(date)-1));
+ size -= avio_get_buffer(pb, date, FFMIN(size, sizeof(date)-1));
url_fskip(pb, size);
avi_metadata_creation_time(&s->metadata, date);
break;
@@ -406,24 +406,24 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
case MKTAG('a', 'v', 'i', 'h'):
/* AVI header */
/* using frame_period is bad idea */
- frame_period = get_le32(pb);
- bit_rate = get_le32(pb) * 8;
- get_le32(pb);
- avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX;
+ frame_period = avio_get_le32(pb);
+ bit_rate = avio_get_le32(pb) * 8;
+ avio_get_le32(pb);
+ avi->non_interleaved |= avio_get_le32(pb) & AVIF_MUSTUSEINDEX;
url_fskip(pb, 2 * 4);
- get_le32(pb);
- get_le32(pb);
- avih_width=get_le32(pb);
- avih_height=get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ avih_width=avio_get_le32(pb);
+ avih_height=avio_get_le32(pb);
url_fskip(pb, size - 10 * 4);
break;
case MKTAG('s', 't', 'r', 'h'):
/* stream header */
- tag1 = get_le32(pb);
- handler = get_le32(pb); /* codec tag */
+ tag1 = avio_get_le32(pb);
+ handler = avio_get_le32(pb); /* codec tag */
if(tag1 == MKTAG('p', 'a', 'd', 's')){
url_fskip(pb, size - 8);
@@ -471,11 +471,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
s->streams[0]->priv_data = ast;
url_fskip(pb, 3 * 4);
- ast->scale = get_le32(pb);
- ast->rate = get_le32(pb);
+ ast->scale = avio_get_le32(pb);
+ ast->rate = avio_get_le32(pb);
url_fskip(pb, 4); /* start time */
- dv_dur = get_le32(pb);
+ dv_dur = avio_get_le32(pb);
if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
dv_dur *= AV_TIME_BASE;
s->duration = av_rescale(dv_dur, ast->scale, ast->rate);
@@ -493,12 +493,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
assert(stream_index < s->nb_streams);
st->codec->stream_codec_tag= handler;
- get_le32(pb); /* flags */
- get_le16(pb); /* priority */
- get_le16(pb); /* language */
- get_le32(pb); /* initial frame */
- ast->scale = get_le32(pb);
- ast->rate = get_le32(pb);
+ avio_get_le32(pb); /* flags */
+ avio_get_le16(pb); /* priority */
+ avio_get_le16(pb); /* language */
+ avio_get_le32(pb); /* initial frame */
+ ast->scale = avio_get_le32(pb);
+ ast->rate = avio_get_le32(pb);
if(!(ast->scale && ast->rate)){
av_log(s, AV_LOG_WARNING, "scale/rate is %u/%u which is invalid. (This file has been generated by broken software.)\n", ast->scale, ast->rate);
if(frame_period){
@@ -511,13 +511,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
av_set_pts_info(st, 64, ast->scale, ast->rate);
- ast->cum_len=get_le32(pb); /* start */
- st->nb_frames = get_le32(pb);
+ ast->cum_len=avio_get_le32(pb); /* start */
+ st->nb_frames = avio_get_le32(pb);
st->start_time = 0;
- get_le32(pb); /* buffer size */
- get_le32(pb); /* quality */
- ast->sample_size = get_le32(pb); /* sample ssize */
+ avio_get_le32(pb); /* buffer size */
+ avio_get_le32(pb); /* quality */
+ ast->sample_size = avio_get_le32(pb); /* sample ssize */
ast->cum_len *= FFMAX(1, ast->sample_size);
// av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
@@ -580,11 +580,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata_size= 0;
return AVERROR(ENOMEM);
}
- get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
+ avio_get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
}
if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly
- get_byte(pb);
+ avio_get_byte(pb);
/* Extract palette from extradata if bpp <= 8. */
/* This code assumes that extradata contains only palette. */
@@ -676,17 +676,17 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVRational active, active_aspect;
st = s->streams[stream_index];
- get_le32(pb);
- get_le32(pb);
- get_le32(pb);
- get_le32(pb);
- get_le32(pb);
-
- active_aspect.den= get_le16(pb);
- active_aspect.num= get_le16(pb);
- active.num = get_le32(pb);
- active.den = get_le32(pb);
- get_le32(pb); //nbFieldsPerFrame
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+
+ active_aspect.den= avio_get_le16(pb);
+ active_aspect.num= avio_get_le16(pb);
+ active.num = avio_get_le32(pb);
+ active.den = avio_get_le32(pb);
+ avio_get_le32(pb); //nbFieldsPerFrame
if(active_aspect.num && active_aspect.den && active.num && active.den){
st->sample_aspect_ratio= av_div_q(active_aspect, active);
@@ -1000,7 +1000,7 @@ resync:
for(j=0; j<7; j++)
d[j]= d[j+1];
- d[7]= get_byte(pb);
+ d[7]= avio_get_byte(pb);
size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
@@ -1071,13 +1071,13 @@ resync:
}
if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) {
- int k = get_byte(pb);
- int last = (k + get_byte(pb) - 1) & 0xFF;
+ int k = avio_get_byte(pb);
+ int last = (k + avio_get_byte(pb) - 1) & 0xFF;
- get_le16(pb); //flags
+ avio_get_le16(pb); //flags
for (; k <= last; k++)
- ast->pal[k] = get_be32(pb)>>8;// b + (g << 8) + (r << 16);
+ ast->pal[k] = avio_get_be32(pb)>>8;// b + (g << 8) + (r << 16);
ast->has_pal= 1;
goto resync;
} else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) ||
@@ -1129,10 +1129,10 @@ static int avi_read_idx1(AVFormatContext *s, int size)
/* Read the entries and sort them in each stream component. */
for(i = 0; i < nb_index_entries; i++) {
- tag = get_le32(pb);
- flags = get_le32(pb);
- pos = get_le32(pb);
- len = get_le32(pb);
+ tag = avio_get_le32(pb);
+ flags = avio_get_le32(pb);
+ pos = avio_get_le32(pb);
+ len = avio_get_le32(pb);
#if defined(DEBUG_SEEK)
av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
i, tag, flags, pos, len);
@@ -1181,7 +1181,7 @@ static int guess_ni_flag(AVFormatContext *s){
if(n >= 2){
int64_t pos= st->index_entries[0].pos;
url_fseek(s->pb, pos + 4, SEEK_SET);
- size= get_le32(s->pb);
+ size= avio_get_le32(s->pb);
if(pos + size > st->index_entries[1].pos)
last_start= INT64_MAX;
}
@@ -1211,8 +1211,8 @@ static int avi_load_index(AVFormatContext *s)
for(;;) {
if (url_feof(pb))
break;
- tag = get_le32(pb);
- size = get_le32(pb);
+ tag = avio_get_le32(pb);
+ size = avio_get_le32(pb);
#ifdef DEBUG_SEEK
printf("tag=%c%c%c%c size=0x%x\n",
tag & 0xff,
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 4ea493c..99acfe0 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -370,6 +370,18 @@ attribute_deprecated void put_be24(ByteIOContext *s, unsigned int val);
attribute_deprecated void put_le16(ByteIOContext *s, unsigned int val);
attribute_deprecated void put_be16(ByteIOContext *s, unsigned int val);
attribute_deprecated void put_tag(ByteIOContext *s, const char *tag);
+
+attribute_deprecated int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
+attribute_deprecated int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size);
+attribute_deprecated int get_byte(ByteIOContext *s);
+attribute_deprecated unsigned int get_le16(ByteIOContext *s);
+attribute_deprecated unsigned int get_le24(ByteIOContext *s);
+attribute_deprecated unsigned int get_le32(ByteIOContext *s);
+attribute_deprecated uint64_t get_le64(ByteIOContext *s);
+attribute_deprecated unsigned int get_be16(ByteIOContext *s);
+attribute_deprecated unsigned int get_be24(ByteIOContext *s);
+attribute_deprecated unsigned int get_be32(ByteIOContext *s);
+attribute_deprecated uint64_t get_be64(ByteIOContext *s);
#endif
void avio_put_byte( ByteIOContext *s, int b);
@@ -460,7 +472,7 @@ void put_flush_packet(ByteIOContext *s);
* Read size bytes from ByteIOContext into buf.
* @return number of bytes read or AVERROR
*/
-int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
+int avio_get_buffer(ByteIOContext *s, unsigned char *buf, int size);
/**
* Read size bytes from ByteIOContext into buf.
@@ -468,15 +480,15 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size);
* returned.
* @return number of bytes read or AVERROR
*/
-int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size);
+int avio_get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size);
/** @note return 0 if EOF, so you cannot use it if EOF handling is
necessary */
-int get_byte(ByteIOContext *s);
-unsigned int get_le24(ByteIOContext *s);
-unsigned int get_le32(ByteIOContext *s);
-uint64_t get_le64(ByteIOContext *s);
-unsigned int get_le16(ByteIOContext *s);
+int avio_get_byte(ByteIOContext *s);
+unsigned int avio_get_le24(ByteIOContext *s);
+unsigned int avio_get_le32(ByteIOContext *s);
+uint64_t avio_get_le64(ByteIOContext *s);
+unsigned int avio_get_le16(ByteIOContext *s);
/**
* Read a UTF-16 string from pb and convert it to UTF-8.
@@ -488,10 +500,10 @@ int avio_get_str16le(ByteIOContext *pb, int maxlen, char *buf, int buflen);
int avio_get_str16be(ByteIOContext *pb, int maxlen, char *buf, int buflen);
char *get_strz(ByteIOContext *s, char *buf, int maxlen);
-unsigned int get_be16(ByteIOContext *s);
-unsigned int get_be24(ByteIOContext *s);
-unsigned int get_be32(ByteIOContext *s);
-uint64_t get_be64(ByteIOContext *s);
+unsigned int avio_get_be16(ByteIOContext *s);
+unsigned int avio_get_be24(ByteIOContext *s);
+unsigned int avio_get_be32(ByteIOContext *s);
+uint64_t avio_get_be64(ByteIOContext *s);
uint64_t ff_get_v(ByteIOContext *bc);
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 8429032..ef763fb 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -298,6 +298,32 @@ void put_nbyte(ByteIOContext *s, int b, int count)
avio_put_nbyte(s, b, count);
}
+#define GET(name, type) \
+ type get_ ##name(ByteIOContext *s) \
+{\
+ return avio_get_ ##name(s);\
+}
+
+GET(byte, int)
+GET(le16, unsigned int)
+GET(le24, unsigned int)
+GET(le32, unsigned int)
+GET(le64, uint64_t)
+GET(be16, unsigned int)
+GET(be24, unsigned int)
+GET(be32, unsigned int)
+GET(be64, uint64_t)
+
+#undef GET
+
+int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
+{
+ return avio_get_buffer(s, buf, size);
+}
+int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
+{
+ return avio_get_partial_buffer(s, buf, size);
+}
#endif
int avio_put_str(ByteIOContext *s, const char *str)
@@ -457,7 +483,7 @@ void init_checksum(ByteIOContext *s,
}
/* XXX: put an inline version */
-int get_byte(ByteIOContext *s)
+int avio_get_byte(ByteIOContext *s)
{
if (s->buf_ptr >= s->buf_end)
fill_buffer(s);
@@ -475,7 +501,7 @@ int url_fgetc(ByteIOContext *s)
return URL_EOF;
}
-int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
+int avio_get_buffer(ByteIOContext *s, unsigned char *buf, int size)
{
int len, size1;
@@ -522,7 +548,7 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
return size1 - size;
}
-int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
+int avio_get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
{
int len;
@@ -545,58 +571,58 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
return len;
}
-unsigned int get_le16(ByteIOContext *s)
+unsigned int avio_get_le16(ByteIOContext *s)
{
unsigned int val;
- val = get_byte(s);
- val |= get_byte(s) << 8;
+ val = avio_get_byte(s);
+ val |= avio_get_byte(s) << 8;
return val;
}
-unsigned int get_le24(ByteIOContext *s)
+unsigned int avio_get_le24(ByteIOContext *s)
{
unsigned int val;
- val = get_le16(s);
- val |= get_byte(s) << 16;
+ val = avio_get_le16(s);
+ val |= avio_get_byte(s) << 16;
return val;
}
-unsigned int get_le32(ByteIOContext *s)
+unsigned int avio_get_le32(ByteIOContext *s)
{
unsigned int val;
- val = get_le16(s);
- val |= get_le16(s) << 16;
+ val = avio_get_le16(s);
+ val |= avio_get_le16(s) << 16;
return val;
}
-uint64_t get_le64(ByteIOContext *s)
+uint64_t avio_get_le64(ByteIOContext *s)
{
uint64_t val;
- val = (uint64_t)get_le32(s);
- val |= (uint64_t)get_le32(s) << 32;
+ val = (uint64_t)avio_get_le32(s);
+ val |= (uint64_t)avio_get_le32(s) << 32;
return val;
}
-unsigned int get_be16(ByteIOContext *s)
+unsigned int avio_get_be16(ByteIOContext *s)
{
unsigned int val;
- val = get_byte(s) << 8;
- val |= get_byte(s);
+ val = avio_get_byte(s) << 8;
+ val |= avio_get_byte(s);
return val;
}
-unsigned int get_be24(ByteIOContext *s)
+unsigned int avio_get_be24(ByteIOContext *s)
{
unsigned int val;
- val = get_be16(s) << 8;
- val |= get_byte(s);
+ val = avio_get_be16(s) << 8;
+ val |= avio_get_byte(s);
return val;
}
-unsigned int get_be32(ByteIOContext *s)
+unsigned int avio_get_be32(ByteIOContext *s)
{
unsigned int val;
- val = get_be16(s) << 16;
- val |= get_be16(s);
+ val = avio_get_be16(s) << 16;
+ val |= avio_get_be16(s);
return val;
}
@@ -605,7 +631,7 @@ char *get_strz(ByteIOContext *s, char *buf, int maxlen)
int i = 0;
char c;
- while ((c = get_byte(s))) {
+ while ((c = avio_get_byte(s))) {
if (i < maxlen-1)
buf[i++] = c;
}
@@ -621,7 +647,7 @@ int ff_get_line(ByteIOContext *s, char *buf, int maxlen)
char c;
do {
- c = get_byte(s);
+ c = avio_get_byte(s);
if (c && i < maxlen-1)
buf[i++] = c;
} while (c != '\n' && c);
@@ -652,11 +678,11 @@ GET_STR16(be, get_be16)
#undef GET_STR16
-uint64_t get_be64(ByteIOContext *s)
+uint64_t avio_get_be64(ByteIOContext *s)
{
uint64_t val;
- val = (uint64_t)get_be32(s) << 32;
- val |= (uint64_t)get_be32(s);
+ val = (uint64_t)avio_get_be32(s) << 32;
+ val |= (uint64_t)avio_get_be32(s);
return val;
}
@@ -665,7 +691,7 @@ uint64_t ff_get_v(ByteIOContext *bc){
int tmp;
do{
- tmp = get_byte(bc);
+ tmp = avio_get_byte(bc);
val= (val<<7) + (tmp&127);
}while(tmp&128);
return val;
diff --git a/libavformat/avs.c b/libavformat/avs.c
index 2e1b224..71bb82a 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -62,11 +62,11 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
s->ctx_flags |= AVFMTCTX_NOHEADER;
url_fskip(s->pb, 4);
- avs->width = get_le16(s->pb);
- avs->height = get_le16(s->pb);
- avs->bits_per_sample = get_le16(s->pb);
- avs->fps = get_le16(s->pb);
- avs->nb_frames = get_le32(s->pb);
+ avs->width = avio_get_le16(s->pb);
+ avs->height = avio_get_le16(s->pb);
+ avs->bits_per_sample = avio_get_le16(s->pb);
+ avs->fps = avio_get_le16(s->pb);
+ avs->nb_frames = avio_get_le32(s->pb);
avs->remaining_frame_size = 0;
avs->remaining_audio_size = 0;
@@ -104,7 +104,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt,
pkt->data[palette_size + 1] = type;
pkt->data[palette_size + 2] = size & 0xFF;
pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
- ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
+ ret = avio_get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
if (ret < size) {
av_free_packet(pkt);
return AVERROR(EIO);
@@ -154,20 +154,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
while (1) {
if (avs->remaining_frame_size <= 0) {
- if (!get_le16(s->pb)) /* found EOF */
+ if (!avio_get_le16(s->pb)) /* found EOF */
return AVERROR(EIO);
- avs->remaining_frame_size = get_le16(s->pb) - 4;
+ avs->remaining_frame_size = avio_get_le16(s->pb) - 4;
}
while (avs->remaining_frame_size > 0) {
- sub_type = get_byte(s->pb);
- type = get_byte(s->pb);
- size = get_le16(s->pb);
+ sub_type = avio_get_byte(s->pb);
+ type = avio_get_byte(s->pb);
+ size = avio_get_le16(s->pb);
avs->remaining_frame_size -= size;
switch (type) {
case AVS_PALETTE:
- ret = get_buffer(s->pb, palette, size - 4);
+ ret = avio_get_buffer(s->pb, palette, size - 4);
if (ret < size - 4)
return AVERROR(EIO);
palette_size = size;
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 97e8e7e..8ff3681 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -68,7 +68,7 @@ static int vid_read_header(AVFormatContext *s,
* int16s: always_512, nframes, width, height, delay, always_14
*/
url_fseek(pb, 5, SEEK_CUR);
- vid->nframes = get_le16(pb);
+ vid->nframes = avio_get_le16(pb);
stream = av_new_stream(s, 0);
if (!stream)
@@ -76,11 +76,11 @@ static int vid_read_header(AVFormatContext *s,
av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
- stream->codec->width = get_le16(pb);
- stream->codec->height = get_le16(pb);
+ stream->codec->width = avio_get_le16(pb);
+ stream->codec->height = avio_get_le16(pb);
stream->codec->pix_fmt = PIX_FMT_PAL8;
- vid->bethsoft_global_delay = get_le16(pb);
- get_le16(pb);
+ vid->bethsoft_global_delay = avio_get_le16(pb);
+ avio_get_le16(pb);
// done with video codec, set up audio codec
stream = av_new_stream(s, 0);
@@ -117,11 +117,11 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
vidbuf_start[vidbuf_nbytes++] = block_type;
// get the video delay (next int16), and set the presentation time
- vid->video_pts += vid->bethsoft_global_delay + get_le16(pb);
+ vid->video_pts += vid->bethsoft_global_delay + avio_get_le16(pb);
// set the y offset if it exists (decoder header data should be in data section)
if(block_type == VIDEO_YOFF_P_FRAME){
- if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
+ if(avio_get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
goto fail;
vidbuf_nbytes += 2;
}
@@ -131,21 +131,21 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
if(!vidbuf_start)
return AVERROR(ENOMEM);
- code = get_byte(pb);
+ code = avio_get_byte(pb);
vidbuf_start[vidbuf_nbytes++] = code;
if(code >= 0x80){ // rle sequence
if(block_type == VIDEO_I_FRAME)
- vidbuf_start[vidbuf_nbytes++] = get_byte(pb);
+ vidbuf_start[vidbuf_nbytes++] = avio_get_byte(pb);
} else if(code){ // plain sequence
- if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
+ if(avio_get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
goto fail;
vidbuf_nbytes += code;
}
bytes_copied += code & 0x7F;
if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied
// may contain a 0 byte even if read all pixels
- if(get_byte(pb))
+ if(avio_get_byte(pb))
url_fseek(pb, -1, SEEK_CUR);
break;
}
@@ -182,7 +182,7 @@ static int vid_read_packet(AVFormatContext *s,
if(vid->is_finished || url_feof(pb))
return AVERROR(EIO);
- block_type = get_byte(pb);
+ block_type = avio_get_byte(pb);
switch(block_type){
case PALETTE_BLOCK:
url_fseek(pb, -1, SEEK_CUR); // include block type
@@ -195,12 +195,12 @@ static int vid_read_packet(AVFormatContext *s,
return ret_value;
case FIRST_AUDIO_BLOCK:
- get_le16(pb);
+ avio_get_le16(pb);
// soundblaster DAC used for sample rate, as on specification page (link above)
- s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
+ s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_get_byte(pb));
s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
case AUDIO_BLOCK:
- audio_length = get_le16(pb);
+ audio_length = avio_get_le16(pb);
ret_value = av_get_packet(pb, pkt, audio_length);
pkt->stream_index = 1;
return ret_value != audio_length ? AVERROR(EIO) : ret_value;
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 3b1c9aa..f8c2690 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -66,24 +66,24 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Set the total number of frames. */
url_fskip(pb, 8);
- chunk_header = get_le32(pb);
- bfi->nframes = get_le32(pb);
- get_le32(pb);
- get_le32(pb);
- get_le32(pb);
- fps = get_le32(pb);
+ chunk_header = avio_get_le32(pb);
+ bfi->nframes = avio_get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ avio_get_le32(pb);
+ fps = avio_get_le32(pb);
url_fskip(pb, 12);
- vstream->codec->width = get_le32(pb);
- vstream->codec->height = get_le32(pb);
+ vstream->codec->width = avio_get_le32(pb);
+ vstream->codec->height = avio_get_le32(pb);
/*Load the palette to extradata */
url_fskip(pb, 8);
vstream->codec->extradata = av_malloc(768);
vstream->codec->extradata_size = 768;
- get_buffer(pb, vstream->codec->extradata,
+ avio_get_buffer(pb, vstream->codec->extradata,
vstream->codec->extradata_size);
- astream->codec->sample_rate = get_le32(pb);
+ astream->codec->sample_rate = avio_get_le32(pb);
/* Set up the video codec... */
av_set_pts_info(vstream, 32, 1, fps);
@@ -119,14 +119,14 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
while(state != MKTAG('S','A','V','I')){
if (url_feof(pb))
return AVERROR(EIO);
- state = 256*state + get_byte(pb);
+ state = 256*state + avio_get_byte(pb);
}
/* Now that the chunk's location is confirmed, we proceed... */
- chunk_size = get_le32(pb);
- get_le32(pb);
- audio_offset = get_le32(pb);
- get_le32(pb);
- video_offset = get_le32(pb);
+ chunk_size = avio_get_le32(pb);
+ avio_get_le32(pb);
+ audio_offset = avio_get_le32(pb);
+ avio_get_le32(pb);
+ video_offset = avio_get_le32(pb);
audio_size = video_offset - audio_offset;
bfi->video_size = chunk_size - video_offset;
diff --git a/libavformat/bink.c b/libavformat/bink.c
index c134dd8..240be89 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -82,17 +82,17 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!vst)
return AVERROR(ENOMEM);
- vst->codec->codec_tag = get_le32(pb);
+ vst->codec->codec_tag = avio_get_le32(pb);
- bink->file_size = get_le32(pb) + 8;
- vst->duration = get_le32(pb);
+ bink->file_size = avio_get_le32(pb) + 8;
+ vst->duration = avio_get_le32(pb);
if (vst->duration > 1000000) {
av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n");
return AVERROR(EIO);
}
- if (get_le32(pb) > bink->file_size) {
+ if (avio_get_le32(pb) > bink->file_size) {
av_log(s, AV_LOG_ERROR,
"invalid header: largest frame size greater than file size\n");
return AVERROR(EIO);
@@ -100,11 +100,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
url_fskip(pb, 4);
- vst->codec->width = get_le32(pb);
- vst->codec->height = get_le32(pb);
+ vst->codec->width = avio_get_le32(pb);
+ vst->codec->height = avio_get_le32(pb);
- fps_num = get_le32(pb);
- fps_den = get_le32(pb);
+ fps_num = avio_get_le32(pb);
+ fps_den = avio_get_le32(pb);
if (fps_num == 0 || fps_den == 0) {
av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den);
return AVERROR(EIO);
@@ -115,9 +115,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
vst->codec->codec_id = CODEC_ID_BINKVIDEO;
vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
vst->codec->extradata_size = 4;
- get_buffer(pb, vst->codec->extradata, 4);
+ avio_get_buffer(pb, vst->codec->extradata, 4);
- bink->num_audio_tracks = get_le32(pb);
+ bink->num_audio_tracks = avio_get_le32(pb);
if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) {
av_log(s, AV_LOG_ERROR,
@@ -135,9 +135,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_tag = 0;
- ast->codec->sample_rate = get_le16(pb);
+ ast->codec->sample_rate = avio_get_le16(pb);
av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
- flags = get_le16(pb);
+ flags = avio_get_le16(pb);
ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
@@ -147,14 +147,14 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
}
/* frame index table */
- next_pos = get_le32(pb);
+ next_pos = avio_get_le32(pb);
for (i = 0; i < vst->duration; i++) {
pos = next_pos;
if (i == vst->duration - 1) {
next_pos = bink->file_size;
keyframe = 0;
} else {
- next_pos = get_le32(pb);
+ next_pos = avio_get_le32(pb);
keyframe = pos & 1;
}
pos &= ~1;
@@ -201,7 +201,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
}
while (bink->current_track < bink->num_audio_tracks) {
- uint32_t audio_size = get_le32(pb);
+ uint32_t audio_size = avio_get_le32(pb);
if (audio_size > bink->remain_packet_size - 4) {
av_log(s, AV_LOG_ERROR,
"frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n",
diff --git a/libavformat/c93.c b/libavformat/c93.c
index dbb2bf3..8401eac 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -66,9 +66,9 @@ static int read_header(AVFormatContext *s,
int framecount = 0;
for (i = 0; i < 512; i++) {
- c93->block_records[i].index = get_le16(pb);
- c93->block_records[i].length = get_byte(pb);
- c93->block_records[i].frames = get_byte(pb);
+ c93->block_records[i].index = avio_get_le16(pb);
+ c93->block_records[i].length = avio_get_byte(pb);
+ c93->block_records[i].frames = avio_get_byte(pb);
if (c93->block_records[i].frames > 32) {
av_log(s, AV_LOG_ERROR, "too many frames in block\n");
return AVERROR_INVALIDDATA;
@@ -114,7 +114,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
if (c93->next_pkt_is_audio) {
c93->current_frame++;
c93->next_pkt_is_audio = 0;
- datasize = get_le16(pb);
+ datasize = avio_get_le16(pb);
if (datasize > 42) {
if (!c93->audio) {
c93->audio = av_new_stream(s, 1);
@@ -142,13 +142,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
if (c93->current_frame == 0) {
url_fseek(pb, br->index * 2048, SEEK_SET);
for (i = 0; i < 32; i++) {
- c93->frame_offsets[i] = get_le32(pb);
+ c93->frame_offsets[i] = avio_get_le32(pb);
}
}
url_fseek(pb,br->index * 2048 +
c93->frame_offsets[c93->current_frame], SEEK_SET);
- datasize = get_le16(pb); /* video frame size */
+ datasize = avio_get_le16(pb); /* video frame size */
ret = av_new_packet(pkt, datasize + 768 + 1);
if (ret < 0)
@@ -156,13 +156,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data[0] = 0;
pkt->size = datasize + 1;
- ret = get_buffer(pb, pkt->data + 1, datasize);
+ ret = avio_get_buffer(pb, pkt->data + 1, datasize);
if (ret < datasize) {
ret = AVERROR(EIO);
goto fail;
}
- datasize = get_le16(pb); /* palette size */
+ datasize = avio_get_le16(pb); /* palette size */
if (datasize) {
if (datasize != 768) {
av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize);
@@ -170,7 +170,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
goto fail;
}
pkt->data[0] |= C93_HAS_PALETTE;
- ret = get_buffer(pb, pkt->data + pkt->size, datasize);
+ ret = avio_get_buffer(pb, pkt->data + pkt->size, datasize);
if (ret < datasize) {
ret = AVERROR(EIO);
goto fail;
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 7b0c871..6e1f517 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -65,14 +65,14 @@ static int read_desc_chunk(AVFormatContext *s)
/* parse format description */
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codec->sample_rate = av_int2dbl(get_be64(pb));
- st->codec->codec_tag = get_be32(pb);
- flags = get_be32(pb);
- caf->bytes_per_packet = get_be32(pb);
+ st->codec->sample_rate = av_int2dbl(avio_get_be64(pb));
+ st->codec->codec_tag = avio_get_be32(pb);
+ flags = avio_get_be32(pb);
+ caf->bytes_per_packet = avio_get_be32(pb);
st->codec->block_align = caf->bytes_per_packet;
- caf->frames_per_packet = get_be32(pb);
- st->codec->channels = get_be32(pb);
- st->codec->bits_per_coded_sample = get_be32(pb);
+ caf->frames_per_packet = avio_get_be32(pb);
+ st->codec->channels = avio_get_be32(pb);
+ st->codec->bits_per_coded_sample = avio_get_be32(pb);
/* calculate bit rate for constant size packets */
if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
@@ -127,14 +127,14 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
- get_buffer(pb, st->codec->extradata, ALAC_HEADER);
+ avio_get_buffer(pb, st->codec->extradata, ALAC_HEADER);
st->codec->extradata_size = ALAC_HEADER;
url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
} else {
st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
- get_buffer(pb, st->codec->extradata, size);
+ avio_get_buffer(pb, st->codec->extradata, size);
st->codec->extradata_size = size;
}
@@ -152,13 +152,13 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
ccount = url_ftell(pb);
- num_packets = get_be64(pb);
+ num_packets = avio_get_be64(pb);
if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
return AVERROR_INVALIDDATA;
- st->nb_frames = get_be64(pb); /* valid frames */
- st->nb_frames += get_be32(pb); /* priming frames */
- st->nb_frames += get_be32(pb); /* remainder frames */
+ st->nb_frames = avio_get_be64(pb); /* valid frames */
+ st->nb_frames += avio_get_be32(pb); /* priming frames */
+ st->nb_frames += avio_get_be32(pb); /* remainder frames */
st->duration = 0;
for (i = 0; i < num_packets; i++) {
@@ -181,7 +181,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size)
{
ByteIOContext *pb = s->pb;
unsigned int i;
- unsigned int nb_entries = get_be32(pb);
+ unsigned int nb_entries = avio_get_be32(pb);
for (i = 0; i < nb_entries; i++) {
char key[32];
char value[1024];
@@ -204,11 +204,11 @@ static int read_header(AVFormatContext *s,
url_fskip(pb, 8); /* magic, version, file flags */
/* audio description chunk */
- if (get_be32(pb) != MKBETAG('d','e','s','c')) {
+ if (avio_get_be32(pb) != MKBETAG('d','e','s','c')) {
av_log(s, AV_LOG_ERROR, "desc chunk not present\n");
return AVERROR_INVALIDDATA;
}
- size = get_be64(pb);
+ size = avio_get_be64(pb);
if (size != 32)
return AVERROR_INVALIDDATA;
@@ -226,8 +226,8 @@ static int read_header(AVFormatContext *s,
if (found_data && (caf->data_size < 0 || url_is_streamed(pb)))
break;
- tag = get_be32(pb);
- size = get_be64(pb);
+ tag = avio_get_be32(pb);
+ size = avio_get_be64(pb);
if (url_feof(pb))
break;
diff --git a/libavformat/daud.c b/libavformat/daud.c
index 887a910..b1d9afc 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -40,8 +40,8 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
int ret, size;
if (url_feof(pb))
return AVERROR(EIO);
- size = get_be16(pb);
- get_be16(pb); // unknown
+ size = avio_get_be16(pb);
+ avio_get_be16(pb); // unknown
ret = av_get_packet(pb, pkt, size);
pkt->stream_index = 0;
return ret;
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index 10a2a9d..b83fbf0 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -73,16 +73,16 @@ static int cin_probe(AVProbeData *p)
static int cin_read_file_header(CinDemuxContext *cin, ByteIOContext *pb) {
CinFileHeader *hdr = &cin->file_header;
- if (get_le32(pb) != 0x55AA0000)
+ if (avio_get_le32(pb) != 0x55AA0000)
return AVERROR_INVALIDDATA;
- hdr->video_frame_size = get_le32(pb);
- hdr->video_frame_width = get_le16(pb);
- hdr->video_frame_height = get_le16(pb);
- hdr->audio_frequency = get_le32(pb);
- hdr->audio_bits = get_byte(pb);
- hdr->audio_stereo = get_byte(pb);
- hdr->audio_frame_size = get_le16(pb);
+ hdr->video_frame_size = avio_get_le32(pb);
+ hdr->video_frame_width = avio_get_le16(pb);
+ hdr->video_frame_height = avio_get_le16(pb);
+ hdr->audio_frequency = avio_get_le32(pb);
+ hdr->audio_bits = avio_get_byte(pb);
+ hdr->audio_stereo = avio_get_byte(pb);
+ hdr->audio_frame_size = avio_get_le16(pb);
if (hdr->audio_frequency != 22050 || hdr->audio_bits != 16 || hdr->audio_stereo != 0)
return AVERROR_INVALIDDATA;
@@ -141,16 +141,16 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap)
static int cin_read_frame_header(CinDemuxContext *cin, ByteIOContext *pb) {
CinFrameHeader *hdr = &cin->frame_header;
- hdr->video_frame_type = get_byte(pb);
- hdr->audio_frame_type = get_byte(pb);
- hdr->pal_colors_count = get_le16(pb);
- hdr->video_frame_size = get_le32(pb);
- hdr->audio_frame_size = get_le32(pb);
+ hdr->video_frame_type = avio_get_byte(pb);
+ hdr->audio_frame_type = avio_get_byte(pb);
+ hdr->pal_colors_count = avio_get_le16(pb);
+ hdr->video_frame_size = avio_get_le32(pb);
+ hdr->audio_frame_size = avio_get_le32(pb);
if (url_feof(pb) || url_ferror(pb))
return AVERROR(EIO);
- if (get_le32(pb) != 0xAA55AA55)
+ if (avio_get_le32(pb) != 0xAA55AA55)
return AVERROR_INVALIDDATA;
return 0;
@@ -191,7 +191,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data[2] = hdr->pal_colors_count >> 8;
pkt->data[3] = hdr->video_frame_type;
- ret = get_buffer(pb, &pkt->data[4], pkt_size);
+ ret = avio_get_buffer(pb, &pkt->data[4], pkt_size);
if (ret < 0) {
av_free_packet(pkt);
return ret;
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 1f05eb2..917fce0 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -410,7 +410,7 @@ static int dv_read_header(AVFormatContext *s,
if (!c->dv_demux)
return -1;
- state = get_be32(s->pb);
+ state = avio_get_be32(s->pb);
while ((state & 0xffffff7f) != 0x1f07003f) {
if (url_feof(s->pb)) {
av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
@@ -420,14 +420,14 @@ static int dv_read_header(AVFormatContext *s,
marker_pos = url_ftell(s->pb);
if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
url_fseek(s->pb, -163, SEEK_CUR);
- state = get_be32(s->pb);
+ state = avio_get_be32(s->pb);
break;
}
- state = (state << 8) | get_byte(s->pb);
+ state = (state << 8) | avio_get_byte(s->pb);
}
AV_WB32(c->buf, state);
- if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
+ if (avio_get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
return AVERROR(EIO);
@@ -455,7 +455,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!c->dv_demux->sys)
return AVERROR(EIO);
size = c->dv_demux->sys->frame_size;
- if (get_buffer(s->pb, c->buf, size) <= 0)
+ if (avio_get_buffer(s->pb, c->buf, size) <= 0)
return AVERROR(EIO);
size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 6ad4582..e2ecaca 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -61,17 +61,17 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
int num, den;
int flags;
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
if (tag != MKTAG('D', 'E', 'X', 'A'))
return -1;
- flags = get_byte(pb);
- c->frames = get_be16(pb);
+ flags = avio_get_byte(pb);
+ c->frames = avio_get_be16(pb);
if(!c->frames){
av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
return -1;
}
- fps = get_be32(pb);
+ fps = avio_get_be32(pb);
if(fps > 0){
den = 1000;
num = fps;
@@ -82,8 +82,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
den = 10;
num = 1;
}
- w = get_be16(pb);
- h = get_be16(pb);
+ w = avio_get_be16(pb);
+ h = avio_get_be16(pb);
c->has_sound = 0;
st = av_new_stream(s, 0);
@@ -91,13 +91,13 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
// Parse WAV data header
- if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){
+ if(avio_get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){
uint32_t size, fsize;
c->has_sound = 1;
- size = get_be32(pb);
+ size = avio_get_be32(pb);
c->vidpos = url_ftell(pb) + size;
url_fskip(pb, 16);
- fsize = get_le32(pb);
+ fsize = avio_get_le32(pb);
ast = av_new_stream(s, 0);
if (!ast)
@@ -105,8 +105,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
ff_get_wav_header(pb, ast->codec, fsize);
// find 'data' chunk
while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
- tag = get_le32(pb);
- fsize = get_le32(pb);
+ tag = avio_get_le32(pb);
+ fsize = avio_get_le32(pb);
if(tag == MKTAG('d', 'a', 't', 'a')) break;
url_fskip(pb, fsize);
}
@@ -163,7 +163,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
}
url_fseek(s->pb, c->vidpos, SEEK_SET);
while(!url_feof(s->pb) && c->frames){
- get_buffer(s->pb, buf, 4);
+ avio_get_buffer(s->pb, buf, 4);
switch(AV_RL32(buf)){
case MKTAG('N', 'U', 'L', 'L'):
if(av_new_packet(pkt, 4 + pal_size) < 0)
@@ -178,10 +178,10 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
case MKTAG('C', 'M', 'A', 'P'):
pal_size = 768+4;
memcpy(pal, buf, 4);
- get_buffer(s->pb, pal + 4, 768);
+ avio_get_buffer(s->pb, pal + 4, 768);
break;
case MKTAG('F', 'R', 'A', 'M'):
- get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
+ avio_get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
size = AV_RB32(buf + 5);
if(size > 0xFFFFFF){
av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
@@ -190,7 +190,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
return AVERROR(ENOMEM);
memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
- ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
+ ret = avio_get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
if(ret != size){
av_free_packet(pkt);
return AVERROR(EIO);
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
index 809b190..2f2e907 100644
--- a/libavformat/eacdata.c
+++ b/libavformat/eacdata.c
@@ -51,7 +51,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
unsigned int sample_rate, header;
AVStream *st;
- header = get_be16(pb);
+ header = avio_get_be16(pb);
switch (header) {
case 0x0400: cdata->channels = 1; break;
case 0x0404: cdata->channels = 2; break;
@@ -61,7 +61,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
};
- sample_rate = get_be16(pb);
+ sample_rate = avio_get_be16(pb);
url_fskip(pb, 12);
st = av_new_stream(s, 0);
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 5408a1f..ee2d95e 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -82,11 +82,11 @@ static uint32_t read_arbitary(ByteIOContext *pb) {
int i;
uint32_t word;
- size = get_byte(pb);
+ size = avio_get_byte(pb);
word = 0;
for (i = 0; i < size; i++) {
- byte = get_byte(pb);
+ byte = avio_get_byte(pb);
word <<= 8;
word |= byte;
}
@@ -112,7 +112,7 @@ static int process_audio_header_elements(AVFormatContext *s)
while (!url_feof(pb) && inHeader) {
int inSubheader;
uint8_t byte;
- byte = get_byte(pb);
+ byte = avio_get_byte(pb);
switch (byte) {
case 0xFD:
@@ -120,7 +120,7 @@ static int process_audio_header_elements(AVFormatContext *s)
inSubheader = 1;
while (!url_feof(pb) && inSubheader) {
uint8_t subbyte;
- subbyte = get_byte(pb);
+ subbyte = avio_get_byte(pb);
switch (subbyte) {
case 0x80:
@@ -218,10 +218,10 @@ static int process_audio_header_eacs(AVFormatContext *s)
ByteIOContext *pb = s->pb;
int compression_type;
- ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb);
- ea->bytes = get_byte(pb); /* 1=8-bit, 2=16-bit */
- ea->num_channels = get_byte(pb);
- compression_type = get_byte(pb);
+ ea->sample_rate = ea->big_endian ? avio_get_be32(pb) : avio_get_le32(pb);
+ ea->bytes = avio_get_byte(pb); /* 1=8-bit, 2=16-bit */
+ ea->num_channels = avio_get_byte(pb);
+ compression_type = avio_get_byte(pb);
url_fskip(pb, 13);
switch (compression_type) {
@@ -249,9 +249,9 @@ static int process_audio_header_sead(AVFormatContext *s)
EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb;
- ea->sample_rate = get_le32(pb);
- ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */
- ea->num_channels = get_le32(pb);
+ ea->sample_rate = avio_get_le32(pb);
+ ea->bytes = avio_get_le32(pb); /* 1=8-bit, 2=16-bit */
+ ea->num_channels = avio_get_le32(pb);
ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD;
return 1;
@@ -262,8 +262,8 @@ static int process_video_header_mdec(AVFormatContext *s)
EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = s->pb;
url_fskip(pb, 4);
- ea->width = get_le16(pb);
- ea->height = get_le16(pb);
+ ea->width = avio_get_le16(pb);
+ ea->height = avio_get_le16(pb);
ea->time_base = (AVRational){1,15};
ea->video_codec = CODEC_ID_MDEC;
return 1;
@@ -275,8 +275,8 @@ static int process_video_header_vp6(AVFormatContext *s)
ByteIOContext *pb = s->pb;
url_fskip(pb, 16);
- ea->time_base.den = get_le32(pb);
- ea->time_base.num = get_le32(pb);
+ ea->time_base.den = avio_get_le32(pb);
+ ea->time_base.num = avio_get_le32(pb);
ea->video_codec = CODEC_ID_VP6;
return 1;
@@ -296,8 +296,8 @@ static int process_ea_header(AVFormatContext *s) {
unsigned int startpos = url_ftell(pb);
int err = 0;
- blockid = get_le32(pb);
- size = get_le32(pb);
+ blockid = avio_get_le32(pb);
+ size = avio_get_le32(pb);
if (i == 0)
ea->big_endian = size > 0x000FFFFF;
if (ea->big_endian)
@@ -305,7 +305,7 @@ static int process_ea_header(AVFormatContext *s) {
switch (blockid) {
case ISNh_TAG:
- if (get_le32(pb) != EACS_TAG) {
+ if (avio_get_le32(pb) != EACS_TAG) {
av_log (s, AV_LOG_ERROR, "unknown 1SNh headerid\n");
return 0;
}
@@ -314,7 +314,7 @@ static int process_ea_header(AVFormatContext *s) {
case SCHl_TAG :
case SHEN_TAG :
- blockid = get_le32(pb);
+ blockid = avio_get_le32(pb);
if (blockid == GSTR_TAG) {
url_fskip(pb, 4);
} else if ((blockid & 0xFFFF)!=PT00_TAG) {
@@ -467,8 +467,8 @@ static int ea_read_packet(AVFormatContext *s,
int av_uninit(num_samples);
while (!packet_read) {
- chunk_type = get_le32(pb);
- chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8;
+ chunk_type = avio_get_le32(pb);
+ chunk_size = (ea->big_endian ? avio_get_be32(pb) : avio_get_le32(pb)) - 8;
switch (chunk_type) {
/* audio data */
@@ -485,7 +485,7 @@ static int ea_read_packet(AVFormatContext *s,
break;
} else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
ea->audio_codec == CODEC_ID_MP3) {
- num_samples = get_le32(pb);
+ num_samples = avio_get_le32(pb);
url_fskip(pb, 8);
chunk_size -= 12;
}
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index 91da650..b87fda5 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -95,7 +95,7 @@ static int ffm_resync(AVFormatContext *s, int state)
av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
return -1;
}
- state = (state << 8) | get_byte(s->pb);
+ state = (state << 8) | avio_get_byte(s->pb);
}
return 0;
}
@@ -120,14 +120,14 @@ static int ffm_read_data(AVFormatContext *s,
if (url_ftell(pb) == ffm->file_size)
url_fseek(pb, ffm->packet_size, SEEK_SET);
retry_read:
- id = get_be16(pb); /* PACKET_ID */
+ id = avio_get_be16(pb); /* PACKET_ID */
if (id != PACKET_ID)
if (ffm_resync(s, id) < 0)
return -1;
- fill_size = get_be16(pb);
- ffm->dts = get_be64(pb);
- frame_offset = get_be16(pb);
- get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
+ fill_size = avio_get_be16(pb);
+ ffm->dts = avio_get_be64(pb);
+ frame_offset = avio_get_be16(pb);
+ avio_get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
if (ffm->packet_end < ffm->packet || frame_offset < 0)
return -1;
@@ -188,7 +188,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
ffm_seek1(s, pos);
url_fskip(pb, 4);
- dts = get_be64(pb);
+ dts = avio_get_be64(pb);
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
#endif
@@ -273,13 +273,13 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
uint32_t tag;
/* header */
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
if (tag != MKTAG('F', 'F', 'M', '1'))
goto fail;
- ffm->packet_size = get_be32(pb);
+ ffm->packet_size = avio_get_be32(pb);
if (ffm->packet_size != FFM_PACKET_SIZE)
goto fail;
- ffm->write_index = get_be64(pb);
+ ffm->write_index = avio_get_be64(pb);
/* get also filesize */
if (!url_is_streamed(pb)) {
ffm->file_size = url_fsize(pb);
@@ -289,8 +289,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
ffm->file_size = (UINT64_C(1) << 63) - 1;
}
- nb_streams = get_be32(pb);
- get_be32(pb); /* total bitrate */
+ nb_streams = avio_get_be32(pb);
+ avio_get_be32(pb); /* total bitrate */
/* read each stream */
for(i=0;i<nb_streams;i++) {
char rc_eq_buf[128];
@@ -303,85 +303,85 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec = st->codec;
/* generic info */
- codec->codec_id = get_be32(pb);
- codec->codec_type = get_byte(pb); /* codec_type */
- codec->bit_rate = get_be32(pb);
- st->quality = get_be32(pb);
- codec->flags = get_be32(pb);
- codec->flags2 = get_be32(pb);
- codec->debug = get_be32(pb);
+ codec->codec_id = avio_get_be32(pb);
+ codec->codec_type = avio_get_byte(pb); /* codec_type */
+ codec->bit_rate = avio_get_be32(pb);
+ st->quality = avio_get_be32(pb);
+ codec->flags = avio_get_be32(pb);
+ codec->flags2 = avio_get_be32(pb);
+ codec->debug = avio_get_be32(pb);
/* specific info */
switch(codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
- codec->time_base.num = get_be32(pb);
- codec->time_base.den = get_be32(pb);
- codec->width = get_be16(pb);
- codec->height = get_be16(pb);
- codec->gop_size = get_be16(pb);
- codec->pix_fmt = get_be32(pb);
- codec->qmin = get_byte(pb);
- codec->qmax = get_byte(pb);
- codec->max_qdiff = get_byte(pb);
- codec->qcompress = get_be16(pb) / 10000.0;
- codec->qblur = get_be16(pb) / 10000.0;
- codec->bit_rate_tolerance = get_be32(pb);
+ codec->time_base.num = avio_get_be32(pb);
+ codec->time_base.den = avio_get_be32(pb);
+ codec->width = avio_get_be16(pb);
+ codec->height = avio_get_be16(pb);
+ codec->gop_size = avio_get_be16(pb);
+ codec->pix_fmt = avio_get_be32(pb);
+ codec->qmin = avio_get_byte(pb);
+ codec->qmax = avio_get_byte(pb);
+ codec->max_qdiff = avio_get_byte(pb);
+ codec->qcompress = avio_get_be16(pb) / 10000.0;
+ codec->qblur = avio_get_be16(pb) / 10000.0;
+ codec->bit_rate_tolerance = avio_get_be32(pb);
codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf)));
- codec->rc_max_rate = get_be32(pb);
- codec->rc_min_rate = get_be32(pb);
- codec->rc_buffer_size = get_be32(pb);
- codec->i_quant_factor = av_int2dbl(get_be64(pb));
- codec->b_quant_factor = av_int2dbl(get_be64(pb));
- codec->i_quant_offset = av_int2dbl(get_be64(pb));
- codec->b_quant_offset = av_int2dbl(get_be64(pb));
- codec->dct_algo = get_be32(pb);
- codec->strict_std_compliance = get_be32(pb);
- codec->max_b_frames = get_be32(pb);
- codec->luma_elim_threshold = get_be32(pb);
- codec->chroma_elim_threshold = get_be32(pb);
- codec->mpeg_quant = get_be32(pb);
- codec->intra_dc_precision = get_be32(pb);
- codec->me_method = get_be32(pb);
- codec->mb_decision = get_be32(pb);
- codec->nsse_weight = get_be32(pb);
- codec->frame_skip_cmp = get_be32(pb);
- codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb));
- codec->codec_tag = get_be32(pb);
- codec->thread_count = get_byte(pb);
- codec->coder_type = get_be32(pb);
- codec->me_cmp = get_be32(pb);
- codec->partitions = get_be32(pb);
- codec->me_subpel_quality = get_be32(pb);
- codec->me_range = get_be32(pb);
- codec->keyint_min = get_be32(pb);
- codec->scenechange_threshold = get_be32(pb);
- codec->b_frame_strategy = get_be32(pb);
- codec->qcompress = av_int2dbl(get_be64(pb));
- codec->qblur = av_int2dbl(get_be64(pb));
- codec->max_qdiff = get_be32(pb);
- codec->refs = get_be32(pb);
- codec->directpred = get_be32(pb);
+ codec->rc_max_rate = avio_get_be32(pb);
+ codec->rc_min_rate = avio_get_be32(pb);
+ codec->rc_buffer_size = avio_get_be32(pb);
+ codec->i_quant_factor = av_int2dbl(avio_get_be64(pb));
+ codec->b_quant_factor = av_int2dbl(avio_get_be64(pb));
+ codec->i_quant_offset = av_int2dbl(avio_get_be64(pb));
+ codec->b_quant_offset = av_int2dbl(avio_get_be64(pb));
+ codec->dct_algo = avio_get_be32(pb);
+ codec->strict_std_compliance = avio_get_be32(pb);
+ codec->max_b_frames = avio_get_be32(pb);
+ codec->luma_elim_threshold = avio_get_be32(pb);
+ codec->chroma_elim_threshold = avio_get_be32(pb);
+ codec->mpeg_quant = avio_get_be32(pb);
+ codec->intra_dc_precision = avio_get_be32(pb);
+ codec->me_method = avio_get_be32(pb);
+ codec->mb_decision = avio_get_be32(pb);
+ codec->nsse_weight = avio_get_be32(pb);
+ codec->frame_skip_cmp = avio_get_be32(pb);
+ codec->rc_buffer_aggressivity = av_int2dbl(avio_get_be64(pb));
+ codec->codec_tag = avio_get_be32(pb);
+ codec->thread_count = avio_get_byte(pb);
+ codec->coder_type = avio_get_be32(pb);
+ codec->me_cmp = avio_get_be32(pb);
+ codec->partitions = avio_get_be32(pb);
+ codec->me_subpel_quality = avio_get_be32(pb);
+ codec->me_range = avio_get_be32(pb);
+ codec->keyint_min = avio_get_be32(pb);
+ codec->scenechange_threshold = avio_get_be32(pb);
+ codec->b_frame_strategy = avio_get_be32(pb);
+ codec->qcompress = av_int2dbl(avio_get_be64(pb));
+ codec->qblur = av_int2dbl(avio_get_be64(pb));
+ codec->max_qdiff = avio_get_be32(pb);
+ codec->refs = avio_get_be32(pb);
+ codec->directpred = avio_get_be32(pb);
break;
case AVMEDIA_TYPE_AUDIO:
- codec->sample_rate = get_be32(pb);
- codec->channels = get_le16(pb);
- codec->frame_size = get_le16(pb);
- codec->sample_fmt = (int16_t) get_le16(pb);
+ codec->sample_rate = avio_get_be32(pb);
+ codec->channels = avio_get_le16(pb);
+ codec->frame_size = avio_get_le16(pb);
+ codec->sample_fmt = (int16_t) avio_get_le16(pb);
break;
default:
goto fail;
}
if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
- codec->extradata_size = get_be32(pb);
+ codec->extradata_size = avio_get_be32(pb);
codec->extradata = av_malloc(codec->extradata_size);
if (!codec->extradata)
return AVERROR(ENOMEM);
- get_buffer(pb, codec->extradata, codec->extradata_size);
+ avio_get_buffer(pb, codec->extradata, codec->extradata_size);
}
}
/* get until end of block reached */
while ((url_ftell(pb) % ffm->packet_size) != 0)
- get_byte(pb);
+ avio_get_byte(pb);
/* init packet demux */
ffm->packet_ptr = ffm->packet;
diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c
index ab35746..50e6389 100644
--- a/libavformat/ffmetadec.c
+++ b/libavformat/ffmetadec.c
@@ -35,11 +35,11 @@ static void get_line(ByteIOContext *s, uint8_t *buf, int size)
uint8_t c;
int i = 0;
- while ((c = get_byte(s))) {
+ while ((c = avio_get_byte(s))) {
if (c == '\\') {
if (i < size - 1)
buf[i++] = c;
- c = get_byte(s);
+ c = avio_get_byte(s);
} else if (c == '\n')
break;
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 805ca99..bfd1840 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -44,7 +44,7 @@ static int read_header(AVFormatContext *s,
return AVERROR(EIO);
url_fseek(pb, url_fsize(pb) - 36, SEEK_SET);
- if (get_be32(pb) != RAND_TAG) {
+ if (avio_get_be32(pb) != RAND_TAG) {
av_log(s, AV_LOG_ERROR, "magic number not found");
return AVERROR_INVALIDDATA;
}
@@ -53,8 +53,8 @@ static int read_header(AVFormatContext *s,
if (!st)
return AVERROR(ENOMEM);
- st->nb_frames = get_be32(pb);
- if (get_be16(pb) != 0) {
+ st->nb_frames = avio_get_be32(pb);
+ if (avio_get_be16(pb) != 0) {
av_log_ask_for_sample(s, "unsupported packing method\n");
return AVERROR_INVALIDDATA;
}
@@ -64,10 +64,10 @@ static int read_header(AVFormatContext *s,
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->pix_fmt = PIX_FMT_RGBA;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->width = get_be16(pb);
- st->codec->height = get_be16(pb);
- film->leading = get_be16(pb);
- av_set_pts_info(st, 64, 1, get_be16(pb));
+ st->codec->width = avio_get_be16(pb);
+ st->codec->height = avio_get_be16(pb);
+ film->leading = avio_get_be16(pb);
+ av_set_pts_info(st, 64, 1, avio_get_be16(pb));
url_fseek(pb, 0, SEEK_SET);
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index f971d09..ff521d5 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -40,14 +40,14 @@ static int flac_read_header(AVFormatContext *s,
/* the parameters will be extracted from the compressed bitstream */
/* if fLaC marker is not found, assume there is no header */
- if (get_le32(s->pb) != MKTAG('f','L','a','C')) {
+ if (avio_get_le32(s->pb) != MKTAG('f','L','a','C')) {
url_fseek(s->pb, -4, SEEK_CUR);
return 0;
}
/* process metadata blocks */
while (!url_feof(s->pb) && !metadata_last) {
- get_buffer(s->pb, header, 4);
+ avio_get_buffer(s->pb, header, 4);
ff_flac_parse_block_header(header, &metadata_last, &metadata_type,
&metadata_size);
switch (metadata_type) {
@@ -58,7 +58,7 @@ static int flac_read_header(AVFormatContext *s,
if (!buffer) {
return AVERROR(ENOMEM);
}
- if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) {
+ if (avio_get_buffer(s->pb, buffer, metadata_size) != metadata_size) {
av_freep(&buffer);
return AVERROR(EIO);
}
diff --git a/libavformat/flic.c b/libavformat/flic.c
index bf93c5c..6b90a13 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -95,7 +95,7 @@ static int flic_read_header(AVFormatContext *s,
flic->frame_number = 0;
/* load the whole header and pull out the width and height */
- if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
+ if (avio_get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
return AVERROR(EIO);
magic_number = AV_RL16(&header[4]);
@@ -129,7 +129,7 @@ static int flic_read_header(AVFormatContext *s,
memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE);
/* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */
- if (get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) {
+ if (avio_get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) {
av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n");
return AVERROR(EIO);
}
@@ -206,7 +206,7 @@ static int flic_read_packet(AVFormatContext *s,
while (!packet_read) {
- if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
+ if ((ret = avio_get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
FLIC_PREAMBLE_SIZE) {
ret = AVERROR(EIO);
break;
@@ -224,7 +224,7 @@ static int flic_read_packet(AVFormatContext *s,
pkt->pts = flic->frame_number++;
pkt->pos = url_ftell(pb);
memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
- ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE,
+ ret = avio_get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE,
size - FLIC_PREAMBLE_SIZE);
if (ret != size - FLIC_PREAMBLE_SIZE) {
av_free_packet(pkt);
@@ -242,7 +242,7 @@ static int flic_read_packet(AVFormatContext *s,
pkt->stream_index = flic->audio_stream_index;
pkt->pos = url_ftell(pb);
- ret = get_buffer(pb, pkt->data, size);
+ ret = avio_get_buffer(pb, pkt->data, size);
if (ret != size) {
av_free_packet(pkt);
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index e6081d9..4eef6da 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -97,7 +97,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
vcodec->extradata_size = 1;
vcodec->extradata = av_malloc(1);
}
- vcodec->extradata[0] = get_byte(s->pb);
+ vcodec->extradata[0] = avio_get_byte(s->pb);
return 1; // 1 byte body size adjustment for flv_read_packet()
case FLV_CODECID_H264:
vcodec->codec_id = CODEC_ID_H264;
@@ -111,13 +111,13 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
}
static int amf_get_string(ByteIOContext *ioc, char *buffer, int buffsize) {
- int length = get_be16(ioc);
+ int length = avio_get_be16(ioc);
if(length >= buffsize) {
url_fskip(ioc, length);
return -1;
}
- get_buffer(ioc, buffer, length);
+ avio_get_buffer(ioc, buffer, length);
buffer[length] = '\0';
@@ -134,13 +134,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
num_val = 0;
ioc = s->pb;
- amf_type = get_byte(ioc);
+ amf_type = avio_get_byte(ioc);
switch(amf_type) {
case AMF_DATA_TYPE_NUMBER:
- num_val = av_int2dbl(get_be64(ioc)); break;
+ num_val = av_int2dbl(avio_get_be64(ioc)); break;
case AMF_DATA_TYPE_BOOL:
- num_val = get_byte(ioc); break;
+ num_val = avio_get_byte(ioc); break;
case AMF_DATA_TYPE_STRING:
if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0)
return -1;
@@ -148,12 +148,12 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
case AMF_DATA_TYPE_OBJECT: {
unsigned int keylen;
- while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) {
+ while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_get_be16(ioc))) {
url_fskip(ioc, keylen); //skip key string
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
return -1; //if we couldn't skip, bomb out.
}
- if(get_byte(ioc) != AMF_END_OF_OBJECT)
+ if(avio_get_byte(ioc) != AMF_END_OF_OBJECT)
return -1;
}
break;
@@ -168,13 +168,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
return -1;
}
- if(get_byte(ioc) != AMF_END_OF_OBJECT)
+ if(avio_get_byte(ioc) != AMF_END_OF_OBJECT)
return -1;
break;
case AMF_DATA_TYPE_ARRAY: {
unsigned int arraylen, i;
- arraylen = get_be32(ioc);
+ arraylen = avio_get_be32(ioc);
for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
return -1; //if we couldn't skip, bomb out.
@@ -222,7 +222,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) {
ioc = s->pb;
//first object needs to be "onMetaData" string
- type = get_byte(ioc);
+ type = avio_get_byte(ioc);
if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData"))
return -1;
@@ -255,7 +255,7 @@ static int flv_read_header(AVFormatContext *s,
int offset, flags;
url_fskip(s->pb, 4);
- flags = get_byte(s->pb);
+ flags = avio_get_byte(s->pb);
/* old flvtool cleared this field */
/* FIXME: better fix needed */
if (!flags) {
@@ -276,7 +276,7 @@ static int flv_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
}
- offset = get_be32(s->pb);
+ offset = avio_get_be32(s->pb);
url_fseek(s->pb, offset, SEEK_SET);
url_fskip(s->pb, 4);
@@ -292,7 +292,7 @@ static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = size;
- get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
+ avio_get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
return 0;
}
@@ -306,10 +306,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */
pos = url_ftell(s->pb);
- type = get_byte(s->pb);
- size = get_be24(s->pb);
- dts = get_be24(s->pb);
- dts |= get_byte(s->pb) << 24;
+ type = avio_get_byte(s->pb);
+ size = avio_get_be24(s->pb);
+ dts = avio_get_be24(s->pb);
+ dts |= avio_get_byte(s->pb) << 24;
// av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts);
if (url_feof(s->pb))
return AVERROR_EOF;
@@ -323,11 +323,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (type == FLV_TAG_TYPE_AUDIO) {
is_audio=1;
- flags = get_byte(s->pb);
+ flags = avio_get_byte(s->pb);
size--;
} else if (type == FLV_TAG_TYPE_VIDEO) {
is_audio=0;
- flags = get_byte(s->pb);
+ flags = avio_get_byte(s->pb);
size--;
if ((flags & 0xf0) == 0x50) /* video info / command frame */
goto skip;
@@ -375,11 +375,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
const int64_t pos= url_ftell(s->pb);
const int64_t fsize= url_fsize(s->pb);
url_fseek(s->pb, fsize-4, SEEK_SET);
- size= get_be32(s->pb);
+ size= avio_get_be32(s->pb);
url_fseek(s->pb, fsize-3-size, SEEK_SET);
- if(size == get_be24(s->pb) + 11){
- uint32_t ts = get_be24(s->pb);
- ts |= get_byte(s->pb) << 24;
+ if(size == avio_get_be24(s->pb) + 11){
+ uint32_t ts = avio_get_be24(s->pb);
+ ts |= avio_get_byte(s->pb) << 24;
s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
}
url_fseek(s->pb, pos, SEEK_SET);
@@ -400,10 +400,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
if (st->codec->codec_id == CODEC_ID_AAC ||
st->codec->codec_id == CODEC_ID_H264) {
- int type = get_byte(s->pb);
+ int type = avio_get_byte(s->pb);
size--;
if (st->codec->codec_id == CODEC_ID_H264) {
- int32_t cts = (get_be24(s->pb)+0xff800000)^0xff800000; // sign extension
+ int32_t cts = (avio_get_be24(s->pb)+0xff800000)^0xff800000; // sign extension
pts = dts + cts;
if (cts < 0) { // dts are wrong
flv->wrong_dts = 1;
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 1e08d82..d5349e3 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -39,20 +39,20 @@ struct gxf_stream_info {
* \return 0 if header not found or contains invalid data, 1 otherwise
*/
static int parse_packet_header(ByteIOContext *pb, GXFPktType *type, int *length) {
- if (get_be32(pb))
+ if (avio_get_be32(pb))
return 0;
- if (get_byte(pb) != 1)
+ if (avio_get_byte(pb) != 1)
return 0;
- *type = get_byte(pb);
- *length = get_be32(pb);
+ *type = avio_get_byte(pb);
+ *length = avio_get_be32(pb);
if ((*length >> 24) || *length < 16)
return 0;
*length -= 16;
- if (get_be32(pb))
+ if (avio_get_be32(pb))
return 0;
- if (get_byte(pb) != 0xe1)
+ if (avio_get_byte(pb) != 0xe1)
return 0;
- if (get_byte(pb) != 0xe2)
+ if (avio_get_byte(pb) != 0xe2)
return 0;
return 1;
}
@@ -161,14 +161,14 @@ static void gxf_material_tags(ByteIOContext *pb, int *len, struct gxf_stream_inf
si->first_field = AV_NOPTS_VALUE;
si->last_field = AV_NOPTS_VALUE;
while (*len >= 2) {
- GXFMatTag tag = get_byte(pb);
- int tlen = get_byte(pb);
+ GXFMatTag tag = avio_get_byte(pb);
+ int tlen = avio_get_byte(pb);
*len -= 2;
if (tlen > *len)
return;
*len -= tlen;
if (tlen == 4) {
- uint32_t value = get_be32(pb);
+ uint32_t value = avio_get_be32(pb);
if (tag == MAT_FIRST_FIELD)
si->first_field = value;
else if (tag == MAT_LAST_FIELD)
@@ -210,14 +210,14 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *
si->frames_per_second = (AVRational){0, 0};
si->fields_per_frame = 0;
while (*len >= 2) {
- GXFTrackTag tag = get_byte(pb);
- int tlen = get_byte(pb);
+ GXFTrackTag tag = avio_get_byte(pb);
+ int tlen = avio_get_byte(pb);
*len -= 2;
if (tlen > *len)
return;
*len -= tlen;
if (tlen == 4) {
- uint32_t value = get_be32(pb);
+ uint32_t value = avio_get_be32(pb);
if (tag == TRACK_FPS)
si->frames_per_second = fps_tag2avr(value);
else if (tag == TRACK_FPF && (value == 1 || value == 2))
@@ -233,8 +233,8 @@ static void gxf_track_tags(ByteIOContext *pb, int *len, struct gxf_stream_info *
static void gxf_read_index(AVFormatContext *s, int pkt_len) {
ByteIOContext *pb = s->pb;
AVStream *st = s->streams[0];
- uint32_t fields_per_map = get_le32(pb);
- uint32_t map_cnt = get_le32(pb);
+ uint32_t fields_per_map = avio_get_le32(pb);
+ uint32_t map_cnt = avio_get_le32(pb);
int i;
pkt_len -= 8;
if (s->flags & AVFMT_FLAG_IGNIDX) {
@@ -253,7 +253,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
pkt_len -= 4 * map_cnt;
av_add_index_entry(st, 0, 0, 0, 0, 0);
for (i = 0; i < map_cnt; i++)
- av_add_index_entry(st, (uint64_t)get_le32(pb) * 1024,
+ av_add_index_entry(st, (uint64_t)avio_get_le32(pb) * 1024,
i * (uint64_t)fields_per_map + 1, 0, 0, 0);
url_fskip(pb, pkt_len);
}
@@ -271,12 +271,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
return 0;
}
map_len -= 2;
- if (get_byte(pb) != 0x0e0 || get_byte(pb) != 0xff) {
+ if (avio_get_byte(pb) != 0x0e0 || avio_get_byte(pb) != 0xff) {
av_log(s, AV_LOG_ERROR, "unknown version or invalid map preamble\n");
return 0;
}
map_len -= 2;
- len = get_be16(pb); // length of material data section
+ len = avio_get_be16(pb); // length of material data section
if (len > map_len) {
av_log(s, AV_LOG_ERROR, "material data longer than map data\n");
return 0;
@@ -285,7 +285,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
gxf_material_tags(pb, &len, &si);
url_fskip(pb, len);
map_len -= 2;
- len = get_be16(pb); // length of track description
+ len = avio_get_be16(pb); // length of track description
if (len > map_len) {
av_log(s, AV_LOG_ERROR, "track description longer than map data\n");
return 0;
@@ -296,9 +296,9 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *st;
int idx;
len -= 4;
- track_type = get_byte(pb);
- track_id = get_byte(pb);
- track_len = get_be16(pb);
+ track_type = avio_get_byte(pb);
+ track_id = avio_get_byte(pb);
+ track_len = avio_get_be16(pb);
len -= track_len;
gxf_track_tags(pb, &track_len, &si);
url_fskip(pb, track_len);
@@ -344,7 +344,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
len -= 0x39;
url_fskip(pb, 5); // preamble
url_fskip(pb, 0x30); // payload description
- fps = fps_umf2avr(get_le32(pb));
+ fps = fps_umf2avr(avio_get_le32(pb));
if (!main_timebase.num || !main_timebase.den) {
// this may not always be correct, but simply the best we can get
main_timebase.num = fps.den;
@@ -370,7 +370,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
{ \
if (!max_interval-- || url_feof(pb)) \
goto out; \
- tmp = tmp << 8 | get_byte(pb); \
+ tmp = tmp << 8 | avio_get_byte(pb); \
}
/**
@@ -389,7 +389,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t
int len;
ByteIOContext *pb = s->pb;
GXFPktType type;
- tmp = get_be32(pb);
+ tmp = avio_get_be32(pb);
start:
while (tmp)
READ_ONE();
@@ -404,9 +404,9 @@ start:
goto out;
goto start;
}
- get_byte(pb);
- cur_track = get_byte(pb);
- cur_timestamp = get_be32(pb);
+ avio_get_byte(pb);
+ cur_track = avio_get_byte(pb);
+ cur_timestamp = avio_get_be32(pb);
last_found_pos = url_ftell(pb) - 16 - 6;
if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
if (url_fseek(pb, last_pos, SEEK_SET) >= 0)
@@ -445,17 +445,17 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
continue;
}
pkt_len -= 16;
- track_type = get_byte(pb);
- track_id = get_byte(pb);
+ track_type = avio_get_byte(pb);
+ track_id = avio_get_byte(pb);
stream_index = get_sindex(s, track_id, track_type);
if (stream_index < 0)
return stream_index;
st = s->streams[stream_index];
- field_nr = get_be32(pb);
- field_info = get_be32(pb);
- get_be32(pb); // "timeline" field number
- get_byte(pb); // flags
- get_byte(pb); // reserved
+ field_nr = avio_get_be32(pb);
+ field_info = avio_get_be32(pb);
+ avio_get_be32(pb); // "timeline" field number
+ avio_get_byte(pb); // flags
+ avio_get_byte(pb); // reserved
if (st->codec->codec_id == CODEC_ID_PCM_S24LE ||
st->codec->codec_id == CODEC_ID_PCM_S16LE) {
int first = field_info >> 16;
diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c
index 481db97..f804423 100644
--- a/libavformat/id3v1.c
+++ b/libavformat/id3v1.c
@@ -233,7 +233,7 @@ void ff_id3v1_read(AVFormatContext *s)
filesize = url_fsize(s->pb);
if (filesize > 128) {
url_fseek(s->pb, filesize - 128, SEEK_SET);
- ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
+ ret = avio_get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
if (ret == ID3v1_TAG_SIZE) {
parse_tag(s, buf);
}
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 7cedf6e..1c5a1bb 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -54,7 +54,7 @@ static unsigned int get_size(ByteIOContext *s, int len)
{
int v = 0;
while (len--)
- v = (v << 7) + (get_byte(s) & 0x7F);
+ v = (v << 7) + (avio_get_byte(s) & 0x7F);
return v;
}
@@ -64,7 +64,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c
const char *val = NULL;
int len, dstlen = sizeof(dst) - 1;
unsigned genre;
- unsigned int (*get)(ByteIOContext*) = get_be16;
+ unsigned int (*get)(ByteIOContext*) = avio_get_be16;
dst[0] = 0;
if (taglen < 1)
@@ -72,22 +72,22 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c
taglen--; /* account for encoding type byte */
- switch (get_byte(pb)) { /* encoding type */
+ switch (avio_get_byte(pb)) { /* encoding type */
case ID3v2_ENCODING_ISO8859:
q = dst;
while (taglen-- && q - dst < dstlen - 7) {
uint8_t tmp;
- PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;)
+ PUT_UTF8(avio_get_byte(pb), tmp, *q++ = tmp;)
}
*q = 0;
break;
case ID3v2_ENCODING_UTF16BOM:
taglen -= 2;
- switch (get_be16(pb)) {
+ switch (avio_get_be16(pb)) {
case 0xfffe:
- get = get_le16;
+ get = avio_get_le16;
case 0xfeff:
break;
default:
@@ -110,7 +110,7 @@ static void read_ttag(AVFormatContext *s, ByteIOContext *pb, int taglen, const c
case ID3v2_ENCODING_UTF8:
len = FFMIN(taglen, dstlen);
- get_buffer(pb, dst, len);
+ avio_get_buffer(pb, dst, len);
dst[len] = 0;
break;
default:
@@ -177,18 +177,18 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
int tunsync = 0;
if (isv34) {
- get_buffer(s->pb, tag, 4);
+ avio_get_buffer(s->pb, tag, 4);
tag[4] = 0;
if(version==3){
- tlen = get_be32(s->pb);
+ tlen = avio_get_be32(s->pb);
}else
tlen = get_size(s->pb, 4);
- tflags = get_be16(s->pb);
+ tflags = avio_get_be16(s->pb);
tunsync = tflags & ID3v2_FLAG_UNSYNCH;
} else {
- get_buffer(s->pb, tag, 3);
+ avio_get_buffer(s->pb, tag, 3);
tag[3] = 0;
- tlen = get_be24(s->pb);
+ tlen = avio_get_be24(s->pb);
}
len -= taghdrlen + tlen;
@@ -198,7 +198,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
next = url_ftell(s->pb) + tlen;
if (tflags & ID3v2_FLAG_DATALEN) {
- get_be32(s->pb);
+ avio_get_be32(s->pb);
tlen -= 4;
}
@@ -210,7 +210,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
int i, j;
av_fast_malloc(&buffer, &buffer_size, tlen);
for (i = 0, j = 0; i < tlen; i++, j++) {
- buffer[j] = get_byte(s->pb);
+ buffer[j] = avio_get_byte(s->pb);
if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) {
/* Unsynchronised byte, skip it */
j--;
@@ -258,7 +258,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic)
do {
/* save the current offset in case there's nothing to read/skip */
off = url_ftell(s->pb);
- ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
+ ret = avio_get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
if (ret != ID3v2_HEADER_SIZE)
break;
found_header = ff_id3v2_match(buf, magic);
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index e40d725..5419c2c 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -149,11 +149,11 @@ static int idcin_read_header(AVFormatContext *s,
unsigned int sample_rate, bytes_per_sample, channels;
/* get the 5 header parameters */
- width = get_le32(pb);
- height = get_le32(pb);
- sample_rate = get_le32(pb);
- bytes_per_sample = get_le32(pb);
- channels = get_le32(pb);
+ width = avio_get_le32(pb);
+ height = avio_get_le32(pb);
+ sample_rate = avio_get_le32(pb);
+ bytes_per_sample = avio_get_le32(pb);
+ channels = avio_get_le32(pb);
st = av_new_stream(s, 0);
if (!st)
@@ -169,7 +169,7 @@ static int idcin_read_header(AVFormatContext *s,
/* load up the Huffman tables into extradata */
st->codec->extradata_size = HUFFMAN_TABLE_SIZE;
st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
- if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
+ if (avio_get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
HUFFMAN_TABLE_SIZE)
return AVERROR(EIO);
/* save a reference in order to transport the palette */
@@ -231,13 +231,13 @@ static int idcin_read_packet(AVFormatContext *s,
return AVERROR(EIO);
if (idcin->next_chunk_is_video) {
- command = get_le32(pb);
+ command = avio_get_le32(pb);
if (command == 2) {
return AVERROR(EIO);
} else if (command == 1) {
/* trigger a palette change */
idcin->palctrl.palette_changed = 1;
- if (get_buffer(pb, palette_buffer, 768) != 768)
+ if (avio_get_buffer(pb, palette_buffer, 768) != 768)
return AVERROR(EIO);
/* scale the palette as necessary */
palette_scale = 2;
@@ -255,7 +255,7 @@ static int idcin_read_packet(AVFormatContext *s,
}
}
- chunk_size = get_le32(pb);
+ chunk_size = avio_get_le32(pb);
/* skip the number of decoded bytes (always equal to width * height) */
url_fseek(pb, 4, SEEK_CUR);
chunk_size -= 4;
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 285a3e1..6ffacf5 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -74,7 +74,7 @@ static int roq_read_header(AVFormatContext *s,
unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
/* get the main header */
- if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+ if (avio_get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
framerate = AV_RL16(&preamble[6]);
@@ -115,7 +115,7 @@ static int roq_read_packet(AVFormatContext *s,
return AVERROR(EIO);
/* get the next chunk preamble */
- if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
+ if ((ret = avio_get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
@@ -129,7 +129,7 @@ static int roq_read_packet(AVFormatContext *s,
case RoQ_INFO:
if (!roq->width || !roq->height) {
AVStream *st = s->streams[roq->video_stream_index];
- if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
+ if (avio_get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
st->codec->width = roq->width = AV_RL16(preamble);
st->codec->height = roq->height = AV_RL16(preamble + 2);
@@ -144,7 +144,7 @@ static int roq_read_packet(AVFormatContext *s,
codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
codebook_size = chunk_size;
url_fseek(pb, codebook_size, SEEK_CUR);
- if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+ if (avio_get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
@@ -198,7 +198,7 @@ static int roq_read_packet(AVFormatContext *s,
}
pkt->pos= url_ftell(pb);
- ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
+ ret = avio_get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
chunk_size);
if (ret != chunk_size)
ret = AVERROR(EIO);
diff --git a/libavformat/iff.c b/libavformat/iff.c
index 90a3ea9..0d8400f 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -101,7 +101,7 @@ static int get_metadata(AVFormatContext *s,
if (!buf)
return AVERROR(ENOMEM);
- if (get_buffer(s->pb, buf, data_size) < 0) {
+ if (avio_get_buffer(s->pb, buf, data_size) < 0) {
av_free(buf);
return AVERROR(EIO);
}
@@ -136,14 +136,14 @@ static int iff_read_header(AVFormatContext *s,
st->codec->channels = 1;
url_fskip(pb, 8);
// codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
- st->codec->codec_tag = get_le32(pb);
+ st->codec->codec_tag = avio_get_le32(pb);
while(!url_feof(pb)) {
uint64_t orig_pos;
int res;
const char *metadata_tag = NULL;
- chunk_id = get_le32(pb);
- data_size = get_be32(pb);
+ chunk_id = avio_get_le32(pb);
+ data_size = avio_get_be32(pb);
orig_pos = url_ftell(pb);
switch(chunk_id) {
@@ -153,10 +153,10 @@ static int iff_read_header(AVFormatContext *s,
if (data_size < 14)
return AVERROR_INVALIDDATA;
url_fskip(pb, 12);
- st->codec->sample_rate = get_be16(pb);
+ st->codec->sample_rate = avio_get_be16(pb);
if (data_size >= 16) {
url_fskip(pb, 1);
- compression = get_byte(pb);
+ compression = avio_get_byte(pb);
}
break;
@@ -168,7 +168,7 @@ static int iff_read_header(AVFormatContext *s,
case ID_CHAN:
if (data_size < 4)
return AVERROR_INVALIDDATA;
- st->codec->channels = (get_be32(pb) < 6) ? 1 : 2;
+ st->codec->channels = (avio_get_be32(pb) < 6) ? 1 : 2;
break;
case ID_CMAP:
@@ -176,7 +176,7 @@ static int iff_read_header(AVFormatContext *s,
st->codec->extradata = av_malloc(data_size);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
- if (get_buffer(pb, st->codec->extradata, data_size) < 0)
+ if (avio_get_buffer(pb, st->codec->extradata, data_size) < 0)
return AVERROR(EIO);
break;
@@ -184,18 +184,18 @@ static int iff_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
if (data_size <= 8)
return AVERROR_INVALIDDATA;
- st->codec->width = get_be16(pb);
- st->codec->height = get_be16(pb);
+ st->codec->width = avio_get_be16(pb);
+ st->codec->height = avio_get_be16(pb);
url_fskip(pb, 4); // x, y offset
- st->codec->bits_per_coded_sample = get_byte(pb);
+ st->codec->bits_per_coded_sample = avio_get_byte(pb);
if (data_size >= 11) {
url_fskip(pb, 1); // masking
- compression = get_byte(pb);
+ compression = avio_get_byte(pb);
}
if (data_size >= 16) {
url_fskip(pb, 3); // paddding, transparent
- st->sample_aspect_ratio.num = get_byte(pb);
- st->sample_aspect_ratio.den = get_byte(pb);
+ st->sample_aspect_ratio.num = avio_get_byte(pb);
+ st->sample_aspect_ratio.den = avio_get_byte(pb);
}
break;
@@ -286,7 +286,7 @@ static int iff_read_packet(AVFormatContext *s,
if(st->codec->channels == 2) {
uint8_t sample_buffer[PACKET_SIZE];
- ret = get_buffer(pb, sample_buffer, PACKET_SIZE);
+ ret = avio_get_buffer(pb, sample_buffer, PACKET_SIZE);
if(av_new_packet(pkt, PACKET_SIZE) < 0) {
av_log(s, AV_LOG_ERROR, "cannot allocate packet\n");
return AVERROR(ENOMEM);
diff --git a/libavformat/img2.c b/libavformat/img2.c
index e646e78..6e80072 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -298,7 +298,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
pkt->size= 0;
for(i=0; i<3; i++){
if(size[i]){
- ret[i]= get_buffer(f[i], pkt->data + pkt->size, size[i]);
+ ret[i]= avio_get_buffer(f[i], pkt->data + pkt->size, size[i]);
if (!s->is_pipe)
url_fclose(f[i]);
if(ret[i]>0)
diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c
index 79587b5..a55255d 100644
--- a/libavformat/ingenientdec.c
+++ b/libavformat/ingenientdec.c
@@ -27,18 +27,18 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, size, w, h, unk1, unk2;
- if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
+ if (avio_get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
return AVERROR(EIO); // FIXME
- size = get_le32(s->pb);
+ size = avio_get_le32(s->pb);
- w = get_le16(s->pb);
- h = get_le16(s->pb);
+ w = avio_get_le16(s->pb);
+ h = avio_get_le16(s->pb);
url_fskip(s->pb, 8); // zero + size (padded?)
url_fskip(s->pb, 2);
- unk1 = get_le16(s->pb);
- unk2 = get_le16(s->pb);
+ unk1 = avio_get_le16(s->pb);
+ unk2 = avio_get_le16(s->pb);
url_fskip(s->pb, 22); // ASCII timestamp
av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
@@ -49,7 +49,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos = url_ftell(s->pb);
pkt->stream_index = 0;
- ret = get_buffer(s->pb, pkt->data, size);
+ ret = avio_get_buffer(s->pb, pkt->data, size);
if (ret < 0) {
av_free_packet(pkt);
return ret;
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 6d84402..46b4d3a 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -166,7 +166,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET);
s->decode_map_chunk_offset = 0;
- if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) !=
+ if (avio_get_buffer(pb, pkt->data, s->decode_map_chunk_size) !=
s->decode_map_chunk_size) {
av_free_packet(pkt);
return CHUNK_EOF;
@@ -175,7 +175,7 @@ static int load_ipmovie_packet(IPMVEContext *s, ByteIOContext *pb,
url_fseek(pb, s->video_chunk_offset, SEEK_SET);
s->video_chunk_offset = 0;
- if (get_buffer(pb, pkt->data + s->decode_map_chunk_size,
+ if (avio_get_buffer(pb, pkt->data + s->decode_map_chunk_size,
s->video_chunk_size) != s->video_chunk_size) {
av_free_packet(pkt);
return CHUNK_EOF;
@@ -227,7 +227,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
/* read the next chunk, wherever the file happens to be pointing */
if (url_feof(pb))
return CHUNK_EOF;
- if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
+ if (avio_get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
CHUNK_PREAMBLE_SIZE)
return CHUNK_BAD;
chunk_size = AV_RL16(&chunk_preamble[0]);
@@ -275,7 +275,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
chunk_type = CHUNK_EOF;
break;
}
- if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
+ if (avio_get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
CHUNK_PREAMBLE_SIZE) {
chunk_type = CHUNK_BAD;
break;
@@ -314,7 +314,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
chunk_type = CHUNK_BAD;
break;
}
- if (get_buffer(pb, scratch, opcode_size) !=
+ if (avio_get_buffer(pb, scratch, opcode_size) !=
opcode_size) {
chunk_type = CHUNK_BAD;
break;
@@ -331,7 +331,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
chunk_type = CHUNK_BAD;
break;
}
- if (get_buffer(pb, scratch, opcode_size) !=
+ if (avio_get_buffer(pb, scratch, opcode_size) !=
opcode_size) {
chunk_type = CHUNK_BAD;
break;
@@ -369,7 +369,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
chunk_type = CHUNK_BAD;
break;
}
- if (get_buffer(pb, scratch, opcode_size) !=
+ if (avio_get_buffer(pb, scratch, opcode_size) !=
opcode_size) {
chunk_type = CHUNK_BAD;
break;
@@ -434,7 +434,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, ByteIOContext *pb,
chunk_type = CHUNK_BAD;
break;
}
- if (get_buffer(pb, scratch, opcode_size) != opcode_size) {
+ if (avio_get_buffer(pb, scratch, opcode_size) != opcode_size) {
chunk_type = CHUNK_BAD;
break;
}
@@ -528,10 +528,10 @@ static int ipmovie_read_header(AVFormatContext *s,
int chunk_type;
uint8_t signature_buffer[sizeof(signature)];
- get_buffer(pb, signature_buffer, sizeof(signature_buffer));
+ avio_get_buffer(pb, signature_buffer, sizeof(signature_buffer));
while (memcmp(signature_buffer, signature, sizeof(signature))) {
memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
- signature_buffer[sizeof(signature_buffer) - 1] = get_byte(pb);
+ signature_buffer[sizeof(signature_buffer) - 1] = avio_get_byte(pb);
if (url_feof(pb))
return AVERROR_EOF;
}
@@ -549,7 +549,7 @@ static int ipmovie_read_header(AVFormatContext *s,
/* peek ahead to the next chunk-- if it is an init audio chunk, process
* it; if it is the first video chunk, this is a silent file */
- if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
+ if (avio_get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
chunk_type = AV_RL16(&chunk_preamble[2]);
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 89b352c..88782f3 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -345,7 +345,7 @@ int ff_mp4_read_descr_len(ByteIOContext *pb)
int len = 0;
int count = 4;
while (count--) {
- int c = get_byte(pb);
+ int c = avio_get_byte(pb);
len = (len << 7) | (c & 0x7f);
if (!(c & 0x80))
break;
@@ -356,7 +356,7 @@ int ff_mp4_read_descr_len(ByteIOContext *pb)
int ff_mp4_read_descr(AVFormatContext *fc, ByteIOContext *pb, int *tag)
{
int len;
- *tag = get_byte(pb);
+ *tag = avio_get_byte(pb);
len = ff_mp4_read_descr_len(pb);
av_dlog(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len);
return len;
@@ -374,11 +374,11 @@ static const AVCodecTag mp4_audio_types[] = {
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContext *pb)
{
int len, tag;
- int object_type_id = get_byte(pb);
- get_byte(pb); /* stream type */
- get_be24(pb); /* buffer size db */
- get_be32(pb); /* max bitrate */
- get_be32(pb); /* avg bitrate */
+ int object_type_id = avio_get_byte(pb);
+ avio_get_byte(pb); /* stream type */
+ avio_get_be24(pb); /* buffer size db */
+ avio_get_be32(pb); /* max bitrate */
+ avio_get_be32(pb); /* avg bitrate */
st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id);
av_dlog(fc, "esds object type id 0x%02x\n", object_type_id);
@@ -391,7 +391,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, ByteIOContex
st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
- get_buffer(pb, st->codec->extradata, len);
+ avio_get_buffer(pb, st->codec->extradata, len);
st->codec->extradata_size = len;
if (st->codec->codec_id == CODEC_ID_AAC) {
MPEG4AudioConfig cfg;
diff --git a/libavformat/iss.c b/libavformat/iss.c
index c47c8c8..4ebba85 100644
--- a/libavformat/iss.c
+++ b/libavformat/iss.c
@@ -44,7 +44,7 @@ static void get_token(ByteIOContext *s, char *buf, int maxlen)
int i = 0;
char c;
- while ((c = get_byte(s))) {
+ while ((c = avio_get_byte(s))) {
if(c == ' ')
break;
if (i < maxlen-1)
@@ -52,7 +52,7 @@ static void get_token(ByteIOContext *s, char *buf, int maxlen)
}
if(!c)
- get_byte(s);
+ avio_get_byte(s);
buf[i] = 0; /* Ensure null terminated, but may be truncated */
}
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index 07659cf..d8f4001 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -57,13 +57,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, size, pts, type;
retry:
- type= get_be16(s->pb); // 257 or 258
- size= get_be16(s->pb);
+ type= avio_get_be16(s->pb); // 257 or 258
+ size= avio_get_be16(s->pb);
- get_be16(s->pb); //some flags, 0x80 indicates end of frame
- get_be16(s->pb); //packet number
- pts=get_be32(s->pb);
- get_be32(s->pb); //6A 13 E3 88
+ avio_get_be16(s->pb); //some flags, 0x80 indicates end of frame
+ avio_get_be16(s->pb); //packet number
+ pts=avio_get_be32(s->pb);
+ avio_get_be32(s->pb); //6A 13 E3 88
size -= 12;
if(size<1)
diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index 94b8b82..83449b8 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -36,9 +36,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st;
AVRational time_base;
- get_le32(s->pb); // DKIF
- get_le16(s->pb); // version
- get_le16(s->pb); // header size
+ avio_get_le32(s->pb); // DKIF
+ avio_get_le16(s->pb); // version
+ avio_get_le16(s->pb); // header size
st = av_new_stream(s, 0);
if (!st)
@@ -46,13 +46,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codec->codec_tag = get_le32(s->pb);
+ st->codec->codec_tag = avio_get_le32(s->pb);
st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag);
- st->codec->width = get_le16(s->pb);
- st->codec->height = get_le16(s->pb);
- time_base.den = get_le32(s->pb);
- time_base.num = get_le32(s->pb);
- st->duration = get_le64(s->pb);
+ st->codec->width = avio_get_le16(s->pb);
+ st->codec->height = avio_get_le16(s->pb);
+ time_base.den = avio_get_le32(s->pb);
+ time_base.num = avio_get_le32(s->pb);
+ st->duration = avio_get_le64(s->pb);
st->need_parsing = AVSTREAM_PARSE_HEADERS;
@@ -68,8 +68,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
static int read_packet(AVFormatContext *s, AVPacket *pkt)
{
- int ret, size = get_le32(s->pb);
- int64_t pts = get_le64(s->pb);
+ int ret, size = avio_get_le32(s->pb);
+ int64_t pts = avio_get_le64(s->pb);
ret = av_get_packet(s->pb, pkt, size);
pkt->stream_index = 0;
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 5630bf8..f4db206 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -173,7 +173,7 @@ static int nut_probe(AVProbeData *p) {
static size_t av_read(void * h, size_t len, uint8_t * buf) {
ByteIOContext * bc = h;
- return get_buffer(bc, buf, len);
+ return avio_get_buffer(bc, buf, len);
}
static off_t av_seek(void * h, long long pos, int whence) {
diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
index 5cb202e..1caa6c1 100644
--- a/libavformat/lmlm4.c
+++ b/libavformat/lmlm4.c
@@ -82,9 +82,9 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
int ret;
unsigned int frame_type, packet_size, padding, frame_size;
- get_be16(pb); /* channel number */
- frame_type = get_be16(pb);
- packet_size = get_be32(pb);
+ avio_get_be16(pb); /* channel number */
+ frame_type = avio_get_be16(pb);
+ packet_size = avio_get_be32(pb);
padding = -packet_size & 511;
frame_size = packet_size - 8;
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 1d4d269..39a36c4 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -86,7 +86,7 @@ static int sync(AVFormatContext *s, uint8_t *header)
uint8_t buf[LXF_IDENT_LENGTH];
int ret;
- if ((ret = get_buffer(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH)
+ if ((ret = avio_get_buffer(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH)
return ret < 0 ? ret : AVERROR_EOF;
while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) {
@@ -94,7 +94,7 @@ static int sync(AVFormatContext *s, uint8_t *header)
return AVERROR_EOF;
memmove(buf, &buf[1], LXF_IDENT_LENGTH-1);
- buf[LXF_IDENT_LENGTH-1] = get_byte(s->pb);
+ buf[LXF_IDENT_LENGTH-1] = avio_get_byte(s->pb);
}
memcpy(header, LXF_IDENT, LXF_IDENT_LENGTH);
@@ -120,7 +120,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
return ret;
//read the rest of the packet header
- if ((ret = get_buffer(pb, header + LXF_IDENT_LENGTH,
+ if ((ret = avio_get_buffer(pb, header + LXF_IDENT_LENGTH,
LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH)) !=
LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH) {
return ret < 0 ? ret : AVERROR_EOF;
@@ -214,7 +214,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR_INVALIDDATA;
}
- if ((ret = get_buffer(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
+ if ((ret = avio_get_buffer(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
return ret < 0 ? ret : AVERROR_EOF;
if (!(st = av_new_stream(s, 0)))
@@ -315,7 +315,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt)
//read non-20-bit audio data into lxf->temp so we can deplanarize it
buf = ast && ast->codec->codec_id != CODEC_ID_PCM_LXF ? lxf->temp : pkt->data;
- if ((ret2 = get_buffer(pb, buf, ret)) != ret) {
+ if ((ret2 = avio_get_buffer(pb, buf, ret)) != ret) {
av_free_packet(pkt);
return ret2 < 0 ? ret2 : AVERROR_EOF;
}
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index b5cee29..5450eb2 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -541,10 +541,10 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
int read = 1, n = 1;
uint64_t total = 0;
- /* The first byte tells us the length in bytes - get_byte() can normally
+ /* The first byte tells us the length in bytes - avio_get_byte() can normally
* return 0, but since that's not a valid first ebmlID byte, we can
* use it safely here to catch EOS. */
- if (!(total = get_byte(pb))) {
+ if (!(total = avio_get_byte(pb))) {
/* we might encounter EOS here */
if (!url_feof(pb)) {
int64_t pos = url_ftell(pb);
@@ -568,7 +568,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, ByteIOContext *pb,
/* read out length */
total ^= 1 << ff_log2_tab[total];
while (n++ < read)
- total = (total << 8) | get_byte(pb);
+ total = (total << 8) | avio_get_byte(pb);
*number = total;
@@ -603,7 +603,7 @@ static int ebml_read_uint(ByteIOContext *pb, int size, uint64_t *num)
/* big-endian ordering; build up number */
*num = 0;
while (n++ < size)
- *num = (*num << 8) | get_byte(pb);
+ *num = (*num << 8) | avio_get_byte(pb);
return 0;
}
@@ -617,9 +617,9 @@ static int ebml_read_float(ByteIOContext *pb, int size, double *num)
if (size == 0) {
*num = 0;
} else if (size == 4) {
- *num= av_int2flt(get_be32(pb));
+ *num= av_int2flt(avio_get_be32(pb));
} else if(size==8){
- *num= av_int2dbl(get_be64(pb));
+ *num= av_int2dbl(avio_get_be64(pb));
} else
return AVERROR_INVALIDDATA;
@@ -637,7 +637,7 @@ static int ebml_read_ascii(ByteIOContext *pb, int size, char **str)
* byte more, read the string and NULL-terminate it ourselves. */
if (!(*str = av_malloc(size + 1)))
return AVERROR(ENOMEM);
- if (get_buffer(pb, (uint8_t *) *str, size) != size) {
+ if (avio_get_buffer(pb, (uint8_t *) *str, size) != size) {
av_freep(str);
return AVERROR(EIO);
}
@@ -658,7 +658,7 @@ static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
bin->size = length;
bin->pos = url_ftell(pb);
- if (get_buffer(pb, bin->data, length) != length) {
+ if (avio_get_buffer(pb, bin->data, length) != length) {
av_freep(&bin->data);
return AVERROR(EIO);
}
@@ -1376,12 +1376,12 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
init_put_byte(&b, track->codec_priv.data,track->codec_priv.size,
0, NULL, NULL, NULL, NULL);
url_fskip(&b, 22);
- flavor = get_be16(&b);
- track->audio.coded_framesize = get_be32(&b);
+ flavor = avio_get_be16(&b);
+ track->audio.coded_framesize = avio_get_be32(&b);
url_fskip(&b, 12);
- track->audio.sub_packet_h = get_be16(&b);
- track->audio.frame_size = get_be16(&b);
- track->audio.sub_packet_size = get_be16(&b);
+ track->audio.sub_packet_h = avio_get_be16(&b);
+ track->audio.frame_size = avio_get_be16(&b);
+ track->audio.sub_packet_size = avio_get_be16(&b);
track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h);
if (codec_id == CODEC_ID_RA_288) {
st->codec->block_align = track->audio.coded_framesize;
diff --git a/libavformat/mm.c b/libavformat/mm.c
index 475930f..5c99fcd 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -90,18 +90,18 @@ static int read_header(AVFormatContext *s,
unsigned int type, length;
unsigned int frame_rate, width, height;
- type = get_le16(pb);
- length = get_le32(pb);
+ type = avio_get_le16(pb);
+ length = avio_get_le32(pb);
if (type != MM_TYPE_HEADER)
return AVERROR_INVALIDDATA;
/* read header */
- get_le16(pb); /* total number of chunks */
- frame_rate = get_le16(pb);
- get_le16(pb); /* ibm-pc video bios mode */
- width = get_le16(pb);
- height = get_le16(pb);
+ avio_get_le16(pb); /* total number of chunks */
+ frame_rate = avio_get_le16(pb);
+ avio_get_le16(pb); /* ibm-pc video bios mode */
+ width = avio_get_le16(pb);
+ height = avio_get_le16(pb);
url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */
/* video stream */
@@ -143,7 +143,7 @@ static int read_packet(AVFormatContext *s,
while(1) {
- if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
+ if (avio_get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
return AVERROR(EIO);
}
@@ -162,7 +162,7 @@ static int read_packet(AVFormatContext *s,
if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE))
return AVERROR(ENOMEM);
memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
- if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
+ if (avio_get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
return AVERROR(EIO);
pkt->size = length + MM_PREAMBLE_SIZE;
pkt->stream_index = 0;
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index 11f1187..7b4cb7c 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -188,15 +188,15 @@ static int mmf_read_header(AVFormatContext *s,
int64_t file_size, size;
int rate, params;
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
if (tag != MKTAG('M', 'M', 'M', 'D'))
return -1;
- file_size = get_be32(pb);
+ file_size = avio_get_be32(pb);
/* Skip some unused chunks that may or may not be present */
for(;; url_fseek(pb, size, SEEK_CUR)) {
- tag = get_le32(pb);
- size = get_be32(pb);
+ tag = avio_get_le32(pb);
+ size = avio_get_be32(pb);
if(tag == MKTAG('C','N','T','I')) continue;
if(tag == MKTAG('O','P','D','A')) continue;
break;
@@ -212,22 +212,22 @@ static int mmf_read_header(AVFormatContext *s,
return -1;
}
- get_byte(pb); /* format type */
- get_byte(pb); /* sequence type */
- params = get_byte(pb); /* (channel << 7) | (format << 4) | rate */
+ avio_get_byte(pb); /* format type */
+ avio_get_byte(pb); /* sequence type */
+ params = avio_get_byte(pb); /* (channel << 7) | (format << 4) | rate */
rate = mmf_rate(params & 0x0f);
if(rate < 0) {
av_log(s, AV_LOG_ERROR, "Invalid sample rate\n");
return -1;
}
- get_byte(pb); /* wave base bit */
- get_byte(pb); /* time base d */
- get_byte(pb); /* time base g */
+ avio_get_byte(pb); /* wave base bit */
+ avio_get_byte(pb); /* time base d */
+ avio_get_byte(pb); /* time base g */
/* Skip some unused chunks that may or may not be present */
for(;; url_fseek(pb, size, SEEK_CUR)) {
- tag = get_le32(pb);
- size = get_be32(pb);
+ tag = avio_get_le32(pb);
+ size = avio_get_be32(pb);
if(tag == MKTAG('A','t','s','q')) continue;
if(tag == MKTAG('A','s','p','I')) continue;
break;
@@ -280,7 +280,7 @@ static int mmf_read_packet(AVFormatContext *s,
return AVERROR(EIO);
pkt->stream_index = 0;
- ret = get_buffer(s->pb, pkt->data, pkt->size);
+ ret = avio_get_buffer(s->pb, pkt->data, pkt->size);
if (ret < 0)
av_free_packet(pkt);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a48000f..3e0330c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -82,11 +82,11 @@ static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len)
{
char buf[16];
- get_be16(pb); // unknown
- snprintf(buf, sizeof(buf), "%d", get_be16(pb));
+ avio_get_be16(pb); // unknown
+ snprintf(buf, sizeof(buf), "%d", avio_get_be16(pb));
av_metadata_set2(&c->fc->metadata, "track", buf, 0);
- get_be16(pb); // total tracks
+ avio_get_be16(pb); // total tracks
return 0;
}
@@ -118,7 +118,7 @@ static int mov_read_mac_string(MOVContext *c, ByteIOContext *pb, int len,
int i;
for (i = 0; i < len; i++) {
- uint8_t t, c = get_byte(pb);
+ uint8_t t, c = avio_get_byte(pb);
if (c < 0x80 && p < end)
*p++ = c;
else
@@ -164,17 +164,17 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
}
if (c->itunes_metadata && atom.size > 8) {
- int data_size = get_be32(pb);
- int tag = get_le32(pb);
+ int data_size = avio_get_be32(pb);
+ int tag = avio_get_le32(pb);
if (tag == MKTAG('d','a','t','a')) {
- data_type = get_be32(pb); // type
- get_be32(pb); // unknown
+ data_type = avio_get_be32(pb); // type
+ avio_get_be32(pb); // unknown
str_size = data_size - 16;
atom.size -= 16;
} else return 0;
} else if (atom.size > 4 && key && !c->itunes_metadata) {
- str_size = get_be16(pb); // string length
- langcode = get_be16(pb);
+ str_size = avio_get_be16(pb); // string length
+ langcode = avio_get_be16(pb);
ff_mov_lang_to_iso639(langcode, language);
atom.size -= 4;
} else
@@ -200,7 +200,7 @@ static int mov_read_udta_string(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded
mov_read_mac_string(c, pb, str_size, str, sizeof(str));
} else {
- get_buffer(pb, str, str_size);
+ avio_get_buffer(pb, str, str_size);
str[str_size] = 0;
}
av_metadata_set2(&c->fc->metadata, key, str, 0);
@@ -227,23 +227,23 @@ static int mov_read_chpl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if ((atom.size -= 5) < 0)
return 0;
- version = get_byte(pb);
- get_be24(pb);
+ version = avio_get_byte(pb);
+ avio_get_be24(pb);
if (version)
- get_be32(pb); // ???
- nb_chapters = get_byte(pb);
+ avio_get_be32(pb); // ???
+ nb_chapters = avio_get_byte(pb);
for (i = 0; i < nb_chapters; i++) {
if (atom.size < 9)
return 0;
- start = get_be64(pb);
- str_len = get_byte(pb);
+ start = avio_get_be64(pb);
+ str_len = avio_get_byte(pb);
if ((atom.size -= 9+str_len) < 0)
return 0;
- get_buffer(pb, str, str_len);
+ avio_get_buffer(pb, str, str_len);
str[str_len] = 0;
ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str);
}
@@ -263,14 +263,14 @@ static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
a.size = atom.size;
a.type=0;
if(atom.size >= 8) {
- a.size = get_be32(pb);
- a.type = get_le32(pb);
+ a.size = avio_get_be32(pb);
+ a.type = avio_get_le32(pb);
}
av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
total_size += 8;
if (a.size == 1) { /* 64 bit extended size */
- a.size = get_be64(pb) - 8;
+ a.size = avio_get_be64(pb) - 8;
total_size += 8;
}
if (a.size == 0) {
@@ -330,8 +330,8 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_be32(pb); // version + flags
- entries = get_be32(pb);
+ avio_get_be32(pb); // version + flags
+ entries = avio_get_be32(pb);
if (entries >= UINT_MAX / sizeof(*sc->drefs))
return -1;
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
@@ -341,14 +341,14 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
for (i = 0; i < sc->drefs_count; i++) {
MOVDref *dref = &sc->drefs[i];
- uint32_t size = get_be32(pb);
+ uint32_t size = avio_get_be32(pb);
int64_t next = url_ftell(pb) + size - 4;
if (size < 12)
return -1;
- dref->type = get_le32(pb);
- get_be32(pb); // version + flags
+ dref->type = avio_get_le32(pb);
+ avio_get_be32(pb); // version + flags
av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
if (dref->type == MKTAG('a','l','i','s') && size > 150) {
@@ -358,33 +358,33 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
url_fskip(pb, 10);
- volume_len = get_byte(pb);
+ volume_len = avio_get_byte(pb);
volume_len = FFMIN(volume_len, 27);
- get_buffer(pb, dref->volume, 27);
+ avio_get_buffer(pb, dref->volume, 27);
dref->volume[volume_len] = 0;
av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len);
url_fskip(pb, 12);
- len = get_byte(pb);
+ len = avio_get_byte(pb);
len = FFMIN(len, 63);
- get_buffer(pb, dref->filename, 63);
+ avio_get_buffer(pb, dref->filename, 63);
dref->filename[len] = 0;
av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len);
url_fskip(pb, 16);
/* read next level up_from_alias/down_to_target */
- dref->nlvl_from = get_be16(pb);
- dref->nlvl_to = get_be16(pb);
+ dref->nlvl_from = avio_get_be16(pb);
+ dref->nlvl_to = avio_get_be16(pb);
av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n",
dref->nlvl_from, dref->nlvl_to);
url_fskip(pb, 16);
for (type = 0; type != -1 && url_ftell(pb) < next; ) {
- type = get_be16(pb);
- len = get_be16(pb);
+ type = avio_get_be16(pb);
+ len = avio_get_be16(pb);
av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
if (len&1)
len += 1;
@@ -393,7 +393,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
dref->path = av_mallocz(len+1);
if (!dref->path)
return AVERROR(ENOMEM);
- get_buffer(pb, dref->path, len);
+ avio_get_buffer(pb, dref->path, len);
if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) {
len -= volume_len;
memmove(dref->path, dref->path+volume_len, len);
@@ -408,7 +408,7 @@ static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
dref->dir = av_malloc(len+1);
if (!dref->dir)
return AVERROR(ENOMEM);
- get_buffer(pb, dref->dir, len);
+ avio_get_buffer(pb, dref->dir, len);
dref->dir[len] = 0;
for (j = 0; j < len; j++)
if (dref->dir[j] == ':')
@@ -434,12 +434,12 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
/* component type */
- ctype = get_le32(pb);
- type = get_le32(pb); /* component subtype */
+ ctype = avio_get_le32(pb);
+ type = avio_get_le32(pb); /* component subtype */
av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
av_dlog(c->fc, "stype= %.4s\n", (char*)&type);
@@ -453,9 +453,9 @@ static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
else if(type == MKTAG('s','u','b','p'))
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
- get_be32(pb); /* component manufacture */
- get_be32(pb); /* component flags */
- get_be32(pb); /* component flags mask */
+ avio_get_be32(pb); /* component manufacture */
+ avio_get_be32(pb); /* component flags */
+ avio_get_be32(pb); /* component flags mask */
return 0;
}
@@ -469,13 +469,13 @@ int ff_mov_read_esds(AVFormatContext *fc, ByteIOContext *pb, MOVAtom atom)
return 0;
st = fc->streams[fc->nb_streams-1];
- get_be32(pb); /* version + flags */
+ avio_get_be32(pb); /* version + flags */
len = ff_mp4_read_descr(fc, pb, &tag);
if (tag == MP4ESDescrTag) {
- get_be16(pb); /* ID */
- get_byte(pb); /* priority */
+ avio_get_be16(pb); /* ID */
+ avio_get_byte(pb); /* priority */
} else
- get_be16(pb); /* ID */
+ avio_get_be16(pb); /* ID */
len = ff_mp4_read_descr(fc, pb, &tag);
if (tag == MP4DecConfigDescrTag)
@@ -497,7 +497,7 @@ static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
- ac3info = get_be24(pb);
+ ac3info = avio_get_be24(pb);
acmod = (ac3info >> 11) & 0x7;
lfeon = (ac3info >> 10) & 0x1;
st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
@@ -507,8 +507,8 @@ static int mov_read_dac3(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
static int mov_read_pasp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
- const int num = get_be32(pb);
- const int den = get_be32(pb);
+ const int num = avio_get_be32(pb);
+ const int den = avio_get_be32(pb);
AVStream *st;
if (c->fc->nb_streams < 1)
@@ -546,12 +546,12 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
char* comp_brands_str;
uint8_t type[5] = {0};
- get_buffer(pb, type, 4);
+ avio_get_buffer(pb, type, 4);
if (strcmp(type, "qt "))
c->isom = 1;
av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type);
av_metadata_set2(&c->fc->metadata, "major_brand", type, 0);
- minor_ver = get_be32(pb); /* minor version */
+ minor_ver = avio_get_be32(pb); /* minor version */
snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver);
av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0);
@@ -561,7 +561,7 @@ static int mov_read_ftyp(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null terminator */
if (!comp_brands_str)
return AVERROR(ENOMEM);
- get_buffer(pb, comp_brands_str, comp_brand_size);
+ avio_get_buffer(pb, comp_brands_str, comp_brand_size);
comp_brands_str[comp_brand_size] = 0;
av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0);
av_freep(&comp_brands_str);
@@ -614,27 +614,27 @@ static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- version = get_byte(pb);
+ version = avio_get_byte(pb);
if (version > 1)
return -1; /* unsupported */
- get_be24(pb); /* flags */
+ avio_get_be24(pb); /* flags */
if (version == 1) {
- creation_time = get_be64(pb);
- get_be64(pb);
+ creation_time = avio_get_be64(pb);
+ avio_get_be64(pb);
} else {
- creation_time = get_be32(pb);
- get_be32(pb); /* modification time */
+ creation_time = avio_get_be32(pb);
+ avio_get_be32(pb); /* modification time */
}
mov_metadata_creation_time(&st->metadata, creation_time);
- sc->time_scale = get_be32(pb);
- st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
+ sc->time_scale = avio_get_be32(pb);
+ st->duration = (version == 1) ? avio_get_be64(pb) : avio_get_be32(pb); /* duration */
- lang = get_be16(pb); /* language */
+ lang = avio_get_be16(pb); /* language */
if (ff_mov_lang_to_iso639(lang, language))
av_metadata_set2(&st->metadata, "language", language, 0);
- get_be16(pb); /* quality */
+ avio_get_be16(pb); /* quality */
return 0;
}
@@ -642,37 +642,37 @@ static int mov_read_mdhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
static int mov_read_mvhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
time_t creation_time;
- int version = get_byte(pb); /* version */
- get_be24(pb); /* flags */
+ int version = avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
if (version == 1) {
- creation_time = get_be64(pb);
- get_be64(pb);
+ creation_time = avio_get_be64(pb);
+ avio_get_be64(pb);
} else {
- creation_time = get_be32(pb);
- get_be32(pb); /* modification time */
+ creation_time = avio_get_be32(pb);
+ avio_get_be32(pb); /* modification time */
}
mov_metadata_creation_time(&c->fc->metadata, creation_time);
- c->time_scale = get_be32(pb); /* time scale */
+ c->time_scale = avio_get_be32(pb); /* time scale */
av_dlog(c->fc, "time scale = %i\n", c->time_scale);
- c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
- get_be32(pb); /* preferred scale */
+ c->duration = (version == 1) ? avio_get_be64(pb) : avio_get_be32(pb); /* duration */
+ avio_get_be32(pb); /* preferred scale */
- get_be16(pb); /* preferred volume */
+ avio_get_be16(pb); /* preferred volume */
url_fskip(pb, 10); /* reserved */
url_fskip(pb, 36); /* display matrix */
- get_be32(pb); /* preview time */
- get_be32(pb); /* preview duration */
- get_be32(pb); /* poster time */
- get_be32(pb); /* selection time */
- get_be32(pb); /* selection duration */
- get_be32(pb); /* current time */
- get_be32(pb); /* next track ID */
+ avio_get_be32(pb); /* preview time */
+ avio_get_be32(pb); /* preview duration */
+ avio_get_be32(pb); /* poster time */
+ avio_get_be32(pb); /* selection time */
+ avio_get_be32(pb); /* selection duration */
+ avio_get_be32(pb); /* current time */
+ avio_get_be32(pb); /* next track ID */
return 0;
}
@@ -696,7 +696,7 @@ static int mov_read_smi(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return AVERROR(ENOMEM);
st->codec->extradata_size = 0x5a + atom.size;
memcpy(st->codec->extradata, "SVQ3", 4); // fake
- get_buffer(pb, st->codec->extradata + 0x5a, atom.size);
+ avio_get_buffer(pb, st->codec->extradata + 0x5a, atom.size);
av_dlog(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a);
return 0;
}
@@ -710,7 +710,7 @@ static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
- little_endian = get_be16(pb);
+ little_endian = avio_get_be16(pb);
av_dlog(c->fc, "enda %d\n", little_endian);
if (little_endian == 1) {
switch (st->codec->codec_id) {
@@ -754,7 +754,7 @@ static int mov_read_extradata(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;
AV_WB32( buf , atom.size + 8);
AV_WL32( buf + 4, atom.type);
- get_buffer(pb, buf + 8, atom.size);
+ avio_get_buffer(pb, buf + 8, atom.size);
return 0;
}
@@ -776,7 +776,7 @@ static int mov_read_wave(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = atom.size;
- get_buffer(pb, st->codec->extradata, atom.size);
+ avio_get_buffer(pb, st->codec->extradata, atom.size);
} else if (atom.size > 8) { /* to read frma, esds atoms */
if (mov_read_default(c, pb, atom) < 0)
return -1;
@@ -805,7 +805,7 @@ static int mov_read_glbl(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = atom.size;
- get_buffer(pb, st->codec->extradata, atom.size);
+ avio_get_buffer(pb, st->codec->extradata, atom.size);
return 0;
}
@@ -833,7 +833,7 @@ static int mov_read_strf(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return AVERROR(ENOMEM);
st->codec->extradata_size = atom.size - 40;
url_fskip(pb, 40);
- get_buffer(pb, st->codec->extradata, atom.size - 40);
+ avio_get_buffer(pb, st->codec->extradata, atom.size - 40);
return 0;
}
@@ -848,10 +848,10 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
- entries = get_be32(pb);
+ entries = avio_get_be32(pb);
if(entries >= UINT_MAX/sizeof(int64_t))
return -1;
@@ -863,10 +863,10 @@ static int mov_read_stco(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if (atom.type == MKTAG('s','t','c','o'))
for(i=0; i<entries; i++)
- sc->chunk_offsets[i] = get_be32(pb);
+ sc->chunk_offsets[i] = avio_get_be32(pb);
else if (atom.type == MKTAG('c','o','6','4'))
for(i=0; i<entries; i++)
- sc->chunk_offsets[i] = get_be64(pb);
+ sc->chunk_offsets[i] = avio_get_be64(pb);
else
return -1;
@@ -925,13 +925,13 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
int dref_id = 1;
MOVAtom a = { AV_RL32("stsd") };
int64_t start_pos = url_ftell(pb);
- int size = get_be32(pb); /* size */
- uint32_t format = get_le32(pb); /* data format */
+ int size = avio_get_be32(pb); /* size */
+ uint32_t format = avio_get_le32(pb); /* data format */
if (size >= 16) {
- get_be32(pb); /* reserved */
- get_be16(pb); /* reserved */
- dref_id = get_be16(pb);
+ avio_get_be32(pb); /* reserved */
+ avio_get_be16(pb); /* reserved */
+ dref_id = avio_get_be16(pb);
}
if (st->codec->codec_tag &&
@@ -983,21 +983,21 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
int color_greyscale;
st->codec->codec_id = id;
- get_be16(pb); /* version */
- get_be16(pb); /* revision level */
- get_be32(pb); /* vendor */
- get_be32(pb); /* temporal quality */
- get_be32(pb); /* spatial quality */
+ avio_get_be16(pb); /* version */
+ avio_get_be16(pb); /* revision level */
+ avio_get_be32(pb); /* vendor */
+ avio_get_be32(pb); /* temporal quality */
+ avio_get_be32(pb); /* spatial quality */
- st->codec->width = get_be16(pb); /* width */
- st->codec->height = get_be16(pb); /* height */
+ st->codec->width = avio_get_be16(pb); /* width */
+ st->codec->height = avio_get_be16(pb); /* height */
- get_be32(pb); /* horiz resolution */
- get_be32(pb); /* vert resolution */
- get_be32(pb); /* data size, always 0 */
- get_be16(pb); /* frames per samples */
+ avio_get_be32(pb); /* horiz resolution */
+ avio_get_be32(pb); /* vert resolution */
+ avio_get_be32(pb); /* data size, always 0 */
+ avio_get_be16(pb); /* frames per samples */
- len = get_byte(pb); /* codec name, pascal string */
+ len = avio_get_byte(pb); /* codec name, pascal string */
if (len > 31)
len = 31;
mov_read_mac_string(c, pb, len, st->codec->codec_name, 32);
@@ -1007,8 +1007,8 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
st->codec->codec_tag=MKTAG('I', '4', '2', '0');
- st->codec->bits_per_coded_sample = get_be16(pb); /* depth */
- st->codec->color_table_id = get_be16(pb); /* colortable id */
+ st->codec->bits_per_coded_sample = avio_get_be16(pb); /* depth */
+ st->codec->color_table_id = avio_get_be16(pb); /* colortable id */
av_dlog(c->fc, "depth %d, ctab id %d\n",
st->codec->bits_per_coded_sample, st->codec->color_table_id);
/* figure out the palette situation */
@@ -1058,23 +1058,23 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
}
} else {
/* load the palette from the file */
- color_start = get_be32(pb);
- color_count = get_be16(pb);
- color_end = get_be16(pb);
+ color_start = avio_get_be32(pb);
+ color_count = avio_get_be16(pb);
+ color_end = avio_get_be16(pb);
if ((color_start <= 255) &&
(color_end <= 255)) {
for (j = color_start; j <= color_end; j++) {
/* each R, G, or B component is 16 bits;
* only use the top 8 bits; skip alpha bytes
* up front */
- get_byte(pb);
- get_byte(pb);
- r = get_byte(pb);
- get_byte(pb);
- g = get_byte(pb);
- get_byte(pb);
- b = get_byte(pb);
- get_byte(pb);
+ avio_get_byte(pb);
+ avio_get_byte(pb);
+ r = avio_get_byte(pb);
+ avio_get_byte(pb);
+ g = avio_get_byte(pb);
+ avio_get_byte(pb);
+ b = avio_get_byte(pb);
+ avio_get_byte(pb);
st->codec->palctrl->palette[j] =
(r << 16) | (g << 8) | (b);
}
@@ -1084,38 +1084,38 @@ int ff_mov_read_stsd_entries(MOVContext *c, ByteIOContext *pb, int entries)
}
} else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
int bits_per_sample, flags;
- uint16_t version = get_be16(pb);
+ uint16_t version = avio_get_be16(pb);
st->codec->codec_id = id;
- get_be16(pb); /* revision level */
- get_be32(pb); /* vendor */
+ avio_get_be16(pb); /* revision level */
+ avio_get_be32(pb); /* vendor */
- st->codec->channels = get_be16(pb); /* channel count */
+ st->codec->channels = avio_get_be16(pb); /* channel count */
av_dlog(c->fc, "audio channels %d\n", st->codec->channels);
- st->codec->bits_per_coded_sample = get_be16(pb); /* sample size */
+ st->codec->bits_per_coded_sample = avio_get_be16(pb); /* sample size */
- sc->audio_cid = get_be16(pb);
- get_be16(pb); /* packet size = 0 */
+ sc->audio_cid = avio_get_be16(pb);
+ avio_get_be16(pb); /* packet size = 0 */
- st->codec->sample_rate = ((get_be32(pb) >> 16));
+ st->codec->sample_rate = ((avio_get_be32(pb) >> 16));
//Read QT version 1 fields. In version 0 these do not exist.
av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom);
if(!c->isom) {
if(version==1) {
- sc->samples_per_frame = get_be32(pb);
- get_be32(pb); /* bytes per packet */
- sc->bytes_per_frame = get_be32(pb);
- get_be32(pb); /* bytes per sample */
+ sc->samples_per_frame = avio_get_be32(pb);
+ avio_get_be32(pb); /* bytes per packet */
+ sc->bytes_per_frame = avio_get_be32(pb);
+ avio_get_be32(pb); /* bytes per sample */
} else if(version==2) {
- get_be32(pb); /* sizeof struct only */
- st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */
- st->codec->channels = get_be32(pb);
- get_be32(pb); /* always 0x7F000000 */
- st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */
- flags = get_be32(pb); /* lpcm format specific flag */
- sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */
- sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */
+ avio_get_be32(pb); /* sizeof struct only */
+ st->codec->sample_rate = av_int2dbl(avio_get_be64(pb)); /* float 64 */
+ st->codec->channels = avio_get_be32(pb);
+ avio_get_be32(pb); /* always 0x7F000000 */
+ st->codec->bits_per_coded_sample = avio_get_be32(pb); /* bits per channel if sound is uncompressed */
+ flags = avio_get_be32(pb); /* lpcm format specific flag */
+ sc->bytes_per_frame = avio_get_be32(pb); /* bytes per audio packet if constant */
+ sc->samples_per_frame = avio_get_be32(pb); /* lpcm frames per audio packet if constant */
if (format == MKTAG('l','p','c','m'))
st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
}
@@ -1248,9 +1248,9 @@ static int mov_read_stsd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
int entries;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
- entries = get_be32(pb);
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
+ entries = avio_get_be32(pb);
return ff_mov_read_stsd_entries(c, pb, entries);
}
@@ -1266,10 +1266,10 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
- entries = get_be32(pb);
+ entries = avio_get_be32(pb);
av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
@@ -1281,9 +1281,9 @@ static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
sc->stsc_count = entries;
for(i=0; i<entries; i++) {
- sc->stsc_data[i].first = get_be32(pb);
- sc->stsc_data[i].count = get_be32(pb);
- sc->stsc_data[i].id = get_be32(pb);
+ sc->stsc_data[i].first = avio_get_be32(pb);
+ sc->stsc_data[i].count = avio_get_be32(pb);
+ sc->stsc_data[i].id = avio_get_be32(pb);
}
return 0;
}
@@ -1299,9 +1299,9 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_be32(pb); // version + flags
+ avio_get_be32(pb); // version + flags
- entries = get_be32(pb);
+ entries = avio_get_be32(pb);
if (entries >= UINT_MAX / sizeof(*sc->stps_data))
return -1;
sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data));
@@ -1310,7 +1310,7 @@ static int mov_read_stps(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
sc->stps_count = entries;
for (i = 0; i < entries; i++) {
- sc->stps_data[i] = get_be32(pb);
+ sc->stps_data[i] = avio_get_be32(pb);
//av_dlog(c->fc, "stps %d\n", sc->stps_data[i]);
}
@@ -1328,10 +1328,10 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
- entries = get_be32(pb);
+ entries = avio_get_be32(pb);
av_dlog(c->fc, "keyframe_count = %d\n", entries);
@@ -1343,7 +1343,7 @@ static int mov_read_stss(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
sc->keyframe_count = entries;
for(i=0; i<entries; i++) {
- sc->keyframes[i] = get_be32(pb);
+ sc->keyframes[i] = avio_get_be32(pb);
//av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
}
return 0;
@@ -1362,20 +1362,20 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
if (atom.type == MKTAG('s','t','s','z')) {
- sample_size = get_be32(pb);
+ sample_size = avio_get_be32(pb);
if (!sc->sample_size) /* do not overwrite value computed in stsd */
sc->sample_size = sample_size;
field_size = 32;
} else {
sample_size = 0;
- get_be24(pb); /* reserved */
- field_size = get_byte(pb);
+ avio_get_be24(pb); /* reserved */
+ field_size = avio_get_byte(pb);
}
- entries = get_be32(pb);
+ entries = avio_get_be32(pb);
av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries);
@@ -1402,7 +1402,7 @@ static int mov_read_stsz(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return AVERROR(ENOMEM);
}
- if (get_buffer(pb, buf, num_bytes) < num_bytes) {
+ if (avio_get_buffer(pb, buf, num_bytes) < num_bytes) {
av_freep(&sc->sample_sizes);
av_free(buf);
return -1;
@@ -1430,9 +1430,9 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
- entries = get_be32(pb);
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
+ entries = avio_get_be32(pb);
av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
@@ -1447,8 +1447,8 @@ static int mov_read_stts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
int sample_duration;
int sample_count;
- sample_count=get_be32(pb);
- sample_duration = get_be32(pb);
+ sample_count=avio_get_be32(pb);
+ sample_duration = avio_get_be32(pb);
sc->stts_data[i].count= sample_count;
sc->stts_data[i].duration= sample_duration;
@@ -1475,9 +1475,9 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
- entries = get_be32(pb);
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
+ entries = avio_get_be32(pb);
av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
@@ -1489,8 +1489,8 @@ static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
sc->ctts_count = entries;
for(i=0; i<entries; i++) {
- int count =get_be32(pb);
- int duration =get_be32(pb);
+ int count =avio_get_be32(pb);
+ int duration =avio_get_be32(pb);
sc->ctts_data[i].count = count;
sc->ctts_data[i].duration= duration;
@@ -1836,7 +1836,7 @@ static int mov_read_ilst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
static int mov_read_meta(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
while (atom.size > 8) {
- uint32_t tag = get_le32(pb);
+ uint32_t tag = avio_get_le32(pb);
atom.size -= 4;
if (tag == MKTAG('h','d','l','r')) {
url_fseek(pb, -8, SEEK_CUR);
@@ -1863,8 +1863,8 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
- version = get_byte(pb);
- get_be24(pb); /* flags */
+ version = avio_get_byte(pb);
+ avio_get_be24(pb); /* flags */
/*
MOV_TRACK_ENABLED 0x0001
MOV_TRACK_IN_MOVIE 0x0002
@@ -1873,36 +1873,36 @@ static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
*/
if (version == 1) {
- get_be64(pb);
- get_be64(pb);
+ avio_get_be64(pb);
+ avio_get_be64(pb);
} else {
- get_be32(pb); /* creation time */
- get_be32(pb); /* modification time */
+ avio_get_be32(pb); /* creation time */
+ avio_get_be32(pb); /* modification time */
}
- st->id = (int)get_be32(pb); /* track id (NOT 0 !)*/
- get_be32(pb); /* reserved */
+ st->id = (int)avio_get_be32(pb); /* track id (NOT 0 !)*/
+ avio_get_be32(pb); /* reserved */
/* highlevel (considering edits) duration in movie timebase */
- (version == 1) ? get_be64(pb) : get_be32(pb);
- get_be32(pb); /* reserved */
- get_be32(pb); /* reserved */
+ (version == 1) ? avio_get_be64(pb) : avio_get_be32(pb);
+ avio_get_be32(pb); /* reserved */
+ avio_get_be32(pb); /* reserved */
- get_be16(pb); /* layer */
- get_be16(pb); /* alternate group */
- get_be16(pb); /* volume */
- get_be16(pb); /* reserved */
+ avio_get_be16(pb); /* layer */
+ avio_get_be16(pb); /* alternate group */
+ avio_get_be16(pb); /* volume */
+ avio_get_be16(pb); /* reserved */
//read in the display matrix (outlined in ISO 14496-12, Section 6.2.2)
// they're kept in fixed point format through all calculations
// ignore u,v,z b/c we don't need the scale factor to calc aspect ratio
for (i = 0; i < 3; i++) {
- display_matrix[i][0] = get_be32(pb); // 16.16 fixed point
- display_matrix[i][1] = get_be32(pb); // 16.16 fixed point
- get_be32(pb); // 2.30 fixed point (not used)
+ display_matrix[i][0] = avio_get_be32(pb); // 16.16 fixed point
+ display_matrix[i][1] = avio_get_be32(pb); // 16.16 fixed point
+ avio_get_be32(pb); // 2.30 fixed point (not used)
}
- width = get_be32(pb); // 16.16 fixed point track width
- height = get_be32(pb); // 16.16 fixed point track height
+ width = avio_get_be32(pb); // 16.16 fixed point track width
+ height = avio_get_be32(pb); // 16.16 fixed point track height
sc->width = width >> 16;
sc->height = height >> 16;
@@ -1936,10 +1936,10 @@ static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
MOVTrackExt *trex = NULL;
int flags, track_id, i;
- get_byte(pb); /* version */
- flags = get_be24(pb);
+ avio_get_byte(pb); /* version */
+ flags = avio_get_be24(pb);
- track_id = get_be32(pb);
+ track_id = avio_get_be32(pb);
if (!track_id)
return -1;
frag->track_id = track_id;
@@ -1953,21 +1953,21 @@ static int mov_read_tfhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return -1;
}
- if (flags & 0x01) frag->base_data_offset = get_be64(pb);
+ if (flags & 0x01) frag->base_data_offset = avio_get_be64(pb);
else frag->base_data_offset = frag->moof_offset;
- if (flags & 0x02) frag->stsd_id = get_be32(pb);
+ if (flags & 0x02) frag->stsd_id = avio_get_be32(pb);
else frag->stsd_id = trex->stsd_id;
- frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration;
- frag->size = flags & 0x10 ? get_be32(pb) : trex->size;
- frag->flags = flags & 0x20 ? get_be32(pb) : trex->flags;
+ frag->duration = flags & 0x08 ? avio_get_be32(pb) : trex->duration;
+ frag->size = flags & 0x10 ? avio_get_be32(pb) : trex->size;
+ frag->flags = flags & 0x20 ? avio_get_be32(pb) : trex->flags;
av_dlog(c->fc, "frag flags 0x%x\n", frag->flags);
return 0;
}
static int mov_read_chap(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
{
- c->chapter_track = get_be32(pb);
+ c->chapter_track = avio_get_be32(pb);
return 0;
}
@@ -1982,13 +1982,13 @@ static int mov_read_trex(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return AVERROR(ENOMEM);
c->trex_data = trex;
trex = &c->trex_data[c->trex_count++];
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
- trex->track_id = get_be32(pb);
- trex->stsd_id = get_be32(pb);
- trex->duration = get_be32(pb);
- trex->size = get_be32(pb);
- trex->flags = get_be32(pb);
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
+ trex->track_id = avio_get_be32(pb);
+ trex->stsd_id = avio_get_be32(pb);
+ trex->duration = avio_get_be32(pb);
+ trex->size = avio_get_be32(pb);
+ trex->flags = avio_get_be32(pb);
return 0;
}
@@ -2016,12 +2016,12 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
sc = st->priv_data;
if (sc->pseudo_stream_id+1 != frag->stsd_id)
return 0;
- get_byte(pb); /* version */
- flags = get_be24(pb);
- entries = get_be32(pb);
+ avio_get_byte(pb); /* version */
+ flags = avio_get_be24(pb);
+ entries = avio_get_be32(pb);
av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries);
- if (flags & 0x001) data_offset = get_be32(pb);
- if (flags & 0x004) first_sample_flags = get_be32(pb);
+ if (flags & 0x001) data_offset = avio_get_be32(pb);
+ if (flags & 0x004) first_sample_flags = avio_get_be32(pb);
if (flags & 0x800) {
MOVStts *ctts_data;
if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
@@ -2042,12 +2042,12 @@ static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
unsigned sample_duration = frag->duration;
int keyframe;
- if (flags & 0x100) sample_duration = get_be32(pb);
- if (flags & 0x200) sample_size = get_be32(pb);
- if (flags & 0x400) sample_flags = get_be32(pb);
+ if (flags & 0x100) sample_duration = avio_get_be32(pb);
+ if (flags & 0x200) sample_size = avio_get_be32(pb);
+ if (flags & 0x400) sample_flags = avio_get_be32(pb);
if (flags & 0x800) {
sc->ctts_data[sc->ctts_count].count = 1;
- sc->ctts_data[sc->ctts_count].duration = get_be32(pb);
+ sc->ctts_data[sc->ctts_count].duration = avio_get_be32(pb);
sc->ctts_count++;
}
if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
@@ -2076,11 +2076,11 @@ static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
if (atom.size < 8)
return 0; /* continue */
- if (get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
+ if (avio_get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
url_fskip(pb, atom.size - 4);
return 0;
}
- atom.type = get_le32(pb);
+ atom.type = avio_get_le32(pb);
atom.size -= 8;
if (atom.type != MKTAG('m','d','a','t')) {
url_fskip(pb, atom.size);
@@ -2099,17 +2099,17 @@ static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
long cmov_len, moov_len;
int ret = -1;
- get_be32(pb); /* dcom atom */
- if (get_le32(pb) != MKTAG('d','c','o','m'))
+ avio_get_be32(pb); /* dcom atom */
+ if (avio_get_le32(pb) != MKTAG('d','c','o','m'))
return -1;
- if (get_le32(pb) != MKTAG('z','l','i','b')) {
+ if (avio_get_le32(pb) != MKTAG('z','l','i','b')) {
av_log(c->fc, AV_LOG_ERROR, "unknown compression for cmov atom !");
return -1;
}
- get_be32(pb); /* cmvd atom */
- if (get_le32(pb) != MKTAG('c','m','v','d'))
+ avio_get_be32(pb); /* cmvd atom */
+ if (avio_get_le32(pb) != MKTAG('c','m','v','d'))
return -1;
- moov_len = get_be32(pb); /* uncompressed size */
+ moov_len = avio_get_be32(pb); /* uncompressed size */
cmov_len = atom.size - 6 * 4;
cmov_data = av_malloc(cmov_len);
@@ -2120,7 +2120,7 @@ static int mov_read_cmov(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
av_free(cmov_data);
return AVERROR(ENOMEM);
}
- get_buffer(pb, cmov_data, cmov_len);
+ avio_get_buffer(pb, cmov_data, cmov_len);
if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK)
goto free_and_return;
if(init_put_byte(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
@@ -2151,18 +2151,18 @@ static int mov_read_elst(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
return 0;
sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
- get_byte(pb); /* version */
- get_be24(pb); /* flags */
- edit_count = get_be32(pb); /* entries */
+ avio_get_byte(pb); /* version */
+ avio_get_be24(pb); /* flags */
+ edit_count = avio_get_be32(pb); /* entries */
if((uint64_t)edit_count*12+8 > atom.size)
return -1;
for(i=0; i<edit_count; i++){
int time;
- int duration = get_be32(pb); /* Track duration */
- time = get_be32(pb); /* Media time */
- get_be32(pb); /* Media rate */
+ int duration = avio_get_be32(pb); /* Track duration */
+ time = avio_get_be32(pb); /* Media time */
+ avio_get_be32(pb); /* Media rate */
if (i == 0 && time >= -1) {
sc->time_offset = time != -1 ? time : -duration;
}
@@ -2313,7 +2313,7 @@ static void mov_read_chapters(AVFormatContext *s)
}
// the first two bytes are the length of the title
- len = get_be16(sc->pb);
+ len = avio_get_be16(sc->pb);
if (len > sample->size-2)
continue;
title_len = 2*len + 1;
@@ -2323,7 +2323,7 @@ static void mov_read_chapters(AVFormatContext *s)
// The samples could theoretically be in any encoding if there's an encd
// atom following, but in practice are only utf-8 or utf-16, distinguished
// instead by the presence of a BOM
- ch = get_be16(sc->pb);
+ ch = avio_get_be16(sc->pb);
if (ch == 0xfeff)
avio_get_str16be(sc->pb, len, title, title_len);
else if (ch == 0xfffe)
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 5bc4ce6..e1f65c3 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -80,7 +80,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
MPADecodeHeader c;
int vbrtag_size = 0;
- v = get_be32(s->pb);
+ v = avio_get_be32(s->pb);
if(ff_mpa_check_header(v) < 0)
return -1;
@@ -91,25 +91,25 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
/* Check for Xing / Info tag */
url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
- v = get_be32(s->pb);
+ v = avio_get_be32(s->pb);
if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
- v = get_be32(s->pb);
+ v = avio_get_be32(s->pb);
if(v & 0x1)
- frames = get_be32(s->pb);
+ frames = avio_get_be32(s->pb);
if(v & 0x2)
- size = get_be32(s->pb);
+ size = avio_get_be32(s->pb);
}
/* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
url_fseek(s->pb, base + 4 + 32, SEEK_SET);
- v = get_be32(s->pb);
+ v = avio_get_be32(s->pb);
if(v == MKBETAG('V', 'B', 'R', 'I')) {
/* Check tag version */
- if(get_be16(s->pb) == 1) {
+ if(avio_get_be16(s->pb) == 1) {
/* skip delay and quality */
url_fseek(s->pb, 4, SEEK_CUR);
- frames = get_be32(s->pb);
- size = get_be32(s->pb);
+ frames = avio_get_be32(s->pb);
+ size = avio_get_be32(s->pb);
}
}
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index aa05726..406933b 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -55,16 +55,16 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
MPCContext *c = s->priv_data;
AVStream *st;
- if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
+ if(avio_get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
return -1;
}
- c->ver = get_byte(s->pb);
+ c->ver = avio_get_byte(s->pb);
if(c->ver != 0x07 && c->ver != 0x17){
av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver);
return -1;
}
- c->fcount = get_le32(s->pb);
+ c->fcount = avio_get_le32(s->pb);
if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){
av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n");
return -1;
@@ -85,7 +85,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata_size = 16;
st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
- get_buffer(s->pb, st->codec->extradata, 16);
+ avio_get_buffer(s->pb, st->codec->extradata, 16);
st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
/* scan for seekpoints */
@@ -121,11 +121,11 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
c->curframe++;
curbits = c->curbits;
pos = url_ftell(s->pb);
- tmp = get_le32(s->pb);
+ tmp = avio_get_le32(s->pb);
if(curbits <= 12){
size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
}else{
- tmp = (tmp << 32) | get_le32(s->pb);
+ tmp = (tmp << 32) | avio_get_le32(s->pb);
size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
}
curbits += 20;
@@ -151,7 +151,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = 0;
pkt->pts = cur;
- ret = get_buffer(s->pb, pkt->data + 4, size);
+ ret = avio_get_buffer(s->pb, pkt->data + 4, size);
if(c->curbits)
url_fseek(s->pb, -4, SEEK_CUR);
if(ret < size){
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 1117300..7f685c5 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -121,7 +121,7 @@ static void mpc8_get_chunk_header(ByteIOContext *pb, int *tag, int64_t *size)
{
int64_t pos;
pos = url_ftell(pb);
- *tag = get_le16(pb);
+ *tag = avio_get_le16(pb);
*size = ff_get_v(pb);
*size -= url_ftell(pb) - pos;
}
@@ -143,7 +143,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
}
if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
return;
- get_buffer(s->pb, buf, size);
+ avio_get_buffer(s->pb, buf, size);
init_get_bits(&gb, buf, size * 8);
size = gb_get_v(&gb);
if(size > UINT_MAX/4 || size > c->samples/1152){
@@ -195,7 +195,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
int64_t size, pos;
c->header_pos = url_ftell(pb);
- if(get_le32(pb) != TAG_MPCK){
+ if(avio_get_le32(pb) != TAG_MPCK){
av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
return -1;
}
@@ -213,7 +213,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
pos = url_ftell(pb);
url_fskip(pb, 4); //CRC
- c->ver = get_byte(pb);
+ c->ver = avio_get_byte(pb);
if(c->ver != 8){
av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
return -1;
@@ -230,7 +230,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata_size = 2;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
+ avio_get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 135482b..7990bb1 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -112,7 +112,7 @@ static int mpegps_read_header(AVFormatContext *s,
m->sofdec = -1;
do {
- v = get_byte(s->pb);
+ v = avio_get_byte(s->pb);
m->header_state = m->header_state << 8 | v;
m->sofdec++;
} while (v == sofdec[i] && i++ < 6);
@@ -127,8 +127,8 @@ static int64_t get_pts(ByteIOContext *pb, int c)
{
uint8_t buf[5];
- buf[0] = c<0 ? get_byte(pb) : c;
- get_buffer(pb, buf+1, 4);
+ buf[0] = c<0 ? avio_get_byte(pb) : c;
+ avio_get_buffer(pb, buf+1, 4);
return ff_parse_pes_pts(buf);
}
@@ -144,7 +144,7 @@ static int find_next_start_code(ByteIOContext *pb, int *size_ptr,
while (n > 0) {
if (url_feof(pb))
break;
- v = get_byte(pb);
+ v = avio_get_byte(pb);
n--;
if (state == 0x000001) {
state = ((state << 8) | v) & 0xffffff;
@@ -175,7 +175,7 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr)
if (pos < 0)
pos = 0;
url_fseek(pb, pos, SEEK_SET);
- get_byte(pb);
+ avio_get_byte(pb);
pos = pos_start;
for(;;) {
@@ -185,7 +185,7 @@ static int find_prev_start_code(ByteIOContext *pb, int *size_ptr)
goto the_end;
}
url_fseek(pb, pos, SEEK_SET);
- start_code = get_be32(pb);
+ start_code = avio_get_be32(pb);
if ((start_code & 0xffffff00) == 0x100)
break;
}
@@ -205,27 +205,27 @@ static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb)
{
int psm_length, ps_info_length, es_map_length;
- psm_length = get_be16(pb);
- get_byte(pb);
- get_byte(pb);
- ps_info_length = get_be16(pb);
+ psm_length = avio_get_be16(pb);
+ avio_get_byte(pb);
+ avio_get_byte(pb);
+ ps_info_length = avio_get_be16(pb);
/* skip program_stream_info */
url_fskip(pb, ps_info_length);
- es_map_length = get_be16(pb);
+ es_map_length = avio_get_be16(pb);
/* at least one es available? */
while (es_map_length >= 4){
- unsigned char type = get_byte(pb);
- unsigned char es_id = get_byte(pb);
- uint16_t es_info_length = get_be16(pb);
+ unsigned char type = avio_get_byte(pb);
+ unsigned char es_id = avio_get_byte(pb);
+ uint16_t es_info_length = avio_get_be16(pb);
/* remember mapping from stream id to stream type */
m->psm_es_type[es_id] = type;
/* skip program_stream_info */
url_fskip(pb, es_info_length);
es_map_length -= 4 + es_info_length;
}
- get_be32(pb); /* crc32 */
+ avio_get_be32(pb); /* crc32 */
return 2 + psm_length;
}
@@ -263,16 +263,16 @@ static int mpegps_read_pes_header(AVFormatContext *s,
if (startcode == SYSTEM_HEADER_START_CODE)
goto redo;
if (startcode == PADDING_STREAM) {
- url_fskip(s->pb, get_be16(s->pb));
+ url_fskip(s->pb, avio_get_be16(s->pb));
goto redo;
}
if (startcode == PRIVATE_STREAM_2) {
- len = get_be16(s->pb);
+ len = avio_get_be16(s->pb);
if (!m->sofdec) {
while (len-- >= 6) {
- if (get_byte(s->pb) == 'S') {
+ if (avio_get_byte(s->pb) == 'S') {
uint8_t buf[5];
- get_buffer(s->pb, buf, sizeof(buf));
+ avio_get_buffer(s->pb, buf, sizeof(buf));
m->sofdec = !memcmp(buf, "ofdec", 5);
len -= sizeof(buf);
break;
@@ -296,14 +296,14 @@ static int mpegps_read_pes_header(AVFormatContext *s,
if (ppos) {
*ppos = url_ftell(s->pb) - 4;
}
- len = get_be16(s->pb);
+ len = avio_get_be16(s->pb);
pts =
dts = AV_NOPTS_VALUE;
/* stuffing */
for(;;) {
if (len < 1)
goto error_redo;
- c = get_byte(s->pb);
+ c = avio_get_byte(s->pb);
len--;
/* XXX: for mpeg1, should test only bit 7 */
if (c != 0xff)
@@ -311,8 +311,8 @@ static int mpegps_read_pes_header(AVFormatContext *s,
}
if ((c & 0xc0) == 0x40) {
/* buffer scale & size */
- get_byte(s->pb);
- c = get_byte(s->pb);
+ avio_get_byte(s->pb);
+ c = avio_get_byte(s->pb);
len -= 2;
}
if ((c & 0xe0) == 0x20) {
@@ -330,8 +330,8 @@ static int mpegps_read_pes_header(AVFormatContext *s,
goto redo;
}
#endif
- flags = get_byte(s->pb);
- header_len = get_byte(s->pb);
+ flags = avio_get_byte(s->pb);
+ header_len = avio_get_byte(s->pb);
len -= 2;
if (header_len > len)
goto error_redo;
@@ -349,7 +349,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n");
}
if (flags & 0x01) { /* PES extension */
- pes_ext = get_byte(s->pb);
+ pes_ext = avio_get_byte(s->pb);
header_len--;
/* Skip PES private data, program packet sequence counter and P-STD buffer */
skip = (pes_ext >> 4) & 0xb;
@@ -362,10 +362,10 @@ static int mpegps_read_pes_header(AVFormatContext *s,
header_len -= skip;
if (pes_ext & 0x01) { /* PES extension 2 */
- ext2_len = get_byte(s->pb);
+ ext2_len = avio_get_byte(s->pb);
header_len--;
if ((ext2_len & 0x7f) > 0) {
- id_ext = get_byte(s->pb);
+ id_ext = avio_get_byte(s->pb);
if ((id_ext & 0x80) == 0)
startcode = ((startcode & 0xff) << 8) | id_ext;
header_len--;
@@ -380,17 +380,17 @@ static int mpegps_read_pes_header(AVFormatContext *s,
goto redo;
if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
- startcode = get_byte(s->pb);
+ startcode = avio_get_byte(s->pb);
len--;
if (startcode >= 0x80 && startcode <= 0xcf) {
/* audio: skip header */
- get_byte(s->pb);
- get_byte(s->pb);
- get_byte(s->pb);
+ avio_get_byte(s->pb);
+ avio_get_byte(s->pb);
+ avio_get_byte(s->pb);
len -= 3;
if (startcode >= 0xb0 && startcode <= 0xbf) {
/* MLP/TrueHD audio has a 4-byte header */
- get_byte(s->pb);
+ avio_get_byte(s->pb);
len--;
}
}
@@ -431,7 +431,7 @@ static int mpegps_read_packet(AVFormatContext *s,
return len;
if(startcode == 0x1bd) {
- dvdaudio_substream_type = get_byte(s->pb);
+ dvdaudio_substream_type = avio_get_byte(s->pb);
url_fskip(s->pb, 3);
len -= 4;
}
@@ -473,7 +473,7 @@ static int mpegps_read_packet(AVFormatContext *s,
} else if (startcode >= 0x1e0 && startcode <= 0x1ef) {
static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
unsigned char buf[8];
- get_buffer(s->pb, buf, 8);
+ avio_get_buffer(s->pb, buf, 8);
url_fseek(s->pb, -8, SEEK_CUR);
if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
codec_id = CODEC_ID_CAVS;
@@ -546,9 +546,9 @@ static int mpegps_read_packet(AVFormatContext *s,
audio data */
if (len <= 3)
goto skip;
- get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
- b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
- get_byte(s->pb); /* dynamic range control (0x80 = off) */
+ avio_get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
+ b1 = avio_get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
+ avio_get_byte(s->pb); /* dynamic range control (0x80 = off) */
len -= 3;
freq = (b1 >> 4) & 3;
st->codec->sample_rate = lpcm_freq_tab[freq];
@@ -563,7 +563,7 @@ static int mpegps_read_packet(AVFormatContext *s,
return AVERROR(EINVAL);
}
av_new_packet(pkt, len);
- get_buffer(s->pb, pkt->data, pkt->size);
+ avio_get_buffer(s->pb, pkt->data, pkt->size);
pkt->pts = pts;
pkt->dts = dts;
pkt->pos = dummy_pos;
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 8467e85..5cc2262 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -862,24 +862,24 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size,
len = ff_mp4_read_descr(s, &pb, &tag);
if (tag == MP4IODescrTag) {
- get_be16(&pb); // ID
- get_byte(&pb);
- get_byte(&pb);
- get_byte(&pb);
- get_byte(&pb);
- get_byte(&pb);
+ avio_get_be16(&pb); // ID
+ avio_get_byte(&pb);
+ avio_get_byte(&pb);
+ avio_get_byte(&pb);
+ avio_get_byte(&pb);
+ avio_get_byte(&pb);
len = ff_mp4_read_descr(s, &pb, &tag);
if (tag == MP4ESDescrTag) {
- *es_id = get_be16(&pb); /* ES_ID */
+ *es_id = avio_get_be16(&pb); /* ES_ID */
av_dlog(s, "ES_ID %#x\n", *es_id);
- get_byte(&pb); /* priority */
+ avio_get_byte(&pb); /* priority */
len = ff_mp4_read_descr(s, &pb, &tag);
if (tag == MP4DecConfigDescrTag) {
*dec_config_descr = av_malloc(len);
if (!*dec_config_descr)
return AVERROR(ENOMEM);
*dec_config_descr_size = len;
- get_buffer(&pb, *dec_config_descr, len);
+ avio_get_buffer(&pb, *dec_config_descr, len);
}
}
}
@@ -1329,7 +1329,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
int skip, len;
for(;;) {
- len = get_buffer(pb, buf, TS_PACKET_SIZE);
+ len = avio_get_buffer(pb, buf, TS_PACKET_SIZE);
if (len != TS_PACKET_SIZE)
return AVERROR(EIO);
/* check paquet sync byte */
@@ -1452,7 +1452,7 @@ static int mpegts_read_header(AVFormatContext *s,
/* read the first 1024 bytes to get packet size */
pos = url_ftell(pb);
- len = get_buffer(pb, buf, sizeof(buf));
+ len = avio_get_buffer(pb, buf, sizeof(buf));
if (len != sizeof(buf))
goto fail;
ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
@@ -1562,7 +1562,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
pos = url_ftell(s->pb);
for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
- get_buffer(s->pb, pcr_buf, 12);
+ avio_get_buffer(s->pb, pcr_buf, 12);
if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
/* XXX: not precise enough */
ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) /
@@ -1647,7 +1647,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
if (find_next) {
for(;;) {
url_fseek(s->pb, pos, SEEK_SET);
- if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+ if (avio_get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
return AV_NOPTS_VALUE;
if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
parse_pcr(×tamp, &pcr_l, buf) == 0) {
@@ -1661,7 +1661,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
if (pos < 0)
return AV_NOPTS_VALUE;
url_fseek(s->pb, pos, SEEK_SET);
- if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+ if (avio_get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
return AV_NOPTS_VALUE;
if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
parse_pcr(×tamp, &pcr_l, buf) == 0) {
@@ -1772,7 +1772,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
for(;;) {
url_fseek(s->pb, pos, SEEK_SET);
- if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+ if (avio_get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
return -1;
// pid = AV_RB16(buf + 1) & 0x1fff;
if(buf[1] & 0x40) break;
diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index f9cde02..08b8454 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -88,7 +88,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap)
/* Some files start with "connected\r\n\r\n".
* So skip until we find the first byte of struct size */
- while(get_byte(pb) != HEADER_SIZE && !url_feof(pb));
+ while(avio_get_byte(pb) != HEADER_SIZE && !url_feof(pb));
if(url_feof(pb)) {
av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
@@ -107,11 +107,11 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
url_fskip(pb, 1); /* one byte has been read ahead */
url_fskip(pb, 2);
url_fskip(pb, 2);
- keyframe = get_le16(pb);
- size = get_le32(pb);
+ keyframe = avio_get_le16(pb);
+ size = avio_get_le32(pb);
url_fskip(pb, 4);
url_fskip(pb, 4);
- timestamp = get_le32(pb);
+ timestamp = avio_get_le32(pb);
if(!size || av_get_packet(pb, pkt, size) != size)
return -1;
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index acb21a9..aacc7a4 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -84,16 +84,16 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
unsigned int audio_subsegments;
url_fskip(pb, 3);
- mtv->file_size = get_le32(pb);
- mtv->segments = get_le32(pb);
+ mtv->file_size = avio_get_le32(pb);
+ mtv->segments = avio_get_le32(pb);
url_fskip(pb, 32);
- mtv->audio_identifier = get_le24(pb);
- mtv->audio_br = get_le16(pb);
- mtv->img_colorfmt = get_le24(pb);
- mtv->img_bpp = get_byte(pb);
- mtv->img_width = get_le16(pb);
- mtv->img_height = get_le16(pb);
- mtv->img_segment_size = get_le16(pb);
+ mtv->audio_identifier = avio_get_le24(pb);
+ mtv->audio_br = avio_get_le16(pb);
+ mtv->img_colorfmt = avio_get_le24(pb);
+ mtv->img_bpp = avio_get_byte(pb);
+ mtv->img_width = avio_get_le16(pb);
+ mtv->img_height = avio_get_le16(pb);
+ mtv->img_segment_size = avio_get_le16(pb);
/* Calculate width and height if missing from header */
@@ -106,7 +106,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
/ mtv->img_width;
url_fskip(pb, 4);
- audio_subsegments = get_le16(pb);
+ audio_subsegments = avio_get_le16(pb);
mtv->full_segment_size =
audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
mtv->img_segment_size;
diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index c982e6b..e7ef59b 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -53,20 +53,20 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
vst->codec->extradata_size = 2;
vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE);
- version = get_byte(pb);
- vst->codec->extradata[0] = get_byte(pb);
- vst->codec->extradata[1] = get_byte(pb);
- frames_count = get_le32(pb);
- msecs_per_frame = get_le32(pb);
- vst->codec->width = get_le16(pb);
- vst->codec->height = get_le16(pb);
- get_byte(pb);
- ast->codec->sample_rate = get_le16(pb);
- mvi->audio_data_size = get_le32(pb);
- get_byte(pb);
- player_version = get_le32(pb);
- get_le16(pb);
- get_byte(pb);
+ version = avio_get_byte(pb);
+ vst->codec->extradata[0] = avio_get_byte(pb);
+ vst->codec->extradata[1] = avio_get_byte(pb);
+ frames_count = avio_get_le32(pb);
+ msecs_per_frame = avio_get_le32(pb);
+ vst->codec->width = avio_get_le16(pb);
+ vst->codec->height = avio_get_le16(pb);
+ avio_get_byte(pb);
+ ast->codec->sample_rate = avio_get_le16(pb);
+ mvi->audio_data_size = avio_get_le32(pb);
+ avio_get_byte(pb);
+ player_version = avio_get_le32(pb);
+ avio_get_le16(pb);
+ avio_get_byte(pb);
if (frames_count == 0 || mvi->audio_data_size == 0)
return AVERROR_INVALIDDATA;
@@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_MOTIONPIXELS;
- mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? get_le16 : get_le24;
+ mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_get_le16 : avio_get_le24;
mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size;
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 9193561..dd981a5 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -163,7 +163,7 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x
static int64_t klv_decode_ber_length(ByteIOContext *pb)
{
- uint64_t size = get_byte(pb);
+ uint64_t size = avio_get_byte(pb);
if (size & 0x80) { /* long form */
int bytes_num = size & 0x7f;
/* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */
@@ -171,7 +171,7 @@ static int64_t klv_decode_ber_length(ByteIOContext *pb)
return -1;
size = 0;
while (bytes_num--)
- size = size << 8 | get_byte(pb);
+ size = size << 8 | avio_get_byte(pb);
}
return size;
}
@@ -180,7 +180,7 @@ static int mxf_read_sync(ByteIOContext *pb, const uint8_t *key, unsigned size)
{
int i, b;
for (i = 0; i < size && !url_feof(pb); i++) {
- b = get_byte(pb);
+ b = avio_get_byte(pb);
if (b == key[0])
i = 0;
else if (b != key[i])
@@ -195,7 +195,7 @@ static int klv_read_packet(KLVPacket *klv, ByteIOContext *pb)
return -1;
klv->offset = url_ftell(pb) - 4;
memcpy(klv->key, mxf_klv_key, 4);
- get_buffer(pb, klv->key + 4, 12);
+ avio_get_buffer(pb, klv->key + 4, 12);
klv->length = klv_decode_ber_length(pb);
return klv->length == -1 ? -1 : 0;
}
@@ -224,7 +224,7 @@ static int mxf_get_d10_aes3_packet(ByteIOContext *pb, AVStream *st, AVPacket *pk
if (length > 61444) /* worst case PAL 1920 samples 8 channels */
return -1;
av_new_packet(pkt, length);
- get_buffer(pb, pkt->data, length);
+ avio_get_buffer(pb, pkt->data, length);
data_ptr = pkt->data;
end_ptr = pkt->data + length;
buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */
@@ -265,10 +265,10 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
url_fskip(pb, klv_decode_ber_length(pb));
// plaintext offset
klv_decode_ber_length(pb);
- plaintext_size = get_be64(pb);
+ plaintext_size = avio_get_be64(pb);
// source klv key
klv_decode_ber_length(pb);
- get_buffer(pb, klv->key, 16);
+ avio_get_buffer(pb, klv->key, 16);
if (!IS_KLV_KEY(klv, mxf_essence_element_key))
return -1;
index = mxf_get_stream_index(s, klv);
@@ -276,15 +276,15 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
return -1;
// source size
klv_decode_ber_length(pb);
- orig_size = get_be64(pb);
+ orig_size = avio_get_be64(pb);
if (orig_size < plaintext_size)
return -1;
// enc. code
size = klv_decode_ber_length(pb);
if (size < 32 || size - 32 < orig_size)
return -1;
- get_buffer(pb, ivec, 16);
- get_buffer(pb, tmpbuf, 16);
+ avio_get_buffer(pb, ivec, 16);
+ avio_get_buffer(pb, tmpbuf, 16);
if (mxf->aesc)
av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1);
if (memcmp(tmpbuf, checkv, 16))
@@ -347,8 +347,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
{
MXFContext *mxf = arg;
- int item_num = get_be32(pb);
- int item_len = get_be32(pb);
+ int item_num = avio_get_be32(pb);
+ int item_len = avio_get_be32(pb);
if (item_len != 18) {
av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n");
@@ -360,7 +360,7 @@ static int mxf_read_primer_pack(void *arg, ByteIOContext *pb, int tag, int size,
mxf->local_tags = av_malloc(item_num*item_len);
if (!mxf->local_tags)
return -1;
- get_buffer(pb, mxf->local_tags, item_num*item_len);
+ avio_get_buffer(pb, mxf->local_tags, item_num*item_len);
return 0;
}
@@ -382,7 +382,7 @@ static int mxf_read_cryptographic_context(void *arg, ByteIOContext *pb, int tag,
if (size != 16)
return -1;
if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul))
- get_buffer(pb, cryptocontext->source_container_ul, 16);
+ avio_get_buffer(pb, cryptocontext->source_container_ul, 16);
return 0;
}
@@ -391,14 +391,14 @@ static int mxf_read_content_storage(void *arg, ByteIOContext *pb, int tag, int s
MXFContext *mxf = arg;
switch (tag) {
case 0x1901:
- mxf->packages_count = get_be32(pb);
+ mxf->packages_count = avio_get_be32(pb);
if (mxf->packages_count >= UINT_MAX / sizeof(UID))
return -1;
mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID));
if (!mxf->packages_refs)
return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
- get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
+ avio_get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
break;
}
return 0;
@@ -409,18 +409,18 @@ static int mxf_read_source_clip(void *arg, ByteIOContext *pb, int tag, int size,
MXFStructuralComponent *source_clip = arg;
switch(tag) {
case 0x0202:
- source_clip->duration = get_be64(pb);
+ source_clip->duration = avio_get_be64(pb);
break;
case 0x1201:
- source_clip->start_position = get_be64(pb);
+ source_clip->start_position = avio_get_be64(pb);
break;
case 0x1101:
/* UMID, only get last 16 bytes */
url_fskip(pb, 16);
- get_buffer(pb, source_clip->source_package_uid, 16);
+ avio_get_buffer(pb, source_clip->source_package_uid, 16);
break;
case 0x1102:
- source_clip->source_track_id = get_be32(pb);
+ source_clip->source_track_id = avio_get_be32(pb);
break;
}
return 0;
@@ -431,14 +431,14 @@ static int mxf_read_material_package(void *arg, ByteIOContext *pb, int tag, int
MXFPackage *package = arg;
switch(tag) {
case 0x4403:
- package->tracks_count = get_be32(pb);
+ package->tracks_count = avio_get_be32(pb);
if (package->tracks_count >= UINT_MAX / sizeof(UID))
return -1;
package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
if (!package->tracks_refs)
return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
- get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
+ avio_get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
break;
}
return 0;
@@ -449,17 +449,17 @@ static int mxf_read_track(void *arg, ByteIOContext *pb, int tag, int size, UID u
MXFTrack *track = arg;
switch(tag) {
case 0x4801:
- track->track_id = get_be32(pb);
+ track->track_id = avio_get_be32(pb);
break;
case 0x4804:
- get_buffer(pb, track->track_number, 4);
+ avio_get_buffer(pb, track->track_number, 4);
break;
case 0x4B01:
- track->edit_rate.den = get_be32(pb);
- track->edit_rate.num = get_be32(pb);
+ track->edit_rate.den = avio_get_be32(pb);
+ track->edit_rate.num = avio_get_be32(pb);
break;
case 0x4803:
- get_buffer(pb, track->sequence_ref, 16);
+ avio_get_buffer(pb, track->sequence_ref, 16);
break;
}
return 0;
@@ -470,20 +470,20 @@ static int mxf_read_sequence(void *arg, ByteIOContext *pb, int tag, int size, UI
MXFSequence *sequence = arg;
switch(tag) {
case 0x0202:
- sequence->duration = get_be64(pb);
+ sequence->duration = avio_get_be64(pb);
break;
case 0x0201:
- get_buffer(pb, sequence->data_definition_ul, 16);
+ avio_get_buffer(pb, sequence->data_definition_ul, 16);
break;
case 0x1001:
- sequence->structural_components_count = get_be32(pb);
+ sequence->structural_components_count = avio_get_be32(pb);
if (sequence->structural_components_count >= UINT_MAX / sizeof(UID))
return -1;
sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID));
if (!sequence->structural_components_refs)
return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
- get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
+ avio_get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
break;
}
return 0;
@@ -494,22 +494,22 @@ static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int si
MXFPackage *package = arg;
switch(tag) {
case 0x4403:
- package->tracks_count = get_be32(pb);
+ package->tracks_count = avio_get_be32(pb);
if (package->tracks_count >= UINT_MAX / sizeof(UID))
return -1;
package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
if (!package->tracks_refs)
return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
- get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
+ avio_get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
break;
case 0x4401:
/* UMID, only get last 16 bytes */
url_fskip(pb, 16);
- get_buffer(pb, package->package_uid, 16);
+ avio_get_buffer(pb, package->package_uid, 16);
break;
case 0x4701:
- get_buffer(pb, package->descriptor_ref, 16);
+ avio_get_buffer(pb, package->descriptor_ref, 16);
break;
}
return 0;
@@ -518,12 +518,12 @@ static int mxf_read_source_package(void *arg, ByteIOContext *pb, int tag, int si
static int mxf_read_index_table_segment(void *arg, ByteIOContext *pb, int tag, int size, UID uid)
{
switch(tag) {
- case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break;
- case 0x3F06: av_dlog(NULL, "IndexSID %d\n", get_be32(pb)); break;
- case 0x3F07: av_dlog(NULL, "BodySID %d\n", get_be32(pb)); break;
- case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break;
- case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break;
- case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", get_be64(pb)); break;
+ case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", avio_get_be32(pb)); break;
+ case 0x3F06: av_dlog(NULL, "IndexSID %d\n", avio_get_be32(pb)); break;
+ case 0x3F07: av_dlog(NULL, "BodySID %d\n", avio_get_be32(pb)); break;
+ case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", avio_get_be32(pb), get_be32(pb)); break;
+ case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", avio_get_be64(pb)); break;
+ case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", avio_get_be64(pb)); break;
}
return 0;
}
@@ -534,8 +534,8 @@ static void mxf_read_pixel_layout(ByteIOContext *pb, MXFDescriptor *descriptor)
char layout[16] = {0};
do {
- code = get_byte(pb);
- value = get_byte(pb);
+ code = avio_get_byte(pb);
+ value = avio_get_byte(pb);
av_dlog(NULL, "pixel layout: code %#x\n", code);
if (ofs < 16) {
@@ -552,46 +552,46 @@ static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, in
MXFDescriptor *descriptor = arg;
switch(tag) {
case 0x3F01:
- descriptor->sub_descriptors_count = get_be32(pb);
+ descriptor->sub_descriptors_count = avio_get_be32(pb);
if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID))
return -1;
descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID));
if (!descriptor->sub_descriptors_refs)
return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
- get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
+ avio_get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
break;
case 0x3004:
- get_buffer(pb, descriptor->essence_container_ul, 16);
+ avio_get_buffer(pb, descriptor->essence_container_ul, 16);
break;
case 0x3006:
- descriptor->linked_track_id = get_be32(pb);
+ descriptor->linked_track_id = avio_get_be32(pb);
break;
case 0x3201: /* PictureEssenceCoding */
- get_buffer(pb, descriptor->essence_codec_ul, 16);
+ avio_get_buffer(pb, descriptor->essence_codec_ul, 16);
break;
case 0x3203:
- descriptor->width = get_be32(pb);
+ descriptor->width = avio_get_be32(pb);
break;
case 0x3202:
- descriptor->height = get_be32(pb);
+ descriptor->height = avio_get_be32(pb);
break;
case 0x320E:
- descriptor->aspect_ratio.num = get_be32(pb);
- descriptor->aspect_ratio.den = get_be32(pb);
+ descriptor->aspect_ratio.num = avio_get_be32(pb);
+ descriptor->aspect_ratio.den = avio_get_be32(pb);
break;
case 0x3D03:
- descriptor->sample_rate.num = get_be32(pb);
- descriptor->sample_rate.den = get_be32(pb);
+ descriptor->sample_rate.num = avio_get_be32(pb);
+ descriptor->sample_rate.den = avio_get_be32(pb);
break;
case 0x3D06: /* SoundEssenceCompression */
- get_buffer(pb, descriptor->essence_codec_ul, 16);
+ avio_get_buffer(pb, descriptor->essence_codec_ul, 16);
break;
case 0x3D07:
- descriptor->channels = get_be32(pb);
+ descriptor->channels = avio_get_be32(pb);
break;
case 0x3D01:
- descriptor->bits_per_sample = get_be32(pb);
+ descriptor->bits_per_sample = avio_get_be32(pb);
break;
case 0x3401:
mxf_read_pixel_layout(pb, descriptor);
@@ -603,7 +603,7 @@ static int mxf_read_generic_descriptor(void *arg, ByteIOContext *pb, int tag, in
if (!descriptor->extradata)
return -1;
descriptor->extradata_size = size;
- get_buffer(pb, descriptor->extradata, size);
+ avio_get_buffer(pb, descriptor->extradata, size);
}
break;
}
@@ -871,8 +871,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
if (!ctx)
return -1;
while (url_ftell(pb) + 4 < klv_end) {
- int tag = get_be16(pb);
- int size = get_be16(pb); /* KLV specified by 0x53 */
+ int tag = avio_get_be16(pb);
+ int size = avio_get_be16(pb); /* KLV specified by 0x53 */
uint64_t next = url_ftell(pb) + size;
UID uid = {0};
@@ -893,7 +893,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
}
}
if (ctx_size && tag == 0x3C0A)
- get_buffer(pb, ctx->uid, 16);
+ avio_get_buffer(pb, ctx->uid, 16);
else if (read_child(ctx, pb, tag, size, uid) < 0)
return -1;
diff --git a/libavformat/mxg.c b/libavformat/mxg.c
index 9be97d0..eb3a03d 100644
--- a/libavformat/mxg.c
+++ b/libavformat/mxg.c
@@ -115,7 +115,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size)
if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos;
/* get data */
- ret = get_buffer(s->pb, mxg->buffer_ptr + mxg->cache_size,
+ ret = avio_get_buffer(s->pb, mxg->buffer_ptr + mxg->cache_size,
cache_size - mxg->cache_size);
if (ret < 0)
return ret;
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
index 1472d15..0936a82 100644
--- a/libavformat/ncdec.c
+++ b/libavformat/ncdec.c
@@ -68,11 +68,11 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
while (state != NC_VIDEO_FLAG) {
if (url_feof(s->pb))
return AVERROR(EIO);
- state = (state<<8) + get_byte(s->pb);
+ state = (state<<8) + avio_get_byte(s->pb);
}
- get_byte(s->pb);
- size = get_le16(s->pb);
+ avio_get_byte(s->pb);
+ size = avio_get_le16(s->pb);
url_fskip(s->pb, 9);
if (size == 0) {
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index e15d6e2..eae20a1 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -246,7 +246,7 @@ static int nsv_resync(AVFormatContext *s)
return -1;
}
v <<= 8;
- v |= get_byte(pb);
+ v |= avio_get_byte(pb);
/*
if (i < 8) {
PRINT(("NSV resync: [%d] = %02x\n", i, v & 0x0FF));
@@ -289,23 +289,23 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
nsv->state = NSV_UNSYNC; /* in case we fail */
- size = get_le32(pb);
+ size = avio_get_le32(pb);
if (size < 28)
return -1;
nsv->NSVf_end = size;
- //s->file_size = (uint32_t)get_le32(pb);
- file_size = (uint32_t)get_le32(pb);
+ //s->file_size = (uint32_t)avio_get_le32(pb);
+ file_size = (uint32_t)avio_get_le32(pb);
PRINT(("NSV NSVf chunk_size %u\n", size));
PRINT(("NSV NSVf file_size %u\n", file_size));
- nsv->duration = duration = get_le32(pb); /* in ms */
+ nsv->duration = duration = avio_get_le32(pb); /* in ms */
PRINT(("NSV NSVf duration %"PRId64" ms\n", duration));
// XXX: store it in AVStreams
- strings_size = get_le32(pb);
- table_entries = get_le32(pb);
- table_entries_used = get_le32(pb);
+ strings_size = avio_get_le32(pb);
+ table_entries = avio_get_le32(pb);
+ table_entries_used = avio_get_le32(pb);
PRINT(("NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
strings_size, table_entries, table_entries_used));
if (url_feof(pb))
@@ -321,7 +321,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
p = strings = av_mallocz(strings_size + 1);
endp = strings + strings_size;
- get_buffer(pb, strings, strings_size);
+ avio_get_buffer(pb, strings, strings_size);
while (p < endp) {
while (*p == ' ')
p++; /* strip out spaces */
@@ -356,13 +356,13 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t));
for(i=0;i<table_entries_used;i++)
- nsv->nsvs_file_offset[i] = get_le32(pb) + size;
+ nsv->nsvs_file_offset[i] = avio_get_le32(pb) + size;
if(table_entries > table_entries_used &&
- get_le32(pb) == MKTAG('T','O','C','2')) {
+ avio_get_le32(pb) == MKTAG('T','O','C','2')) {
nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t));
for(i=0;i<table_entries_used;i++) {
- nsv->nsvs_timestamps[i] = get_le32(pb);
+ nsv->nsvs_timestamps[i] = avio_get_le32(pb);
}
}
}
@@ -377,7 +377,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
for (i = 0; i < table_entries; i++) {
unsigned char b[8];
url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
- get_buffer(pb, b, 8);
+ avio_get_buffer(pb, b, 8);
PRINT(("NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
"%c%c%c%c%c%c%c%c\n",
nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i],
@@ -408,11 +408,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
NSVStream *nst;
PRINT(("%s()\n", __FUNCTION__));
- vtag = get_le32(pb);
- atag = get_le32(pb);
- vwidth = get_le16(pb);
- vheight = get_le16(pb);
- i = get_byte(pb);
+ vtag = avio_get_le32(pb);
+ atag = avio_get_le32(pb);
+ vwidth = avio_get_le16(pb);
+ vheight = avio_get_le16(pb);
+ i = avio_get_byte(pb);
PRINT(("NSV NSVs framerate code %2x\n", i));
if(i&0x80) { /* odd way of giving native framerates from docs */
@@ -432,7 +432,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap)
else
framerate= (AVRational){i, 1};
- nsv->avsync = get_le16(pb);
+ nsv->avsync = avio_get_le16(pb);
nsv->framerate = framerate;
#ifdef DEBUG
print_tag("NSV NSVs vtag", vtag, 0);
@@ -581,16 +581,16 @@ null_chunk_retry:
if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)
return -1;
- auxcount = get_byte(pb);
- vsize = get_le16(pb);
- asize = get_le16(pb);
+ auxcount = avio_get_byte(pb);
+ vsize = avio_get_le16(pb);
+ asize = avio_get_le16(pb);
vsize = (vsize << 4) | (auxcount >> 4);
auxcount &= 0x0f;
PRINT(("NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize));
/* skip aux stuff */
for (i = 0; i < auxcount; i++) {
- auxsize = get_le16(pb);
- auxtag = get_le32(pb);
+ auxsize = avio_get_le16(pb);
+ auxtag = avio_get_le32(pb);
PRINT(("NSV aux data: '%c%c%c%c', %d bytes\n",
(auxtag & 0x0ff),
((auxtag >> 8) & 0x0ff),
@@ -638,9 +638,9 @@ null_chunk_retry:
uint8_t bps;
uint8_t channels;
uint16_t samplerate;
- bps = get_byte(pb);
- channels = get_byte(pb);
- samplerate = get_le16(pb);
+ bps = avio_get_byte(pb);
+ channels = avio_get_byte(pb);
+ samplerate = avio_get_le16(pb);
asize-=4;
PRINT(("NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate));
if (fill_header) {
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index a574108..787b96d 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -39,9 +39,9 @@ static int get_str(ByteIOContext *bc, char *string, unsigned int maxlen){
unsigned int len= ff_get_v(bc);
if(len && maxlen)
- get_buffer(bc, string, FFMIN(len, maxlen));
+ avio_get_buffer(bc, string, FFMIN(len, maxlen));
while(len > maxlen){
- get_byte(bc);
+ avio_get_byte(bc);
len--;
}
@@ -64,8 +64,8 @@ static int64_t get_s(ByteIOContext *bc){
static uint64_t get_fourcc(ByteIOContext *bc){
unsigned int len= ff_get_v(bc);
- if (len==2) return get_le16(bc);
- else if(len==4) return get_le32(bc);
+ if (len==2) return avio_get_le16(bc);
+ else if(len==4) return avio_get_le32(bc);
else return -1;
}
@@ -106,7 +106,7 @@ static int get_packetheader(NUTContext *nut, ByteIOContext *bc, int calculate_ch
init_checksum(bc, ff_crc04C11DB7_update, startcode);
size= ff_get_v(bc);
if(size > 4096)
- get_be32(bc);
+ avio_get_be32(bc);
if(get_checksum(bc) && size > 4096)
return -1;
@@ -122,7 +122,7 @@ static uint64_t find_any_startcode(ByteIOContext *bc, int64_t pos){
url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
while(!url_feof(bc)){
- state= (state<<8) | get_byte(bc);
+ state= (state<<8) | avio_get_byte(bc);
if((state>>56) != 'N')
continue;
switch(state){
@@ -182,7 +182,7 @@ static int skip_reserved(ByteIOContext *bc, int64_t pos){
return -1;
}else{
while(pos--)
- get_byte(bc);
+ avio_get_byte(bc);
return 0;
}
}
@@ -279,7 +279,7 @@ static int decode_main_header(NUTContext *nut){
return AVERROR_INVALIDDATA;
}
nut->header[i]= av_malloc(nut->header_len[i]);
- get_buffer(bc, nut->header[i], nut->header_len[i]);
+ avio_get_buffer(bc, nut->header[i], nut->header_len[i]);
}
assert(nut->header_len[0]==0);
}
@@ -355,7 +355,7 @@ static int decode_stream_header(NUTContext *nut){
GET_V(st->codec->extradata_size, tmp < (1<<30));
if(st->codec->extradata_size){
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
+ avio_get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
@@ -514,8 +514,8 @@ static int find_and_decode_index(NUTContext *nut){
int ret= -1;
url_fseek(bc, filesize-12, SEEK_SET);
- url_fseek(bc, filesize-get_be64(bc), SEEK_SET);
- if(get_be64(bc) != INDEX_STARTCODE){
+ url_fseek(bc, filesize-avio_get_be64(bc), SEEK_SET);
+ if(avio_get_be64(bc) != INDEX_STARTCODE){
av_log(s, AV_LOG_ERROR, "no index at the end\n");
return -1;
}
@@ -722,7 +722,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
size -= nut->header_len[*header_idx];
if(flags&FLAG_CHECKSUM){
- get_be32(bc); //FIXME check this
+ avio_get_be32(bc); //FIXME check this
}else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n");
return AVERROR_INVALIDDATA;
@@ -764,7 +764,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
av_new_packet(pkt, size + nut->header_len[header_idx]);
memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
pkt->pos= url_ftell(bc); //FIXME
- get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
+ avio_get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
pkt->stream_index = stream_id;
if (stc->last_flags & FLAG_KEY)
@@ -789,13 +789,13 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
if(tmp){
pos-=8;
}else{
- frame_code = get_byte(bc);
+ frame_code = avio_get_byte(bc);
if(url_feof(bc))
return -1;
if(frame_code == 'N'){
tmp= frame_code;
for(i=1; i<8; i++)
- tmp = (tmp<<8) + get_byte(bc);
+ tmp = (tmp<<8) + avio_get_byte(bc);
}
}
switch(tmp){
@@ -812,7 +812,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
case SYNCPOINT_STARTCODE:
if(decode_syncpoint(nut, &ts, &back_ptr)<0)
goto resync;
- frame_code = get_byte(bc);
+ frame_code = avio_get_byte(bc);
case 0:
ret= decode_frame(nut, pkt, frame_code);
if(ret==0)
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 58a00df..217367d 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -62,16 +62,16 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
return 1; // no codec data needed
while (!url_feof(pb)) {
int size, subtype;
- frametype = get_byte(pb);
+ frametype = avio_get_byte(pb);
switch (frametype) {
case NUV_EXTRADATA:
- subtype = get_byte(pb);
+ subtype = avio_get_byte(pb);
url_fskip(pb, 6);
- size = PKTSIZE(get_le32(pb));
+ size = PKTSIZE(avio_get_le32(pb));
if (vst && subtype == 'R') {
vst->codec->extradata_size = size;
vst->codec->extradata = av_malloc(size);
- get_buffer(pb, vst->codec->extradata, size);
+ avio_get_buffer(pb, vst->codec->extradata, size);
size = 0;
if (!myth)
return 1;
@@ -79,12 +79,12 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
break;
case NUV_MYTHEXT:
url_fskip(pb, 7);
- size = PKTSIZE(get_le32(pb));
+ size = PKTSIZE(avio_get_le32(pb));
if (size != 128 * 4)
break;
- get_le32(pb); // version
+ avio_get_le32(pb); // version
if (vst) {
- vst->codec->codec_tag = get_le32(pb);
+ vst->codec->codec_tag = avio_get_le32(pb);
vst->codec->codec_id =
ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag);
if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
@@ -93,10 +93,10 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
url_fskip(pb, 4);
if (ast) {
- ast->codec->codec_tag = get_le32(pb);
- ast->codec->sample_rate = get_le32(pb);
- ast->codec->bits_per_coded_sample = get_le32(pb);
- ast->codec->channels = get_le32(pb);
+ ast->codec->codec_tag = avio_get_le32(pb);
+ ast->codec->sample_rate = avio_get_le32(pb);
+ ast->codec->bits_per_coded_sample = avio_get_le32(pb);
+ ast->codec->channels = avio_get_le32(pb);
ast->codec->codec_id =
ff_wav_codec_get_id(ast->codec->codec_tag,
ast->codec->bits_per_coded_sample);
@@ -112,7 +112,7 @@ static int get_codec_data(ByteIOContext *pb, AVStream *vst,
break;
default:
url_fskip(pb, 7);
- size = PKTSIZE(get_le32(pb));
+ size = PKTSIZE(avio_get_le32(pb));
break;
}
url_fskip(pb, size);
@@ -128,27 +128,27 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
int is_mythtv, width, height, v_packs, a_packs;
int stream_nr = 0;
AVStream *vst = NULL, *ast = NULL;
- get_buffer(pb, id_string, 12);
+ avio_get_buffer(pb, id_string, 12);
is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
url_fskip(pb, 5); // version string
url_fskip(pb, 3); // padding
- width = get_le32(pb);
- height = get_le32(pb);
- get_le32(pb); // unused, "desiredwidth"
- get_le32(pb); // unused, "desiredheight"
- get_byte(pb); // 'P' == progressive, 'I' == interlaced
+ width = avio_get_le32(pb);
+ height = avio_get_le32(pb);
+ avio_get_le32(pb); // unused, "desiredwidth"
+ avio_get_le32(pb); // unused, "desiredheight"
+ avio_get_byte(pb); // 'P' == progressive, 'I' == interlaced
url_fskip(pb, 3); // padding
- aspect = av_int2dbl(get_le64(pb));
+ aspect = av_int2dbl(avio_get_le64(pb));
if (aspect > 0.9999 && aspect < 1.0001)
aspect = 4.0 / 3.0;
- fps = av_int2dbl(get_le64(pb));
+ fps = av_int2dbl(avio_get_le64(pb));
// number of packets per stream type, -1 means unknown, e.g. streaming
- v_packs = get_le32(pb);
- a_packs = get_le32(pb);
- get_le32(pb); // text
+ v_packs = avio_get_le32(pb);
+ a_packs = avio_get_le32(pb);
+ avio_get_le32(pb); // text
- get_le32(pb); // keyframe distance (?)
+ avio_get_le32(pb); // keyframe distance (?)
if (v_packs) {
ctx->v_id = stream_nr++;
@@ -198,7 +198,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
while (!url_feof(pb)) {
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
uint64_t pos = url_ftell(pb);
- ret = get_buffer(pb, hdr, HDRSIZE);
+ ret = avio_get_buffer(pb, hdr, HDRSIZE);
if (ret < HDRSIZE)
return ret < 0 ? ret : AVERROR(EIO);
frametype = hdr[0];
@@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
pkt->pts = AV_RL32(&hdr[4]);
pkt->stream_index = ctx->v_id;
memcpy(pkt->data, hdr, copyhdrsize);
- ret = get_buffer(pb, pkt->data + copyhdrsize, size);
+ ret = avio_get_buffer(pb, pkt->data + copyhdrsize, size);
if (ret < 0) {
av_free_packet(pkt);
return ret;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 1b4553c..0ac6bbe 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -207,7 +207,7 @@ ogg_read_page (AVFormatContext * s, int *str)
uint8_t sync[4];
int sp = 0;
- if (get_buffer (bc, sync, 4) < 4)
+ if (avio_get_buffer (bc, sync, 4) < 4)
return -1;
do{
@@ -233,10 +233,10 @@ ogg_read_page (AVFormatContext * s, int *str)
return -1;
flags = url_fgetc (bc);
- gp = get_le64 (bc);
- serial = get_le32 (bc);
- seq = get_le32 (bc);
- crc = get_le32 (bc);
+ gp = avio_get_le64 (bc);
+ serial = avio_get_le32 (bc);
+ seq = avio_get_le32 (bc);
+ crc = avio_get_le32 (bc);
nsegs = url_fgetc (bc);
idx = ogg_find_stream (ogg, serial);
@@ -252,7 +252,7 @@ ogg_read_page (AVFormatContext * s, int *str)
if(os->psize > 0)
ogg_new_buf(ogg, idx);
- if (get_buffer (bc, os->segments, nsegs) < nsegs)
+ if (avio_get_buffer (bc, os->segments, nsegs) < nsegs)
return -1;
os->nsegs = nsegs;
@@ -284,7 +284,7 @@ ogg_read_page (AVFormatContext * s, int *str)
os->buf = nb;
}
- if (get_buffer (bc, os->buf + os->bufpos, size) < size)
+ if (avio_get_buffer (bc, os->buf + os->bufpos, size) < size)
return -1;
os->bufpos += size;
diff --git a/libavformat/oma.c b/libavformat/oma.c
index 158ed11..2a3139d 100644
--- a/libavformat/oma.c
+++ b/libavformat/oma.c
@@ -79,7 +79,7 @@ static int oma_read_header(AVFormatContext *s,
AVStream *st;
ff_id3v2_read(s, ID3v2_EA3_MAGIC);
- ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
+ ret = avio_get_buffer(s->pb, buf, EA3_HEADER_SIZE);
if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 4b3d0f3..f306519 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -105,7 +105,7 @@ static int str_read_header(AVFormatContext *s,
int i;
/* skip over any RIFF header */
- if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
+ if (avio_get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
return AVERROR(EIO);
if (AV_RL32(§or[0]) == RIFF_TAG)
start = RIFF_HEADER_SIZE;
@@ -136,7 +136,7 @@ static int str_read_packet(AVFormatContext *s,
while (1) {
- if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
+ if (avio_get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
return AVERROR(EIO);
channel = sector[0x11];
diff --git a/libavformat/pva.c b/libavformat/pva.c
index 544fc7d..b97d75f 100644
--- a/libavformat/pva.c
+++ b/libavformat/pva.c
@@ -75,12 +75,12 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts,
recover:
startpos = url_ftell(pb);
- syncword = get_be16(pb);
- streamid = get_byte(pb);
- get_byte(pb); /* counter not used */
- reserved = get_byte(pb);
- flags = get_byte(pb);
- length = get_be16(pb);
+ syncword = avio_get_be16(pb);
+ streamid = avio_get_byte(pb);
+ avio_get_byte(pb); /* counter not used */
+ reserved = avio_get_byte(pb);
+ flags = avio_get_byte(pb);
+ length = avio_get_be16(pb);
pts_flag = flags & 0x10;
@@ -101,7 +101,7 @@ recover:
}
if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) {
- pva_pts = get_be32(pb);
+ pva_pts = avio_get_be32(pb);
length -= 4;
} else if (streamid == PVA_AUDIO_PAYLOAD) {
/* PVA Audio Packets either start with a signaled PES packet or
@@ -113,11 +113,11 @@ recover:
pes_flags;
unsigned char pes_header_data[256];
- pes_signal = get_be24(pb);
- get_byte(pb);
- pes_packet_length = get_be16(pb);
- pes_flags = get_be16(pb);
- pes_header_data_length = get_byte(pb);
+ pes_signal = avio_get_be24(pb);
+ avio_get_byte(pb);
+ pes_packet_length = avio_get_be16(pb);
+ pes_flags = avio_get_be16(pb);
+ pes_header_data_length = avio_get_byte(pb);
if (pes_signal != 1) {
pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, "
@@ -128,7 +128,7 @@ recover:
goto recover;
}
- get_buffer(pb, pes_header_data, pes_header_data_length);
+ avio_get_buffer(pb, pes_header_data, pes_header_data_length);
length -= 9 + pes_header_data_length;
pes_packet_length -= 3 + pes_header_data_length;
diff --git a/libavformat/qcp.c b/libavformat/qcp.c
index 7bc32b9..1690bb5 100644
--- a/libavformat/qcp.c
+++ b/libavformat/qcp.c
@@ -91,13 +91,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
- get_be32(pb); // "RIFF"
- s->file_size = get_le32(pb) + 8;
+ avio_get_be32(pb); // "RIFF"
+ s->file_size = avio_get_le32(pb) + 8;
url_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->channels = 1;
- get_buffer(pb, buf, 16);
+ avio_get_buffer(pb, buf, 16);
if (is_qcelp_13k_guid(buf)) {
st->codec->codec_id = CODEC_ID_QCELP;
} else if (!memcmp(buf, guid_evrc, 16)) {
@@ -111,19 +111,19 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR_INVALIDDATA;
}
url_fskip(pb, 2 + 80); // codec-version + codec-name
- st->codec->bit_rate = get_le16(pb);
+ st->codec->bit_rate = avio_get_le16(pb);
- s->packet_size = get_le16(pb);
+ s->packet_size = avio_get_le16(pb);
url_fskip(pb, 2); // block-size
- st->codec->sample_rate = get_le16(pb);
+ st->codec->sample_rate = avio_get_le16(pb);
url_fskip(pb, 2); // sample-size
memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode));
- nb_rates = get_le32(pb);
+ nb_rates = avio_get_le32(pb);
nb_rates = FFMIN(nb_rates, 8);
for (i=0; i<nb_rates; i++) {
- int size = get_byte(pb);
- int mode = get_byte(pb);
+ int size = avio_get_byte(pb);
+ int mode = avio_get_byte(pb);
if (mode > QCP_MAX_MODE) {
av_log(s, AV_LOG_WARNING, "Unknown entry %d=>%d in rate-map-table.\n ", mode, size);
} else
@@ -142,7 +142,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
while(!url_feof(pb)) {
if (c->data_size) {
- int pkt_size, ret, mode = get_byte(pb);
+ int pkt_size, ret, mode = avio_get_byte(pb);
if (s->packet_size) {
pkt_size = s->packet_size - 1;
@@ -165,14 +165,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
}
- if (url_ftell(pb) & 1 && get_byte(pb))
+ if (url_ftell(pb) & 1 && avio_get_byte(pb))
av_log(s, AV_LOG_WARNING, "Padding should be 0.\n");
- tag = get_le32(pb);
- chunk_size = get_le32(pb);
+ tag = avio_get_le32(pb);
+ chunk_size = avio_get_le32(pb);
switch (tag) {
case MKTAG('v', 'r', 'a', 't'):
- if (get_le32(pb)) // var-rate-flag
+ if (avio_get_le32(pb)) // var-rate-flag
s->packet_size = 0;
url_fskip(pb, 4); // size-in-packets
break;
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 9c9fa1b..91f6c00 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -39,10 +39,10 @@ typedef struct {
static int read_atom(AVFormatContext *s, Atom *atom)
{
atom->offset = url_ftell(s->pb);
- atom->size = get_be32(s->pb);
+ atom->size = avio_get_be32(s->pb);
if (atom->size < 8)
return -1;
- atom->tag = get_le32(s->pb);
+ atom->tag = avio_get_le32(s->pb);
av_dlog(s, "atom %d %.4s offset %#llx\n",
atom->size, (char*)&atom->tag, atom->offset);
return atom->size;
@@ -59,31 +59,31 @@ static int r3d_read_red1(AVFormatContext *s)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_JPEG2000;
- tmp = get_byte(s->pb); // major version
- tmp2 = get_byte(s->pb); // minor version
+ tmp = avio_get_byte(s->pb); // major version
+ tmp2 = avio_get_byte(s->pb); // minor version
av_dlog(s, "version %d.%d\n", tmp, tmp2);
- tmp = get_be16(s->pb); // unknown
+ tmp = avio_get_be16(s->pb); // unknown
av_dlog(s, "unknown1 %d\n", tmp);
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_set_pts_info(st, 32, 1, tmp);
- tmp = get_be32(s->pb); // filenum
+ tmp = avio_get_be32(s->pb); // filenum
av_dlog(s, "filenum %d\n", tmp);
url_fskip(s->pb, 32); // unknown
- st->codec->width = get_be32(s->pb);
- st->codec->height = get_be32(s->pb);
+ st->codec->width = avio_get_be32(s->pb);
+ st->codec->height = avio_get_be32(s->pb);
- tmp = get_be16(s->pb); // unknown
+ tmp = avio_get_be16(s->pb); // unknown
av_dlog(s, "unknown2 %d\n", tmp);
- st->codec->time_base.den = get_be16(s->pb);
- st->codec->time_base.num = get_be16(s->pb);
+ st->codec->time_base.den = avio_get_be16(s->pb);
+ st->codec->time_base.num = avio_get_be16(s->pb);
- tmp = get_byte(s->pb); // audio channels
+ tmp = avio_get_byte(s->pb); // audio channels
av_dlog(s, "audio channels %d\n", tmp);
if (tmp > 0) {
AVStream *ast = av_new_stream(s, 1);
@@ -95,7 +95,7 @@ static int r3d_read_red1(AVFormatContext *s)
av_set_pts_info(ast, 32, 1, st->time_base.den);
}
- get_buffer(s->pb, filename, 257);
+ avio_get_buffer(s->pb, filename, 257);
filename[sizeof(filename)-1] = 0;
av_metadata_set2(&st->metadata, "filename", filename, 0);
@@ -120,7 +120,7 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom)
return AVERROR(ENOMEM);
for (i = 0; i < r3d->video_offsets_count; i++) {
- r3d->video_offsets[i] = get_be32(s->pb);
+ r3d->video_offsets[i] = avio_get_be32(s->pb);
if (!r3d->video_offsets[i]) {
r3d->video_offsets_count = i;
break;
@@ -141,15 +141,15 @@ static void r3d_read_reos(AVFormatContext *s)
R3DContext *r3d = s->priv_data;
int tmp;
- r3d->rdvo_offset = get_be32(s->pb);
- get_be32(s->pb); // rdvs offset
- get_be32(s->pb); // rdao offset
- get_be32(s->pb); // rdas offset
+ r3d->rdvo_offset = avio_get_be32(s->pb);
+ avio_get_be32(s->pb); // rdvs offset
+ avio_get_be32(s->pb); // rdao offset
+ avio_get_be32(s->pb); // rdas offset
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_dlog(s, "num video chunks %d\n", tmp);
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_dlog(s, "num audio chunks %d\n", tmp);
url_fskip(s->pb, 6*4);
@@ -214,31 +214,31 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
unsigned dts;
int ret;
- dts = get_be32(s->pb);
+ dts = avio_get_be32(s->pb);
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_dlog(s, "frame num %d\n", tmp);
- tmp = get_byte(s->pb); // major version
- tmp2 = get_byte(s->pb); // minor version
+ tmp = avio_get_byte(s->pb); // major version
+ tmp2 = avio_get_byte(s->pb); // minor version
av_dlog(s, "version %d.%d\n", tmp, tmp2);
- tmp = get_be16(s->pb); // unknown
+ tmp = avio_get_be16(s->pb); // unknown
av_dlog(s, "unknown %d\n", tmp);
if (tmp > 4) {
- tmp = get_be16(s->pb); // unknown
+ tmp = avio_get_be16(s->pb); // unknown
av_dlog(s, "unknown %d\n", tmp);
- tmp = get_be16(s->pb); // unknown
+ tmp = avio_get_be16(s->pb); // unknown
av_dlog(s, "unknown %d\n", tmp);
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_dlog(s, "width %d\n", tmp);
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_dlog(s, "height %d\n", tmp);
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_dlog(s, "metadata len %d\n", tmp);
}
tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
@@ -268,23 +268,23 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
unsigned dts;
int ret;
- dts = get_be32(s->pb);
+ dts = avio_get_be32(s->pb);
- st->codec->sample_rate = get_be32(s->pb);
+ st->codec->sample_rate = avio_get_be32(s->pb);
- samples = get_be32(s->pb);
+ samples = avio_get_be32(s->pb);
- tmp = get_be32(s->pb);
+ tmp = avio_get_be32(s->pb);
av_dlog(s, "packet num %d\n", tmp);
- tmp = get_be16(s->pb); // unkown
+ tmp = avio_get_be16(s->pb); // unkown
av_dlog(s, "unknown %d\n", tmp);
- tmp = get_byte(s->pb); // major version
- tmp2 = get_byte(s->pb); // minor version
+ tmp = avio_get_byte(s->pb); // major version
+ tmp2 = avio_get_byte(s->pb); // minor version
av_dlog(s, "version %d.%d\n", tmp, tmp2);
- tmp = get_be32(s->pb); // unknown
+ tmp = avio_get_be32(s->pb); // unknown
av_dlog(s, "unknown %d\n", tmp);
size = atom->size - 8 - (url_ftell(s->pb) - pos);
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index 4f830e3..cf565ee 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -81,7 +81,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos= url_ftell(s->pb);
pkt->stream_index = 0;
- ret = get_partial_buffer(s->pb, pkt->data, size);
+ ret = avio_get_partial_buffer(s->pb, pkt->data, size);
if (ret < 0) {
av_free_packet(pkt);
return ret;
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index 3428b4d..0cf81ab 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -157,25 +157,25 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
return -1;
init_put_byte(&pb, rdt->mlti_data, rdt->mlti_data_size, 0,
NULL, NULL, NULL, NULL);
- tag = get_le32(&pb);
+ tag = avio_get_le32(&pb);
if (tag == MKTAG('M', 'L', 'T', 'I')) {
int num, chunk_nr;
/* read index of MDPR chunk numbers */
- num = get_be16(&pb);
+ num = avio_get_be16(&pb);
if (rule_nr < 0 || rule_nr >= num)
return -1;
url_fskip(&pb, rule_nr * 2);
- chunk_nr = get_be16(&pb);
+ chunk_nr = avio_get_be16(&pb);
url_fskip(&pb, (num - 1 - rule_nr) * 2);
/* read MDPR chunks */
- num = get_be16(&pb);
+ num = avio_get_be16(&pb);
if (chunk_nr >= num)
return -1;
while (chunk_nr--)
- url_fskip(&pb, get_be32(&pb));
- size = get_be32(&pb);
+ url_fskip(&pb, avio_get_be32(&pb));
+ size = avio_get_be32(&pb);
} else {
size = rdt->mlti_data_size;
url_fseek(&pb, 0, SEEK_SET);
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 27e6e7b..7d720c7 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -481,25 +481,25 @@ void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
{
int id;
- id = get_le16(pb);
+ id = avio_get_le16(pb);
codec->codec_type = AVMEDIA_TYPE_AUDIO;
codec->codec_tag = id;
- codec->channels = get_le16(pb);
- codec->sample_rate = get_le32(pb);
- codec->bit_rate = get_le32(pb) * 8;
- codec->block_align = get_le16(pb);
+ codec->channels = avio_get_le16(pb);
+ codec->sample_rate = avio_get_le32(pb);
+ codec->bit_rate = avio_get_le32(pb) * 8;
+ codec->block_align = avio_get_le16(pb);
if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */
codec->bits_per_coded_sample = 8;
}else
- codec->bits_per_coded_sample = get_le16(pb);
+ codec->bits_per_coded_sample = avio_get_le16(pb);
if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */
- int cbSize = get_le16(pb); /* cbSize */
+ int cbSize = avio_get_le16(pb); /* cbSize */
size -= 18;
cbSize = FFMIN(size, cbSize);
if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
- codec->bits_per_coded_sample = get_le16(pb);
- codec->channel_layout = get_le32(pb); /* dwChannelMask */
- id = get_le32(pb); /* 4 first bytes of GUID */
+ codec->bits_per_coded_sample = avio_get_le16(pb);
+ codec->channel_layout = avio_get_le32(pb); /* dwChannelMask */
+ id = avio_get_le32(pb); /* 4 first bytes of GUID */
url_fskip(pb, 12); /* skip end of GUID */
cbSize -= 22;
size -= 22;
@@ -507,7 +507,7 @@ void ff_get_wav_header(ByteIOContext *pb, AVCodecContext *codec, int size)
codec->extradata_size = cbSize;
if (cbSize > 0) {
codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- get_buffer(pb, codec->extradata, codec->extradata_size);
+ avio_get_buffer(pb, codec->extradata, codec->extradata_size);
size -= cbSize;
}
@@ -547,17 +547,17 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps)
int ff_get_bmp_header(ByteIOContext *pb, AVStream *st)
{
int tag1;
- get_le32(pb); /* size */
- st->codec->width = get_le32(pb);
- st->codec->height = (int32_t)get_le32(pb);
- get_le16(pb); /* planes */
- st->codec->bits_per_coded_sample= get_le16(pb); /* depth */
- tag1 = get_le32(pb);
- get_le32(pb); /* ImageSize */
- get_le32(pb); /* XPelsPerMeter */
- get_le32(pb); /* YPelsPerMeter */
- get_le32(pb); /* ClrUsed */
- get_le32(pb); /* ClrImportant */
+ avio_get_le32(pb); /* size */
+ st->codec->width = avio_get_le32(pb);
+ st->codec->height = (int32_t)avio_get_le32(pb);
+ avio_get_le16(pb); /* planes */
+ st->codec->bits_per_coded_sample= avio_get_le16(pb); /* depth */
+ tag1 = avio_get_le32(pb);
+ avio_get_le32(pb); /* ImageSize */
+ avio_get_le32(pb); /* XPelsPerMeter */
+ avio_get_le32(pb); /* YPelsPerMeter */
+ avio_get_le32(pb); /* ClrUsed */
+ avio_get_le32(pb); /* ClrImportant */
return tag1;
}
#endif // CONFIG_DEMUXERS
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index ed1fb23..14f8f19 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -96,20 +96,20 @@ static av_cold int rl2_read_header(AVFormatContext *s,
int ret = 0;
url_fskip(pb,4); /* skip FORM tag */
- back_size = get_le32(pb); /**< get size of the background frame */
- signature = get_be32(pb);
- data_size = get_be32(pb);
- frame_count = get_le32(pb);
+ back_size = avio_get_le32(pb); /**< get size of the background frame */
+ signature = avio_get_be32(pb);
+ data_size = avio_get_be32(pb);
+ frame_count = avio_get_le32(pb);
/* disallow back_sizes and frame_counts that may lead to overflows later */
if(back_size > INT_MAX/2 || frame_count > INT_MAX / sizeof(uint32_t))
return AVERROR_INVALIDDATA;
- encoding_method = get_le16(pb);
- sound_rate = get_le16(pb);
- rate = get_le16(pb);
- channels = get_le16(pb);
- def_sound_size = get_le16(pb);
+ encoding_method = avio_get_le16(pb);
+ sound_rate = avio_get_le16(pb);
+ rate = avio_get_le16(pb);
+ channels = avio_get_le16(pb);
+ def_sound_size = avio_get_le16(pb);
/** setup video stream */
st = av_new_stream(s, 0);
@@ -133,7 +133,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
if(!st->codec->extradata)
return AVERROR(ENOMEM);
- if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) !=
+ if(avio_get_buffer(pb,st->codec->extradata,st->codec->extradata_size) !=
st->codec->extradata_size)
return AVERROR(EIO);
@@ -173,11 +173,11 @@ static av_cold int rl2_read_header(AVFormatContext *s,
/** read offset and size tables */
for(i=0; i < frame_count;i++)
- chunk_size[i] = get_le32(pb);
+ chunk_size[i] = avio_get_le32(pb);
for(i=0; i < frame_count;i++)
- chunk_offset[i] = get_le32(pb);
+ chunk_offset[i] = avio_get_le32(pb);
for(i=0; i < frame_count;i++)
- audio_size[i] = get_le32(pb) & 0xFFFF;
+ audio_size[i] = avio_get_le32(pb) & 0xFFFF;
/** build the sample index */
for(i=0;i<frame_count;i++){
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index da7e6b2..1f5a171 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -71,7 +71,7 @@ static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len)
q = buf;
for(i=0;i<len;i++) {
- r = get_byte(pb);
+ r = avio_get_byte(pb);
if (i < buf_size - 1)
*q++ = r;
}
@@ -80,7 +80,7 @@ static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len)
static void get_str8(ByteIOContext *pb, char *buf, int buf_size)
{
- get_strl(pb, buf, buf_size, get_byte(pb));
+ get_strl(pb, buf, buf_size, avio_get_byte(pb));
}
static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned size)
@@ -90,7 +90,7 @@ static int rm_read_extradata(ByteIOContext *pb, AVCodecContext *avctx, unsigned
avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!avctx->extradata)
return AVERROR(ENOMEM);
- avctx->extradata_size = get_buffer(pb, avctx->extradata, size);
+ avctx->extradata_size = avio_get_buffer(pb, avctx->extradata, size);
memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
if (avctx->extradata_size != size)
return AVERROR(EIO);
@@ -102,7 +102,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide)
char buf[1024];
int i;
for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
- int len = wide ? get_be16(s->pb) : get_byte(s->pb);
+ int len = wide ? avio_get_be16(s->pb) : avio_get_byte(s->pb);
get_strl(s->pb, buf, sizeof(buf), len);
av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0);
}
@@ -128,15 +128,15 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
int ret;
/* ra type header */
- version = get_be16(pb); /* version */
+ version = avio_get_be16(pb); /* version */
if (version == 3) {
- int header_size = get_be16(pb);
+ int header_size = avio_get_be16(pb);
int64_t startpos = url_ftell(pb);
url_fskip(pb, 14);
rm_read_metadata(s, 0);
if ((startpos + header_size) >= url_ftell(pb) + 2) {
// fourcc (should always be "lpcJ")
- get_byte(pb);
+ avio_get_byte(pb);
get_str8(pb, buf, sizeof(buf));
}
// Skip extra header crap (this should never happen)
@@ -151,28 +151,28 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
int codecdata_length;
/* old version (4) */
url_fskip(pb, 2); /* unused */
- get_be32(pb); /* .ra4 */
- get_be32(pb); /* data size */
- get_be16(pb); /* version2 */
- get_be32(pb); /* header size */
- flavor= get_be16(pb); /* add codec info / flavor */
- ast->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */
- get_be32(pb); /* ??? */
- get_be32(pb); /* ??? */
- get_be32(pb); /* ??? */
- ast->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */
- st->codec->block_align= get_be16(pb); /* frame size */
- ast->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */
- get_be16(pb); /* ??? */
+ avio_get_be32(pb); /* .ra4 */
+ avio_get_be32(pb); /* data size */
+ avio_get_be16(pb); /* version2 */
+ avio_get_be32(pb); /* header size */
+ flavor= avio_get_be16(pb); /* add codec info / flavor */
+ ast->coded_framesize = coded_framesize = avio_get_be32(pb); /* coded frame size */
+ avio_get_be32(pb); /* ??? */
+ avio_get_be32(pb); /* ??? */
+ avio_get_be32(pb); /* ??? */
+ ast->sub_packet_h = sub_packet_h = avio_get_be16(pb); /* 1 */
+ st->codec->block_align= avio_get_be16(pb); /* frame size */
+ ast->sub_packet_size = sub_packet_size = avio_get_be16(pb); /* sub packet size */
+ avio_get_be16(pb); /* ??? */
if (version == 5) {
- get_be16(pb); get_be16(pb); get_be16(pb);
+ avio_get_be16(pb); avio_get_be16(pb); avio_get_be16(pb);
}
- st->codec->sample_rate = get_be16(pb);
- get_be32(pb);
- st->codec->channels = get_be16(pb);
+ st->codec->sample_rate = avio_get_be16(pb);
+ avio_get_be32(pb);
+ st->codec->channels = avio_get_be16(pb);
if (version == 5) {
- get_be32(pb);
- get_buffer(pb, buf, 4);
+ avio_get_be32(pb);
+ avio_get_buffer(pb, buf, 4);
buf[4] = 0;
} else {
get_str8(pb, buf, sizeof(buf)); /* desc */
@@ -201,10 +201,10 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
case CODEC_ID_COOK:
case CODEC_ID_ATRAC3:
case CODEC_ID_SIPR:
- get_be16(pb); get_byte(pb);
+ avio_get_be16(pb); avio_get_byte(pb);
if (version == 5)
- get_byte(pb);
- codecdata_length = get_be32(pb);
+ avio_get_byte(pb);
+ codecdata_length = avio_get_be32(pb);
if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
return -1;
@@ -236,16 +236,16 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h);
break;
case CODEC_ID_AAC:
- get_be16(pb); get_byte(pb);
+ avio_get_be16(pb); avio_get_byte(pb);
if (version == 5)
- get_byte(pb);
- codecdata_length = get_be32(pb);
+ avio_get_byte(pb);
+ codecdata_length = avio_get_be32(pb);
if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
return -1;
}
if (codecdata_length >= 1) {
- get_byte(pb);
+ avio_get_byte(pb);
if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0)
return ret;
}
@@ -254,9 +254,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name));
}
if (read_all) {
- get_byte(pb);
- get_byte(pb);
- get_byte(pb);
+ avio_get_byte(pb);
+ avio_get_byte(pb);
+ avio_get_byte(pb);
rm_read_metadata(s, 0);
}
}
@@ -274,32 +274,32 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
av_set_pts_info(st, 64, 1, 1000);
codec_pos = url_ftell(pb);
- v = get_be32(pb);
+ v = avio_get_be32(pb);
if (v == MKTAG(0xfd, 'a', 'r', '.')) {
/* ra type header */
if (rm_read_audio_stream_info(s, pb, st, rst, 0))
return -1;
} else {
int fps, fps2;
- if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
+ if (avio_get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
fail1:
av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
goto skip;
}
- st->codec->codec_tag = get_le32(pb);
+ st->codec->codec_tag = avio_get_le32(pb);
st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags,
st->codec->codec_tag);
// av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
if (st->codec->codec_id == CODEC_ID_NONE)
goto fail1;
- st->codec->width = get_be16(pb);
- st->codec->height = get_be16(pb);
+ st->codec->width = avio_get_be16(pb);
+ st->codec->height = avio_get_be16(pb);
st->codec->time_base.num= 1;
- fps= get_be16(pb);
+ fps= avio_get_be16(pb);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- get_be32(pb);
- fps2= get_be16(pb);
- get_be16(pb);
+ avio_get_be32(pb);
+ fps2= avio_get_be16(pb);
+ avio_get_be16(pb);
if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0)
return ret;
@@ -335,15 +335,15 @@ static int rm_read_index(AVFormatContext *s)
AVStream *st;
do {
- if (get_le32(pb) != MKTAG('I','N','D','X'))
+ if (avio_get_le32(pb) != MKTAG('I','N','D','X'))
return -1;
- size = get_be32(pb);
+ size = avio_get_be32(pb);
if (size < 20)
return -1;
url_fskip(pb, 2);
- n_pkts = get_be32(pb);
- str_id = get_be16(pb);
- next_off = get_be32(pb);
+ n_pkts = avio_get_be32(pb);
+ str_id = avio_get_be16(pb);
+ next_off = avio_get_be32(pb);
for (n = 0; n < s->nb_streams; n++)
if (s->streams[n]->id == str_id) {
st = s->streams[n];
@@ -354,8 +354,8 @@ static int rm_read_index(AVFormatContext *s)
for (n = 0; n < n_pkts; n++) {
url_fskip(pb, 2);
- pts = get_be32(pb);
- pos = get_be32(pb);
+ pts = avio_get_be32(pb);
+ pos = avio_get_be32(pb);
url_fskip(pb, 4); /* packet no. */
av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME);
@@ -395,7 +395,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
char buf[128];
int flags = 0;
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
/* very old .ra format */
return rm_read_header_old(s, ap);
@@ -403,17 +403,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(EIO);
}
- get_be32(pb); /* header size */
- get_be16(pb);
- get_be32(pb);
- get_be32(pb); /* number of headers */
+ avio_get_be32(pb); /* header size */
+ avio_get_be16(pb);
+ avio_get_be32(pb);
+ avio_get_be32(pb); /* number of headers */
for(;;) {
if (url_feof(pb))
return -1;
- tag = get_le32(pb);
- tag_size = get_be32(pb);
- get_be16(pb);
+ tag = avio_get_le32(pb);
+ tag_size = avio_get_be32(pb);
+ avio_get_be16(pb);
#if 0
printf("tag=%c%c%c%c (%08x) size=%d\n",
(tag) & 0xff,
@@ -428,17 +428,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
switch(tag) {
case MKTAG('P', 'R', 'O', 'P'):
/* file header */
- get_be32(pb); /* max bit rate */
- get_be32(pb); /* avg bit rate */
- get_be32(pb); /* max packet size */
- get_be32(pb); /* avg packet size */
- get_be32(pb); /* nb packets */
- get_be32(pb); /* duration */
- get_be32(pb); /* preroll */
- indx_off = get_be32(pb); /* index offset */
- data_off = get_be32(pb); /* data offset */
- get_be16(pb); /* nb streams */
- flags = get_be16(pb); /* flags */
+ avio_get_be32(pb); /* max bit rate */
+ avio_get_be32(pb); /* avg bit rate */
+ avio_get_be32(pb); /* max packet size */
+ avio_get_be32(pb); /* avg packet size */
+ avio_get_be32(pb); /* nb packets */
+ avio_get_be32(pb); /* duration */
+ avio_get_be32(pb); /* preroll */
+ indx_off = avio_get_be32(pb); /* index offset */
+ data_off = avio_get_be32(pb); /* data offset */
+ avio_get_be16(pb); /* nb streams */
+ flags = avio_get_be16(pb); /* flags */
break;
case MKTAG('C', 'O', 'N', 'T'):
rm_read_metadata(s, 1);
@@ -447,14 +447,14 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
st = av_new_stream(s, 0);
if (!st)
return AVERROR(ENOMEM);
- st->id = get_be16(pb);
- get_be32(pb); /* max bit rate */
- st->codec->bit_rate = get_be32(pb); /* bit rate */
- get_be32(pb); /* max packet size */
- get_be32(pb); /* avg packet size */
- start_time = get_be32(pb); /* start time */
- get_be32(pb); /* preroll */
- duration = get_be32(pb); /* duration */
+ st->id = avio_get_be16(pb);
+ avio_get_be32(pb); /* max bit rate */
+ st->codec->bit_rate = avio_get_be32(pb); /* bit rate */
+ avio_get_be32(pb); /* max packet size */
+ avio_get_be32(pb); /* avg packet size */
+ start_time = avio_get_be32(pb); /* start time */
+ avio_get_be32(pb); /* preroll */
+ duration = avio_get_be32(pb); /* duration */
st->start_time = start_time;
st->duration = duration;
get_str8(pb, buf, sizeof(buf)); /* desc */
@@ -462,7 +462,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->priv_data = ff_rm_alloc_rmstream();
if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
- get_be32(pb)) < 0)
+ avio_get_be32(pb)) < 0)
return -1;
break;
case MKTAG('D', 'A', 'T', 'A'):
@@ -474,10 +474,10 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
header_end:
- rm->nb_packets = get_be32(pb); /* number of packets */
+ rm->nb_packets = avio_get_be32(pb); /* number of packets */
if (!rm->nb_packets && (flags & 4))
rm->nb_packets = 3600 * 25;
- get_be32(pb); /* next data header */
+ avio_get_be32(pb); /* next data header */
if (!data_off)
data_off = url_ftell(pb) - 18;
@@ -494,13 +494,13 @@ static int get_num(ByteIOContext *pb, int *len)
{
int n, n1;
- n = get_be16(pb);
+ n = avio_get_be16(pb);
(*len)-=2;
n &= 0x7FFF;
if (n >= 0x4000) {
return n - 0x4000;
} else {
- n1 = get_be16(pb);
+ n1 = avio_get_be16(pb);
(*len)-=2;
return (n << 16) | n1;
}
@@ -524,13 +524,13 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
*timestamp = AV_NOPTS_VALUE;
*flags= 0;
}else{
- state= (state<<8) + get_byte(pb);
+ state= (state<<8) + avio_get_byte(pb);
if(state == MKBETAG('I', 'N', 'D', 'X')){
int n_pkts, expected_len;
- len = get_be32(pb);
+ len = avio_get_be32(pb);
url_fskip(pb, 2);
- n_pkts = get_be32(pb);
+ n_pkts = avio_get_be32(pb);
expected_len = 20 + n_pkts * 14;
if (len == 20)
/* some files don't add index entries to chunk size... */
@@ -553,10 +553,10 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
len=state - 12;
state= 0xFFFFFFFF;
- num = get_be16(pb);
- *timestamp = get_be32(pb);
- get_byte(pb); /* reserved */
- *flags = get_byte(pb); /* flags */
+ num = avio_get_be16(pb);
+ *timestamp = avio_get_be32(pb);
+ avio_get_byte(pb); /* reserved */
+ *flags = avio_get_byte(pb); /* flags */
}
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
@@ -584,16 +584,16 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
int hdr, seq, pic_num, len2, pos;
int type;
- hdr = get_byte(pb); len--;
+ hdr = avio_get_byte(pb); len--;
type = hdr >> 6;
if(type != 3){ // not frame as a part of packet
- seq = get_byte(pb); len--;
+ seq = avio_get_byte(pb); len--;
}
if(type != 1){ // not whole frame
len2 = get_num(pb, &len);
pos = get_num(pb, &len);
- pic_num = get_byte(pb); len--;
+ pic_num = avio_get_byte(pb); len--;
}
if(len<0)
return -1;
@@ -609,7 +609,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
pkt->data[0] = 0;
AV_WL32(pkt->data + 1, 1);
AV_WL32(pkt->data + 5, 0);
- get_buffer(pb, pkt->data + 9, len);
+ avio_get_buffer(pb, pkt->data + 9, len);
return 0;
}
//now we have to deal with single slice
@@ -635,7 +635,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb,
AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1);
if(vst->videobufpos + len > vst->videobufsize)
return 1;
- if (get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len)
+ if (avio_get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len)
return AVERROR(EIO);
vst->videobufpos += len;
rm->remaining_len-= len;
@@ -730,15 +730,15 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
switch(st->codec->codec_id) {
case CODEC_ID_RA_288:
for (x = 0; x < h/2; x++)
- get_buffer(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
+ avio_get_buffer(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
break;
case CODEC_ID_ATRAC3:
case CODEC_ID_COOK:
for (x = 0; x < w/sps; x++)
- get_buffer(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
+ avio_get_buffer(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
break;
case CODEC_ID_SIPR:
- get_buffer(pb, ast->pkt.data + y * w, w);
+ avio_get_buffer(pb, ast->pkt.data + y * w, w);
break;
}
@@ -753,10 +753,10 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
} else if (st->codec->codec_id == CODEC_ID_AAC) {
int x;
rm->audio_stream_num = st->index;
- ast->sub_packet_cnt = (get_be16(pb) & 0xf0) >> 4;
+ ast->sub_packet_cnt = (avio_get_be16(pb) & 0xf0) >> 4;
if (ast->sub_packet_cnt) {
for (x = 0; x < ast->sub_packet_cnt; x++)
- ast->sub_packet_lengths[x] = get_be16(pb);
+ ast->sub_packet_lengths[x] = avio_get_be16(pb);
rm->audio_pkt_cnt = ast->sub_packet_cnt;
ast->audiotimestamp = timestamp;
} else
@@ -916,9 +916,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
st = s->streams[stream_index2];
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- h= get_byte(s->pb); len--;
+ h= avio_get_byte(s->pb); len--;
if(!(h & 0x40)){
- seq = get_byte(s->pb); len--;
+ seq = avio_get_byte(s->pb); len--;
}
}
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 241b541..f32a439 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -51,7 +51,7 @@ static int read_line(ByteIOContext * pb, char* line, int bufsize)
{
int i;
for (i = 0; i < bufsize - 1; i++) {
- int b = get_byte(pb);
+ int b = avio_get_byte(pb);
if (b == 0)
break;
if (b == '\n') {
@@ -301,8 +301,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
// multiple frames per chunk in Escape 124 samples.
uint32_t frame_size, frame_flags;
- frame_flags = get_le32(pb);
- frame_size = get_le32(pb);
+ frame_flags = avio_get_le32(pb);
+ frame_size = avio_get_le32(pb);
if (url_fseek(pb, -8, SEEK_CUR) < 0)
return AVERROR(EIO);
diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c
index 698f82e..743d0a0 100644
--- a/libavformat/rsodec.c
+++ b/libavformat/rsodec.c
@@ -35,10 +35,10 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
enum CodecID codec;
AVStream *st;
- id = get_be16(pb);
- size = get_be16(pb);
- rate = get_be16(pb);
- get_be16(pb); /* play mode ? (0x0000 = don't loop) */
+ id = avio_get_be16(pb);
+ size = avio_get_be16(pb);
+ rate = avio_get_be16(pb);
+ avio_get_be16(pb); /* play mode ? (0x0000 = don't loop) */
codec = ff_codec_get_id(ff_codec_rso_tags, id);
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index 8ae063f..75fe39d 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -181,10 +181,10 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
while (url_ftell(pb) + 4 < len) {
int start_off = url_ftell(pb);
- mflags = get_byte(pb);
+ mflags = avio_get_byte(pb);
if (mflags & 0x80)
flags |= RTP_FLAG_KEY;
- len_off = get_be24(pb);
+ len_off = avio_get_be24(pb);
if (mflags & 0x20) /**< relative timestamp */
url_fskip(pb, 4);
if (mflags & 0x10) /**< has duration */
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 28460a7..6d84dcc 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -103,20 +103,20 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
data_len = get_bits(&gb, 16);
url_fseek(&pb, pos + 4, SEEK_SET);
- tag = get_le32(&pb);
+ tag = avio_get_le32(&pb);
if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
tag != MKTAG('v','i','d','e')) ||
(st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
tag != MKTAG('s','o','u','n')))
return AVERROR_INVALIDDATA;
- av_set_pts_info(st, 32, 1, get_be32(&pb));
+ av_set_pts_info(st, 32, 1, avio_get_be32(&pb));
if (pos + data_len > len)
return AVERROR_INVALIDDATA;
/* TLVs */
while (url_ftell(&pb) + 4 < pos + data_len) {
- int tlv_len = get_be16(&pb);
- tag = get_le16(&pb);
+ int tlv_len = avio_get_be16(&pb);
+ tag = avio_get_le16(&pb);
if (url_ftell(&pb) + tlv_len > pos + data_len)
return AVERROR_INVALIDDATA;
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index d3e88e9..682c440 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1782,7 +1782,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* read the whole sdp file */
/* XXX: better loading */
content = av_malloc(SDP_MAX_SIZE);
- size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
+ size = avio_get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
if (size <= 0) {
av_free(content);
return AVERROR_INVALIDDATA;
diff --git a/libavformat/sauce.c b/libavformat/sauce.c
index 4972d33..e95773d 100644
--- a/libavformat/sauce.c
+++ b/libavformat/sauce.c
@@ -36,13 +36,13 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
uint64_t start_pos = url_fsize(pb) - 128;
url_fseek(pb, start_pos, SEEK_SET);
- if (get_buffer(pb, buf, 7) != 7)
+ if (avio_get_buffer(pb, buf, 7) != 7)
return -1;
if (memcmp(buf, "SAUCE00", 7))
return -1;
#define GET_SAUCE_META(name,size) \
- if (get_buffer(pb, buf, size) == size && buf[0]) { \
+ if (avio_get_buffer(pb, buf, size) == size && buf[0]) { \
buf[size] = 0; \
av_metadata_set2(&avctx->metadata, name, buf, 0); \
}
@@ -52,12 +52,12 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
GET_SAUCE_META("publisher", 20)
GET_SAUCE_META("date", 8)
url_fskip(pb, 4);
- datatype = get_byte(pb);
- filetype = get_byte(pb);
- t1 = get_le16(pb);
- t2 = get_le16(pb);
- nb_comments = get_byte(pb);
- flags = get_byte(pb);
+ datatype = avio_get_byte(pb);
+ filetype = avio_get_byte(pb);
+ t1 = avio_get_le16(pb);
+ t2 = avio_get_le16(pb);
+ nb_comments = avio_get_byte(pb);
+ flags = avio_get_byte(pb);
url_fskip(pb, 4);
GET_SAUCE_META("encoder", 22);
@@ -83,14 +83,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
if (nb_comments > 0) {
url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
- if (get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
+ if (avio_get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
int i;
char *str = av_malloc(65*nb_comments + 1);
*fsize -= 64*nb_comments + 5;
if (!str)
return 0;
for (i = 0; i < nb_comments; i++) {
- if (get_buffer(pb, str + 65*i, 64) != 64)
+ if (avio_get_buffer(pb, str + 65*i, 64) != 64)
break;
str[65*i + 64] = '\n';
}
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 4f3e5b9..d30fa99 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s,
film->stereo_buffer_size = 0;
/* load the main FILM header */
- if (get_buffer(pb, scratch, 16) != 16)
+ if (avio_get_buffer(pb, scratch, 16) != 16)
return AVERROR(EIO);
data_offset = AV_RB32(&scratch[4]);
film->version = AV_RB32(&scratch[8]);
@@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s,
/* load the FDSC chunk */
if (film->version == 0) {
/* special case for Lemmings .film files; 20-byte header */
- if (get_buffer(pb, scratch, 20) != 20)
+ if (avio_get_buffer(pb, scratch, 20) != 20)
return AVERROR(EIO);
/* make some assumptions about the audio parameters */
film->audio_type = CODEC_ID_PCM_S8;
@@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s,
film->audio_bits = 8;
} else {
/* normal Saturn .cpk files; 32-byte header */
- if (get_buffer(pb, scratch, 32) != 32)
+ if (avio_get_buffer(pb, scratch, 32) != 32)
return AVERROR(EIO);
film->audio_samplerate = AV_RB16(&scratch[24]);
film->audio_channels = scratch[21];
@@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s,
}
/* load the sample table */
- if (get_buffer(pb, scratch, 16) != 16)
+ if (avio_get_buffer(pb, scratch, 16) != 16)
return AVERROR(EIO);
if (AV_RB32(&scratch[0]) != STAB_TAG)
return AVERROR_INVALIDDATA;
@@ -174,7 +174,7 @@ static int film_read_header(AVFormatContext *s,
audio_frame_counter = 0;
for (i = 0; i < film->sample_count; i++) {
/* load the next sample record and transfer it to an internal struct */
- if (get_buffer(pb, scratch, 16) != 16) {
+ if (avio_get_buffer(pb, scratch, 16) != 16) {
av_free(film->sample_table);
return AVERROR(EIO);
}
@@ -225,7 +225,7 @@ static int film_read_packet(AVFormatContext *s,
pkt->pos= url_ftell(pb);
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
- get_buffer(pb, pkt->data, sample->sample_size);
+ avio_get_buffer(pb, pkt->data, sample->sample_size);
} else if ((sample->stream == film->audio_stream_index) &&
(film->audio_channels == 2)) {
/* stereo PCM needs to be interleaved */
@@ -241,7 +241,7 @@ static int film_read_packet(AVFormatContext *s,
}
pkt->pos= url_ftell(pb);
- ret = get_buffer(pb, film->stereo_buffer, sample->sample_size);
+ ret = avio_get_buffer(pb, film->stereo_buffer, sample->sample_size);
if (ret != sample->sample_size)
ret = AVERROR(EIO);
diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c
index 98fe95a..c00524f 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -96,7 +96,7 @@ static int vmd_read_header(AVFormatContext *s,
/* fetch the main header, including the 2 header length bytes */
url_fseek(pb, 0, SEEK_SET);
- if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
+ if (avio_get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
return AVERROR(EIO);
if(vmd->vmd_header[16] == 'i' && vmd->vmd_header[17] == 'v' && vmd->vmd_header[18] == '3')
@@ -172,7 +172,7 @@ static int vmd_read_header(AVFormatContext *s,
av_free(vmd->frame_table);
return AVERROR(ENOMEM);
}
- if (get_buffer(pb, raw_frame_table, raw_frame_table_size) !=
+ if (avio_get_buffer(pb, raw_frame_table, raw_frame_table_size) !=
raw_frame_table_size) {
av_free(raw_frame_table);
av_free(vmd->frame_table);
@@ -189,7 +189,7 @@ static int vmd_read_header(AVFormatContext *s,
int type;
uint32_t size;
- get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD);
+ avio_get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD);
type = chunk[0];
size = AV_RL32(&chunk[2]);
if(!size && type != 1)
@@ -250,9 +250,9 @@ static int vmd_read_packet(AVFormatContext *s,
pkt->pos= url_ftell(pb);
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
if(vmd->is_indeo3)
- ret = get_buffer(pb, pkt->data, frame->frame_size);
+ ret = avio_get_buffer(pb, pkt->data, frame->frame_size);
else
- ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD,
+ ret = avio_get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD,
frame->frame_size);
if (ret != frame->frame_size) {
diff --git a/libavformat/siff.c b/libavformat/siff.c
index 5219368..013aa73 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -89,28 +89,28 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb
AVStream *st;
int width, height;
- if (get_le32(pb) != TAG_VBHD){
+ if (avio_get_le32(pb) != TAG_VBHD){
av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
return -1;
}
- if(get_be32(pb) != 32){
+ if(avio_get_be32(pb) != 32){
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
return -1;
}
- if(get_le16(pb) != 1){
+ if(avio_get_le16(pb) != 1){
av_log(s, AV_LOG_ERROR, "Incorrect header version\n");
return -1;
}
- width = get_le16(pb);
- height = get_le16(pb);
+ width = avio_get_le16(pb);
+ height = avio_get_le16(pb);
url_fskip(pb, 4);
- c->frames = get_le16(pb);
+ c->frames = avio_get_le16(pb);
if(!c->frames){
av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
return -1;
}
- c->bits = get_le16(pb);
- c->rate = get_le16(pb);
+ c->bits = avio_get_le16(pb);
+ c->rate = avio_get_le16(pb);
c->block_align = c->rate * (c->bits >> 3);
url_fskip(pb, 16); //zeroes
@@ -137,17 +137,17 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb
static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, ByteIOContext *pb)
{
- if (get_le32(pb) != TAG_SHDR){
+ if (avio_get_le32(pb) != TAG_SHDR){
av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
return -1;
}
- if(get_be32(pb) != 8){
+ if(avio_get_be32(pb) != 8){
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
return -1;
}
url_fskip(pb, 4); //unknown value
- c->rate = get_le16(pb);
- c->bits = get_le16(pb);
+ c->rate = avio_get_le16(pb);
+ c->bits = avio_get_le16(pb);
c->block_align = c->rate * (c->bits >> 3);
return create_audio_stream(s, c);
}
@@ -158,10 +158,10 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
SIFFContext *c = s->priv_data;
uint32_t tag;
- if (get_le32(pb) != TAG_SIFF)
+ if (avio_get_le32(pb) != TAG_SIFF)
return -1;
url_fskip(pb, 4); //ignore size
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
if (tag != TAG_VBV1 && tag != TAG_SOUN){
av_log(s, AV_LOG_ERROR, "Not a VBV file\n");
@@ -172,7 +172,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0)
return -1;
- if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){
+ if (avio_get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){
av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
return -1;
}
@@ -190,12 +190,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (c->cur_frame >= c->frames)
return AVERROR(EIO);
if (c->curstrm == -1){
- c->pktsize = get_le32(s->pb) - 4;
- c->flags = get_le16(s->pb);
+ c->pktsize = avio_get_le32(s->pb) - 4;
+ c->flags = avio_get_le16(s->pb);
c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
if (c->gmcsize)
- get_buffer(s->pb, c->gmc, c->gmcsize);
- c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
+ avio_get_buffer(s->pb, c->gmc, c->gmcsize);
+ c->sndsize = (c->flags & VB_HAS_AUDIO) ? avio_get_le32(s->pb): 0;
c->curstrm = !!(c->flags & VB_HAS_AUDIO);
}
@@ -206,7 +206,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
AV_WL16(pkt->data, c->flags);
if (c->gmcsize)
memcpy(pkt->data + 2, c->gmc, c->gmcsize);
- get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
+ avio_get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
pkt->stream_index = 0;
c->curstrm = -1;
}else{
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 92da91e..790702f 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -105,19 +105,19 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
int tbase;
/* read and check header */
- smk->magic = get_le32(pb);
+ smk->magic = avio_get_le32(pb);
if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4'))
return -1;
- smk->width = get_le32(pb);
- smk->height = get_le32(pb);
- smk->frames = get_le32(pb);
- smk->pts_inc = (int32_t)get_le32(pb);
- smk->flags = get_le32(pb);
+ smk->width = avio_get_le32(pb);
+ smk->height = avio_get_le32(pb);
+ smk->frames = avio_get_le32(pb);
+ smk->pts_inc = (int32_t)avio_get_le32(pb);
+ smk->flags = avio_get_le32(pb);
if(smk->flags & SMACKER_FLAG_RING_FRAME)
smk->frames++;
for(i = 0; i < 7; i++)
- smk->audio[i] = get_le32(pb);
- smk->treesize = get_le32(pb);
+ smk->audio[i] = avio_get_le32(pb);
+ smk->treesize = avio_get_le32(pb);
if(smk->treesize >= UINT_MAX/4){ // smk->treesize + 16 must not overflow (this check is probably redundant)
av_log(s, AV_LOG_ERROR, "treesize too large\n");
@@ -125,13 +125,13 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
//FIXME remove extradata "rebuilding"
- smk->mmap_size = get_le32(pb);
- smk->mclr_size = get_le32(pb);
- smk->full_size = get_le32(pb);
- smk->type_size = get_le32(pb);
+ smk->mmap_size = avio_get_le32(pb);
+ smk->mclr_size = avio_get_le32(pb);
+ smk->full_size = avio_get_le32(pb);
+ smk->type_size = avio_get_le32(pb);
for(i = 0; i < 7; i++)
- smk->rates[i] = get_le32(pb);
- smk->pad = get_le32(pb);
+ smk->rates[i] = avio_get_le32(pb);
+ smk->pad = avio_get_le32(pb);
/* setup data */
if(smk->frames > 0xFFFFFF) {
av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames);
@@ -144,10 +144,10 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* read frame info */
for(i = 0; i < smk->frames; i++) {
- smk->frm_size[i] = get_le32(pb);
+ smk->frm_size[i] = avio_get_le32(pb);
}
for(i = 0; i < smk->frames; i++) {
- smk->frm_flags[i] = get_byte(pb);
+ smk->frm_flags[i] = avio_get_byte(pb);
}
/* init video codec */
@@ -207,7 +207,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_free(smk->frm_flags);
return -1;
}
- ret = get_buffer(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
+ ret = avio_get_buffer(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
if(ret != st->codec->extradata_size - 16){
av_free(smk->frm_size);
av_free(smk->frm_flags);
@@ -251,19 +251,19 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t oldpal[768];
memcpy(oldpal, pal, 768);
- size = get_byte(s->pb);
+ size = avio_get_byte(s->pb);
size = size * 4 - 1;
frame_size -= size;
frame_size--;
sz = 0;
pos = url_ftell(s->pb) + size;
while(sz < 256){
- t = get_byte(s->pb);
+ t = avio_get_byte(s->pb);
if(t & 0x80){ /* skip palette entries */
sz += (t & 0x7F) + 1;
pal += ((t & 0x7F) + 1) * 3;
} else if(t & 0x40){ /* copy with offset */
- off = get_byte(s->pb) * 3;
+ off = avio_get_byte(s->pb) * 3;
j = (t & 0x3F) + 1;
while(j-- && sz < 256) {
*pal++ = oldpal[off + 0];
@@ -274,8 +274,8 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
}
} else { /* new entries */
*pal++ = smk_pal[t];
- *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
- *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
+ *pal++ = smk_pal[avio_get_byte(s->pb) & 0x3F];
+ *pal++ = smk_pal[avio_get_byte(s->pb) & 0x3F];
sz++;
}
}
@@ -288,13 +288,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
for(i = 0; i < 7; i++) {
if(flags & 1) {
int size;
- size = get_le32(s->pb) - 4;
+ size = avio_get_le32(s->pb) - 4;
frame_size -= size;
frame_size -= 4;
smk->curstream++;
smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
smk->buf_sizes[smk->curstream] = size;
- ret = get_buffer(s->pb, smk->bufs[smk->curstream], size);
+ ret = avio_get_buffer(s->pb, smk->bufs[smk->curstream], size);
if(ret != size)
return AVERROR(EIO);
smk->stream_id[smk->curstream] = smk->indexes[i];
@@ -307,7 +307,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
palchange |= 2;
pkt->data[0] = palchange;
memcpy(pkt->data + 1, smk->pal, 768);
- ret = get_buffer(s->pb, pkt->data + 769, frame_size);
+ ret = avio_get_buffer(s->pb, pkt->data + 769, frame_size);
if(ret != frame_size)
return AVERROR(EIO);
pkt->stream_index = smk->videoindex;
diff --git a/libavformat/sol.c b/libavformat/sol.c
index fd7eb66..9dec54a 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -93,15 +93,15 @@ static int sol_read_header(AVFormatContext *s,
AVStream *st;
/* check ".snd" header */
- magic = get_le16(pb);
- tag = get_le32(pb);
+ magic = avio_get_le16(pb);
+ tag = avio_get_le32(pb);
if (tag != MKTAG('S', 'O', 'L', 0))
return -1;
- rate = get_le16(pb);
- type = get_byte(pb);
- size = get_le32(pb);
+ rate = avio_get_le16(pb);
+ type = avio_get_byte(pb);
+ size = avio_get_le32(pb);
if (magic != 0x0B8D)
- get_byte(pb); /* newer SOLs contain padding byte */
+ avio_get_byte(pb); /* newer SOLs contain padding byte */
codec = sol_codec_id(magic, type);
channels = sol_channels(magic, type);
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index 0a57f48..3a30683 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -55,20 +55,20 @@ static int sox_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- if (get_le32(pb) == SOX_TAG) {
+ if (avio_get_le32(pb) == SOX_TAG) {
st->codec->codec_id = CODEC_ID_PCM_S32LE;
- header_size = get_le32(pb);
+ header_size = avio_get_le32(pb);
url_fskip(pb, 8); /* sample count */
- sample_rate = av_int2dbl(get_le64(pb));
- st->codec->channels = get_le32(pb);
- comment_size = get_le32(pb);
+ sample_rate = av_int2dbl(avio_get_le64(pb));
+ st->codec->channels = avio_get_le32(pb);
+ comment_size = avio_get_le32(pb);
} else {
st->codec->codec_id = CODEC_ID_PCM_S32BE;
- header_size = get_be32(pb);
+ header_size = avio_get_be32(pb);
url_fskip(pb, 8); /* sample count */
- sample_rate = av_int2dbl(get_be64(pb));
- st->codec->channels = get_be32(pb);
- comment_size = get_be32(pb);
+ sample_rate = av_int2dbl(avio_get_be64(pb));
+ st->codec->channels = avio_get_be32(pb);
+ comment_size = avio_get_be32(pb);
}
if (comment_size > 0xFFFFFFFFU - SOX_FIXED_HDR - 4U) {
@@ -95,7 +95,7 @@ static int sox_read_header(AVFormatContext *s,
if (comment_size && comment_size < UINT_MAX) {
char *comment = av_malloc(comment_size+1);
- if (get_buffer(pb, comment, comment_size) != comment_size) {
+ if (avio_get_buffer(pb, comment, comment_size) != comment_size) {
av_freep(&comment);
return AVERROR(EIO);
}
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index 5c4dba0..07b085c 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -170,13 +170,13 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
int pkt_size_bits, offset, ret;
while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) {
- state = (state << 8) | get_byte(pb);
+ state = (state << 8) | avio_get_byte(pb);
if (url_feof(pb))
return AVERROR_EOF;
}
- data_type = get_le16(pb);
- pkt_size_bits = get_le16(pb);
+ data_type = avio_get_le16(pb);
+ pkt_size_bits = avio_get_le16(pb);
if (pkt_size_bits % 16)
av_log_ask_for_sample(s, "Packet does not end to a 16-bit boundary.");
@@ -187,7 +187,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE;
- if (get_buffer(pb, pkt->data, pkt->size) < pkt->size) {
+ if (avio_get_buffer(pb, pkt->data, pkt->size) < pkt->size) {
av_free_packet(pkt);
return AVERROR_EOF;
}
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index d2a84f0..cfdcede 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -30,11 +30,11 @@ static int get_swf_tag(ByteIOContext *pb, int *len_ptr)
if (url_feof(pb))
return -1;
- tag = get_le16(pb);
+ tag = avio_get_le16(pb);
len = tag & 0x3f;
tag = tag >> 6;
if (len == 0x3f) {
- len = get_le32(pb);
+ len = avio_get_le32(pb);
}
// av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
*len_ptr = len;
@@ -58,7 +58,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
ByteIOContext *pb = s->pb;
int nbits, len, tag;
- tag = get_be32(pb) & 0xffffff00;
+ tag = avio_get_be32(pb) & 0xffffff00;
if (tag == MKBETAG('C', 'W', 'S', 0)) {
av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n");
@@ -66,13 +66,13 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
if (tag != MKBETAG('F', 'W', 'S', 0))
return AVERROR(EIO);
- get_le32(pb);
+ avio_get_le32(pb);
/* skip rectangle size */
- nbits = get_byte(pb) >> 3;
+ nbits = avio_get_byte(pb) >> 3;
len = (4 * nbits - 3 + 7) / 8;
url_fskip(pb, len);
- swf->frame_rate = get_le16(pb); /* 8.8 fixed */
- get_le16(pb); /* frame count */
+ swf->frame_rate = avio_get_le16(pb); /* 8.8 fixed */
+ avio_get_le16(pb); /* frame count */
swf->samples_per_frame = 0;
s->ctx_flags |= AVFMTCTX_NOHEADER;
@@ -92,7 +92,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
if (tag < 0)
return AVERROR(EIO);
if (tag == TAG_VIDEOSTREAM) {
- int ch_id = get_le16(pb);
+ int ch_id = avio_get_le16(pb);
len -= 2;
for (i=0; i<s->nb_streams; i++) {
@@ -101,16 +101,16 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
goto skip;
}
- get_le16(pb);
- get_le16(pb);
- get_le16(pb);
- get_byte(pb);
+ avio_get_le16(pb);
+ avio_get_le16(pb);
+ avio_get_le16(pb);
+ avio_get_byte(pb);
/* Check for FLV1 */
vst = av_new_stream(s, ch_id);
if (!vst)
return -1;
vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb));
+ vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_get_byte(pb));
av_set_pts_info(vst, 16, 256, swf->frame_rate);
vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
len -= 8;
@@ -124,9 +124,9 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
goto skip;
}
- get_byte(pb);
- v = get_byte(pb);
- swf->samples_per_frame = get_le16(pb);
+ avio_get_byte(pb);
+ v = avio_get_byte(pb);
+ swf->samples_per_frame = avio_get_le16(pb);
ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
if (!ast)
return -1;
@@ -141,12 +141,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
len -= 4;
} else if (tag == TAG_VIDEOFRAME) {
- int ch_id = get_le16(pb);
+ int ch_id = avio_get_le16(pb);
len -= 2;
for(i=0; i<s->nb_streams; i++) {
st = s->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
- frame = get_le16(pb);
+ frame = avio_get_le16(pb);
av_get_packet(pb, pkt, len-2);
pkt->pos = pos;
pkt->pts = frame;
@@ -185,17 +185,17 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
st = vst;
}
- get_le16(pb); /* BITMAP_ID */
+ avio_get_le16(pb); /* BITMAP_ID */
av_new_packet(pkt, len-2);
- get_buffer(pb, pkt->data, 4);
+ avio_get_buffer(pb, pkt->data, 4);
if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
AV_RB32(pkt->data) == 0xffd9ffd8) {
/* old SWF files containing SOI/EOI as data start */
/* files created by swink have reversed tag */
pkt->size -= 4;
- get_buffer(pb, pkt->data, pkt->size);
+ avio_get_buffer(pb, pkt->data, pkt->size);
} else {
- get_buffer(pb, pkt->data + 4, pkt->size - 4);
+ avio_get_buffer(pb, pkt->data + 4, pkt->size - 4);
}
pkt->pos = pos;
pkt->stream_index = st->index;
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 226f2fd..bd14486 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -61,31 +61,31 @@ static int thp_read_header(AVFormatContext *s,
int i;
/* Read the file header. */
- get_be32(pb); /* Skip Magic. */
- thp->version = get_be32(pb);
+ avio_get_be32(pb); /* Skip Magic. */
+ thp->version = avio_get_be32(pb);
- get_be32(pb); /* Max buf size. */
- get_be32(pb); /* Max samples. */
+ avio_get_be32(pb); /* Max buf size. */
+ avio_get_be32(pb); /* Max samples. */
- thp->fps = av_d2q(av_int2flt(get_be32(pb)), INT_MAX);
- thp->framecnt = get_be32(pb);
- thp->first_framesz = get_be32(pb);
- get_be32(pb); /* Data size. */
+ thp->fps = av_d2q(av_int2flt(avio_get_be32(pb)), INT_MAX);
+ thp->framecnt = avio_get_be32(pb);
+ thp->first_framesz = avio_get_be32(pb);
+ avio_get_be32(pb); /* Data size. */
- thp->compoff = get_be32(pb);
- get_be32(pb); /* offsetDataOffset. */
- thp->first_frame = get_be32(pb);
- thp->last_frame = get_be32(pb);
+ thp->compoff = avio_get_be32(pb);
+ avio_get_be32(pb); /* offsetDataOffset. */
+ thp->first_frame = avio_get_be32(pb);
+ thp->last_frame = avio_get_be32(pb);
thp->next_framesz = thp->first_framesz;
thp->next_frame = thp->first_frame;
/* Read the component structure. */
url_fseek (pb, thp->compoff, SEEK_SET);
- thp->compcount = get_be32(pb);
+ thp->compcount = avio_get_be32(pb);
/* Read the list of component types. */
- get_buffer(pb, thp->components, 16);
+ avio_get_buffer(pb, thp->components, 16);
for (i = 0; i < thp->compcount; i++) {
if (thp->components[i] == 0) {
@@ -103,14 +103,14 @@ static int thp_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_THP;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->width = get_be32(pb);
- st->codec->height = get_be32(pb);
+ st->codec->width = avio_get_be32(pb);
+ st->codec->height = avio_get_be32(pb);
st->codec->sample_rate = av_q2d(thp->fps);
thp->vst = st;
thp->video_stream_index = st->index;
if (thp->version == 0x11000)
- get_be32(pb); /* Unknown. */
+ avio_get_be32(pb); /* Unknown. */
} else if (thp->components[i] == 1) {
if (thp->has_audio != 0)
break;
@@ -123,8 +123,8 @@ static int thp_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_THP;
st->codec->codec_tag = 0; /* no fourcc */
- st->codec->channels = get_be32(pb); /* numChannels. */
- st->codec->sample_rate = get_be32(pb); /* Frequency. */
+ st->codec->channels = avio_get_be32(pb); /* numChannels. */
+ st->codec->sample_rate = avio_get_be32(pb); /* Frequency. */
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
@@ -153,15 +153,15 @@ static int thp_read_packet(AVFormatContext *s,
/* Locate the next frame and read out its size. */
thp->next_frame += thp->next_framesz;
- thp->next_framesz = get_be32(pb);
+ thp->next_framesz = avio_get_be32(pb);
- get_be32(pb); /* Previous total size. */
- size = get_be32(pb); /* Total size of this frame. */
+ avio_get_be32(pb); /* Previous total size. */
+ size = avio_get_be32(pb); /* Total size of this frame. */
/* Store the audiosize so the next time this function is called,
the audio can be read. */
if (thp->has_audio)
- thp->audiosize = get_be32(pb); /* Audio size. */
+ thp->audiosize = avio_get_be32(pb); /* Audio size. */
else
thp->frame++;
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index 2992fa1..c06eccd 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -86,7 +86,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, ByteIOContext *pb)
url_fseek(pb, 256, SEEK_SET);
for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) {
- sz = get_le16(pb);
+ sz = avio_get_le16(pb);
if (sz == 0)
break;
else {
@@ -114,7 +114,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, ByteIOContext *pb, int buffer_n
return AVERROR_INVALIDDATA;
url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
- if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
+ if (avio_get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
return AVERROR(EIO);
seq_buffer->fill_size += data_size;
@@ -131,7 +131,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb)
url_fseek(pb, seq->current_frame_offs, SEEK_SET);
/* sound data */
- seq->current_audio_data_offs = get_le16(pb);
+ seq->current_audio_data_offs = avio_get_le16(pb);
if (seq->current_audio_data_offs) {
seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2;
} else {
@@ -139,7 +139,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb)
}
/* palette data */
- seq->current_pal_data_offs = get_le16(pb);
+ seq->current_pal_data_offs = avio_get_le16(pb);
if (seq->current_pal_data_offs) {
seq->current_pal_data_size = 768;
} else {
@@ -148,10 +148,10 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb)
/* video data */
for (i = 0; i < 4; i++)
- buffer_num[i] = get_byte(pb);
+ buffer_num[i] = avio_get_byte(pb);
for (i = 0; i < 4; i++)
- offset_table[i] = get_le16(pb);
+ offset_table[i] = avio_get_le16(pb);
for (i = 0; i < 3; i++) {
if (offset_table[i]) {
@@ -257,7 +257,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
if (seq->current_pal_data_size) {
pkt->data[0] |= 1;
url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
- if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
+ if (avio_get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
return AVERROR(EIO);
}
if (seq->current_video_data_size) {
diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index 72d0f29..efb8d88 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -70,7 +70,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVRational fps;
unsigned comp_method, char_cols, char_rows, features;
- if (get_le32(pb) != TMV_TAG)
+ if (avio_get_le32(pb) != TMV_TAG)
return -1;
if (!(vst = av_new_stream(s, 0)))
@@ -79,30 +79,30 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!(ast = av_new_stream(s, 0)))
return AVERROR(ENOMEM);
- ast->codec->sample_rate = get_le16(pb);
+ ast->codec->sample_rate = avio_get_le16(pb);
if (!ast->codec->sample_rate) {
av_log(s, AV_LOG_ERROR, "invalid sample rate\n");
return -1;
}
- tmv->audio_chunk_size = get_le16(pb);
+ tmv->audio_chunk_size = avio_get_le16(pb);
if (!tmv->audio_chunk_size) {
av_log(s, AV_LOG_ERROR, "invalid audio chunk size\n");
return -1;
}
- comp_method = get_byte(pb);
+ comp_method = avio_get_byte(pb);
if (comp_method) {
av_log(s, AV_LOG_ERROR, "unsupported compression method %d\n",
comp_method);
return -1;
}
- char_cols = get_byte(pb);
- char_rows = get_byte(pb);
+ char_cols = avio_get_byte(pb);
+ char_rows = avio_get_byte(pb);
tmv->video_chunk_size = char_cols * char_rows * 2;
- features = get_byte(pb);
+ features = avio_get_byte(pb);
if (features & ~(TMV_PADDING | TMV_STEREO)) {
av_log(s, AV_LOG_ERROR, "unsupported features 0x%02x\n",
features & ~(TMV_PADDING | TMV_STEREO));
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 21b7538..1c7f482 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -47,19 +47,19 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
ff_id3v1_read(s);
start_offset = url_ftell(s->pb);
- if (get_le32(s->pb) != AV_RL32("TTA1"))
+ if (avio_get_le32(s->pb) != AV_RL32("TTA1"))
return -1; // not tta file
url_fskip(s->pb, 2); // FIXME: flags
- channels = get_le16(s->pb);
- bps = get_le16(s->pb);
- samplerate = get_le32(s->pb);
+ channels = avio_get_le16(s->pb);
+ bps = avio_get_le16(s->pb);
+ samplerate = avio_get_le32(s->pb);
if(samplerate <= 0 || samplerate > 1000000){
av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
return -1;
}
- datalen = get_le32(s->pb);
+ datalen = avio_get_le32(s->pb);
if(datalen < 0){
av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
return -1;
@@ -87,7 +87,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
for (i = 0; i < c->totalframes; i++) {
- uint32_t size = get_le32(s->pb);
+ uint32_t size = avio_get_le32(s->pb);
av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
framepos += size;
}
@@ -101,13 +101,13 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->extradata_size = url_ftell(s->pb) - start_offset;
if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
- //this check is redundant as get_buffer should fail
+ //this check is redundant as avio_get_buffer should fail
av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
return -1;
}
st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
url_fseek(s->pb, start_offset, SEEK_SET);
- get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
+ avio_get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
return 0;
}
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 1003157..c559a6c 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -47,14 +47,14 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos)
int len;
url_fseek(pb, start_pos, SEEK_SET);
- if (get_byte(pb) != 0x1A)
+ if (avio_get_byte(pb) != 0x1A)
return -1;
#define GET_EFI_META(name,size) \
- len = get_byte(pb); \
+ len = avio_get_byte(pb); \
if (len < 1 || len > size) \
return -1; \
- if (get_buffer(pb, buf, size) == size) { \
+ if (avio_get_buffer(pb, buf, size) == size) { \
buf[len] = 0; \
av_metadata_set2(&avctx->metadata, name, buf, 0); \
}
diff --git a/libavformat/txd.c b/libavformat/txd.c
index eb5e8b3..adc975b 100644
--- a/libavformat/txd.c
+++ b/libavformat/txd.c
@@ -57,9 +57,9 @@ static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) {
int ret;
next_chunk:
- id = get_le32(pb);
- chunk_size = get_le32(pb);
- marker = get_le32(pb);
+ id = avio_get_le32(pb);
+ chunk_size = avio_get_le32(pb);
+ marker = avio_get_le32(pb);
if (url_feof(s->pb))
return AVERROR_EOF;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d12bbc2..546fe53 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -332,7 +332,7 @@ int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
pkt->pos= url_ftell(s);
- ret= get_buffer(s, pkt->data, size);
+ ret= avio_get_buffer(s, pkt->data, size);
if(ret<=0)
av_free_packet(pkt);
else
@@ -351,7 +351,7 @@ int av_append_packet(ByteIOContext *s, AVPacket *pkt, int size)
ret = av_grow_packet(pkt, size);
if (ret < 0)
return ret;
- ret = get_buffer(s, pkt->data + old_size, size);
+ ret = avio_get_buffer(s, pkt->data + old_size, size);
av_shrink_packet(pkt, old_size + FFMAX(ret, 0));
return ret;
}
@@ -555,7 +555,7 @@ int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt,
/* read probe data */
buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE);
- if ((ret = get_buffer(*pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
+ if ((ret = avio_get_buffer(*pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
/* fail if error was not end of file, otherwise, lower score */
if (ret != AVERROR_EOF) {
av_free(buf);
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index 8dd735d..4221196 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -49,8 +49,8 @@ static int vc1t_read_header(AVFormatContext *s,
int frames;
uint32_t fps;
- frames = get_le24(pb);
- if(get_byte(pb) != 0xC5 || get_le32(pb) != 4)
+ frames = avio_get_le24(pb);
+ if(avio_get_byte(pb) != 0xC5 || avio_get_le32(pb) != 4)
return -1;
/* init video codec */
@@ -63,13 +63,13 @@ static int vc1t_read_header(AVFormatContext *s,
st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
st->codec->extradata_size = VC1_EXTRADATA_SIZE;
- get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
- st->codec->height = get_le32(pb);
- st->codec->width = get_le32(pb);
- if(get_le32(pb) != 0xC)
+ avio_get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
+ st->codec->height = avio_get_le32(pb);
+ st->codec->width = avio_get_le32(pb);
+ if(avio_get_le32(pb) != 0xC)
return -1;
url_fskip(pb, 8);
- fps = get_le32(pb);
+ fps = avio_get_le32(pb);
if(fps == 0xFFFFFFFF)
av_set_pts_info(st, 32, 1, 1000);
else{
@@ -95,10 +95,10 @@ static int vc1t_read_packet(AVFormatContext *s,
if(url_feof(pb))
return AVERROR(EIO);
- frame_size = get_le24(pb);
- if(get_byte(pb) & 0x80)
+ frame_size = avio_get_le24(pb);
+ if(avio_get_byte(pb) & 0x80)
keyframe = 1;
- pts = get_le32(pb);
+ pts = avio_get_le32(pb);
if(av_get_packet(pb, pkt, frame_size) < 0)
return AVERROR(EIO);
if(s->streams[0]->time_base.den == 1000)
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index 7ef29d8..0389701 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -46,7 +46,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st;
url_fskip(pb, 20);
- header_size = get_le16(pb) - 22;
+ header_size = avio_get_le16(pb) - 22;
if (header_size != 4) {
av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size);
return AVERROR(ENOSYS);
@@ -73,10 +73,10 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
int channels = 1;
while (!voc->remaining_size) {
- type = get_byte(pb);
+ type = avio_get_byte(pb);
if (type == VOC_TYPE_EOF)
return AVERROR(EIO);
- voc->remaining_size = get_le24(pb);
+ voc->remaining_size = avio_get_le24(pb);
if (!voc->remaining_size) {
if (url_is_streamed(s->pb))
return AVERROR(EIO);
@@ -86,11 +86,11 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
switch (type) {
case VOC_TYPE_VOICE_DATA:
- dec->sample_rate = 1000000 / (256 - get_byte(pb));
+ dec->sample_rate = 1000000 / (256 - avio_get_byte(pb));
if (sample_rate)
dec->sample_rate = sample_rate;
dec->channels = channels;
- tmp_codec = get_byte(pb);
+ tmp_codec = avio_get_byte(pb);
dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);
voc->remaining_size -= 2;
max_size -= 2;
@@ -101,19 +101,19 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
break;
case VOC_TYPE_EXTENDED:
- sample_rate = get_le16(pb);
- get_byte(pb);
- channels = get_byte(pb) + 1;
+ sample_rate = avio_get_le16(pb);
+ avio_get_byte(pb);
+ channels = avio_get_byte(pb) + 1;
sample_rate = 256000000 / (channels * (65536 - sample_rate));
voc->remaining_size = 0;
max_size -= 4;
break;
case VOC_TYPE_NEW_VOICE_DATA:
- dec->sample_rate = get_le32(pb);
- dec->bits_per_coded_sample = get_byte(pb);
- dec->channels = get_byte(pb);
- tmp_codec = get_le16(pb);
+ dec->sample_rate = avio_get_le32(pb);
+ dec->bits_per_coded_sample = avio_get_byte(pb);
+ dec->channels = avio_get_byte(pb);
+ tmp_codec = avio_get_le16(pb);
url_fskip(pb, 4);
voc->remaining_size -= 12;
max_size -= 12;
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 9cf0c3a..47f87ec 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -54,7 +54,7 @@ static void add_metadata(AVFormatContext *s, const char *tag,
buf = av_malloc(len+1);
if (!buf)
return;
- get_buffer(s->pb, buf, len);
+ avio_get_buffer(s->pb, buf, len);
buf[len] = 0;
av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL);
}
@@ -74,7 +74,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
url_fskip(s->pb, 12);
- header_size = get_be32(s->pb);
+ header_size = avio_get_be32(s->pb);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_TWINVQ;
@@ -82,12 +82,12 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
do {
int len;
- chunk_tag = get_le32(s->pb);
+ chunk_tag = avio_get_le32(s->pb);
if (chunk_tag == MKTAG('D','A','T','A'))
break;
- len = get_be32(s->pb);
+ len = avio_get_be32(s->pb);
if ((unsigned) len > INT_MAX/2) {
av_log(s, AV_LOG_ERROR, "Malformed header\n");
@@ -98,9 +98,9 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
switch(chunk_tag){
case MKTAG('C','O','M','M'):
- st->codec->channels = get_be32(s->pb) + 1;
- read_bitrate = get_be32(s->pb);
- rate_flag = get_be32(s->pb);
+ st->codec->channels = avio_get_be32(s->pb) + 1;
+ read_bitrate = avio_get_be32(s->pb);
+ rate_flag = avio_get_be32(s->pb);
url_fskip(s->pb, len-12);
st->codec->bit_rate = read_bitrate*1000;
@@ -208,7 +208,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip
pkt->data[1] = c->last_frame_bits;
- ret = get_buffer(s->pb, pkt->data+2, size);
+ ret = avio_get_buffer(s->pb, pkt->data+2, size);
if (ret<=0) {
av_free_packet(pkt);
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 354afb6..5bc6098 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -143,8 +143,8 @@ AVOutputFormat ff_wav_muxer = {
static int64_t next_tag(ByteIOContext *pb, unsigned int *tag)
{
- *tag = get_le32(pb);
- return get_le32(pb);
+ *tag = avio_get_le32(pb);
+ return avio_get_le32(pb);
}
/* return the size of the found tag */
@@ -197,25 +197,25 @@ static int wav_read_header(AVFormatContext *s,
WAVContext *wav = s->priv_data;
/* check RIFF header */
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
rf64 = tag == MKTAG('R', 'F', '6', '4');
if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
return -1;
- get_le32(pb); /* file size */
- tag = get_le32(pb);
+ avio_get_le32(pb); /* file size */
+ tag = avio_get_le32(pb);
if (tag != MKTAG('W', 'A', 'V', 'E'))
return -1;
if (rf64) {
- if (get_le32(pb) != MKTAG('d', 's', '6', '4'))
+ if (avio_get_le32(pb) != MKTAG('d', 's', '6', '4'))
return -1;
- size = get_le32(pb);
+ size = avio_get_le32(pb);
if (size < 16)
return -1;
- get_le64(pb); /* RIFF size */
- data_size = get_le64(pb);
- sample_count = get_le64(pb);
+ avio_get_le64(pb); /* RIFF size */
+ data_size = avio_get_le64(pb);
+ sample_count = avio_get_le64(pb);
url_fskip(pb, size - 16); /* skip rest of ds64 chunk */
}
@@ -239,7 +239,7 @@ static int wav_read_header(AVFormatContext *s,
if (tag == MKTAG('d', 'a', 't', 'a')){
break;
}else if (tag == MKTAG('f','a','c','t') && !sample_count){
- sample_count = get_le32(pb);
+ sample_count = avio_get_le32(pb);
size -= 4;
}
url_fseek(pb, size, SEEK_CUR);
@@ -269,8 +269,8 @@ static int64_t find_guid(ByteIOContext *pb, const uint8_t guid1[16])
int64_t size;
while (!url_feof(pb)) {
- get_buffer(pb, guid, 16);
- size = get_le64(pb);
+ avio_get_buffer(pb, guid, 16);
+ size = avio_get_le64(pb);
if (size <= 24)
return -1;
if (!memcmp(guid, guid1, 16))
@@ -384,14 +384,14 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st;
uint8_t guid[16];
- get_buffer(pb, guid, 16);
+ avio_get_buffer(pb, guid, 16);
if (memcmp(guid, guid_riff, 16))
return -1;
- if (get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
+ if (avio_get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
return -1;
- get_buffer(pb, guid, 16);
+ avio_get_buffer(pb, guid, 16);
if (memcmp(guid, guid_wave, 16)) {
av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
return -1;
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 1757159..2c9f55f 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -105,8 +105,8 @@ static int wc3_read_header(AVFormatContext *s,
/* traverse through the chunks and load the header information before
* the first BRCH tag */
- fourcc_tag = get_le32(pb);
- size = (get_be32(pb) + 1) & (~1);
+ fourcc_tag = avio_get_le32(pb);
+ size = (avio_get_be32(pb) + 1) & (~1);
do {
switch (fourcc_tag) {
@@ -127,7 +127,7 @@ static int wc3_read_header(AVFormatContext *s,
buffer = av_malloc(size+1);
if (!buffer)
return AVERROR(ENOMEM);
- if ((ret = get_buffer(pb, buffer, size)) != size)
+ if ((ret = avio_get_buffer(pb, buffer, size)) != size)
return AVERROR(EIO);
buffer[size] = 0;
av_metadata_set2(&s->metadata, "title", buffer,
@@ -136,8 +136,8 @@ static int wc3_read_header(AVFormatContext *s,
case SIZE_TAG:
/* video resolution override */
- wc3->width = get_le32(pb);
- wc3->height = get_le32(pb);
+ wc3->width = avio_get_le32(pb);
+ wc3->height = avio_get_le32(pb);
break;
case PALT_TAG:
@@ -154,9 +154,9 @@ static int wc3_read_header(AVFormatContext *s,
break;
}
- fourcc_tag = get_le32(pb);
+ fourcc_tag = avio_get_le32(pb);
/* chunk sizes are 16-bit aligned */
- size = (get_be32(pb) + 1) & (~1);
+ size = (avio_get_be32(pb) + 1) & (~1);
if (url_feof(pb))
return AVERROR(EIO);
@@ -205,9 +205,9 @@ static int wc3_read_packet(AVFormatContext *s,
while (!packet_read) {
- fourcc_tag = get_le32(pb);
+ fourcc_tag = avio_get_le32(pb);
/* chunk sizes are 16-bit aligned */
- size = (get_be32(pb) + 1) & (~1);
+ size = (avio_get_be32(pb) + 1) & (~1);
if (url_feof(pb))
return AVERROR(EIO);
@@ -242,7 +242,7 @@ static int wc3_read_packet(AVFormatContext *s,
#if 0
url_fseek(pb, size, SEEK_CUR);
#else
- if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size)
+ if ((unsigned)size > sizeof(text) || (ret = avio_get_buffer(pb, text, size)) != size)
ret = AVERROR(EIO);
else {
int i = 0;
diff --git a/libavformat/westwood.c b/libavformat/westwood.c
index 85d2056..f58199e 100644
--- a/libavformat/westwood.c
+++ b/libavformat/westwood.c
@@ -130,7 +130,7 @@ static int wsaud_read_header(AVFormatContext *s,
AVStream *st;
unsigned char header[AUD_HEADER_SIZE];
- if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
+ if (avio_get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
return AVERROR(EIO);
wsaud->audio_samplerate = AV_RL16(&header[0]);
if (header[11] == 99)
@@ -173,7 +173,7 @@ static int wsaud_read_packet(AVFormatContext *s,
unsigned int chunk_size;
int ret = 0;
- if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
+ if (avio_get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
AUD_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
@@ -237,7 +237,7 @@ static int wsvqa_read_header(AVFormatContext *s,
st->codec->extradata_size = VQA_HEADER_SIZE;
st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
header = (unsigned char *)st->codec->extradata;
- if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
+ if (avio_get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
VQA_HEADER_SIZE) {
av_free(st->codec->extradata);
return AVERROR(EIO);
@@ -277,7 +277,7 @@ static int wsvqa_read_header(AVFormatContext *s,
/* there are 0 or more chunks before the FINF chunk; iterate until
* FINF has been skipped and the file will be ready to be demuxed */
do {
- if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
+ if (avio_get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
av_free(st->codec->extradata);
return AVERROR(EIO);
}
@@ -320,7 +320,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
unsigned int chunk_size;
int skip_byte;
- while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
+ while (avio_get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
chunk_type = AV_RB32(&preamble[0]);
chunk_size = AV_RB32(&preamble[4]);
skip_byte = chunk_size & 0x01;
@@ -329,7 +329,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
if (av_new_packet(pkt, chunk_size))
return AVERROR(EIO);
- ret = get_buffer(pb, pkt->data, chunk_size);
+ ret = avio_get_buffer(pb, pkt->data, chunk_size);
if (ret != chunk_size) {
av_free_packet(pkt);
return AVERROR(EIO);
diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index e0881d3..2d117b2 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -87,7 +87,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1));
int read_request = FFMIN(buf_size - nread, remaining_in_sector);
- n = get_buffer(pb, buf, read_request);
+ n = avio_get_buffer(pb, buf, read_request);
if (n <= 0)
break;
nread += n;
@@ -139,7 +139,7 @@ static int read_ints(ByteIOContext *pb, uint32_t *data, int count)
{
int i, total = 0;
for (i = 0; i < count; i++) {
- if ((data[total] = get_le32(pb)))
+ if ((data[total] = avio_get_le32(pb)))
total++;
}
return total;
@@ -471,9 +471,9 @@ static void get_attachment(AVFormatContext *s, ByteIOContext *pb, int length)
if (strcmp(mime, "image/jpeg"))
goto done;
- get_byte(pb);
+ avio_get_byte(pb);
avio_get_str16le(pb, INT_MAX, description, sizeof(description));
- filesize = get_le32(pb);
+ filesize = avio_get_le32(pb);
if (!filesize)
goto done;
@@ -487,7 +487,7 @@ static void get_attachment(AVFormatContext *s, ByteIOContext *pb, int length)
if (!st->codec->extradata)
goto done;
st->codec->extradata_size = filesize;
- get_buffer(pb, st->codec->extradata, filesize);
+ avio_get_buffer(pb, st->codec->extradata, filesize);
done:
url_fseek(pb, pos + length, SEEK_SET);
}
@@ -500,7 +500,7 @@ static void get_tag(AVFormatContext *s, ByteIOContext *pb, const char *key, int
return;
if (type == 0 && length == 4) {
- snprintf(buf, buf_size, "%"PRIi32, get_le32(pb));
+ snprintf(buf, buf_size, "%"PRIi32, avio_get_le32(pb));
} else if (type == 1) {
avio_get_str16le(pb, length, buf, buf_size);
if (!strlen(buf)) {
@@ -508,9 +508,9 @@ static void get_tag(AVFormatContext *s, ByteIOContext *pb, const char *key, int
return;
}
} else if (type == 3 && length == 4) {
- strcpy(buf, get_le32(pb) ? "true" : "false");
+ strcpy(buf, avio_get_le32(pb) ? "true" : "false");
} else if (type == 4 && length == 8) {
- int64_t num = get_le64(pb);
+ int64_t num = avio_get_le64(pb);
if (!strcmp(key, "WM/EncodingTime") ||
!strcmp(key, "WM/MediaOriginalBroadcastDateTime"))
filetime_to_iso8601(buf, buf_size, num);
@@ -524,10 +524,10 @@ static void get_tag(AVFormatContext *s, ByteIOContext *pb, const char *key, int
else
snprintf(buf, buf_size, "%"PRIi64, num);
} else if (type == 5 && length == 2) {
- snprintf(buf, buf_size, "%"PRIi16, get_le16(pb));
+ snprintf(buf, buf_size, "%"PRIi16, avio_get_le16(pb));
} else if (type == 6 && length == 16) {
ff_asf_guid guid;
- get_buffer(pb, guid, 16);
+ avio_get_buffer(pb, guid, 16);
snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid));
} else if (type == 2 && !strcmp(key, "WM/Picture")) {
get_attachment(s, pb, length);
@@ -554,8 +554,8 @@ static void parse_legacy_attrib(AVFormatContext *s, ByteIOContext *pb)
while(!url_feof(pb)) {
char key[1024];
ff_get_guid(pb, &guid);
- type = get_le32(pb);
- length = get_le32(pb);
+ type = avio_get_le32(pb);
+ length = avio_get_le32(pb);
if (!length)
break;
if (ff_guidcmp(&guid, metadata_guid)) {
@@ -772,10 +772,10 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
int len, sid, consumed;
ff_get_guid(pb, &g);
- len = get_le32(pb);
+ len = avio_get_le32(pb);
if (len < 32)
break;
- sid = get_le32(pb) & 0x7FFF;
+ sid = avio_get_le32(pb) & 0x7FFF;
url_fskip(pb, 8);
consumed = 32;
@@ -785,13 +785,13 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
int size;
consumed += 20;
url_fskip(pb, 16);
- if (get_le32(pb)) {
+ if (avio_get_le32(pb)) {
url_fskip(pb, 8);
ff_get_guid(pb, &mediatype);
ff_get_guid(pb, &subtype);
url_fskip(pb, 12);
ff_get_guid(pb, &formattype);
- size = get_le32(pb);
+ size = avio_get_le32(pb);
parse_media_type(s, 0, sid, mediatype, subtype, formattype, size);
consumed += 72 + size;
}
@@ -806,7 +806,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
ff_get_guid(pb, &subtype);
url_fskip(pb, 12);
ff_get_guid(pb, &formattype);
- size = get_le32(pb);
+ size = avio_get_le32(pb);
parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size);
consumed += 76 + size;
}
@@ -832,7 +832,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
}
buf_size = FFMIN(len - consumed, sizeof(buf));
- get_buffer(pb, buf, buf_size);
+ avio_get_buffer(pb, buf, buf_size);
consumed += buf_size;
ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0);
}
@@ -840,7 +840,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
int stream_index = ff_find_stream_index(s, sid);
if (stream_index >= 0) {
url_fskip(pb, 12);
- if (get_le32(pb))
+ if (avio_get_le32(pb))
av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index);
consumed += 16;
}
@@ -850,7 +850,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
AVStream *st = s->streams[stream_index];
uint8_t language[4];
url_fskip(pb, 12);
- get_buffer(pb, language, 3);
+ avio_get_buffer(pb, language, 3);
if (language[0]) {
language[3] = 0;
av_metadata_set2(&st->metadata, "language", language, 0);
@@ -861,7 +861,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
int stream_index = ff_find_stream_index(s, sid);
if (stream_index >= 0) {
url_fskip(pb, 8);
- wtv->pts = get_le64(pb);
+ wtv->pts = avio_get_le64(pb);
consumed += 16;
if (wtv->pts == -1)
wtv->pts = AV_NOPTS_VALUE;
@@ -942,16 +942,16 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
/* read root directory sector */
url_fskip(s->pb, 0x30);
- root_size = get_le32(s->pb);
+ root_size = avio_get_le32(s->pb);
if (root_size > sizeof(root)) {
av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n");
return AVERROR_INVALIDDATA;
}
url_fskip(s->pb, 4);
- root_sector = get_le32(s->pb);
+ root_sector = avio_get_le32(s->pb);
url_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET);
- root_size = get_buffer(s->pb, root, root_size);
+ root_size = avio_get_buffer(s->pb, root, root_size);
if (root_size < 0)
return AVERROR_INVALIDDATA;
@@ -982,8 +982,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
pb = wtvfile_open(s, root, root_size, table_0_entries_time_le16);
if (pb) {
while(1) {
- uint64_t timestamp = get_le64(pb);
- uint64_t frame_nb = get_le64(pb);
+ uint64_t timestamp = avio_get_le64(pb);
+ uint64_t frame_nb = avio_get_le64(pb);
if (url_feof(pb))
break;
ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size,
@@ -996,8 +996,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
if (pb) {
int i;
while (1) {
- uint64_t frame_nb = get_le64(pb);
- uint64_t position = get_le64(pb);
+ uint64_t frame_nb = avio_get_le64(pb);
+ uint64_t position = avio_get_le64(pb);
if (url_feof(pb))
break;
for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
diff --git a/libavformat/wv.c b/libavformat/wv.c
index 667ae2e..85e2b52 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -85,25 +85,25 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app
wc->pos = url_ftell(pb);
if(!append){
- tag = get_le32(pb);
+ tag = avio_get_le32(pb);
if (tag != MKTAG('w', 'v', 'p', 'k'))
return -1;
- size = get_le32(pb);
+ size = avio_get_le32(pb);
if(size < 24 || size > WV_BLOCK_LIMIT){
av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
return -1;
}
wc->blksize = size;
- ver = get_le16(pb);
+ ver = avio_get_le16(pb);
if(ver < 0x402 || ver > 0x410){
av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
return -1;
}
- get_byte(pb); // track no
- get_byte(pb); // track sub index
- wc->samples = get_le32(pb); // total samples in file
- wc->soff = get_le32(pb); // offset in samples of current block
- get_buffer(pb, wc->extra, WV_EXTRA_SIZE);
+ avio_get_byte(pb); // track no
+ avio_get_byte(pb); // track sub index
+ wc->samples = avio_get_le32(pb); // total samples in file
+ wc->soff = avio_get_le32(pb); // offset in samples of current block
+ avio_get_buffer(pb, wc->extra, WV_EXTRA_SIZE);
}else{
size = wc->blksize;
}
@@ -126,8 +126,8 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app
}
while(url_ftell(pb) < block_end){
int id, size;
- id = get_byte(pb);
- size = (id & 0x80) ? get_le24(pb) : get_byte(pb);
+ id = avio_get_byte(pb);
+ size = (id & 0x80) ? avio_get_le24(pb) : avio_get_byte(pb);
size <<= 1;
if(id&0x40)
size--;
@@ -137,24 +137,24 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app
av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n");
return -1;
}
- chan = get_byte(pb);
+ chan = avio_get_byte(pb);
switch(size - 2){
case 0:
- chmask = get_byte(pb);
+ chmask = avio_get_byte(pb);
break;
case 1:
- chmask = get_le16(pb);
+ chmask = avio_get_le16(pb);
break;
case 2:
- chmask = get_le24(pb);
+ chmask = avio_get_le24(pb);
break;
case 3:
- chmask = get_le32(pb);
+ chmask = avio_get_le32(pb);
break;
case 5:
url_fskip(pb, 1);
- chan |= (get_byte(pb) & 0xF) << 8;
- chmask = get_le24(pb);
+ chan |= (avio_get_byte(pb) & 0xF) << 8;
+ chmask = avio_get_le24(pb);
break;
default:
av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size);
@@ -162,7 +162,7 @@ static int wv_read_block_header(AVFormatContext *ctx, ByteIOContext *pb, int app
}
break;
case 0x27:
- rate = get_le24(pb);
+ rate = avio_get_le24(pb);
break;
default:
url_fskip(pb, size);
@@ -253,13 +253,13 @@ static int wv_read_packet(AVFormatContext *s,
if(wc->multichannel)
AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12);
memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE);
- ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
+ ret = avio_get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
if(ret != wc->blksize){
av_free_packet(pkt);
return AVERROR(EIO);
}
while(!(wc->flags & WV_END_BLOCK)){
- if(get_le32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
+ if(avio_get_le32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
av_free_packet(pkt);
return -1;
}
@@ -274,16 +274,16 @@ static int wv_read_packet(AVFormatContext *s,
return -1;
}
wc->blksize = size;
- ver = get_le16(s->pb);
+ ver = avio_get_le16(s->pb);
if(ver < 0x402 || ver > 0x410){
av_free_packet(pkt);
av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
return -1;
}
- get_byte(s->pb); // track no
- get_byte(s->pb); // track sub index
- wc->samples = get_le32(s->pb); // total samples in file
- wc->soff = get_le32(s->pb); // offset in samples of current block
+ avio_get_byte(s->pb); // track no
+ avio_get_byte(s->pb); // track sub index
+ wc->samples = avio_get_le32(s->pb); // total samples in file
+ wc->soff = avio_get_le32(s->pb); // offset in samples of current block
if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){
av_free_packet(pkt);
return ret;
diff --git a/libavformat/xa.c b/libavformat/xa.c
index 21a6b26..8c3505d 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -77,14 +77,14 @@ static int xa_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA;
url_fskip(pb, 4); /* Skip the XA ID */
- xa->out_size = get_le32(pb);
+ xa->out_size = avio_get_le32(pb);
url_fskip(pb, 2); /* Skip the tag */
- st->codec->channels = get_le16(pb);
- st->codec->sample_rate = get_le32(pb);
+ st->codec->channels = avio_get_le16(pb);
+ st->codec->sample_rate = avio_get_le32(pb);
/* Value in file is average byte rate*/
- st->codec->bit_rate = get_le32(pb) * 8;
- st->codec->block_align = get_le16(pb);
- st->codec->bits_per_coded_sample = get_le16(pb);
+ st->codec->bit_rate = avio_get_le32(pb) * 8;
+ st->codec->block_align = avio_get_le16(pb);
+ st->codec->bits_per_coded_sample = avio_get_le16(pb);
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
diff --git a/libavformat/yop.c b/libavformat/yop.c
index ae90925..b262943 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -83,14 +83,14 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
url_fskip(pb, 6);
- frame_rate = get_byte(pb);
- yop->frame_size = get_byte(pb) * 2048;
- video_dec->width = get_le16(pb);
- video_dec->height = get_le16(pb);
+ frame_rate = avio_get_byte(pb);
+ yop->frame_size = avio_get_byte(pb) * 2048;
+ video_dec->width = avio_get_le16(pb);
+ video_dec->height = avio_get_le16(pb);
video_stream->sample_aspect_ratio = (AVRational){1, 2};
- ret = get_buffer(pb, video_dec->extradata, 8);
+ ret = avio_get_buffer(pb, video_dec->extradata, 8);
if (ret < 8)
return ret < 0 ? ret : AVERROR_EOF;
@@ -138,7 +138,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
yop->video_packet.pos = url_ftell(pb);
- ret = get_buffer(pb, yop->video_packet.data, yop->palette_size);
+ ret = avio_get_buffer(pb, yop->video_packet.data, yop->palette_size);
if (ret < 0) {
goto err_out;
}else if (ret < yop->palette_size) {
@@ -155,7 +155,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
url_fskip(pb, yop->audio_block_length - ret);
- ret = get_buffer(pb, yop->video_packet.data + yop->palette_size,
+ ret = avio_get_buffer(pb, yop->video_packet.data + yop->palette_size,
actual_video_data_size);
if (ret < 0)
goto err_out;
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index b2df31f..f1e029f 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -200,7 +200,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
struct frame_attributes *s1 = s->priv_data;
for (i=0; i<MAX_YUV4_HEADER; i++) {
- header[i] = get_byte(pb);
+ header[i] = avio_get_byte(pb);
if (header[i] == '\n') {
header[i+1] = 0x20; // Add a space after last option. Makes parsing "444" vs "444alpha" easier.
header[i+2] = 0;
@@ -352,7 +352,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
struct frame_attributes *s1 = s->priv_data;
for (i=0; i<MAX_FRAME_HEADER; i++) {
- header[i] = get_byte(s->pb);
+ header[i] = avio_get_byte(s->pb);
if (header[i] == '\n') {
header[i+1] = 0;
break;
--
1.7.2.3
More information about the ffmpeg-devel
mailing list