[FFmpeg-devel] [PATCH 06/10] avio: rename url_fseek/fskip/ftell/fsize/feof/ferror to avio_*
Anton Khirnov
anton
Sat Feb 19 12:42:50 CET 2011
---
ffmpeg.c | 8 ++--
ffplay.c | 10 ++--
libavformat/4xm.c | 10 ++--
libavformat/aea.c | 4 +-
libavformat/aiffdec.c | 18 +++---
libavformat/aiffenc.c | 16 +++---
libavformat/amr.c | 4 +-
libavformat/anm.c | 28 +++++-----
libavformat/ape.c | 12 ++--
libavformat/apetag.c | 6 +-
libavformat/applehttp.c | 4 +-
libavformat/asfdec.c | 104 ++++++++++++++++++------------------
libavformat/asfenc.c | 38 +++++++-------
libavformat/assdec.c | 2 +-
libavformat/au.c | 8 ++--
libavformat/avidec.c | 118 +++++++++++++++++++++---------------------
libavformat/avienc.c | 36 ++++++------
libavformat/avio.h | 28 ++++++++--
libavformat/aviobuf.c | 51 ++++++++++++++----
libavformat/avs.c | 8 ++--
libavformat/bethsoftvid.c | 10 ++--
libavformat/bfi.c | 12 ++--
libavformat/bink.c | 12 ++--
libavformat/c93.c | 6 +-
libavformat/cafdec.c | 40 +++++++-------
libavformat/cdg.c | 2 +-
libavformat/daud.c | 2 +-
libavformat/dsicin.c | 2 +-
libavformat/dv.c | 14 +++---
libavformat/dxa.c | 26 +++++-----
libavformat/eacdata.c | 2 +-
libavformat/electronicarts.c | 30 +++++-----
libavformat/ffmdec.c | 28 +++++-----
libavformat/ffmenc.c | 4 +-
libavformat/ffmetadec.c | 4 +-
libavformat/filmstripdec.c | 14 +++---
libavformat/flacdec.c | 6 +-
libavformat/flacenc.c | 6 +-
libavformat/flic.c | 12 ++--
libavformat/flvdec.c | 46 ++++++++--------
libavformat/flvenc.c | 28 +++++-----
libavformat/gxf.c | 52 +++++++++---------
libavformat/gxfenc.c | 64 +++++++++++-----------
libavformat/id3v1.c | 6 +-
libavformat/id3v2.c | 20 ++++----
libavformat/idcin.c | 4 +-
libavformat/idroqdec.c | 12 ++--
libavformat/iff.c | 22 ++++----
libavformat/img2.c | 4 +-
libavformat/ingenientdec.c | 8 ++--
libavformat/ipmovie.c | 50 +++++++++---------
libavformat/iss.c | 4 +-
libavformat/iv8.c | 2 +-
libavformat/libnut.c | 6 +-
libavformat/lmlm4.c | 2 +-
libavformat/lxfdec.c | 6 +-
libavformat/matroskadec.c | 32 ++++++------
libavformat/matroskaenc.c | 52 +++++++++---------
libavformat/mm.c | 4 +-
libavformat/mmf.c | 22 ++++----
libavformat/mov.c | 76 +++++++++++++-------------
libavformat/movenc.c | 90 ++++++++++++++++----------------
libavformat/movenchint.c | 16 +++---
libavformat/mp3dec.c | 12 ++--
libavformat/mp3enc.c | 8 ++--
libavformat/mpc.c | 12 ++--
libavformat/mpc8.c | 30 +++++-----
libavformat/mpeg.c | 42 ++++++++--------
libavformat/mpegts.c | 36 ++++++------
libavformat/mpegtsenc.c | 2 +-
libavformat/msnwc_tcp.c | 16 +++---
libavformat/mtv.c | 12 ++--
libavformat/mxfdec.c | 46 ++++++++--------
libavformat/mxfenc.c | 26 +++++-----
libavformat/mxg.c | 2 +-
libavformat/ncdec.c | 4 +-
libavformat/nsvdec.c | 30 +++++-----
libavformat/nutdec.c | 54 ++++++++++----------
libavformat/nutenc.c | 6 +-
libavformat/nuv.c | 34 ++++++------
libavformat/oggdec.c | 14 +++---
libavformat/oggenc.c | 8 ++--
libavformat/pcm.c | 2 +-
libavformat/psxstr.c | 6 +-
libavformat/pva.c | 8 ++--
libavformat/qcp.c | 18 +++---
libavformat/r3d.c | 26 +++++-----
libavformat/rawdec.c | 2 +-
libavformat/rdt.c | 10 ++--
libavformat/riff.c | 12 ++--
libavformat/rl2.c | 4 +-
libavformat/rmdec.c | 58 ++++++++++----------
libavformat/rmenc.c | 4 +-
libavformat/rpl.c | 6 +-
libavformat/rsoenc.c | 6 +-
libavformat/rtpdec_asf.c | 22 ++++----
libavformat/rtpdec_qt.c | 20 ++++----
libavformat/sauce.c | 10 ++--
libavformat/seek.c | 8 ++--
libavformat/segafilm.c | 6 +-
libavformat/sierravmd.c | 8 ++--
libavformat/siff.c | 10 ++--
libavformat/smacker.c | 14 +++---
libavformat/sol.c | 2 +-
libavformat/soxdec.c | 8 ++--
libavformat/soxenc.c | 6 +-
libavformat/spdifdec.c | 6 +-
libavformat/srtdec.c | 4 +-
libavformat/swfdec.c | 10 ++--
libavformat/swfenc.c | 22 ++++----
libavformat/thp.c | 4 +-
libavformat/tiertexseq.c | 10 ++--
libavformat/tmv.c | 6 +-
libavformat/tta.c | 16 +++---
libavformat/tty.c | 10 ++--
libavformat/txd.c | 4 +-
libavformat/utils.c | 36 ++++++------
libavformat/vc1test.c | 4 +-
libavformat/vc1testenc.c | 2 +-
libavformat/vocdec.c | 10 ++--
libavformat/vqf.c | 10 ++--
libavformat/wav.c | 34 ++++++------
libavformat/wc3movie.c | 18 +++---
libavformat/westwood.c | 8 ++--
libavformat/wtv.c | 100 ++++++++++++++++++------------------
libavformat/wv.c | 26 +++++-----
libavformat/xa.c | 4 +-
libavformat/yop.c | 12 ++--
128 files changed, 1221 insertions(+), 1178 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index 185ca19..3ec1a4e 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1350,9 +1350,9 @@ static void print_report(AVFormatContext **output_files,
oc = output_files[0];
- total_size = url_fsize(oc->pb);
- if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too
- total_size= url_ftell(oc->pb);
+ total_size = avio_fsize(oc->pb);
+ if(total_size<0) // FIXME improve avio_fsize() so it works with non seekable output too
+ total_size= avio_ftell(oc->pb);
buf[0] = '\0';
ti1 = 1e10;
@@ -2555,7 +2555,7 @@ static int transcode(AVFormatContext **output_files,
}
/* finish if limit size exhausted */
- if (limit_filesize != 0 && limit_filesize <= url_ftell(output_files[0]->pb))
+ if (limit_filesize != 0 && limit_filesize <= avio_ftell(output_files[0]->pb))
break;
/* read a frame from it and output it in the fifo */
diff --git a/ffplay.c b/ffplay.c
index e71c9c9..5f2289e 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2423,7 +2423,7 @@ static int decode_thread(void *arg)
goto fail;
}
if(ic->pb)
- ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
+ ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use avio_feof() to test for the end
if(seek_by_bytes<0)
seek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT);
@@ -2568,9 +2568,9 @@ static int decode_thread(void *arg)
}
ret = av_read_frame(ic, pkt);
if (ret < 0) {
- if (ret == AVERROR_EOF || url_feof(ic->pb))
+ if (ret == AVERROR_EOF || avio_feof(ic->pb))
eof=1;
- if (url_ferror(ic->pb))
+ if (avio_ferror(ic->pb))
break;
SDL_Delay(100); /* wait for user event */
continue;
@@ -2805,7 +2805,7 @@ static void event_loop(void)
}else if(cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos>=0){
pos= cur_stream->audio_pkt.pos;
}else
- pos = url_ftell(cur_stream->ic->pb);
+ pos = avio_ftell(cur_stream->ic->pb);
if (cur_stream->ic->bit_rate)
incr *= cur_stream->ic->bit_rate / 8.0;
else
@@ -2838,7 +2838,7 @@ static void event_loop(void)
}
if (cur_stream) {
if(seek_by_bytes || cur_stream->ic->duration<=0){
- uint64_t size= url_fsize(cur_stream->ic->pb);
+ uint64_t size= avio_fsize(cur_stream->ic->pb);
stream_seek(cur_stream, size*x/cur_stream->width, 0, 1);
}else{
int64_t ts;
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index eee4679..8bb9f42 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->fps = 1.0;
/* skip the first 3 32-bit numbers */
- url_fseek(pb, 12, SEEK_CUR);
+ avio_fseek(pb, 12, SEEK_CUR);
/* check for LIST-HEAD */
GET_LIST_HEADER();
@@ -259,7 +259,7 @@ static int fourxm_read_packet(AVFormatContext *s,
return ret;
fourcc_tag = AV_RL32(&header[0]);
size = AV_RL32(&header[4]);
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
switch (fourcc_tag) {
@@ -283,7 +283,7 @@ static int fourxm_read_packet(AVFormatContext *s,
return AVERROR(EIO);
pkt->stream_index = fourxm->video_stream_index;
pkt->pts = fourxm->video_pts;
- pkt->pos = url_ftell(s->pb);
+ pkt->pos = avio_ftell(s->pb);
memcpy(pkt->data, header, 8);
ret = avio_get_buffer(s->pb, &pkt->data[8], size);
@@ -322,12 +322,12 @@ static int fourxm_read_packet(AVFormatContext *s,
fourxm->tracks[track_number].audio_pts += audio_frame_count;
} else {
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
}
break;
default:
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
break;
}
}
diff --git a/libavformat/aea.c b/libavformat/aea.c
index ab49718..1cc6fa6 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -62,9 +62,9 @@ static int aea_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
/* Parse the amount of channels and skip to pos 2048(0x800) */
- url_fskip(s->pb, 264);
+ avio_fskip(s->pb, 264);
st->codec->channels = avio_get_byte(s->pb);
- url_fskip(s->pb, 1783);
+ avio_fskip(s->pb, 1783);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index b02caa1..3e9e667 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -51,7 +51,7 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
{
int size;
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
*tag = avio_get_le32(pb);
@@ -70,7 +70,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
int res;
if (!str) {
- url_fskip(s->pb, size);
+ avio_fskip(s->pb, size);
return;
}
@@ -152,7 +152,7 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
/* Chunk is over */
if (size)
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
return num_frames;
}
@@ -232,17 +232,17 @@ static int aiff_read_header(AVFormatContext *s,
get_meta(s, "comment" , size);
break;
case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
- aiff->data_end = url_ftell(pb) + size;
+ aiff->data_end = avio_ftell(pb) + size;
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 */
+ offset += avio_ftell(pb); /* Compute absolute data offset */
if (st->codec->block_align) /* Assume COMM already parsed */
goto got_sound;
if (url_is_streamed(pb)) {
av_log(s, AV_LOG_ERROR, "file is not seekable\n");
return -1;
}
- url_fskip(pb, size - 8);
+ avio_fskip(pb, size - 8);
break;
case MKTAG('w', 'a', 'v', 'e'):
if ((uint64_t)size > (1<<30))
@@ -256,7 +256,7 @@ static int aiff_read_header(AVFormatContext *s,
default: /* Jump */
if (size & 1) /* Always even aligned */
size++;
- url_fskip (pb, size);
+ avio_fskip (pb, size);
}
}
@@ -276,7 +276,7 @@ got_sound:
st->nb_frames * st->codec->frame_size : st->nb_frames;
/* Position the stream at the first block */
- url_fseek(pb, offset, SEEK_SET);
+ avio_fseek(pb, offset, SEEK_SET);
return 0;
}
@@ -292,7 +292,7 @@ static int aiff_read_packet(AVFormatContext *s,
int res, size;
/* calculate size of remaining data */
- max_size = aiff->data_end - url_ftell(s->pb);
+ max_size = aiff->data_end - avio_ftell(s->pb);
if (max_size <= 0)
return AVERROR_EOF;
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 3578459..2d542f4 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -44,7 +44,7 @@ static int aiff_write_header(AVFormatContext *s)
/* FORM AIFF header */
avio_put_tag(pb, "FORM");
- aiff->form = url_ftell(pb);
+ aiff->form = avio_ftell(pb);
avio_put_be32(pb, 0); /* file length */
avio_put_tag(pb, aifc ? "AIFC" : "AIFF");
@@ -65,7 +65,7 @@ static int aiff_write_header(AVFormatContext *s)
avio_put_be32(pb, aifc ? 24 : 18); /* size */
avio_put_be16(pb, enc->channels); /* Number of channels */
- aiff->frames = url_ftell(pb);
+ aiff->frames = avio_ftell(pb);
avio_put_be32(pb, 0); /* Number of frames */
if (!enc->bits_per_coded_sample)
@@ -89,7 +89,7 @@ static int aiff_write_header(AVFormatContext *s)
/* Sound data chunk */
avio_put_tag(pb, "SSND");
- aiff->ssnd = url_ftell(pb); /* Sound chunk size */
+ aiff->ssnd = avio_ftell(pb); /* Sound chunk size */
avio_put_be32(pb, 0); /* Sound samples data size */
avio_put_be32(pb, 0); /* Data offset */
avio_put_be32(pb, 0); /* Block-size (block align) */
@@ -117,7 +117,7 @@ static int aiff_write_trailer(AVFormatContext *s)
/* Chunks sizes must be even */
int64_t file_size, end_size;
- end_size = file_size = url_ftell(pb);
+ end_size = file_size = avio_ftell(pb);
if (file_size & 1) {
avio_put_byte(pb, 0);
end_size++;
@@ -125,19 +125,19 @@ static int aiff_write_trailer(AVFormatContext *s)
if (!url_is_streamed(s->pb)) {
/* File length */
- url_fseek(pb, aiff->form, SEEK_SET);
+ avio_fseek(pb, aiff->form, SEEK_SET);
avio_put_be32(pb, file_size - aiff->form - 4);
/* Number of sample frames */
- url_fseek(pb, aiff->frames, SEEK_SET);
+ avio_fseek(pb, aiff->frames, SEEK_SET);
avio_put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align);
/* Sound Data chunk size */
- url_fseek(pb, aiff->ssnd, SEEK_SET);
+ avio_fseek(pb, aiff->ssnd, SEEK_SET);
avio_put_be32(pb, file_size - aiff->ssnd - 4);
/* return to the end */
- url_fseek(pb, end_size, SEEK_SET);
+ avio_fseek(pb, end_size, SEEK_SET);
put_flush_packet(pb);
}
diff --git a/libavformat/amr.c b/libavformat/amr.c
index ab392be..339f64d 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -122,7 +122,7 @@ static int amr_read_packet(AVFormatContext *s,
AVCodecContext *enc = s->streams[0]->codec;
int read, size = 0, toc, mode;
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
{
return AVERROR(EIO);
}
@@ -154,7 +154,7 @@ static int amr_read_packet(AVFormatContext *s,
}
pkt->stream_index = 0;
- pkt->pos= url_ftell(s->pb);
+ pkt->pos= avio_ftell(s->pb);
pkt->data[0]=toc;
pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
read = avio_get_buffer(s->pb, pkt->data+1, size-1);
diff --git a/libavformat/anm.c b/libavformat/anm.c
index c48c317..dbeda53 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s,
AVStream *st;
int i, ret;
- url_fskip(pb, 4); /* magic number */
+ avio_fskip(pb, 4); /* magic number */
if (avio_get_le16(pb) != MAX_PAGES) {
av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
return AVERROR_INVALIDDATA;
@@ -91,7 +91,7 @@ static int read_header(AVFormatContext *s,
anm->nb_pages = avio_get_le16(pb);
anm->nb_records = avio_get_le32(pb);
- url_fskip(pb, 2); /* max records per page */
+ avio_fskip(pb, 2); /* max records per page */
anm->page_table_offset = avio_get_le16(pb);
if (avio_get_le32(pb) != ANIM_TAG)
return AVERROR_INVALIDDATA;
@@ -107,13 +107,13 @@ static int read_header(AVFormatContext *s,
st->codec->height = avio_get_le16(pb);
if (avio_get_byte(pb) != 0)
goto invalid;
- url_fskip(pb, 1); /* frame rate multiplier info */
+ avio_fskip(pb, 1); /* frame rate multiplier info */
/* ignore last delta record (used for looping) */
if (avio_get_byte(pb)) /* has_last_delta */
anm->nb_records = FFMAX(anm->nb_records - 1, 0);
- url_fskip(pb, 1); /* last_delta_valid */
+ avio_fskip(pb, 1); /* last_delta_valid */
if (avio_get_byte(pb) != 0)
goto invalid;
@@ -121,15 +121,15 @@ static int read_header(AVFormatContext *s,
if (avio_get_byte(pb) != 1)
goto invalid;
- url_fskip(pb, 1); /* other recs per frame */
+ avio_fskip(pb, 1); /* other recs per frame */
if (avio_get_byte(pb) != 1)
goto invalid;
- url_fskip(pb, 32); /* record_types */
+ avio_fskip(pb, 32); /* record_types */
st->nb_frames = avio_get_le32(pb);
av_set_pts_info(st, 64, 1, avio_get_le16(pb));
- url_fskip(pb, 58);
+ avio_fskip(pb, 58);
/* color cycling and palette data */
st->codec->extradata_size = 16*8 + 4*256;
@@ -143,7 +143,7 @@ static int read_header(AVFormatContext *s,
goto close_and_return;
/* read page table */
- ret = url_fseek(pb, anm->page_table_offset, SEEK_SET);
+ ret = avio_fseek(pb, anm->page_table_offset, SEEK_SET);
if (ret < 0)
goto close_and_return;
@@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s,
Page *p;
int tmp, record_size;
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
if (anm->page < 0)
@@ -192,8 +192,8 @@ repeat:
/* parse page header */
if (anm->record < 0) {
- url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
- url_fskip(pb, 8 + 2*p->nb_records);
+ avio_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
+ avio_fskip(pb, 8 + 2*p->nb_records);
anm->record = 0;
}
@@ -208,11 +208,11 @@ repeat:
}
/* fetch record size */
- tmp = url_ftell(pb);
- url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
+ tmp = avio_ftell(pb);
+ avio_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
8 + anm->record * 2, SEEK_SET);
record_size = avio_get_le16(pb);
- url_fseek(pb, tmp, SEEK_SET);
+ avio_fseek(pb, tmp, SEEK_SET);
/* fetch record */
pkt->size = av_get_packet(s->pb, pkt, record_size);
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 3dab495..20530b1 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -187,7 +187,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Skip any unknown bytes at the end of the descriptor.
This is for future compatibility */
if (ape->descriptorlength > 52)
- url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
+ avio_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
/* Read header data */
ape->compressiontype = avio_get_le16(pb);
@@ -212,7 +212,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
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 */
+ avio_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
ape->headerlength += 4;
}
@@ -239,7 +239,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Skip any stored wav header */
if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
- url_fskip(pb, ape->wavheaderlength);
+ avio_fskip(pb, ape->wavheaderlength);
}
if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
@@ -289,7 +289,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* try to read APE tags */
if (!url_is_streamed(pb)) {
ff_ape_parse_tag(s);
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
}
av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype);
@@ -337,12 +337,12 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
APEContext *ape = s->priv_data;
uint32_t extra_size = 8;
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
if (ape->currentframe > ape->totalframes)
return AVERROR(EIO);
- url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
+ avio_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
/* Calculate how many blocks there are in this frame */
if (ape->currentframe == (ape->totalframes - 1))
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index d70a478..a4f0ceb 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -66,7 +66,7 @@ static int ape_tag_read_field(AVFormatContext *s)
void ff_ape_parse_tag(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
- int file_size = url_fsize(pb);
+ int file_size = avio_fsize(pb);
uint32_t val, fields, tag_bytes;
uint8_t buf[8];
int i;
@@ -74,7 +74,7 @@ void ff_ape_parse_tag(AVFormatContext *s)
if (file_size < APE_TAG_FOOTER_BYTES)
return;
- url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
+ avio_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
avio_get_buffer(pb, buf, 8); /* APETAGEX */
if (strncmp(buf, "APETAGEX", 8)) {
@@ -105,7 +105,7 @@ void ff_ape_parse_tag(AVFormatContext *s)
return;
}
- url_fseek(pb, file_size - tag_bytes, SEEK_SET);
+ avio_fseek(pb, file_size - tag_bytes, SEEK_SET);
for (i=0; i<fields; i++)
if (ape_tag_read_field(s) < 0) break;
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index e35aaa8..05aafe6 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -224,7 +224,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
if (var)
free_segment_list(var);
c->finished = 0;
- while (!url_feof(in)) {
+ while (!avio_feof(in)) {
read_chomp_line(in, line, sizeof(line));
if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
struct variant_info info = {{0}};
@@ -457,7 +457,7 @@ start:
if (var->pb && !var->pkt.data) {
ret = av_read_frame(var->ctx, &var->pkt);
if (ret < 0) {
- if (!url_feof(var->pb))
+ if (!avio_feof(var->pb))
return ret;
reset_packet(&var->pkt);
}
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index e7b0418..d4d4373 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -160,7 +160,7 @@ static int get_value(AVIOContext *pb, int type){
static void get_tag(AVFormatContext *s, const char *key, int type, int len)
{
char *value;
- int64_t off = url_ftell(s->pb);
+ int64_t off = avio_ftell(s->pb);
if ((unsigned)len >= (UINT_MAX - 1)/2)
return;
@@ -182,7 +182,7 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len)
av_metadata_set2(&s->metadata, key, value, 0);
finish:
av_freep(&value);
- url_fseek(s->pb, off + len, SEEK_SET);
+ avio_fseek(s->pb, off + len, SEEK_SET);
}
static int asf_read_file_properties(AVFormatContext *s, int64_t size)
@@ -226,7 +226,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
return AVERROR(EINVAL);
}
- pos1 = url_ftell(pb);
+ pos1 = avio_ftell(pb);
st = av_new_stream(s, 0);
if (!st)
@@ -301,7 +301,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
st->need_parsing = AVSTREAM_PARSE_FULL;
}
/* We have to init the frame size at some point .... */
- pos2 = url_ftell(pb);
+ pos2 = avio_ftell(pb);
if (size >= (pos2 + 8 - pos1 + 24)) {
asf_st->ds_span = avio_get_byte(pb);
asf_st->ds_packet_size = avio_get_le16(pb);
@@ -338,7 +338,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
break;
}
} else if (type == AVMEDIA_TYPE_VIDEO &&
- size - (url_ftell(pb) - pos1 + 24) >= 51) {
+ size - (avio_ftell(pb) - pos1 + 24) >= 51) {
avio_get_le32(pb);
avio_get_le32(pb);
avio_get_byte(pb);
@@ -350,7 +350,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
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);
+ avio_fskip(pb, 20);
// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
if (sizeX > 40) {
st->codec->extradata_size = sizeX - 40;
@@ -387,8 +387,8 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
if(st->codec->codec_id == CODEC_ID_H264)
st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
}
- pos2 = url_ftell(pb);
- url_fskip(pb, size - (pos2 - pos1 + 24));
+ pos2 = avio_ftell(pb);
+ avio_fskip(pb, size - (pos2 - pos1 + 24));
return 0;
}
@@ -428,14 +428,14 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
for (i=0; i<stream_ct; i++){
avio_get_le16(pb);
ext_len = avio_get_le16(pb);
- url_fseek(pb, ext_len, SEEK_CUR);
+ avio_fseek(pb, ext_len, SEEK_CUR);
}
for (i=0; i<payload_ext_ct; i++){
ff_get_guid(pb, &g);
ext_d=avio_get_le16(pb);
ext_len=avio_get_le32(pb);
- url_fseek(pb, ext_len, SEEK_CUR);
+ avio_fseek(pb, ext_len, SEEK_CUR);
}
return 0;
@@ -455,7 +455,7 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size)
get_tag(s, "author" , 0, len2);
get_tag(s, "copyright", 0, len3);
get_tag(s, "comment" , 0, len4);
- url_fskip(pb, len5);
+ avio_fskip(pb, len5);
return 0;
}
@@ -475,7 +475,7 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size)
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);
+ avio_fskip(pb, name_len - ret);
value_type = avio_get_le16(pb);
value_len = avio_get_le16(pb);
if (!value_type && value_len%2)
@@ -505,7 +505,7 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size)
char lang[6];
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);
+ avio_fskip(pb, lang_len - ret);
if (j < 128)
av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages));
}
@@ -531,10 +531,10 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
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);
+ avio_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= 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);
+ avio_fskip(pb, value_len - 2);
if(stream_num<128){
if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num;
@@ -571,7 +571,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size)
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);
+ avio_fskip(pb, name_len - ret);
ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
}
@@ -595,14 +595,14 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_get_byte(pb);
memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
for(;;) {
- uint64_t gpos= url_ftell(pb);
+ uint64_t gpos= avio_ftell(pb);
ff_get_guid(pb, &g);
gsize = avio_get_le64(pb);
av_dlog(s, "%08"PRIx64": ", gpos);
print_guid(&g);
av_dlog(s, " size=0x%"PRIx64"\n", gsize);
if (!ff_guidcmp(&g, &ff_asf_data_header)) {
- asf->data_object_offset = url_ftell(pb);
+ asf->data_object_offset = avio_ftell(pb);
// if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
if (!(asf->hdr.flags & 0x01) && gsize >= 100) {
asf->data_object_size = gsize - 24;
@@ -639,7 +639,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
continue;
} else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
asf_read_marker(s, gsize);
- } else if (url_feof(pb)) {
+ } else if (avio_feof(pb)) {
return -1;
} else {
if (!s->keylen) {
@@ -652,17 +652,17 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
}
- if(url_ftell(pb) != gpos + gsize)
- av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize);
- url_fseek(pb, gpos + gsize, SEEK_SET);
+ if(avio_ftell(pb) != gpos + gsize)
+ av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", avio_ftell(pb)-gpos, gsize);
+ avio_fseek(pb, gpos + gsize, SEEK_SET);
}
ff_get_guid(pb, &g);
avio_get_le64(pb);
avio_get_byte(pb);
avio_get_byte(pb);
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
- asf->data_offset = url_ftell(pb);
+ asf->data_offset = avio_ftell(pb);
asf->packet_size_left = 0;
@@ -726,7 +726,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
// if we do not know packet size, allow skipping up to 32 kB
off= 32768;
if (s->packet_size > 0)
- off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3;
+ off= (avio_ftell(pb) - s->data_offset) % s->packet_size + 3;
c=d=e=-1;
while(off-- > 0){
@@ -743,14 +743,14 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
* imply complete -EAGAIN handling support at random positions in
* the stream.
*/
- if (url_ferror(pb) == AVERROR(EAGAIN))
+ if (avio_ferror(pb) == AVERROR(EAGAIN))
return AVERROR(EAGAIN);
- if (!url_feof(pb))
- av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, url_ftell(pb));
+ if (!avio_feof(pb))
+ av_log(s, AV_LOG_ERROR, "ff asf bad header %x at:%"PRId64"\n", c, avio_ftell(pb));
}
if ((c & 0x8f) == 0x82) {
if (d || e) {
- if (!url_feof(pb))
+ if (!avio_feof(pb))
av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
return -1;
}
@@ -758,7 +758,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
d= avio_get_byte(pb);
rsize+=3;
}else{
- url_fseek(pb, -1, SEEK_CUR); //FIXME
+ avio_fseek(pb, -1, SEEK_CUR); //FIXME
}
asf->packet_flags = c;
@@ -770,11 +770,11 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
//the following checks prevent overflows and infinite loops
if(!packet_length || packet_length >= (1U<<29)){
- av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, url_ftell(pb));
+ av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, avio_ftell(pb));
return -1;
}
if(padsize >= packet_length){
- av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, url_ftell(pb));
+ av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, avio_ftell(pb));
return -1;
}
@@ -826,16 +826,16 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
// for(i=0; i<asf->packet_replic_size-8; i++)
// av_log(s, AV_LOG_DEBUG, "%02X ",avio_get_byte(pb));
// av_log(s, AV_LOG_DEBUG, "\n");
- url_fskip(pb, 10);
+ avio_fskip(pb, 10);
ts0= avio_get_le64(pb);
ts1= avio_get_le64(pb);
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
avio_get_le32(pb);
- url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4);
+ avio_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;
}else
- url_fskip(pb, asf->packet_replic_size - 8);
+ avio_fskip(pb, asf->packet_replic_size - 8);
rsize += asf->packet_replic_size; // FIXME - check validity
} else if (asf->packet_replic_size==1){
// multipacket - frag_offset is beginning timestamp
@@ -886,18 +886,18 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
ASFStream *asf_st = 0;
for (;;) {
int ret;
- if(url_feof(pb))
+ if(avio_feof(pb))
return AVERROR_EOF;
if (asf->packet_size_left < FRAME_HEADER_SIZE
|| asf->packet_segments < 1) {
//asf->packet_size_left <= asf->packet_padsize) {
int ret = asf->packet_size_left + asf->packet_padsize;
- //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
+ //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_ftell(pb));
assert(ret>=0);
/* fail safe */
- url_fskip(pb, ret);
+ avio_fskip(pb, ret);
- asf->packet_pos= url_ftell(pb);
+ asf->packet_pos= avio_ftell(pb);
if (asf->data_object_size != (uint64_t)-1 &&
(asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
return AVERROR_EOF; /* Do not exceed the size of the data object */
@@ -914,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
) {
asf->packet_time_start = 0;
/* unhandled packet (should not happen) */
- url_fskip(pb, asf->packet_frag_size);
+ avio_fskip(pb, asf->packet_frag_size);
asf->packet_size_left -= asf->packet_frag_size;
if(asf->stream_index < 0)
av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size);
@@ -934,7 +934,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
if (asf->packet_multi_size < asf->packet_obj_size)
{
asf->packet_time_start = 0;
- url_fskip(pb, asf->packet_multi_size);
+ avio_fskip(pb, asf->packet_multi_size);
asf->packet_size_left -= asf->packet_multi_size;
continue;
}
@@ -1146,7 +1146,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
if (s->packet_size > 0)
pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
*ppos= pos;
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
//printf("asf_read_pts\n");
asf_reset_header(s);
@@ -1185,21 +1185,21 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
{
ff_asf_guid g;
ASFContext *asf = s->priv_data;
- int64_t current_pos= url_ftell(s->pb);
+ int64_t current_pos= avio_ftell(s->pb);
int i;
- url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
+ avio_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
ff_get_guid(s->pb, &g);
/* 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= avio_get_le64(s->pb);
- if (gsize < 24 || url_feof(s->pb)) {
- url_fseek(s->pb, current_pos, SEEK_SET);
+ if (gsize < 24 || avio_feof(s->pb)) {
+ avio_fseek(s->pb, current_pos, SEEK_SET);
return;
}
- url_fseek(s->pb, gsize-24, SEEK_CUR);
+ avio_fseek(s->pb, gsize-24, SEEK_CUR);
ff_get_guid(s->pb, &g);
}
@@ -1227,7 +1227,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
}
asf->index_read= 1;
}
- url_fseek(s->pb, current_pos, SEEK_SET);
+ avio_fseek(s->pb, current_pos, SEEK_SET);
}
static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
@@ -1265,10 +1265,10 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
// various attempts to find key frame have failed so far
// asf_reset_header(s);
- // url_fseek(s->pb, pos, SEEK_SET);
+ // avio_fseek(s->pb, pos, SEEK_SET);
// key_pos = pos;
// for(i=0;i<16;i++){
- // pos = url_ftell(s->pb);
+ // pos = avio_ftell(s->pb);
// if (av_read_frame(s, &pkt) < 0){
// av_log(s, AV_LOG_INFO, "seek failed\n");
// return -1;
@@ -1286,7 +1286,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int
/* do the seek */
av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
}
asf_reset_header(s);
return 0;
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 6be6590..85a5e14 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -247,7 +247,7 @@ static int64_t put_header(AVIOContext *pb, const ff_asf_guid *g)
{
int64_t pos;
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
put_guid(pb, g);
avio_put_le64(pb, 24);
return pos;
@@ -258,10 +258,10 @@ static void end_header(AVIOContext *pb, int64_t pos)
{
int64_t pos1;
- pos1 = url_ftell(pb);
- url_fseek(pb, pos + 16, SEEK_SET);
+ pos1 = avio_ftell(pb);
+ avio_fseek(pb, pos + 16, SEEK_SET);
avio_put_le64(pb, pos1 - pos);
- url_fseek(pb, pos1, SEEK_SET);
+ avio_fseek(pb, pos1, SEEK_SET);
}
/* write an asf chunk (only used in streaming case) */
@@ -336,7 +336,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
avio_put_byte(pb, 2); /* ??? */
/* file header */
- header_offset = url_ftell(pb);
+ header_offset = avio_ftell(pb);
hpos = put_header(pb, &ff_asf_file_header);
put_guid(pb, &ff_asf_my_guid);
avio_put_le64(pb, file_size);
@@ -424,7 +424,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
put_guid(pb, &ff_asf_video_conceal_none);
}
avio_put_le64(pb, 0); /* ??? */
- es_pos = url_ftell(pb);
+ es_pos = avio_ftell(pb);
avio_put_le32(pb, extra_size); /* wav header len */
avio_put_le32(pb, extra_size2); /* additional data len */
avio_put_le16(pb, n + 1); /* stream number */
@@ -441,10 +441,10 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
if (wavsize < 0)
return -1;
if (wavsize != extra_size) {
- cur_pos = url_ftell(pb);
- url_fseek(pb, es_pos, SEEK_SET);
+ cur_pos = avio_ftell(pb);
+ avio_fseek(pb, es_pos, SEEK_SET);
avio_put_le32(pb, wavsize); /* wav header len */
- url_fseek(pb, cur_pos, SEEK_SET);
+ avio_fseek(pb, cur_pos, SEEK_SET);
}
/* ERROR Correction */
avio_put_byte(pb, 0x01);
@@ -524,22 +524,22 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
/* patch the header size fields */
- cur_pos = url_ftell(pb);
+ cur_pos = avio_ftell(pb);
header_size = cur_pos - header_offset;
if (asf->is_streamed) {
header_size += 8 + 30 + 50;
- url_fseek(pb, header_offset - 10 - 30, SEEK_SET);
+ avio_fseek(pb, header_offset - 10 - 30, SEEK_SET);
avio_put_le16(pb, header_size);
- url_fseek(pb, header_offset - 2 - 30, SEEK_SET);
+ avio_fseek(pb, header_offset - 2 - 30, SEEK_SET);
avio_put_le16(pb, header_size);
header_size -= 8 + 30 + 50;
}
header_size += 24 + 6;
- url_fseek(pb, header_offset - 14, SEEK_SET);
+ avio_fseek(pb, header_offset - 14, SEEK_SET);
avio_put_le64(pb, header_size);
- url_fseek(pb, cur_pos, SEEK_SET);
+ avio_fseek(pb, cur_pos, SEEK_SET);
/* movie chunk, followed by packets of packet_size */
asf->data_offset = cur_pos;
@@ -604,7 +604,7 @@ static int put_payload_parsing_info(
ASFContext *asf = s->priv_data;
AVIOContext *pb = s->pb;
int ppi_size, i;
- int64_t start= url_ftell(pb);
+ int64_t start= avio_ftell(pb);
int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS;
@@ -641,7 +641,7 @@ static int put_payload_parsing_info(
if (asf->multi_payloads_present)
avio_put_byte(pb, nb_payloads | ASF_PAYLOAD_FLAGS);
- ppi_size = url_ftell(pb) - start;
+ ppi_size = avio_ftell(pb) - start;
return ppi_size;
}
@@ -859,7 +859,7 @@ static int asf_write_trailer(AVFormatContext *s)
flush_packet(s);
/* write index */
- data_size = url_ftell(s->pb);
+ data_size = avio_ftell(s->pb);
if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
}
@@ -869,8 +869,8 @@ static int asf_write_trailer(AVFormatContext *s)
put_chunk(s, 0x4524, 0, 0); /* end of stream */
} else {
/* rewrite an updated header */
- file_size = url_ftell(s->pb);
- url_fseek(s->pb, 0, SEEK_SET);
+ file_size = avio_ftell(s->pb);
+ avio_fseek(s->pb, 0, SEEK_SET);
asf_write_header1(s, file_size, data_size - asf->data_offset);
}
diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index e04d92a..9fae8d1 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -92,7 +92,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
header_remaining= INT_MAX;
dst[0] = &st->codec->extradata;
dst[1] = &ass->event_buffer;
- while(!url_feof(pb)){
+ while(!avio_feof(pb)){
uint8_t line[MAX_LINESIZE];
len = ff_get_line(pb, line, sizeof(line));
diff --git a/libavformat/au.c b/libavformat/au.c
index 0569ec4..69782b2 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -93,10 +93,10 @@ static int au_write_trailer(AVFormatContext *s)
if (!url_is_streamed(s->pb)) {
/* update file size */
- file_size = url_ftell(pb);
- url_fseek(pb, 8, SEEK_SET);
+ file_size = avio_ftell(pb);
+ avio_fseek(pb, 8, SEEK_SET);
avio_put_be32(pb, (uint32_t)(file_size - 24));
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
}
@@ -146,7 +146,7 @@ static int au_read_header(AVFormatContext *s,
if (size >= 24) {
/* skip unused data */
- url_fseek(pb, size - 24, SEEK_CUR);
+ avio_fseek(pb, size - 24, SEEK_CUR);
}
/* now we are ready: build format streams */
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 0a02ce3..1132584 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -109,7 +109,7 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb)
/* check RIFF header */
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 */
+ avi->riff_end += avio_ftell(pb); /* RIFF chunk end */
avio_get_buffer(pb, header+4, 4);
for(i=0; avi_headers[i][0]; i++)
@@ -138,7 +138,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
AVIStream *ast;
int i;
int64_t last_pos= -1;
- int64_t filesize= url_fsize(s->pb);
+ int64_t filesize= avio_fsize(s->pb);
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"PRIX64"\n",
@@ -178,7 +178,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len);
#endif
- if(url_feof(pb))
+ if(avio_feof(pb))
return -1;
if(last_pos == pos || pos == base - 8)
@@ -195,23 +195,23 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
avio_get_le32(pb); /* size */
duration = avio_get_le32(pb);
- if(url_feof(pb))
+ if(avio_feof(pb))
return -1;
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
if(avi->odml_depth > MAX_ODML_DEPTH){
av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n");
return -1;
}
- url_fseek(pb, offset+8, SEEK_SET);
+ avio_fseek(pb, offset+8, SEEK_SET);
avi->odml_depth++;
read_braindead_odml_indx(s, frame_num);
avi->odml_depth--;
frame_num += duration;
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
}
avi->index_loaded=1;
@@ -267,7 +267,7 @@ 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) {
+ while (avio_ftell(s->pb) < end) {
uint32_t tag = avio_get_le32(s->pb);
uint32_t size = avio_get_le32(s->pb);
avi_read_tag(s, NULL, tag, size);
@@ -298,13 +298,13 @@ 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) {
+ while (avio_ftell(s->pb) < end) {
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) {
+ uint64_t tag_end = avio_ftell(s->pb) + size;
+ while (avio_ftell(s->pb) < tag_end) {
uint16_t tag = avio_get_le16(s->pb);
uint16_t size = avio_get_le16(s->pb);
const char *name = NULL;
@@ -321,12 +321,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
}
if (name)
av_metadata_set2(&s->metadata, name, buffer, 0);
- url_fskip(s->pb, size);
+ avio_fskip(s->pb, size);
}
break;
}
default:
- url_fskip(s->pb, size);
+ avio_fskip(s->pb, size);
break;
}
}
@@ -351,7 +351,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (get_riff(s, pb) < 0)
return -1;
- avi->fsize = url_fsize(pb);
+ avi->fsize = avio_fsize(pb);
if(avi->fsize<=0)
avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end;
@@ -360,7 +360,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec_type = -1;
frame_period = 0;
for(;;) {
- if (url_feof(pb))
+ if (avio_feof(pb))
goto fail;
tag = avio_get_le32(pb);
size = avio_get_le32(pb);
@@ -369,16 +369,16 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
switch(tag) {
case MKTAG('L', 'I', 'S', 'T'):
- list_end = url_ftell(pb) + size;
+ list_end = avio_ftell(pb) + size;
/* Ignored, except at start of video packets. */
tag1 = avio_get_le32(pb);
print_tag("list", tag1, 0);
if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
- avi->movi_list = url_ftell(pb) - 4;
+ avi->movi_list = avio_ftell(pb) - 4;
if(size) avi->movi_end = avi->movi_list + size + (size & 1);
- else avi->movi_end = url_fsize(pb);
+ else avi->movi_end = avio_fsize(pb);
av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
goto end_of_header;
}
@@ -392,13 +392,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
unsigned char date[64] = {0};
size += (size & 1);
size -= avio_get_buffer(pb, date, FFMIN(size, sizeof(date)-1));
- url_fskip(pb, size);
+ avio_fskip(pb, size);
avi_metadata_creation_time(&s->metadata, date);
break;
}
case MKTAG('d', 'm', 'l', 'h'):
avi->is_odml = 1;
- url_fskip(pb, size + (size & 1));
+ avio_fskip(pb, size + (size & 1));
break;
case MKTAG('a', 'm', 'v', 'h'):
amv_file_format=1;
@@ -410,13 +410,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_get_le32(pb);
avi->non_interleaved |= avio_get_le32(pb) & AVIF_MUSTUSEINDEX;
- url_fskip(pb, 2 * 4);
+ avio_fskip(pb, 2 * 4);
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);
+ avio_fskip(pb, size - 10 * 4);
break;
case MKTAG('s', 't', 'r', 'h'):
/* stream header */
@@ -425,7 +425,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
handler = avio_get_le32(pb); /* codec tag */
if(tag1 == MKTAG('p', 'a', 'd', 's')){
- url_fskip(pb, size - 8);
+ avio_fskip(pb, size - 8);
break;
}else{
stream_index++;
@@ -469,10 +469,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto fail;
}
s->streams[0]->priv_data = ast;
- url_fskip(pb, 3 * 4);
+ avio_fskip(pb, 3 * 4);
ast->scale = avio_get_le32(pb);
ast->rate = avio_get_le32(pb);
- url_fskip(pb, 4); /* start time */
+ avio_fskip(pb, 4); /* start time */
dv_dur = avio_get_le32(pb);
if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
@@ -485,7 +485,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
*/
stream_index = s->nb_streams - 1;
- url_fskip(pb, size - 9*4);
+ avio_fskip(pb, size - 9*4);
break;
}
@@ -542,14 +542,14 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(ast->sample_size == 0)
st->duration = st->nb_frames;
ast->frame_offset= ast->cum_len;
- url_fskip(pb, size - 12 * 4);
+ avio_fskip(pb, size - 12 * 4);
break;
case MKTAG('s', 't', 'r', 'f'):
/* stream header */
if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
- url_fskip(pb, size);
+ avio_fskip(pb, size);
} else {
- uint64_t cur_pos = url_ftell(pb);
+ uint64_t cur_pos = avio_ftell(pb);
if (cur_pos < list_end)
size = FFMIN(size, list_end - cur_pos);
st = s->streams[stream_index];
@@ -560,7 +560,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height=avih_height;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_AMV;
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
tag1 = ff_get_bmp_header(pb, st);
@@ -620,7 +620,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
st->codec->height= FFABS(st->codec->height);
-// url_fskip(pb, size - 5 * 4);
+// avio_fskip(pb, size - 5 * 4);
break;
case AVMEDIA_TYPE_AUDIO:
ff_get_wav_header(pb, st->codec, size);
@@ -630,7 +630,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->sample_size= st->codec->block_align;
}
if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
- url_fskip(pb, 1);
+ avio_fskip(pb, 1);
/* Force parsing as several audio frames can be in
* one packet and timestamps refer to packet start. */
st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
@@ -658,17 +658,17 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->codec->codec_id= CODEC_ID_NONE;
st->codec->codec_tag= 0;
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
}
break;
case MKTAG('i', 'n', 'd', 'x'):
- i= url_ftell(pb);
+ i= avio_ftell(pb);
if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){
read_braindead_odml_indx(s, 0);
}
- url_fseek(pb, i+size, SEEK_SET);
+ avio_fseek(pb, i+size, SEEK_SET);
break;
case MKTAG('v', 'p', 'r', 'p'):
if(stream_index < (unsigned)s->nb_streams && size > 9*4){
@@ -693,7 +693,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
size -= 9*4;
}
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
break;
case MKTAG('s', 't', 'r', 'n'):
if(s->nb_streams){
@@ -704,13 +704,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(size > 1000000){
av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "
"I will ignore it and try to continue anyway.\n");
- avi->movi_list = url_ftell(pb) - 4;
- avi->movi_end = url_fsize(pb);
+ avi->movi_list = avio_ftell(pb) - 4;
+ avi->movi_end = avio_fsize(pb);
goto end_of_header;
}
/* skip tag */
size += (size & 1);
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
}
@@ -762,7 +762,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
goto error;
ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc));
- url_fskip(pb, desc_len - ret);
+ avio_fskip(pb, desc_len - ret);
if (*desc)
av_metadata_set2(&st->metadata, "title", desc, 0);
@@ -892,7 +892,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
if(i>=0){
int64_t pos= best_st->index_entries[i].pos;
pos += best_ast->packet_size - best_ast->remaining;
- url_fseek(s->pb, pos + 8, SEEK_SET);
+ avio_fseek(s->pb, pos + 8, SEEK_SET);
// av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos);
assert(best_ast->remaining <= best_ast->packet_size);
@@ -923,7 +923,7 @@ resync:
if(size > ast->remaining)
size= ast->remaining;
- avi->last_pkt_pos= url_ftell(pb);
+ avi->last_pkt_pos= avio_ftell(pb);
err= av_get_packet(pb, pkt, size);
if(err<0)
return err;
@@ -989,7 +989,7 @@ resync:
}
memset(d, -1, sizeof(int)*8);
- for(i=sync=url_ftell(pb); !url_feof(pb); i++) {
+ for(i=sync=avio_ftell(pb); !avio_feof(pb); i++) {
int j;
for(j=0; j<7; j++)
@@ -1008,14 +1008,14 @@ resync:
//parse JUNK
||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
- url_fskip(pb, size);
+ avio_fskip(pb, size);
//av_log(s, AV_LOG_DEBUG, "SKIP\n");
goto resync;
}
//parse stray LIST
if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
goto resync;
}
@@ -1026,7 +1026,7 @@ resync:
//detect ##ix chunk and skip
if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){
- url_fskip(pb, size);
+ avio_fskip(pb, size);
goto resync;
}
@@ -1060,7 +1060,7 @@ resync:
/*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
|| st->discard >= AVDISCARD_ALL){
ast->frame_offset += get_duration(ast, size);
- url_fskip(pb, size);
+ avio_fskip(pb, size);
goto resync;
}
@@ -1092,7 +1092,7 @@ resync:
ast->remaining= size;
if(size || !ast->sample_size){
- uint64_t pos= url_ftell(pb) - 8;
+ uint64_t pos= avio_ftell(pb) - 8;
if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
}
@@ -1145,7 +1145,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
#if defined(DEBUG_SEEK)
av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
#endif
- if(url_feof(pb))
+ if(avio_feof(pb))
return -1;
if(last_pos == pos)
@@ -1162,7 +1162,7 @@ static int guess_ni_flag(AVFormatContext *s){
int i;
int64_t last_start=0;
int64_t first_end= INT64_MAX;
- int64_t oldpos= url_ftell(s->pb);
+ int64_t oldpos= avio_ftell(s->pb);
for(i=0; i<s->nb_streams; i++){
AVStream *st = s->streams[i];
@@ -1174,7 +1174,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);
+ avio_fseek(s->pb, pos + 4, SEEK_SET);
size= avio_get_le32(s->pb);
if(pos + size > st->index_entries[1].pos)
last_start= INT64_MAX;
@@ -1185,7 +1185,7 @@ static int guess_ni_flag(AVFormatContext *s){
if(st->index_entries[n-1].pos < first_end)
first_end= st->index_entries[n-1].pos;
}
- url_fseek(s->pb, oldpos, SEEK_SET);
+ avio_fseek(s->pb, oldpos, SEEK_SET);
return last_start > first_end;
}
@@ -1194,16 +1194,16 @@ static int avi_load_index(AVFormatContext *s)
AVIContext *avi = s->priv_data;
AVIOContext *pb = s->pb;
uint32_t tag, size;
- int64_t pos= url_ftell(pb);
+ int64_t pos= avio_ftell(pb);
int ret = -1;
- if (url_fseek(pb, avi->movi_end, SEEK_SET) < 0)
+ if (avio_fseek(pb, avi->movi_end, SEEK_SET) < 0)
goto the_end; // maybe truncated file
#ifdef DEBUG_SEEK
printf("movi_end=0x%"PRIx64"\n", avi->movi_end);
#endif
for(;;) {
- if (url_feof(pb))
+ if (avio_feof(pb))
break;
tag = avio_get_le32(pb);
size = avio_get_le32(pb);
@@ -1225,13 +1225,13 @@ static int avi_load_index(AVFormatContext *s)
default:
skip:
size += (size & 1);
- if (url_fseek(pb, size, SEEK_CUR) < 0)
+ if (avio_fseek(pb, size, SEEK_CUR) < 0)
goto the_end; // something is wrong here
break;
}
}
the_end:
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
return ret;
}
@@ -1282,7 +1282,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
/* DV demux so it can synthesize correct timestamps. */
dv_offset_reset(avi->dv_demux, timestamp);
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
avi->stream_index= -1;
return 0;
}
@@ -1324,7 +1324,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
}
/* do the seek */
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
avi->stream_index= -1;
return 0;
}
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 7844244..d7699c1 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -123,13 +123,13 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
int64_t file_size;
AVCodecContext* stream;
- file_size = url_ftell(pb);
+ file_size = avio_ftell(pb);
for(n = 0; n < s->nb_streams; n++) {
AVIStream *avist= s->streams[n]->priv_data;
assert(avist->frames_hdr_strm);
stream = s->streams[n]->codec;
- url_fseek(pb, avist->frames_hdr_strm, SEEK_SET);
+ avio_fseek(pb, avist->frames_hdr_strm, SEEK_SET);
ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
if(au_ssize == 0) {
avio_put_le32(pb, avist->packet_count);
@@ -141,10 +141,10 @@ static int avi_write_counters(AVFormatContext* s, int riff_id)
}
if(riff_id == 1) {
assert(avi->frames_hdr_all);
- url_fseek(pb, avi->frames_hdr_all, SEEK_SET);
+ avio_fseek(pb, avi->frames_hdr_all, SEEK_SET);
avio_put_le32(pb, nb_frames);
}
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
return 0;
}
@@ -194,7 +194,7 @@ static int avi_write_header(AVFormatContext *s)
avio_put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
else
avio_put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
- avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
+ avi->frames_hdr_all = avio_ftell(pb); /* remember this offset to fill later */
avio_put_le32(pb, nb_frames); /* nb frames, filled later */
avio_put_le32(pb, 0); /* initial frame */
avio_put_le32(pb, s->nb_streams); /* nb streams */
@@ -251,7 +251,7 @@ static int avi_write_header(AVFormatContext *s)
av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
avio_put_le32(pb, 0); /* start */
- avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */
+ avist->frames_hdr_strm = avio_ftell(pb); /* remember this offset to fill later */
if (url_is_streamed(pb))
avio_put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
else
@@ -412,7 +412,7 @@ static int avi_write_ix(AVFormatContext *s)
ix_tag[3] = '0' + i;
/* Writing AVI OpenDML leaf index chunk */
- ix = url_ftell(pb);
+ ix = avio_ftell(pb);
avio_put_tag(pb, &ix_tag[0]); /* ix?? */
avio_put_le32(pb, avist->indexes.entry * 8 + 24);
/* chunk size */
@@ -432,19 +432,19 @@ static int avi_write_ix(AVFormatContext *s)
(ie->flags & 0x10 ? 0 : 0x80000000));
}
put_flush_packet(pb);
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
/* Updating one entry in the AVI OpenDML master index */
- url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET);
+ avio_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET);
avio_put_tag(pb, "indx"); /* enabling this entry */
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
avio_put_le32(pb, avi->riff_id); /* nEntriesInUse */
- url_fskip(pb, 16*avi->riff_id);
+ avio_fskip(pb, 16*avi->riff_id);
avio_put_le64(pb, ix); /* qwOffset */
avio_put_le32(pb, pos - ix); /* dwSize */
avio_put_le32(pb, avist->indexes.entry); /* dwDuration */
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
return 0;
}
@@ -526,7 +526,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
// Make sure to put an OpenDML chunk when the file size exceeds the limits
if (!url_is_streamed(pb) &&
- (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
+ (avio_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
avi_write_ix(s);
ff_end_tag(pb, avi->movi_list);
@@ -560,7 +560,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
}
idx->cluster[cl][id].flags = flags;
- idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
+ idx->cluster[cl][id].pos = avio_ftell(pb) - avi->movi_list;
idx->cluster[cl][id].len = size;
idx->entry++;
}
@@ -593,10 +593,10 @@ static int avi_write_trailer(AVFormatContext *s)
ff_end_tag(pb, avi->movi_list);
ff_end_tag(pb, avi->riff_start);
- file_size = url_ftell(pb);
- url_fseek(pb, avi->odml_list - 8, SEEK_SET);
+ file_size = avio_ftell(pb);
+ avio_fseek(pb, avi->odml_list - 8, SEEK_SET);
avio_put_tag(pb, "LIST"); /* Making this AVI OpenDML one */
- url_fskip(pb, 16);
+ avio_fskip(pb, 16);
for (n=nb_frames=0;n<s->nb_streams;n++) {
AVCodecContext *stream = s->streams[n]->codec;
@@ -612,7 +612,7 @@ static int avi_write_trailer(AVFormatContext *s)
}
}
avio_put_le32(pb, nb_frames);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
avi_write_counters(s, avi->riff_id);
}
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 43ecf89..9eb0a8a 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -429,6 +429,22 @@ attribute_deprecated uint64_t get_be64(AVIOContext *s);
/**
* @}
*/
+
+
+/**
+ * @defgroup old_url_funcs Old url_*() functions
+ * @deprecated use the avio_ -prefixed functions instead.
+ * @{
+ */
+attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
+attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
+attribute_deprecated int64_t url_ftell(AVIOContext *s);
+attribute_deprecated int64_t url_fsize(AVIOContext *s);
+attribute_deprecated int url_feof(AVIOContext *s);
+attribute_deprecated int url_ferror(AVIOContext *s);
+/**
+ * @}
+ */
#endif
void avio_put_byte( AVIOContext *s, int b);
@@ -502,34 +518,34 @@ char *get_strz(AVIOContext *s, char *buf, int maxlen);
* fseek() equivalent for AVIOContext.
* @return new position or AVERROR.
*/
-int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
+int64_t avio_fseek(AVIOContext *s, int64_t offset, int whence);
/**
* Skip given number of bytes forward.
* @param offset number of bytes
* @return 0 on success, <0 on error
*/
-int url_fskip(AVIOContext *s, int64_t offset);
+int avio_fskip(AVIOContext *s, int64_t offset);
/**
* ftell() equivalent for AVIOContext.
* @return position or AVERROR.
*/
-int64_t url_ftell(AVIOContext *s);
+int64_t avio_ftell(AVIOContext *s);
/**
* Get the filesize.
* @return filesize or AVERROR
*/
-int64_t url_fsize(AVIOContext *s);
+int64_t avio_fsize(AVIOContext *s);
/**
* feof() equivalent for AVIOContext.
* @return non zero if and only if end of file
*/
-int url_feof(AVIOContext *s);
+int avio_feof(AVIOContext *s);
-int url_ferror(AVIOContext *s);
+int avio_ferror(AVIOContext *s);
int av_url_read_fpause(AVIOContext *h, int pause);
int64_t av_url_read_fseek(AVIOContext *h, int stream_index,
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index b882bc5..cd2ab69 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -173,7 +173,7 @@ void put_flush_packet(AVIOContext *s)
s->must_flush = 0;
}
-int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
+int64_t avio_fseek(AVIOContext *s, int64_t offset, int whence)
{
int64_t offset1;
int64_t pos;
@@ -230,18 +230,18 @@ int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
return offset;
}
-int url_fskip(AVIOContext *s, int64_t offset)
+int avio_fskip(AVIOContext *s, int64_t offset)
{
- int64_t ret = url_fseek(s, offset, SEEK_CUR);
+ int64_t ret = avio_fseek(s, offset, SEEK_CUR);
return ret < 0 ? ret : 0;
}
-int64_t url_ftell(AVIOContext *s)
+int64_t avio_ftell(AVIOContext *s)
{
- return url_fseek(s, 0, SEEK_CUR);
+ return avio_fseek(s, 0, SEEK_CUR);
}
-int64_t url_fsize(AVIOContext *s)
+int64_t avio_fsize(AVIOContext *s)
{
int64_t size;
@@ -260,14 +260,14 @@ int64_t url_fsize(AVIOContext *s)
return size;
}
-int url_feof(AVIOContext *s)
+int avio_feof(AVIOContext *s)
{
if(!s)
return 0;
return s->eof_reached;
}
-int url_ferror(AVIOContext *s)
+int avio_ferror(AVIOContext *s)
{
if(!s)
return 0;
@@ -349,6 +349,33 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
{
return avio_get_partial_buffer(s, buf, size);
}
+
+
+int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
+{
+ return avio_fseek(s, offset, whence);
+}
+int url_fskip(AVIOContext *s, int64_t offset)
+{
+ return avio_fskip(s, offset);
+}
+int64_t url_ftell(AVIOContext *s)
+{
+ return avio_ftell(s);
+}
+int64_t url_fsize(AVIOContext *s)
+{
+ return avio_fsize(s);
+}
+int url_feof(AVIOContext *s)
+{
+ return avio_feof(s);
+}
+
+int url_ferror(AVIOContext *s)
+{
+ return avio_ferror(s);
+}
#endif
int avio_put_str(AVIOContext *s, const char *str)
@@ -567,8 +594,8 @@ int avio_get_buffer(AVIOContext *s, unsigned char *buf, int size)
}
}
if (size1 == size) {
- if (url_ferror(s)) return url_ferror(s);
- if (url_feof(s)) return AVERROR_EOF;
+ if (avio_ferror(s)) return avio_ferror(s);
+ if (avio_feof(s)) return AVERROR_EOF;
}
return size1 - size;
}
@@ -590,8 +617,8 @@ int avio_get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
memcpy(buf, s->buf_ptr, len);
s->buf_ptr += len;
if (!len) {
- if (url_ferror(s)) return url_ferror(s);
- if (url_feof(s)) return AVERROR_EOF;
+ if (avio_ferror(s)) return avio_ferror(s);
+ if (avio_feof(s)) return AVERROR_EOF;
}
return len;
}
diff --git a/libavformat/avs.c b/libavformat/avs.c
index 71bb82a..de7b686 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -61,7 +61,7 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
s->ctx_flags |= AVFMTCTX_NOHEADER;
- url_fskip(s->pb, 4);
+ avio_fskip(s->pb, 4);
avs->width = avio_get_le16(s->pb);
avs->height = avio_get_le16(s->pb);
avs->bits_per_sample = avio_get_le16(s->pb);
@@ -123,9 +123,9 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
AvsFormat *avs = s->priv_data;
int ret, size;
- size = url_ftell(s->pb);
+ size = avio_ftell(s->pb);
ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
- size = url_ftell(s->pb) - size;
+ size = avio_ftell(s->pb) - size;
avs->remaining_audio_size -= size;
if (ret == AVERROR(EIO))
@@ -204,7 +204,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
break;
default:
- url_fskip(s->pb, size - 4);
+ avio_fskip(s->pb, size - 4);
}
}
}
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 118ddb1..9bf0212 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -67,7 +67,7 @@ static int vid_read_header(AVFormatContext *s,
* bytes: 'V' 'I' 'D'
* int16s: always_512, nframes, width, height, delay, always_14
*/
- url_fseek(pb, 5, SEEK_CUR);
+ avio_fseek(pb, 5, SEEK_CUR);
vid->nframes = avio_get_le16(pb);
stream = av_new_stream(s, 0);
@@ -112,7 +112,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
return AVERROR(ENOMEM);
// save the file position for the packet, include block type
- position = url_ftell(pb) - 1;
+ position = avio_ftell(pb) - 1;
vidbuf_start[vidbuf_nbytes++] = block_type;
@@ -146,7 +146,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
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(avio_get_byte(pb))
- url_fseek(pb, -1, SEEK_CUR);
+ avio_fseek(pb, -1, SEEK_CUR);
break;
}
if(bytes_copied > npixels)
@@ -179,13 +179,13 @@ static int vid_read_packet(AVFormatContext *s,
int audio_length;
int ret_value;
- if(vid->is_finished || url_feof(pb))
+ if(vid->is_finished || avio_feof(pb))
return AVERROR(EIO);
block_type = avio_get_byte(pb);
switch(block_type){
case PALETTE_BLOCK:
- url_fseek(pb, -1, SEEK_CUR); // include block type
+ avio_fseek(pb, -1, SEEK_CUR); // include block type
ret_value = av_get_packet(pb, pkt, 3 * 256 + 1);
if(ret_value != 3 * 256 + 1){
av_free_packet(pkt);
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 8743fcb..0dbe252 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -65,19 +65,19 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
return AVERROR(ENOMEM);
/* Set the total number of frames. */
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
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);
+ avio_fskip(pb, 12);
vstream->codec->width = avio_get_le32(pb);
vstream->codec->height = avio_get_le32(pb);
/*Load the palette to extradata */
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
vstream->codec->extradata = av_malloc(768);
vstream->codec->extradata_size = 768;
avio_get_buffer(pb, vstream->codec->extradata,
@@ -98,7 +98,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
astream->codec->bits_per_coded_sample = 8;
astream->codec->bit_rate =
astream->codec->sample_rate * astream->codec->bits_per_coded_sample;
- url_fseek(pb, chunk_header - 3, SEEK_SET);
+ avio_fseek(pb, chunk_header - 3, SEEK_SET);
av_set_pts_info(astream, 64, 1, astream->codec->sample_rate);
return 0;
}
@@ -109,7 +109,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
BFIContext *bfi = s->priv_data;
AVIOContext *pb = s->pb;
int ret, audio_offset, video_offset, chunk_size, audio_size = 0;
- if (bfi->nframes == 0 || url_feof(pb)) {
+ if (bfi->nframes == 0 || avio_feof(pb)) {
return AVERROR(EIO);
}
@@ -117,7 +117,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
if (!bfi->avflag) {
uint32_t state = 0;
while(state != MKTAG('S','A','V','I')){
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
state = 256*state + avio_get_byte(pb);
}
diff --git a/libavformat/bink.c b/libavformat/bink.c
index e5633aa..7a96480 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -98,7 +98,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(EIO);
}
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
vst->codec->width = avio_get_le32(pb);
vst->codec->height = avio_get_le32(pb);
@@ -127,7 +127,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
}
if (bink->num_audio_tracks) {
- url_fskip(pb, 4 * bink->num_audio_tracks);
+ avio_fskip(pb, 4 * bink->num_audio_tracks);
for (i = 0; i < bink->num_audio_tracks; i++) {
ast = av_new_stream(s, 1);
@@ -143,7 +143,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
}
- url_fskip(pb, 4 * bink->num_audio_tracks);
+ avio_fskip(pb, 4 * bink->num_audio_tracks);
}
/* frame index table */
@@ -168,7 +168,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
keyframe ? AVINDEX_KEYFRAME : 0);
}
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
bink->current_track = -1;
return 0;
@@ -224,7 +224,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
return 0;
} else {
- url_fseek(pb, audio_size, SEEK_CUR);
+ avio_fseek(pb, audio_size, SEEK_CUR);
}
}
@@ -250,7 +250,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in
return -1;
/* seek to the first frame */
- url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET);
+ avio_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET);
bink->video_pts = 0;
memset(bink->audio_pts, 0, sizeof(bink->audio_pts));
bink->current_track = -1;
diff --git a/libavformat/c93.c b/libavformat/c93.c
index ebe8b33..3248031 100644
--- a/libavformat/c93.c
+++ b/libavformat/c93.c
@@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(ENOMEM);
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
- url_fskip(pb, 26); /* VOC header */
+ avio_fskip(pb, 26); /* VOC header */
ret = voc_get_packet(s, pkt, c93->audio, datasize - 26);
if (ret > 0) {
pkt->stream_index = 1;
@@ -140,13 +140,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
}
if (c93->current_frame == 0) {
- url_fseek(pb, br->index * 2048, SEEK_SET);
+ avio_fseek(pb, br->index * 2048, SEEK_SET);
for (i = 0; i < 32; i++) {
c93->frame_offsets[i] = avio_get_le32(pb);
}
}
- url_fseek(pb,br->index * 2048 +
+ avio_fseek(pb,br->index * 2048 +
c93->frame_offsets[c93->current_frame], SEEK_SET);
datasize = avio_get_le16(pb); /* video frame size */
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 0f77869..c5f79bb 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -106,30 +106,30 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
int strt, skip;
MOVAtom atom;
- strt = url_ftell(pb);
+ strt = avio_ftell(pb);
ff_mov_read_esds(s, pb, atom);
- skip = size - (url_ftell(pb) - strt);
+ skip = size - (avio_ftell(pb) - strt);
if (skip < 0 || !st->codec->extradata ||
st->codec->codec_id != CODEC_ID_AAC) {
av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n");
return AVERROR_INVALIDDATA;
}
- url_fskip(pb, skip);
+ avio_fskip(pb, skip);
} else if (st->codec->codec_id == CODEC_ID_ALAC) {
#define ALAC_PREAMBLE 12
#define ALAC_HEADER 36
if (size < ALAC_PREAMBLE + ALAC_HEADER) {
av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
- url_fskip(pb, size);
+ avio_fskip(pb, size);
return AVERROR_INVALIDDATA;
}
- url_fskip(pb, ALAC_PREAMBLE);
+ avio_fskip(pb, ALAC_PREAMBLE);
st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
avio_get_buffer(pb, st->codec->extradata, ALAC_HEADER);
st->codec->extradata_size = ALAC_HEADER;
- url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
+ avio_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
} else {
st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
@@ -150,7 +150,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
int64_t pos = 0, ccount;
int num_packets, i;
- ccount = url_ftell(pb);
+ ccount = avio_ftell(pb);
num_packets = avio_get_be64(pb);
if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
@@ -167,7 +167,7 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
}
- if (url_ftell(pb) - ccount != size) {
+ if (avio_ftell(pb) - ccount != size) {
av_log(s, AV_LOG_ERROR, "error reading packet table\n");
return -1;
}
@@ -201,7 +201,7 @@ static int read_header(AVFormatContext *s,
int found_data, ret;
int64_t size;
- url_fskip(pb, 8); /* magic, version, file flags */
+ avio_fskip(pb, 8); /* magic, version, file flags */
/* audio description chunk */
if (avio_get_be32(pb) != MKBETAG('d','e','s','c')) {
@@ -219,7 +219,7 @@ static int read_header(AVFormatContext *s,
/* parse each chunk */
found_data = 0;
- while (!url_feof(pb)) {
+ while (!avio_feof(pb)) {
/* stop at data chunk if seeking is not supported or
data chunk size is unknown */
@@ -228,16 +228,16 @@ static int read_header(AVFormatContext *s,
tag = avio_get_be32(pb);
size = avio_get_be64(pb);
- if (url_feof(pb))
+ if (avio_feof(pb))
break;
switch (tag) {
case MKBETAG('d','a','t','a'):
- url_fskip(pb, 4); /* edit count */
- caf->data_start = url_ftell(pb);
+ avio_fskip(pb, 4); /* edit count */
+ caf->data_start = avio_ftell(pb);
caf->data_size = size < 0 ? -1 : size - 4;
if (caf->data_size > 0 && !url_is_streamed(pb))
- url_fskip(pb, caf->data_size);
+ avio_fskip(pb, caf->data_size);
found_data = 1;
break;
@@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s,
case MKBETAG('f','r','e','e'):
if (size < 0)
return AVERROR_INVALIDDATA;
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
}
@@ -284,7 +284,7 @@ static int read_header(AVFormatContext *s,
"block size or frame size are variable.\n");
return AVERROR_INVALIDDATA;
}
- s->file_size = url_fsize(pb);
+ s->file_size = avio_fsize(pb);
s->file_size = FFMAX(0, s->file_size);
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
@@ -292,7 +292,7 @@ static int read_header(AVFormatContext *s,
/* position the stream at the start of data */
if (caf->data_size >= 0)
- url_fseek(pb, caf->data_start, SEEK_SET);
+ avio_fseek(pb, caf->data_start, SEEK_SET);
return 0;
}
@@ -307,12 +307,12 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
int res, pkt_size = 0, pkt_frames = 0;
int64_t left = CAF_MAX_PKT_SIZE;
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
/* don't read past end of data chunk */
if (caf->data_size > 0) {
- left = (caf->data_start + caf->data_size) - url_ftell(pb);
+ left = (caf->data_start + caf->data_size) - avio_ftell(pb);
if (left <= 0)
return AVERROR(EIO);
}
@@ -377,7 +377,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
return -1;
}
- url_fseek(s->pb, pos + caf->data_start, SEEK_SET);
+ avio_fseek(s->pb, pos + caf->data_start, SEEK_SET);
return 0;
}
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index ed3d782..05523b6 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -38,7 +38,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
/// 75 sectors/sec * 4 packets/sector = 300 packets/sec
av_set_pts_info(vst, 32, 1, 300);
- ret = url_fsize(s->pb);
+ ret = avio_fsize(s->pb);
if (ret > 0)
vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300);
diff --git a/libavformat/daud.c b/libavformat/daud.c
index b7482fa..8f2a496 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -38,7 +38,7 @@ static int daud_header(AVFormatContext *s, AVFormatParameters *ap) {
static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
AVIOContext *pb = s->pb;
int ret, size;
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
size = avio_get_be16(pb);
avio_get_be16(pb); // unknown
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index f44b915..8e419d4 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -147,7 +147,7 @@ static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {
hdr->video_frame_size = avio_get_le32(pb);
hdr->audio_frame_size = avio_get_le32(pb);
- if (url_feof(pb) || url_ferror(pb))
+ if (avio_feof(pb) || avio_ferror(pb))
return AVERROR(EIO);
if (avio_get_le32(pb) != 0xAA55AA55)
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 917fce0..5ba4500 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -370,7 +370,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
// FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
const DVprofile* sys = ff_dv_codec_profile(c->vst->codec);
int64_t offset;
- int64_t size = url_fsize(s->pb) - s->data_offset;
+ int64_t size = avio_fsize(s->pb) - s->data_offset;
int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
offset = sys->frame_size * timestamp;
@@ -412,14 +412,14 @@ static int dv_read_header(AVFormatContext *s,
state = avio_get_be32(s->pb);
while ((state & 0xffffff7f) != 0x1f07003f) {
- if (url_feof(s->pb)) {
+ if (avio_feof(s->pb)) {
av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
return -1;
}
if (state == 0x003f0700 || state == 0xff3f0700)
- marker_pos = url_ftell(s->pb);
- if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
- url_fseek(s->pb, -163, SEEK_CUR);
+ marker_pos = avio_ftell(s->pb);
+ if (state == 0xff3f0701 && avio_ftell(s->pb) - marker_pos == 80) {
+ avio_fseek(s->pb, -163, SEEK_CUR);
state = avio_get_be32(s->pb);
break;
}
@@ -428,7 +428,7 @@ static int dv_read_header(AVFormatContext *s,
AV_WB32(c->buf, state);
if (avio_get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
- url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
+ avio_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
return AVERROR(EIO);
c->dv_demux->sys = ff_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES);
@@ -473,7 +473,7 @@ static int dv_read_seek(AVFormatContext *s, int stream_index,
dv_offset_reset(c, offset / c->sys->frame_size);
- offset = url_fseek(s->pb, offset, SEEK_SET);
+ offset = avio_fseek(s->pb, offset, SEEK_SET);
return (offset < 0) ? offset : 0;
}
diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index be6092d..f0dfdfc 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -95,8 +95,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
uint32_t size, fsize;
c->has_sound = 1;
size = avio_get_be32(pb);
- c->vidpos = url_ftell(pb) + size;
- url_fskip(pb, 16);
+ c->vidpos = avio_ftell(pb) + size;
+ avio_fskip(pb, 16);
fsize = avio_get_le32(pb);
ast = av_new_stream(s, 0);
@@ -104,18 +104,18 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
ff_get_wav_header(pb, ast->codec, fsize);
// find 'data' chunk
- while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
+ while(avio_ftell(pb) < c->vidpos && !avio_feof(pb)){
tag = avio_get_le32(pb);
fsize = avio_get_le32(pb);
if(tag == MKTAG('d', 'a', 't', 'a')) break;
- url_fskip(pb, fsize);
+ avio_fskip(pb, fsize);
}
c->bpc = (fsize + c->frames - 1) / c->frames;
if(ast->codec->block_align)
c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align;
c->bytes_left = fsize;
- c->wavpos = url_ftell(pb);
- url_fseek(pb, c->vidpos, SEEK_SET);
+ c->wavpos = avio_ftell(pb);
+ avio_fseek(pb, c->vidpos, SEEK_SET);
}
/* now we are ready: build format streams */
@@ -133,7 +133,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height >>= 1;
}
c->readvid = !c->has_sound;
- c->vidpos = url_ftell(pb);
+ c->vidpos = avio_ftell(pb);
s->start_time = 0;
s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames);
@@ -151,18 +151,18 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(!c->readvid && c->has_sound && c->bytes_left){
c->readvid = 1;
- url_fseek(s->pb, c->wavpos, SEEK_SET);
+ avio_fseek(s->pb, c->wavpos, SEEK_SET);
size = FFMIN(c->bytes_left, c->bpc);
ret = av_get_packet(s->pb, pkt, size);
pkt->stream_index = 1;
if(ret != size)
return AVERROR(EIO);
c->bytes_left -= size;
- c->wavpos = url_ftell(s->pb);
+ c->wavpos = avio_ftell(s->pb);
return 0;
}
- url_fseek(s->pb, c->vidpos, SEEK_SET);
- while(!url_feof(s->pb) && c->frames){
+ avio_fseek(s->pb, c->vidpos, SEEK_SET);
+ while(!avio_feof(s->pb) && c->frames){
avio_get_buffer(s->pb, buf, 4);
switch(AV_RL32(buf)){
case MKTAG('N', 'U', 'L', 'L'):
@@ -172,7 +172,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(pal_size) memcpy(pkt->data, pal, pal_size);
memcpy(pkt->data + pal_size, buf, 4);
c->frames--;
- c->vidpos = url_ftell(s->pb);
+ c->vidpos = avio_ftell(s->pb);
c->readvid = 0;
return 0;
case MKTAG('C', 'M', 'A', 'P'):
@@ -198,7 +198,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt)
if(pal_size) memcpy(pkt->data, pal, pal_size);
pkt->stream_index = 0;
c->frames--;
- c->vidpos = url_ftell(s->pb);
+ c->vidpos = avio_ftell(s->pb);
c->readvid = 0;
return 0;
default:
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
index b9f50d1..6bb6a28 100644
--- a/libavformat/eacdata.c
+++ b/libavformat/eacdata.c
@@ -62,7 +62,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
};
sample_rate = avio_get_be16(pb);
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
st = av_new_stream(s, 0);
if (!st)
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index 4044bf2..3d0a127 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -109,7 +109,7 @@ static int process_audio_header_elements(AVFormatContext *s)
ea->sample_rate = -1;
ea->num_channels = 1;
- while (!url_feof(pb) && inHeader) {
+ while (!avio_feof(pb) && inHeader) {
int inSubheader;
uint8_t byte;
byte = avio_get_byte(pb);
@@ -118,7 +118,7 @@ static int process_audio_header_elements(AVFormatContext *s)
case 0xFD:
av_log (s, AV_LOG_DEBUG, "entered audio subheader\n");
inSubheader = 1;
- while (!url_feof(pb) && inSubheader) {
+ while (!avio_feof(pb) && inSubheader) {
uint8_t subbyte;
subbyte = avio_get_byte(pb);
@@ -222,7 +222,7 @@ static int process_audio_header_eacs(AVFormatContext *s)
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);
+ avio_fskip(pb, 13);
switch (compression_type) {
case 0:
@@ -261,7 +261,7 @@ static int process_video_header_mdec(AVFormatContext *s)
{
EaDemuxContext *ea = s->priv_data;
AVIOContext *pb = s->pb;
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
ea->width = avio_get_le16(pb);
ea->height = avio_get_le16(pb);
ea->time_base = (AVRational){1,15};
@@ -274,7 +274,7 @@ static int process_video_header_vp6(AVFormatContext *s)
EaDemuxContext *ea = s->priv_data;
AVIOContext *pb = s->pb;
- url_fskip(pb, 16);
+ avio_fskip(pb, 16);
ea->time_base.den = avio_get_le32(pb);
ea->time_base.num = avio_get_le32(pb);
ea->video_codec = CODEC_ID_VP6;
@@ -293,7 +293,7 @@ static int process_ea_header(AVFormatContext *s) {
int i;
for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
- unsigned int startpos = url_ftell(pb);
+ unsigned int startpos = avio_ftell(pb);
int err = 0;
blockid = avio_get_le32(pb);
@@ -316,7 +316,7 @@ static int process_ea_header(AVFormatContext *s) {
case SHEN_TAG :
blockid = avio_get_le32(pb);
if (blockid == GSTR_TAG) {
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
} else if ((blockid & 0xFFFF)!=PT00_TAG) {
av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n");
return 0;
@@ -369,10 +369,10 @@ static int process_ea_header(AVFormatContext *s) {
return err;
}
- url_fseek(pb, startpos + size, SEEK_SET);
+ avio_fseek(pb, startpos + size, SEEK_SET);
}
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
return 1;
}
@@ -474,19 +474,19 @@ static int ea_read_packet(AVFormatContext *s,
/* audio data */
case ISNh_TAG:
/* header chunk also contains data; skip over the header portion*/
- url_fskip(pb, 32);
+ avio_fskip(pb, 32);
chunk_size -= 32;
case ISNd_TAG:
case SCDl_TAG:
case SNDC_TAG:
case SDEN_TAG:
if (!ea->audio_codec) {
- url_fskip(pb, chunk_size);
+ avio_fskip(pb, chunk_size);
break;
} else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
ea->audio_codec == CODEC_ID_MP3) {
num_samples = avio_get_le32(pb);
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
chunk_size -= 12;
}
ret = av_get_packet(pb, pkt, chunk_size);
@@ -536,12 +536,12 @@ static int ea_read_packet(AVFormatContext *s,
case fVGT_TAG:
case MADm_TAG:
case MADe_TAG:
- url_fseek(pb, -8, SEEK_CUR); // include chunk preamble
+ avio_fseek(pb, -8, SEEK_CUR); // include chunk preamble
chunk_size += 8;
goto get_video_packet;
case mTCD_TAG:
- url_fseek(pb, 8, SEEK_CUR); // skip ea dct header
+ avio_fseek(pb, 8, SEEK_CUR); // skip ea dct header
chunk_size -= 8;
goto get_video_packet;
@@ -560,7 +560,7 @@ get_video_packet:
break;
default:
- url_fseek(pb, chunk_size, SEEK_CUR);
+ avio_fseek(pb, chunk_size, SEEK_CUR);
break;
}
}
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index b2f3016..019fcfa 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -65,7 +65,7 @@ static int ffm_is_avail_data(AVFormatContext *s, int size)
len = ffm->packet_end - ffm->packet_ptr;
if (size <= len)
return 1;
- pos = url_ftell(s->pb);
+ pos = avio_ftell(s->pb);
if (!ffm->write_index) {
if (pos == ffm->file_size)
return AVERROR_EOF;
@@ -91,7 +91,7 @@ static int ffm_resync(AVFormatContext *s, int state)
{
av_log(s, AV_LOG_ERROR, "resyncing\n");
while (state != PACKET_ID) {
- if (url_feof(s->pb)) {
+ if (avio_feof(s->pb)) {
av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
return -1;
}
@@ -117,8 +117,8 @@ static int ffm_read_data(AVFormatContext *s,
if (len > size)
len = size;
if (len == 0) {
- if (url_ftell(pb) == ffm->file_size)
- url_fseek(pb, ffm->packet_size, SEEK_SET);
+ if (avio_ftell(pb) == ffm->file_size)
+ avio_fseek(pb, ffm->packet_size, SEEK_SET);
retry_read:
id = avio_get_be16(pb); /* PACKET_ID */
if (id != PACKET_ID)
@@ -136,8 +136,8 @@ static int ffm_read_data(AVFormatContext *s,
if (ffm->first_packet || (frame_offset & 0x8000)) {
if (!frame_offset) {
/* This packet has no frame headers in it */
- if (url_ftell(pb) >= ffm->packet_size * 3) {
- url_fseek(pb, -ffm->packet_size * 2, SEEK_CUR);
+ if (avio_ftell(pb) >= ffm->packet_size * 3) {
+ avio_fseek(pb, -ffm->packet_size * 2, SEEK_CUR);
goto retry_read;
}
/* This is bad, we cannot find a valid frame header */
@@ -178,7 +178,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1)
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos);
#endif
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
static int64_t get_dts(AVFormatContext *s, int64_t pos)
@@ -187,7 +187,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
int64_t dts;
ffm_seek1(s, pos);
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
dts = avio_get_be64(pb);
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
@@ -203,7 +203,7 @@ static void adjust_write_index(AVFormatContext *s)
//int64_t orig_write_index = ffm->write_index;
int64_t pos_min, pos_max;
int64_t pts_start;
- int64_t ptr = url_ftell(pb);
+ int64_t ptr = avio_ftell(pb);
pos_min = 0;
@@ -248,7 +248,7 @@ static void adjust_write_index(AVFormatContext *s)
//printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. );
end:
- url_fseek(pb, ptr, SEEK_SET);
+ avio_fseek(pb, ptr, SEEK_SET);
}
@@ -282,7 +282,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
ffm->write_index = avio_get_be64(pb);
/* get also filesize */
if (!url_is_streamed(pb)) {
- ffm->file_size = url_fsize(pb);
+ ffm->file_size = avio_fsize(pb);
if (ffm->write_index)
adjust_write_index(s);
} else {
@@ -380,7 +380,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
/* get until end of block reached */
- while ((url_ftell(pb) % ffm->packet_size) != 0)
+ while ((avio_ftell(pb) % ffm->packet_size) != 0)
avio_get_byte(pb);
/* init packet demux */
@@ -409,7 +409,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
- url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
+ avio_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
FRAME_HEADER_SIZE)
return -1;
@@ -436,7 +436,7 @@ static int ffm_read_packet(AVFormatContext *s, AVPacket *pkt)
ffm->read_state = READ_HEADER;
return -1;
}
- pkt->pos = url_ftell(s->pb);
+ pkt->pos = avio_ftell(s->pb);
if (ffm->header[1] & FLAG_KEY_FRAME)
pkt->flags |= AV_PKT_FLAG_KEY;
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
index 3652b00..92d3a13 100644
--- a/libavformat/ffmenc.c
+++ b/libavformat/ffmenc.c
@@ -32,7 +32,7 @@ static void flush_packet(AVFormatContext *s)
fill_size = ffm->packet_end - ffm->packet_ptr;
memset(ffm->packet_ptr, 0, fill_size);
- if (url_ftell(pb) % ffm->packet_size)
+ if (avio_ftell(pb) % ffm->packet_size)
av_abort();
/* put header */
@@ -184,7 +184,7 @@ static int ffm_write_header(AVFormatContext *s)
}
/* flush until end of block reached */
- while ((url_ftell(pb) % ffm->packet_size) != 0)
+ while ((avio_ftell(pb) % ffm->packet_size) != 0)
avio_put_byte(pb, 0);
put_flush_packet(pb);
diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c
index e52c4c6..e6266fd 100644
--- a/libavformat/ffmetadec.c
+++ b/libavformat/ffmetadec.c
@@ -48,7 +48,7 @@ static void get_line(AVIOContext *s, uint8_t *buf, int size)
buf[i++] = c;
}
buf[i] = 0;
- } while (!url_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
+ } while (!avio_feof(s) && (buf[0] == ';' || buf[0] == '#' || buf[0] == 0));
}
static AVChapter *read_chapter(AVFormatContext *s)
@@ -126,7 +126,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
AVMetadata **m = &s->metadata;
uint8_t line[1024];
- while(!url_feof(s->pb)) {
+ while(!avio_feof(s->pb)) {
get_line(s->pb, line, sizeof(line));
if (!memcmp(line, ID_STREAM, strlen(ID_STREAM))) {
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 0381ece..5e457c6 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -43,7 +43,7 @@ static int read_header(AVFormatContext *s,
if (url_is_streamed(s->pb))
return AVERROR(EIO);
- url_fseek(pb, url_fsize(pb) - 36, SEEK_SET);
+ avio_fseek(pb, avio_fsize(pb) - 36, SEEK_SET);
if (avio_get_be32(pb) != RAND_TAG) {
av_log(s, AV_LOG_ERROR, "magic number not found");
return AVERROR_INVALIDDATA;
@@ -59,7 +59,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
}
- url_fskip(pb, 2);
+ avio_fskip(pb, 2);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->pix_fmt = PIX_FMT_RGBA;
@@ -69,7 +69,7 @@ static int read_header(AVFormatContext *s,
film->leading = avio_get_be16(pb);
av_set_pts_info(st, 64, 1, avio_get_be16(pb));
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
return 0;
}
@@ -80,11 +80,11 @@ static int read_packet(AVFormatContext *s,
FilmstripDemuxContext *film = s->priv_data;
AVStream *st = s->streams[0];
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
- pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
+ pkt->dts = avio_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
- url_fskip(s->pb, st->codec->width * film->leading * 4);
+ avio_fskip(s->pb, st->codec->width * film->leading * 4);
if (pkt->size < 0)
return pkt->size;
pkt->flags |= AV_PKT_FLAG_KEY;
@@ -94,7 +94,7 @@ static int read_packet(AVFormatContext *s,
static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
AVStream *st = s->streams[stream_index];
- url_fseek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET);
+ avio_fseek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET);
return 0;
}
diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index ff521d5..1fbd452 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -41,12 +41,12 @@ static int flac_read_header(AVFormatContext *s,
/* if fLaC marker is not found, assume there is no header */
if (avio_get_le32(s->pb) != MKTAG('f','L','a','C')) {
- url_fseek(s->pb, -4, SEEK_CUR);
+ avio_fseek(s->pb, -4, SEEK_CUR);
return 0;
}
/* process metadata blocks */
- while (!url_feof(s->pb) && !metadata_last) {
+ while (!avio_feof(s->pb) && !metadata_last) {
avio_get_buffer(s->pb, header, 4);
ff_flac_parse_block_header(header, &metadata_last, &metadata_type,
&metadata_size);
@@ -65,7 +65,7 @@ static int flac_read_header(AVFormatContext *s,
break;
/* skip metadata block for unsupported types */
default:
- ret = url_fseek(s->pb, metadata_size, SEEK_CUR);
+ ret = avio_fseek(s->pb, metadata_size, SEEK_CUR);
if (ret < 0)
return ret;
}
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index f3980c9..15288ac 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -100,10 +100,10 @@ static int flac_write_trailer(struct AVFormatContext *s)
if (!url_is_streamed(pb)) {
/* rewrite the STREAMINFO header block data */
- file_size = url_ftell(pb);
- url_fseek(pb, 8, SEEK_SET);
+ file_size = avio_ftell(pb);
+ avio_fseek(pb, 8, SEEK_SET);
avio_put_buffer(pb, streaminfo, FLAC_STREAMINFO_SIZE);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
} else {
av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n");
diff --git a/libavformat/flic.c b/libavformat/flic.c
index 8c982c51..464696e 100644
--- a/libavformat/flic.c
+++ b/libavformat/flic.c
@@ -135,7 +135,7 @@ static int flic_read_header(AVFormatContext *s,
return AVERROR(EIO);
}
- url_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR);
+ avio_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR);
/* Time to figure out the framerate:
* If the first preamble's magic number is 0xAAAA then this file is from
@@ -173,7 +173,7 @@ static int flic_read_header(AVFormatContext *s,
av_set_pts_info(st, 64, FLIC_MC_SPEED, 70);
/* rewind the stream since the first chunk is at offset 12 */
- url_fseek(pb, 12, SEEK_SET);
+ avio_fseek(pb, 12, SEEK_SET);
/* send over abbreviated FLIC header chunk */
av_free(st->codec->extradata);
@@ -223,7 +223,7 @@ static int flic_read_packet(AVFormatContext *s,
}
pkt->stream_index = flic->video_stream_index;
pkt->pts = flic->frame_number++;
- pkt->pos = url_ftell(pb);
+ pkt->pos = avio_ftell(pb);
memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
ret = avio_get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE,
size - FLIC_PREAMBLE_SIZE);
@@ -239,10 +239,10 @@ static int flic_read_packet(AVFormatContext *s,
}
/* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */
- url_fseek(pb, 10, SEEK_CUR);
+ avio_fseek(pb, 10, SEEK_CUR);
pkt->stream_index = flic->audio_stream_index;
- pkt->pos = url_ftell(pb);
+ pkt->pos = avio_ftell(pb);
ret = avio_get_buffer(pb, pkt->data, size);
if (ret != size) {
@@ -253,7 +253,7 @@ static int flic_read_packet(AVFormatContext *s,
packet_read = 1;
} else {
/* not interested in this chunk */
- url_fseek(pb, size - 6, SEEK_CUR);
+ avio_fseek(pb, size - 6, SEEK_CUR);
}
}
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 0810ef1..ea23a8c 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -113,7 +113,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) {
int length = avio_get_be16(ioc);
if(length >= buffsize) {
- url_fskip(ioc, length);
+ avio_fskip(ioc, length);
return -1;
}
@@ -148,8 +148,8 @@ 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 = avio_get_be16(ioc))) {
- url_fskip(ioc, keylen); //skip key string
+ while(avio_ftell(ioc) < max_pos - 2 && (keylen = avio_get_be16(ioc))) {
+ avio_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.
}
@@ -162,8 +162,8 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
case AMF_DATA_TYPE_UNSUPPORTED:
break; //these take up no additional space
case AMF_DATA_TYPE_MIXEDARRAY:
- url_fskip(ioc, 4); //skip 32-bit max array index
- while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
+ avio_fskip(ioc, 4); //skip 32-bit max array index
+ while(avio_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
//this is the only case in which we would want a nested parse to not skip over the object
if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
return -1;
@@ -175,14 +175,14 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
unsigned int arraylen, i;
arraylen = avio_get_be32(ioc);
- for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
+ for(i = 0; i < arraylen && avio_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.
}
}
break;
case AMF_DATA_TYPE_DATE:
- url_fskip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16)
+ avio_fskip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16)
break;
default: //unsupported type, we couldn't skip
return -1;
@@ -254,7 +254,7 @@ static int flv_read_header(AVFormatContext *s,
{
int offset, flags;
- url_fskip(s->pb, 4);
+ avio_fskip(s->pb, 4);
flags = avio_get_byte(s->pb);
/* old flvtool cleared this field */
/* FIXME: better fix needed */
@@ -277,8 +277,8 @@ static int flv_read_header(AVFormatContext *s,
}
offset = avio_get_be32(s->pb);
- url_fseek(s->pb, offset, SEEK_SET);
- url_fskip(s->pb, 4);
+ avio_fseek(s->pb, offset, SEEK_SET);
+ avio_fskip(s->pb, 4);
s->start_time = 0;
@@ -304,22 +304,22 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t dts, pts = AV_NOPTS_VALUE;
AVStream *st = NULL;
- for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */
- pos = url_ftell(s->pb);
+ for(;;avio_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */
+ pos = avio_ftell(s->pb);
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))
+ if (avio_feof(s->pb))
return AVERROR_EOF;
- url_fskip(s->pb, 3); /* stream id, always 0 */
+ avio_fskip(s->pb, 3); /* stream id, always 0 */
flags = 0;
if(size == 0)
continue;
- next= size + url_ftell(s->pb);
+ next= size + avio_ftell(s->pb);
if (type == FLV_TAG_TYPE_AUDIO) {
is_audio=1;
@@ -337,7 +337,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
else /* skip packet */
av_log(s, AV_LOG_DEBUG, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
skip:
- url_fseek(s->pb, next, SEEK_SET);
+ avio_fseek(s->pb, next, SEEK_SET);
continue;
}
@@ -361,7 +361,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
|| st->discard >= AVDISCARD_ALL
){
- url_fseek(s->pb, next, SEEK_SET);
+ avio_fseek(s->pb, next, SEEK_SET);
continue;
}
if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
@@ -372,17 +372,17 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
// if not streamed and no duration from metadata then seek to end to find the duration from the timestamps
if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){
int size;
- const int64_t pos= url_ftell(s->pb);
- const int64_t fsize= url_fsize(s->pb);
- url_fseek(s->pb, fsize-4, SEEK_SET);
+ const int64_t pos= avio_ftell(s->pb);
+ const int64_t fsize= avio_fsize(s->pb);
+ avio_fseek(s->pb, fsize-4, SEEK_SET);
size= avio_get_be32(s->pb);
- url_fseek(s->pb, fsize-3-size, SEEK_SET);
+ avio_fseek(s->pb, fsize-3-size, SEEK_SET);
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);
+ avio_fseek(s->pb, pos, SEEK_SET);
}
if(is_audio){
@@ -454,7 +454,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->flags |= AV_PKT_FLAG_KEY;
leave:
- url_fskip(s->pb, 4);
+ avio_fskip(s->pb, 4);
return ret;
}
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 9d30f59..193ba43 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -221,7 +221,7 @@ static int flv_write_header(AVFormatContext *s)
/* write meta_tag */
avio_put_byte(pb, 18); // tag type META
- metadata_size_pos= url_ftell(pb);
+ metadata_size_pos= avio_ftell(pb);
avio_put_be24(pb, 0); // size of data part (sum of all parts below)
avio_put_be24(pb, 0); // time stamp
avio_put_be32(pb, 0); // reserved
@@ -237,7 +237,7 @@ static int flv_write_header(AVFormatContext *s)
avio_put_be32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
put_amf_string(pb, "duration");
- flv->duration_offset= url_ftell(pb);
+ flv->duration_offset= avio_ftell(pb);
put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect
if(video_enc){
@@ -281,17 +281,17 @@ static int flv_write_header(AVFormatContext *s)
}
put_amf_string(pb, "filesize");
- flv->filesize_offset= url_ftell(pb);
+ flv->filesize_offset= avio_ftell(pb);
put_amf_double(pb, 0); // delayed write
put_amf_string(pb, "");
avio_put_byte(pb, AMF_END_OF_OBJECT);
/* write total size of tag */
- data_size= url_ftell(pb) - metadata_size_pos - 10;
- url_fseek(pb, metadata_size_pos, SEEK_SET);
+ data_size= avio_ftell(pb) - metadata_size_pos - 10;
+ avio_fseek(pb, metadata_size_pos, SEEK_SET);
avio_put_be24(pb, data_size);
- url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
+ avio_fseek(pb, data_size + 10 - 3, SEEK_CUR);
avio_put_be32(pb, data_size + 11);
for (i = 0; i < s->nb_streams; i++) {
@@ -304,7 +304,7 @@ static int flv_write_header(AVFormatContext *s)
avio_put_be24(pb, 0); // ts
avio_put_byte(pb, 0); // ts ext
avio_put_be24(pb, 0); // streamid
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
if (enc->codec_id == CODEC_ID_AAC) {
avio_put_byte(pb, get_audio_flags(enc));
avio_put_byte(pb, 0); // AAC sequence header
@@ -315,10 +315,10 @@ static int flv_write_header(AVFormatContext *s)
avio_put_be24(pb, 0); // composition time
ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size);
}
- data_size = url_ftell(pb) - pos;
- url_fseek(pb, -data_size - 10, SEEK_CUR);
+ data_size = avio_ftell(pb) - pos;
+ avio_fseek(pb, -data_size - 10, SEEK_CUR);
avio_put_be24(pb, data_size);
- url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
+ avio_fseek(pb, data_size + 10 - 3, SEEK_CUR);
avio_put_be32(pb, data_size + 11); // previous tag size
}
}
@@ -343,15 +343,15 @@ static int flv_write_trailer(AVFormatContext *s)
}
}
- file_size = url_ftell(pb);
+ file_size = avio_ftell(pb);
/* update informations */
- url_fseek(pb, flv->duration_offset, SEEK_SET);
+ avio_fseek(pb, flv->duration_offset, SEEK_SET);
put_amf_double(pb, flv->duration / (double)1000);
- url_fseek(pb, flv->filesize_offset, SEEK_SET);
+ avio_fseek(pb, flv->filesize_offset, SEEK_SET);
put_amf_double(pb, file_size);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
return 0;
}
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index b89e30b..c4a2697 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -174,7 +174,7 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info
else if (tag == MAT_LAST_FIELD)
si->last_field = value;
} else
- url_fskip(pb, tlen);
+ avio_fskip(pb, tlen);
}
}
@@ -223,7 +223,7 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si
else if (tag == TRACK_FPF && (value == 1 || value == 2))
si->fields_per_frame = value;
} else
- url_fskip(pb, tlen);
+ avio_fskip(pb, tlen);
}
}
@@ -238,7 +238,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
int i;
pkt_len -= 8;
if (s->flags & AVFMT_FLAG_IGNIDX) {
- url_fskip(pb, pkt_len);
+ avio_fskip(pb, pkt_len);
return;
}
if (map_cnt > 1000) {
@@ -247,7 +247,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
}
if (pkt_len < 4 * map_cnt) {
av_log(s, AV_LOG_ERROR, "invalid index length\n");
- url_fskip(pb, pkt_len);
+ avio_fskip(pb, pkt_len);
return;
}
pkt_len -= 4 * map_cnt;
@@ -255,7 +255,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
for (i = 0; i < map_cnt; i++)
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);
+ avio_fskip(pb, pkt_len);
}
static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
@@ -283,7 +283,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
}
map_len -= len;
gxf_material_tags(pb, &len, &si);
- url_fskip(pb, len);
+ avio_fskip(pb, len);
map_len -= 2;
len = avio_get_be16(pb); // length of track description
if (len > map_len) {
@@ -301,7 +301,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
track_len = avio_get_be16(pb);
len -= track_len;
gxf_track_tags(pb, &track_len, &si);
- url_fskip(pb, track_len);
+ avio_fskip(pb, track_len);
if (!(track_type & 0x80)) {
av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type);
continue;
@@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
if (len < 0)
av_log(s, AV_LOG_ERROR, "invalid track description length specified\n");
if (map_len)
- url_fskip(pb, map_len);
+ avio_fskip(pb, map_len);
if (!parse_packet_header(pb, &pkt_type, &len)) {
av_log(s, AV_LOG_ERROR, "sync lost in header\n");
return -1;
@@ -342,8 +342,8 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
if (len >= 0x39) {
AVRational fps;
len -= 0x39;
- url_fskip(pb, 5); // preamble
- url_fskip(pb, 0x30); // payload description
+ avio_fskip(pb, 5); // preamble
+ avio_fskip(pb, 0x30); // payload description
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
@@ -354,7 +354,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
av_log(s, AV_LOG_INFO, "UMF packet too short\n");
} else
av_log(s, AV_LOG_INFO, "UMF packet missing\n");
- url_fskip(pb, len);
+ avio_fskip(pb, len);
// set a fallback value, 60000/1001 is specified for audio-only files
// so use that regardless of why we do not know the video frame rate.
if (!main_timebase.num || !main_timebase.den)
@@ -368,7 +368,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
#define READ_ONE() \
{ \
- if (!max_interval-- || url_feof(pb)) \
+ if (!max_interval-- || avio_feof(pb)) \
goto out; \
tmp = tmp << 8 | avio_get_byte(pb); \
}
@@ -396,25 +396,25 @@ start:
READ_ONE();
if (tmp != 1)
goto start;
- last_pos = url_ftell(pb);
- if (url_fseek(pb, -5, SEEK_CUR) < 0)
+ last_pos = avio_ftell(pb);
+ if (avio_fseek(pb, -5, SEEK_CUR) < 0)
goto out;
if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) {
- if (url_fseek(pb, last_pos, SEEK_SET) < 0)
+ if (avio_fseek(pb, last_pos, SEEK_SET) < 0)
goto out;
goto start;
}
avio_get_byte(pb);
cur_track = avio_get_byte(pb);
cur_timestamp = avio_get_be32(pb);
- last_found_pos = url_ftell(pb) - 16 - 6;
+ last_found_pos = avio_ftell(pb) - 16 - 6;
if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
- if (url_fseek(pb, last_pos, SEEK_SET) >= 0)
+ if (avio_fseek(pb, last_pos, SEEK_SET) >= 0)
goto start;
}
out:
if (last_found_pos)
- url_fseek(pb, last_found_pos, SEEK_SET);
+ avio_fseek(pb, last_found_pos, SEEK_SET);
return cur_timestamp;
}
@@ -422,13 +422,13 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
AVIOContext *pb = s->pb;
GXFPktType pkt_type;
int pkt_len;
- while (!url_feof(pb)) {
+ while (!avio_feof(pb)) {
AVStream *st;
int track_type, track_id, ret;
int field_nr, field_info, skip = 0;
int stream_index;
if (!parse_packet_header(pb, &pkt_type, &pkt_len)) {
- if (!url_feof(pb))
+ if (!avio_feof(pb))
av_log(s, AV_LOG_ERROR, "sync lost\n");
return -1;
}
@@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
continue;
}
if (pkt_type != PKT_MEDIA) {
- url_fskip(pb, pkt_len);
+ avio_fskip(pb, pkt_len);
continue;
}
if (pkt_len < 16) {
@@ -462,7 +462,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
int last = field_info & 0xffff; // last is exclusive
int bps = av_get_bits_per_sample(st->codec->codec_id)>>3;
if (first <= last && last*bps <= pkt_len) {
- url_fskip(pb, first*bps);
+ avio_fskip(pb, first*bps);
skip = pkt_len - last*bps;
pkt_len = (last-first)*bps;
} else
@@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
}
ret = av_get_packet(pb, pkt, pkt_len);
if (skip)
- url_fskip(pb, skip);
+ avio_fskip(pb, skip);
pkt->stream_index = stream_index;
pkt->dts = field_nr;
return ret;
@@ -495,7 +495,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int
if (idx < st->nb_index_entries - 2)
maxlen = st->index_entries[idx + 2].pos - pos;
maxlen = FFMAX(maxlen, 200 * 1024);
- res = url_fseek(s->pb, pos, SEEK_SET);
+ res = avio_fseek(s->pb, pos, SEEK_SET);
if (res < 0)
return res;
found = gxf_resync_media(s, maxlen, -1, timestamp);
@@ -508,10 +508,10 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
int64_t *pos, int64_t pos_limit) {
AVIOContext *pb = s->pb;
int64_t res;
- if (url_fseek(pb, *pos, SEEK_SET) < 0)
+ if (avio_fseek(pb, *pos, SEEK_SET) < 0)
return AV_NOPTS_VALUE;
res = gxf_resync_media(s, pos_limit - *pos, -1, -1);
- *pos = url_ftell(pb);
+ *pos = avio_ftell(pb);
return res;
}
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index a97ad95..81c0a3a 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -125,15 +125,15 @@ static int64_t updatePacketSize(AVIOContext *pb, int64_t pos)
int64_t curpos;
int size;
- size = url_ftell(pb) - pos;
+ size = avio_ftell(pb) - pos;
if (size % 4) {
gxf_write_padding(pb, 4 - size % 4);
- size = url_ftell(pb) - pos;
+ size = avio_ftell(pb) - pos;
}
- curpos = url_ftell(pb);
- url_fseek(pb, pos + 6, SEEK_SET);
+ curpos = avio_ftell(pb);
+ avio_fseek(pb, pos + 6, SEEK_SET);
avio_put_be32(pb, size);
- url_fseek(pb, curpos, SEEK_SET);
+ avio_fseek(pb, curpos, SEEK_SET);
return curpos - pos;
}
@@ -141,10 +141,10 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos)
{
int64_t curpos;
- curpos = url_ftell(pb);
- url_fseek(pb, pos, SEEK_SET);
+ curpos = avio_ftell(pb);
+ avio_fseek(pb, pos, SEEK_SET);
avio_put_be16(pb, curpos - pos - 2);
- url_fseek(pb, curpos, SEEK_SET);
+ avio_fseek(pb, curpos, SEEK_SET);
return curpos - pos;
}
@@ -218,7 +218,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc,
avio_put_byte(pb, sc->media_type + 0x80);
avio_put_byte(pb, index + 0xC0);
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
avio_put_be16(pb, 0); /* size */
/* media file name */
@@ -271,7 +271,7 @@ static int gxf_write_material_data_section(AVFormatContext *s)
int64_t pos;
const char *filename = strrchr(s->filename, '/');
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
avio_put_be16(pb, 0); /* size */
/* name */
@@ -307,7 +307,7 @@ static int gxf_write_material_data_section(AVFormatContext *s)
/* estimated size */
avio_put_byte(pb, MAT_SIZE);
avio_put_byte(pb, 4);
- avio_put_be32(pb, url_fsize(pb) / 1024);
+ avio_put_be32(pb, avio_fsize(pb) / 1024);
return updateSize(pb, pos);
}
@@ -319,7 +319,7 @@ static int gxf_write_track_description_section(AVFormatContext *s)
int64_t pos;
int i;
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
avio_put_be16(pb, 0); /* size */
for (i = 0; i < s->nb_streams; ++i)
gxf_write_track_description(s, s->streams[i]->priv_data, i);
@@ -333,7 +333,7 @@ static int gxf_write_map_packet(AVFormatContext *s, int rewrite)
{
GXFContext *gxf = s->priv_data;
AVIOContext *pb = s->pb;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
if (!rewrite) {
if (!(gxf->map_offsets_nb % 30)) {
@@ -363,7 +363,7 @@ static int gxf_write_flt_packet(AVFormatContext *s)
{
GXFContext *gxf = s->priv_data;
AVIOContext *pb = s->pb;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1;
int flt_entries = gxf->nb_fields / fields_per_flt;
int i = 0;
@@ -439,7 +439,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
GXFContext *gxf = s->priv_data;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
int i;
gxf->umf_track_offset = pos - gxf->umf_start_offset;
@@ -452,7 +452,7 @@ static int gxf_write_umf_track_description(AVFormatContext *s)
avio_put_le16(pb, gxf->timecode_track.media_info);
avio_put_le16(pb, 1);
- return url_ftell(pb) - pos;
+ return avio_ftell(pb) - pos;
}
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
@@ -530,7 +530,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
int64_t pos;
int i, j;
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
gxf->umf_media_offset = pos - gxf->umf_start_offset;
for (i = 0; i <= s->nb_streams; ++i) {
GXFStreamContext *sc;
@@ -541,7 +541,7 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
else
sc = s->streams[i]->priv_data;
- startpos = url_ftell(pb);
+ startpos = avio_ftell(pb);
avio_put_le16(pb, 0); /* length */
avio_put_le16(pb, sc->media_info);
avio_put_le16(pb, 0); /* reserved */
@@ -577,19 +577,19 @@ static int gxf_write_umf_media_description(AVFormatContext *s)
}
}
- curpos = url_ftell(pb);
- url_fseek(pb, startpos, SEEK_SET);
+ curpos = avio_ftell(pb);
+ avio_fseek(pb, startpos, SEEK_SET);
avio_put_le16(pb, curpos - startpos);
- url_fseek(pb, curpos, SEEK_SET);
+ avio_fseek(pb, curpos, SEEK_SET);
}
- return url_ftell(pb) - pos;
+ return avio_ftell(pb) - pos;
}
static int gxf_write_umf_packet(AVFormatContext *s)
{
GXFContext *gxf = s->priv_data;
AVIOContext *pb = s->pb;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
gxf_write_packet_header(pb, PKT_UMF);
@@ -597,12 +597,12 @@ static int gxf_write_umf_packet(AVFormatContext *s)
avio_put_byte(pb, 3); /* first and last (only) packet */
avio_put_be32(pb, gxf->umf_length); /* data length */
- gxf->umf_start_offset = url_ftell(pb);
+ gxf->umf_start_offset = avio_ftell(pb);
gxf_write_umf_payload(s);
gxf_write_umf_material_description(s);
gxf->umf_track_size = gxf_write_umf_track_description(s);
gxf->umf_media_size = gxf_write_umf_media_description(s);
- gxf->umf_length = url_ftell(pb) - gxf->umf_start_offset;
+ gxf->umf_length = avio_ftell(pb) - gxf->umf_start_offset;
return updatePacketSize(pb, pos);
}
@@ -756,7 +756,7 @@ static int gxf_write_header(AVFormatContext *s)
static int gxf_write_eos_packet(AVIOContext *pb)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
gxf_write_packet_header(pb, PKT_EOS);
return updatePacketSize(pb, pos);
@@ -772,8 +772,8 @@ static int gxf_write_trailer(AVFormatContext *s)
ff_audio_interleave_close(s);
gxf_write_eos_packet(pb);
- end = url_ftell(pb);
- url_fseek(pb, 0, SEEK_SET);
+ end = avio_ftell(pb);
+ avio_fseek(pb, 0, SEEK_SET);
/* overwrite map, flt and umf packets with new values */
gxf_write_map_packet(s, 1);
gxf_write_flt_packet(s);
@@ -781,12 +781,12 @@ static int gxf_write_trailer(AVFormatContext *s)
put_flush_packet(pb);
/* update duration in all map packets */
for (i = 1; i < gxf->map_offsets_nb; i++) {
- url_fseek(pb, gxf->map_offsets[i], SEEK_SET);
+ avio_fseek(pb, gxf->map_offsets[i], SEEK_SET);
gxf_write_map_packet(s, 1);
put_flush_packet(pb);
}
- url_fseek(pb, end, SEEK_SET);
+ avio_fseek(pb, end, SEEK_SET);
av_freep(&gxf->flt_entries);
av_freep(&gxf->map_offsets);
@@ -858,9 +858,9 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
GXFContext *gxf = s->priv_data;
AVIOContext *pb = s->pb;
AVStream *st = s->streams[pkt->stream_index];
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
int padding = 0;
- int packet_start_offset = url_ftell(pb) / 1024;
+ int packet_start_offset = avio_ftell(pb) / 1024;
gxf_write_packet_header(pb, PKT_MEDIA);
if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */
diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c
index f804423..28dc10a 100644
--- a/libavformat/id3v1.c
+++ b/libavformat/id3v1.c
@@ -230,14 +230,14 @@ void ff_id3v1_read(AVFormatContext *s)
if (!url_is_streamed(s->pb)) {
/* XXX: change that */
- filesize = url_fsize(s->pb);
+ filesize = avio_fsize(s->pb);
if (filesize > 128) {
- url_fseek(s->pb, filesize - 128, SEEK_SET);
+ avio_fseek(s->pb, filesize - 128, SEEK_SET);
ret = avio_get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
if (ret == ID3v1_TAG_SIZE) {
parse_tag(s, buf);
}
- url_fseek(s->pb, 0, SEEK_SET);
+ avio_fseek(s->pb, 0, SEEK_SET);
}
}
}
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index 62e0090..40492ee 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -170,7 +170,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
unsync = flags & 0x80;
if (isv34 && flags & 0x40) /* Extended header present, just skip over it */
- url_fskip(s->pb, get_size(s->pb, 4));
+ avio_fskip(s->pb, get_size(s->pb, 4));
while (len >= taghdrlen) {
unsigned int tflags;
@@ -195,7 +195,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
if (len < 0)
break;
- next = url_ftell(s->pb) + tlen;
+ next = avio_ftell(s->pb) + tlen;
if (tflags & ID3v2_FLAG_DATALEN) {
avio_get_be32(s->pb);
@@ -204,7 +204,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) {
av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag);
- url_fskip(s->pb, tlen);
+ avio_fskip(s->pb, tlen);
} else if (tag[0] == 'T') {
if (unsync || tunsync) {
int i, j;
@@ -225,26 +225,26 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
else if (!tag[0]) {
if (tag[1])
av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding");
- url_fskip(s->pb, tlen);
+ avio_fskip(s->pb, tlen);
break;
}
/* Skip to end of tag */
- url_fseek(s->pb, next, SEEK_SET);
+ avio_fseek(s->pb, next, SEEK_SET);
}
if (len > 0) {
/* Skip padding */
- url_fskip(s->pb, len);
+ avio_fskip(s->pb, len);
}
if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
- url_fskip(s->pb, 10);
+ avio_fskip(s->pb, 10);
av_free(buffer);
return;
error:
av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
- url_fskip(s->pb, len);
+ avio_fskip(s->pb, len);
av_free(buffer);
}
@@ -257,7 +257,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);
+ off = avio_ftell(s->pb);
ret = avio_get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
if (ret != ID3v2_HEADER_SIZE)
break;
@@ -270,7 +270,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic)
(buf[9] & 0x7f);
ff_id3v2_parse(s, len, buf[3], buf[5]);
} else {
- url_fseek(s->pb, off, SEEK_SET);
+ avio_fseek(s->pb, off, SEEK_SET);
}
} while (found_header);
ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv);
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 9279f9f..5cf1588 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -227,7 +227,7 @@ static int idcin_read_packet(AVFormatContext *s,
unsigned char r, g, b;
unsigned char palette_buffer[768];
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
if (idcin->next_chunk_is_video) {
@@ -257,7 +257,7 @@ static int idcin_read_packet(AVFormatContext *s,
chunk_size = avio_get_le32(pb);
/* skip the number of decoded bytes (always equal to width * height) */
- url_fseek(pb, 4, SEEK_CUR);
+ avio_fseek(pb, 4, SEEK_CUR);
chunk_size -= 4;
ret= av_get_packet(pb, pkt, chunk_size);
if (ret < 0)
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index e42f37d..a10d9eb 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -111,7 +111,7 @@ static int roq_read_packet(AVFormatContext *s,
while (!packet_read) {
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
/* get the next chunk preamble */
@@ -136,14 +136,14 @@ static int roq_read_packet(AVFormatContext *s,
break;
}
/* don't care about this chunk anymore */
- url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR);
+ avio_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR);
break;
case RoQ_QUAD_CODEBOOK:
/* packet needs to contain both this codebook and next VQ chunk */
- codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
+ codebook_offset = avio_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
codebook_size = chunk_size;
- url_fseek(pb, codebook_size, SEEK_CUR);
+ avio_fseek(pb, codebook_size, SEEK_CUR);
if (avio_get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
@@ -151,7 +151,7 @@ static int roq_read_packet(AVFormatContext *s,
codebook_size;
/* rewind */
- url_fseek(pb, codebook_offset, SEEK_SET);
+ avio_fseek(pb, codebook_offset, SEEK_SET);
/* load up the packet */
ret= av_get_packet(pb, pkt, chunk_size);
@@ -197,7 +197,7 @@ static int roq_read_packet(AVFormatContext *s,
roq->audio_frame_count += (chunk_size / roq->audio_channels);
}
- pkt->pos= url_ftell(pb);
+ pkt->pos= avio_ftell(pb);
ret = avio_get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
chunk_size);
if (ret != chunk_size)
diff --git a/libavformat/iff.c b/libavformat/iff.c
index c31486e..665f1ba 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -134,17 +134,17 @@ static int iff_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
st->codec->channels = 1;
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
// codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
st->codec->codec_tag = avio_get_le32(pb);
- while(!url_feof(pb)) {
+ while(!avio_feof(pb)) {
uint64_t orig_pos;
int res;
const char *metadata_tag = NULL;
chunk_id = avio_get_le32(pb);
data_size = avio_get_be32(pb);
- orig_pos = url_ftell(pb);
+ orig_pos = avio_ftell(pb);
switch(chunk_id) {
case ID_VHDR:
@@ -152,16 +152,16 @@ static int iff_read_header(AVFormatContext *s,
if (data_size < 14)
return AVERROR_INVALIDDATA;
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
st->codec->sample_rate = avio_get_be16(pb);
if (data_size >= 16) {
- url_fskip(pb, 1);
+ avio_fskip(pb, 1);
compression = avio_get_byte(pb);
}
break;
case ID_BODY:
- iff->body_pos = url_ftell(pb);
+ iff->body_pos = avio_ftell(pb);
iff->body_size = data_size;
break;
@@ -186,14 +186,14 @@ static int iff_read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
st->codec->width = avio_get_be16(pb);
st->codec->height = avio_get_be16(pb);
- url_fskip(pb, 4); // x, y offset
+ avio_fskip(pb, 4); // x, y offset
st->codec->bits_per_coded_sample = avio_get_byte(pb);
if (data_size >= 11) {
- url_fskip(pb, 1); // masking
+ avio_fskip(pb, 1); // masking
compression = avio_get_byte(pb);
}
if (data_size >= 16) {
- url_fskip(pb, 3); // paddding, transparent
+ avio_fskip(pb, 3); // paddding, transparent
st->sample_aspect_ratio.num = avio_get_byte(pb);
st->sample_aspect_ratio.den = avio_get_byte(pb);
}
@@ -223,10 +223,10 @@ static int iff_read_header(AVFormatContext *s,
return res;
}
}
- url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1));
+ avio_fskip(pb, data_size - (avio_ftell(pb) - orig_pos) + (data_size & 1));
}
- url_fseek(pb, iff->body_pos, SEEK_SET);
+ avio_fseek(pb, iff->body_pos, SEEK_SET);
switch(st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
diff --git a/libavformat/img2.c b/libavformat/img2.c
index a979abe..00276b6 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -275,7 +275,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
av_log(s1, AV_LOG_ERROR, "Could not open file : %s\n",filename);
return AVERROR(EIO);
}
- size[i]= url_fsize(f[i]);
+ size[i]= avio_fsize(f[i]);
if(codec->codec_id != CODEC_ID_RAWVIDEO)
break;
@@ -286,7 +286,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
infer_size(&codec->width, &codec->height, size[0]);
} else {
f[0] = s1->pb;
- if (url_feof(f[0]))
+ if (avio_feof(f[0]))
return AVERROR(EIO);
size[0]= 4096;
}
diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c
index a55255d..0da6f64 100644
--- a/libavformat/ingenientdec.c
+++ b/libavformat/ingenientdec.c
@@ -35,11 +35,11 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
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);
+ avio_fskip(s->pb, 8); // zero + size (padded?)
+ avio_fskip(s->pb, 2);
unk1 = avio_get_le16(s->pb);
unk2 = avio_get_le16(s->pb);
- url_fskip(s->pb, 22); // ASCII timestamp
+ avio_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",
size, w, h, unk1, unk2);
@@ -47,7 +47,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
if (av_new_packet(pkt, size) < 0)
return AVERROR(ENOMEM);
- pkt->pos = url_ftell(s->pb);
+ pkt->pos = avio_ftell(s->pb);
pkt->stream_index = 0;
ret = avio_get_buffer(s->pb, pkt->data, size);
if (ret < 0) {
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index 925153b..f047315 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -133,7 +133,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
s->audio_chunk_size -= 6;
}
- url_fseek(pb, s->audio_chunk_offset, SEEK_SET);
+ avio_fseek(pb, s->audio_chunk_offset, SEEK_SET);
s->audio_chunk_offset = 0;
if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size))
@@ -163,7 +163,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
return CHUNK_NOMEM;
pkt->pos= s->decode_map_chunk_offset;
- url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET);
+ avio_fseek(pb, s->decode_map_chunk_offset, SEEK_SET);
s->decode_map_chunk_offset = 0;
if (avio_get_buffer(pb, pkt->data, s->decode_map_chunk_size) !=
@@ -172,7 +172,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
return CHUNK_EOF;
}
- url_fseek(pb, s->video_chunk_offset, SEEK_SET);
+ avio_fseek(pb, s->video_chunk_offset, SEEK_SET);
s->video_chunk_offset = 0;
if (avio_get_buffer(pb, pkt->data + s->decode_map_chunk_size,
@@ -193,7 +193,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb,
} else {
- url_fseek(pb, s->next_chunk_offset, SEEK_SET);
+ avio_fseek(pb, s->next_chunk_offset, SEEK_SET);
chunk_type = CHUNK_DONE;
}
@@ -225,7 +225,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
return chunk_type;
/* read the next chunk, wherever the file happens to be pointing */
- if (url_feof(pb))
+ if (avio_feof(pb))
return CHUNK_EOF;
if (avio_get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
CHUNK_PREAMBLE_SIZE)
@@ -271,7 +271,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) {
/* read the next chunk, wherever the file happens to be pointing */
- if (url_feof(pb)) {
+ if (avio_feof(pb)) {
chunk_type = CHUNK_EOF;
break;
}
@@ -299,12 +299,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
case OPCODE_END_OF_STREAM:
debug_ipmovie("end of stream\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_END_OF_CHUNK:
debug_ipmovie("end of chunk\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_CREATE_TIMER:
@@ -359,7 +359,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
case OPCODE_START_STOP_AUDIO:
debug_ipmovie("start/stop audio\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_INIT_VIDEO_BUFFERS:
@@ -393,36 +393,36 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
case OPCODE_UNKNOWN_14:
case OPCODE_UNKNOWN_15:
debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type);
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_SEND_BUFFER:
debug_ipmovie("send buffer\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_AUDIO_FRAME:
debug_ipmovie("audio frame\n");
/* log position and move on for now */
- s->audio_chunk_offset = url_ftell(pb);
+ s->audio_chunk_offset = avio_ftell(pb);
s->audio_chunk_size = opcode_size;
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_SILENCE_FRAME:
debug_ipmovie("silence frame\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_INIT_VIDEO_MODE:
debug_ipmovie("initialize video mode\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_CREATE_GRADIENT:
debug_ipmovie("create gradient\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_SET_PALETTE:
@@ -464,25 +464,25 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
case OPCODE_SET_PALETTE_COMPRESSED:
debug_ipmovie("set palette compressed\n");
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_SET_DECODING_MAP:
debug_ipmovie("set decoding map\n");
/* log position and move on for now */
- s->decode_map_chunk_offset = url_ftell(pb);
+ s->decode_map_chunk_offset = avio_ftell(pb);
s->decode_map_chunk_size = opcode_size;
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
case OPCODE_VIDEO_DATA:
debug_ipmovie("set video data\n");
/* log position and move on for now */
- s->video_chunk_offset = url_ftell(pb);
+ s->video_chunk_offset = avio_ftell(pb);
s->video_chunk_size = opcode_size;
- url_fseek(pb, opcode_size, SEEK_CUR);
+ avio_fseek(pb, opcode_size, SEEK_CUR);
break;
default:
@@ -494,7 +494,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb,
}
/* make a note of where the stream is sitting */
- s->next_chunk_offset = url_ftell(pb);
+ s->next_chunk_offset = avio_ftell(pb);
/* dispatch the first of any pending packets */
if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY))
@@ -532,7 +532,7 @@ static int ipmovie_read_header(AVFormatContext *s,
while (memcmp(signature_buffer, signature, sizeof(signature))) {
memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
signature_buffer[sizeof(signature_buffer) - 1] = avio_get_byte(pb);
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR_EOF;
}
/* initialize private context members */
@@ -541,7 +541,7 @@ static int ipmovie_read_header(AVFormatContext *s,
ipmovie->decode_map_chunk_offset = 0;
/* on the first read, this will position the stream at the first chunk */
- ipmovie->next_chunk_offset = url_ftell(pb) + 4;
+ ipmovie->next_chunk_offset = avio_ftell(pb) + 4;
/* process the first chunk which should be CHUNK_INIT_VIDEO */
if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO)
@@ -553,7 +553,7 @@ static int ipmovie_read_header(AVFormatContext *s,
CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
chunk_type = AV_RL16(&chunk_preamble[2]);
- url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
+ avio_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR);
if (chunk_type == CHUNK_VIDEO)
ipmovie->audio_type = CODEC_ID_NONE; /* no audio */
diff --git a/libavformat/iss.c b/libavformat/iss.c
index daf8bba..6325c2f 100644
--- a/libavformat/iss.c
+++ b/libavformat/iss.c
@@ -87,7 +87,7 @@ static av_cold int iss_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_token(pb, token, sizeof(token)); //Version ID
get_token(pb, token, sizeof(token)); //Size
- iss->sample_start_pos = url_ftell(pb);
+ iss->sample_start_pos = avio_ftell(pb);
st = av_new_stream(s, 0);
if (!st)
@@ -116,7 +116,7 @@ static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(EIO);
pkt->stream_index = 0;
- pkt->pts = url_ftell(s->pb) - iss->sample_start_pos;
+ pkt->pts = avio_ftell(s->pb) - iss->sample_start_pos;
if(s->streams[0]->codec->channels > 0)
pkt->pts /= s->streams[0]->codec->channels*2;
return 0;
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index d8f4001..9ca4db9 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -70,7 +70,7 @@ retry:
return -1;
if(type==258){
- url_fskip(s->pb, size);
+ avio_fskip(s->pb, size);
goto retry;
}
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 8a7774a..3e48e51 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -179,10 +179,10 @@ static size_t av_read(void * h, size_t len, uint8_t * buf) {
static off_t av_seek(void * h, long long pos, int whence) {
AVIOContext * bc = h;
if (whence == SEEK_END) {
- pos = url_fsize(bc) + pos;
+ pos = avio_fsize(bc) + pos;
whence = SEEK_SET;
}
- return url_fseek(bc, pos, whence);
+ return avio_fseek(bc, pos, whence);
}
static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
@@ -272,7 +272,7 @@ static int nut_read_packet(AVFormatContext * avf, AVPacket * pkt) {
if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY;
pkt->pts = pd.pts;
pkt->stream_index = pd.stream;
- pkt->pos = url_ftell(avf->pb);
+ pkt->pos = avio_ftell(avf->pb);
ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
index 093ad09..82de4c2 100644
--- a/libavformat/lmlm4.c
+++ b/libavformat/lmlm4.c
@@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
return AVERROR(EIO);
- url_fskip(pb, padding);
+ avio_fskip(pb, padding);
switch (frame_type) {
case LMLM4_I_FRAME:
diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c
index 549f649..77fd090 100644
--- a/libavformat/lxfdec.c
+++ b/libavformat/lxfdec.c
@@ -90,7 +90,7 @@ static int sync(AVFormatContext *s, uint8_t *header)
return ret < 0 ? ret : AVERROR_EOF;
while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) {
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR_EOF;
memmove(buf, &buf[1], LXF_IDENT_LENGTH-1);
@@ -137,7 +137,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
case 0:
//video
//skip VBI data and metadata
- url_fskip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) +
+ avio_fskip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) +
(int64_t)(uint32_t)AV_RL32(&header[52]));
break;
case 1:
@@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (format == 1) {
//skip extended field data
- url_fskip(s->pb, (uint32_t)AV_RL32(&header[40]));
+ avio_fskip(s->pb, (uint32_t)AV_RL32(&header[40]));
}
return 0;
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index f319087..38f927f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -516,7 +516,7 @@ static const char *matroska_doctypes[] = { "matroska", "webm" };
static int ebml_level_end(MatroskaDemuxContext *matroska)
{
AVIOContext *pb = matroska->ctx->pb;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
if (matroska->num_levels > 0) {
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
@@ -547,8 +547,8 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
* use it safely here to catch EOS. */
if (!(total = avio_get_byte(pb))) {
/* we might encounter EOS here */
- if (!url_feof(pb)) {
- int64_t pos = url_ftell(pb);
+ if (!avio_feof(pb)) {
+ int64_t pos = avio_ftell(pb);
av_log(matroska->ctx, AV_LOG_ERROR,
"Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
pos, pos);
@@ -559,7 +559,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb,
/* get the length of the EBML number */
read = 8 - ff_log2_tab[total];
if (read > max_size) {
- int64_t pos = url_ftell(pb) - 1;
+ int64_t pos = avio_ftell(pb) - 1;
av_log(matroska->ctx, AV_LOG_ERROR,
"Invalid EBML number size tag 0x%02x at pos %"PRIu64" (0x%"PRIx64")\n",
(uint8_t) total, pos, pos);
@@ -658,7 +658,7 @@ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin)
return AVERROR(ENOMEM);
bin->size = length;
- bin->pos = url_ftell(pb);
+ bin->pos = avio_ftell(pb);
if (avio_get_buffer(pb, bin->data, length) != length) {
av_freep(&bin->data);
return AVERROR(EIO);
@@ -684,7 +684,7 @@ static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length)
}
level = &matroska->levels[matroska->num_levels++];
- level->start = url_ftell(pb);
+ level->start = avio_ftell(pb);
level->length = length;
return 0;
@@ -826,11 +826,11 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
case EBML_NEST: if ((res=ebml_read_master(matroska, length)) < 0)
return res;
if (id == MATROSKA_ID_SEGMENT)
- matroska->segment_start = url_ftell(matroska->ctx->pb);
+ matroska->segment_start = avio_ftell(matroska->ctx->pb);
return ebml_parse_nest(matroska, syntax->def.n, data);
case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data);
case EBML_STOP: return 1;
- default: return url_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0;
+ default: return avio_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0;
}
if (res == AVERROR_INVALIDDATA)
av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n");
@@ -1110,7 +1110,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
EbmlList *seekhead_list = &matroska->seekhead;
MatroskaSeekhead *seekhead = seekhead_list->elem;
uint32_t level_up = matroska->level_up;
- int64_t before_pos = url_ftell(matroska->ctx->pb);
+ int64_t before_pos = avio_ftell(matroska->ctx->pb);
uint32_t saved_id = matroska->current_id;
MatroskaLevel level;
int i;
@@ -1129,7 +1129,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
continue;
/* seek */
- if (url_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset)
+ if (avio_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset)
continue;
/* We don't want to lose our seekhead level, so we add
@@ -1158,7 +1158,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
}
/* seek back */
- url_fseek(matroska->ctx->pb, before_pos, SEEK_SET);
+ avio_fseek(matroska->ctx->pb, before_pos, SEEK_SET);
matroska->level_up = level_up;
matroska->current_id = saved_id;
}
@@ -1392,10 +1392,10 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
int flavor;
avio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
0, NULL, NULL, NULL, NULL);
- url_fskip(&b, 22);
+ avio_fskip(&b, 22);
flavor = avio_get_be16(&b);
track->audio.coded_framesize = avio_get_be32(&b);
- url_fskip(&b, 12);
+ avio_fskip(&b, 12);
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);
@@ -1841,7 +1841,7 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
EbmlList *blocks_list;
MatroskaBlock *blocks;
int i, res;
- int64_t pos = url_ftell(matroska->ctx->pb);
+ int64_t pos = avio_ftell(matroska->ctx->pb);
matroska->prev_pkt = NULL;
if (matroska->current_id)
pos -= 4; /* sizeof the ID which was already read */
@@ -1888,7 +1888,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
timestamp = FFMAX(timestamp, st->index_entries[0].timestamp);
if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
- url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
+ avio_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
matroska_clear_queue(matroska);
if (matroska_parse_cluster(matroska) < 0)
@@ -1913,7 +1913,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
}
}
- url_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
+ avio_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
matroska->skip_to_timecode = st->index_entries[index].timestamp;
matroska->done = 0;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 6ee8a68..e71ce1b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -203,7 +203,7 @@ static void put_ebml_string(AVIOContext *pb, unsigned int elementid, const char
*/
static void put_ebml_void(AVIOContext *pb, uint64_t size)
{
- int64_t currentpos = url_ftell(pb);
+ int64_t currentpos = avio_ftell(pb);
assert(size >= 2);
@@ -215,7 +215,7 @@ static void put_ebml_void(AVIOContext *pb, uint64_t size)
put_ebml_num(pb, size-1, 0);
else
put_ebml_num(pb, size-9, 8);
- while(url_ftell(pb) < currentpos + size)
+ while(avio_ftell(pb) < currentpos + size)
avio_put_byte(pb, 0);
}
@@ -224,17 +224,17 @@ static ebml_master start_ebml_master(AVIOContext *pb, unsigned int elementid, ui
int bytes = expectedsize ? ebml_num_size(expectedsize) : 8;
put_ebml_id(pb, elementid);
put_ebml_size_unknown(pb, bytes);
- return (ebml_master){ url_ftell(pb), bytes };
+ return (ebml_master){ avio_ftell(pb), bytes };
}
static void end_ebml_master(AVIOContext *pb, ebml_master master)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
- if (url_fseek(pb, master.pos - master.sizebytes, SEEK_SET) < 0)
+ if (avio_fseek(pb, master.pos - master.sizebytes, SEEK_SET) < 0)
return;
put_ebml_num(pb, pos - master.pos, master.sizebytes);
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
static void put_xiph_size(AVIOContext *pb, int size)
@@ -265,7 +265,7 @@ static mkv_seekhead * mkv_start_seekhead(AVIOContext *pb, int64_t segment_offset
new_seekhead->segment_offset = segment_offset;
if (numelements > 0) {
- new_seekhead->filepos = url_ftell(pb);
+ new_seekhead->filepos = avio_ftell(pb);
// 21 bytes max for a seek entry, 10 bytes max for the SeekHead ID
// and size, and 3 bytes to guarantee that an EBML void element
// will fit afterwards
@@ -310,10 +310,10 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead)
int64_t currentpos;
int i;
- currentpos = url_ftell(pb);
+ currentpos = avio_ftell(pb);
if (seekhead->reserved_size > 0)
- if (url_fseek(pb, seekhead->filepos, SEEK_SET) < 0)
+ if (avio_fseek(pb, seekhead->filepos, SEEK_SET) < 0)
return -1;
metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size);
@@ -332,9 +332,9 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead)
end_ebml_master(pb, metaseek);
if (seekhead->reserved_size > 0) {
- uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb);
+ uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_ftell(pb);
put_ebml_void(pb, remaining);
- url_fseek(pb, currentpos, SEEK_SET);
+ avio_fseek(pb, currentpos, SEEK_SET);
currentpos = seekhead->filepos;
}
@@ -379,7 +379,7 @@ static int64_t mkv_write_cues(AVIOContext *pb, mkv_cues *cues, int num_tracks)
int64_t currentpos;
int i, j;
- currentpos = url_ftell(pb);
+ currentpos = avio_ftell(pb);
cues_element = start_ebml_master(pb, MATROSKA_ID_CUES, 0);
for (i = 0; i < cues->num_entries; i++) {
@@ -526,7 +526,7 @@ static int mkv_write_tracks(AVFormatContext *s)
ebml_master tracks;
int i, j, ret;
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, url_ftell(pb));
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TRACKS, avio_ftell(pb));
if (ret < 0) return ret;
tracks = start_ebml_master(pb, MATROSKA_ID_TRACKS, 0);
@@ -658,7 +658,7 @@ static int mkv_write_chapters(AVFormatContext *s)
if (!s->nb_chapters)
return 0;
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, url_ftell(pb));
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CHAPTERS, avio_ftell(pb));
if (ret < 0) return ret;
chapters = start_ebml_master(pb, MATROSKA_ID_CHAPTERS , 0);
@@ -730,7 +730,7 @@ static int mkv_write_tag(AVFormatContext *s, AVMetadata *m, unsigned int element
int ret;
if (!tags->pos) {
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, url_ftell(s->pb));
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_TAGS, avio_ftell(s->pb));
if (ret < 0) return ret;
*tags = start_ebml_master(s->pb, MATROSKA_ID_TAGS, 0);
@@ -813,7 +813,7 @@ static int mkv_write_header(AVFormatContext *s)
end_ebml_master(pb, ebml_header);
mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0);
- mkv->segment_offset = url_ftell(pb);
+ mkv->segment_offset = avio_ftell(pb);
// we write 2 seek heads - one at the end of the file to point to each
// cluster, and one at the beginning to point to all other level one
@@ -824,7 +824,7 @@ static int mkv_write_header(AVFormatContext *s)
if (!mkv->main_seekhead)
return AVERROR(ENOMEM);
- ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, url_ftell(pb));
+ ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, avio_ftell(pb));
if (ret < 0) return ret;
segment_info = start_ebml_master(pb, MATROSKA_ID_INFO, 0);
@@ -847,7 +847,7 @@ static int mkv_write_header(AVFormatContext *s)
// reserve space for the duration
mkv->duration = 0;
- mkv->duration_offset = url_ftell(pb);
+ mkv->duration_offset = avio_ftell(pb);
put_ebml_void(pb, 11); // assumes double-precision float to be written
end_ebml_master(pb, segment_info);
@@ -928,7 +928,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
"pts %" PRId64 ", duration %d\n",
- url_ftell(pb), size, pkt->pts, duration);
+ avio_ftell(pb), size, pkt->pts, duration);
blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size));
put_ebml_id(pb, MATROSKA_ID_BLOCK);
put_ebml_num(pb, size+4, 0);
@@ -957,7 +957,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
"pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
- url_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
+ avio_ftell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
if (codec->codec_id == CODEC_ID_H264 && codec->extradata_size > 0 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
@@ -1045,7 +1045,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
}
if (!mkv->cluster_pos) {
- mkv->cluster_pos = url_ftell(s->pb);
+ mkv->cluster_pos = avio_ftell(s->pb);
mkv->cluster = start_ebml_master(pb, MATROSKA_ID_CLUSTER, 0);
put_ebml_uint(pb, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
mkv->cluster_pts = FFMAX(0, ts);
@@ -1094,7 +1094,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
int ret, keyframe = !!(pkt->flags & AV_PKT_FLAG_KEY);
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
- int cluster_size = url_ftell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos);
+ int cluster_size = avio_ftell(pb) - (url_is_streamed(s->pb) ? 0 : mkv->cluster_pos);
// start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or
// after 4k and on a keyframe
@@ -1103,7 +1103,7 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
|| cluster_size > 5*1024*1024 || ts > mkv->cluster_pts + 5000
|| (codec->codec_type == AVMEDIA_TYPE_VIDEO && keyframe && cluster_size > 4*1024))) {
av_log(s, AV_LOG_DEBUG, "Starting new cluster at offset %" PRIu64
- " bytes, pts %" PRIu64 "\n", url_ftell(pb), ts);
+ " bytes, pts %" PRIu64 "\n", avio_ftell(pb), ts);
end_ebml_master(pb, mkv->cluster);
mkv->cluster_pos = 0;
if (mkv->dyn_bc)
@@ -1162,11 +1162,11 @@ static int mkv_write_trailer(AVFormatContext *s)
// update the duration
av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration);
- currentpos = url_ftell(pb);
- url_fseek(pb, mkv->duration_offset, SEEK_SET);
+ currentpos = avio_ftell(pb);
+ avio_fseek(pb, mkv->duration_offset, SEEK_SET);
put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration);
- url_fseek(pb, currentpos, SEEK_SET);
+ avio_fseek(pb, currentpos, SEEK_SET);
}
end_ebml_master(pb, mkv->segment);
diff --git a/libavformat/mm.c b/libavformat/mm.c
index 1e32f41..f27bfda 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -102,7 +102,7 @@ static int read_header(AVFormatContext *s,
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 */
+ avio_fseek(pb, length - 10, SEEK_CUR); /* unknown data */
/* video stream */
st = av_new_stream(s, 0);
@@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s,
default :
av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type);
- url_fseek(pb, length, SEEK_CUR);
+ avio_fseek(pb, length, SEEK_CUR);
}
}
diff --git a/libavformat/mmf.c b/libavformat/mmf.c
index b58b15a..704126a 100644
--- a/libavformat/mmf.c
+++ b/libavformat/mmf.c
@@ -51,10 +51,10 @@ static void end_tag_be(AVIOContext *pb, int64_t start)
{
int64_t pos;
- pos = url_ftell(pb);
- url_fseek(pb, start - 4, SEEK_SET);
+ pos = avio_ftell(pb);
+ avio_fseek(pb, start - 4, SEEK_SET);
avio_put_be32(pb, (uint32_t)(pos - start));
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
static int mmf_write_header(AVFormatContext *s)
@@ -83,7 +83,7 @@ static int mmf_write_header(AVFormatContext *s)
avio_put_buffer(pb, "ATR\x00", 4);
avio_put_be32(pb, 0);
- mmf->atrpos = url_ftell(pb);
+ mmf->atrpos = avio_ftell(pb);
avio_put_byte(pb, 0); /* format type */
avio_put_byte(pb, 0); /* sequence type */
avio_put_byte(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
@@ -93,7 +93,7 @@ static int mmf_write_header(AVFormatContext *s)
avio_put_tag(pb, "Atsq");
avio_put_be32(pb, 16);
- mmf->atsqpos = url_ftell(pb);
+ mmf->atsqpos = avio_ftell(pb);
/* Will be filled on close */
avio_put_buffer(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
@@ -138,11 +138,11 @@ static int mmf_write_trailer(AVFormatContext *s)
end_tag_be(pb, mmf->atrpos);
end_tag_be(pb, 8);
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
size = pos - mmf->awapos;
/* Fill Atsq chunk */
- url_fseek(pb, mmf->atsqpos, SEEK_SET);
+ avio_fseek(pb, mmf->atsqpos, SEEK_SET);
/* "play wav" */
avio_put_byte(pb, 0); /* start time */
@@ -157,7 +157,7 @@ static int mmf_write_trailer(AVFormatContext *s)
/* "end of sequence" */
avio_put_buffer(pb, "\x00\x00\x00\x00", 4);
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
put_flush_packet(pb);
}
@@ -194,7 +194,7 @@ static int mmf_read_header(AVFormatContext *s,
file_size = avio_get_be32(pb);
/* Skip some unused chunks that may or may not be present */
- for(;; url_fseek(pb, size, SEEK_CUR)) {
+ for(;; avio_fseek(pb, size, SEEK_CUR)) {
tag = avio_get_le32(pb);
size = avio_get_be32(pb);
if(tag == MKTAG('C','N','T','I')) continue;
@@ -225,7 +225,7 @@ static int mmf_read_header(AVFormatContext *s,
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)) {
+ for(;; avio_fseek(pb, size, SEEK_CUR)) {
tag = avio_get_le32(pb);
size = avio_get_be32(pb);
if(tag == MKTAG('A','t','s','q')) continue;
@@ -265,7 +265,7 @@ static int mmf_read_packet(AVFormatContext *s,
AVStream *st;
int ret, size;
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
st = s->streams[0];
diff --git a/libavformat/mov.c b/libavformat/mov.c
index acde125..f048920 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -258,7 +258,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size < 0)
atom.size = INT64_MAX;
- while (total_size + 8 < atom.size && !url_feof(pb)) {
+ while (total_size + 8 < atom.size && !avio_feof(pb)) {
int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
a.size = atom.size;
a.type=0;
@@ -295,26 +295,26 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
parse = mov_read_udta_string;
if (!parse) { /* skip leaf atoms data */
- url_fskip(pb, a.size);
+ avio_fskip(pb, a.size);
} else {
- int64_t start_pos = url_ftell(pb);
+ int64_t start_pos = avio_ftell(pb);
int64_t left;
int err = parse(c, pb, a);
if (err < 0)
return err;
if (c->found_moov && c->found_mdat &&
- (url_is_streamed(pb) || start_pos + a.size == url_fsize(pb)))
+ (url_is_streamed(pb) || start_pos + a.size == avio_fsize(pb)))
return 0;
- left = a.size - url_ftell(pb) + start_pos;
+ left = a.size - avio_ftell(pb) + start_pos;
if (left > 0) /* skip garbage at atom end */
- url_fskip(pb, left);
+ avio_fskip(pb, left);
}
total_size += a.size;
}
if (total_size < atom.size && atom.size < 0x7ffff)
- url_fskip(pb, atom.size - total_size);
+ avio_fskip(pb, atom.size - total_size);
return 0;
}
@@ -342,7 +342,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
for (i = 0; i < sc->drefs_count; i++) {
MOVDref *dref = &sc->drefs[i];
uint32_t size = avio_get_be32(pb);
- int64_t next = url_ftell(pb) + size - 4;
+ int64_t next = avio_ftell(pb) + size - 4;
if (size < 12)
return -1;
@@ -356,7 +356,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint16_t volume_len, len;
int16_t type;
- url_fskip(pb, 10);
+ avio_fskip(pb, 10);
volume_len = avio_get_byte(pb);
volume_len = FFMIN(volume_len, 27);
@@ -364,7 +364,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
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);
+ avio_fskip(pb, 12);
len = avio_get_byte(pb);
len = FFMIN(len, 63);
@@ -372,7 +372,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
dref->filename[len] = 0;
av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len);
- url_fskip(pb, 16);
+ avio_fskip(pb, 16);
/* read next level up_from_alias/down_to_target */
dref->nlvl_from = avio_get_be16(pb);
@@ -380,9 +380,9 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n",
dref->nlvl_from, dref->nlvl_to);
- url_fskip(pb, 16);
+ avio_fskip(pb, 16);
- for (type = 0; type != -1 && url_ftell(pb) < next; ) {
+ for (type = 0; type != -1 && avio_ftell(pb) < next; ) {
type = avio_get_be16(pb);
len = avio_get_be16(pb);
av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
@@ -415,10 +415,10 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
dref->dir[j] = '/';
av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir);
} else
- url_fskip(pb, len);
+ avio_fskip(pb, len);
}
}
- url_fseek(pb, next, SEEK_SET);
+ avio_fseek(pb, next, SEEK_SET);
}
return 0;
}
@@ -582,7 +582,7 @@ static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
- c->fragment.moof_offset = url_ftell(pb) - 8;
+ c->fragment.moof_offset = avio_ftell(pb) - 8;
av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
return mov_read_default(c, pb, atom);
}
@@ -662,9 +662,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_get_be16(pb); /* preferred volume */
- url_fskip(pb, 10); /* reserved */
+ avio_fskip(pb, 10); /* reserved */
- url_fskip(pb, 36); /* display matrix */
+ avio_fskip(pb, 36); /* display matrix */
avio_get_be32(pb); /* preview time */
avio_get_be32(pb); /* preview duration */
@@ -781,7 +781,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (mov_read_default(c, pb, atom) < 0)
return -1;
} else
- url_fskip(pb, atom.size);
+ avio_fskip(pb, atom.size);
return 0;
}
@@ -832,7 +832,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = atom.size - 40;
- url_fskip(pb, 40);
+ avio_fskip(pb, 40);
avio_get_buffer(pb, st->codec->extradata, atom.size - 40);
return 0;
}
@@ -924,7 +924,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
enum CodecID id;
int dref_id = 1;
MOVAtom a = { AV_RL32("stsd") };
- int64_t start_pos = url_ftell(pb);
+ int64_t start_pos = avio_ftell(pb);
int size = avio_get_be32(pb); /* size */
uint32_t format = avio_get_le32(pb); /* data format */
@@ -944,7 +944,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
* in the MOV demuxer, patch welcome. */
multiple_stsd:
av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");
- url_fskip(pb, size - (url_ftell(pb) - start_pos));
+ avio_fskip(pb, size - (avio_ftell(pb) - start_pos));
continue;
}
/* we cannot demux concatenated h264 streams because of different extradata */
@@ -1002,7 +1002,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
len = 31;
mov_read_mac_string(c, pb, len, st->codec->codec_name, 32);
if (len < 31)
- url_fskip(pb, 31 - len);
+ avio_fskip(pb, 31 - len);
/* codec_tag YV12 triggers an UV swap in rawdec.c */
if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
st->codec->codec_tag=MKTAG('I', '4', '2', '0');
@@ -1165,7 +1165,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
} else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
// ttxt stsd contains display flags, justification, background
// color, fonts, and default styles, so fake an atom to read it
- MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
+ MOVAtom fake_atom = { .size = size - (avio_ftell(pb) - start_pos) };
if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom
mov_read_glbl(c, pb, fake_atom);
st->codec->codec_id= id;
@@ -1173,15 +1173,15 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
st->codec->height = sc->height;
} else {
/* other codec type, just skip (rtp, mp4s, tmcd ...) */
- url_fskip(pb, size - (url_ftell(pb) - start_pos));
+ avio_fskip(pb, size - (avio_ftell(pb) - start_pos));
}
/* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */
- a.size = size - (url_ftell(pb) - start_pos);
+ a.size = size - (avio_ftell(pb) - start_pos);
if (a.size > 8) {
if (mov_read_default(c, pb, a) < 0)
return -1;
} else if (a.size > 0)
- url_fskip(pb, a.size);
+ avio_fskip(pb, a.size);
}
if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
@@ -1839,7 +1839,7 @@ static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint32_t tag = avio_get_le32(pb);
atom.size -= 4;
if (tag == MKTAG('h','d','l','r')) {
- url_fseek(pb, -8, SEEK_CUR);
+ avio_fseek(pb, -8, SEEK_CUR);
atom.size += 8;
return mov_read_default(c, pb, atom);
}
@@ -2077,13 +2077,13 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size < 8)
return 0; /* continue */
if (avio_get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
- url_fskip(pb, atom.size - 4);
+ avio_fskip(pb, atom.size - 4);
return 0;
}
atom.type = avio_get_le32(pb);
atom.size -= 8;
if (atom.type != MKTAG('m','d','a','t')) {
- url_fskip(pb, atom.size);
+ avio_fskip(pb, atom.size);
return 0;
}
err = mov_read_mdat(c, pb, atom);
@@ -2298,7 +2298,7 @@ static void mov_read_chapters(AVFormatContext *s)
st->discard = AVDISCARD_ALL;
sc = st->priv_data;
- cur_pos = url_ftell(sc->pb);
+ cur_pos = avio_ftell(sc->pb);
for (i = 0; i < st->nb_index_entries; i++) {
AVIndexEntry *sample = &st->index_entries[i];
@@ -2307,7 +2307,7 @@ static void mov_read_chapters(AVFormatContext *s)
uint16_t ch;
int len, title_len;
- if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+ if (avio_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i);
goto finish;
}
@@ -2337,7 +2337,7 @@ static void mov_read_chapters(AVFormatContext *s)
av_freep(&title);
}
finish:
- url_fseek(sc->pb, cur_pos, SEEK_SET);
+ avio_fseek(sc->pb, cur_pos, SEEK_SET);
}
static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
@@ -2350,7 +2350,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
mov->fc = s;
/* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
if(!url_is_streamed(pb))
- atom.size = url_fsize(pb);
+ atom.size = avio_fsize(pb);
else
atom.size = INT64_MAX;
@@ -2363,7 +2363,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "moov atom not found\n");
return -1;
}
- av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb));
+ av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", avio_ftell(pb));
if (!url_is_streamed(pb) && mov->chapter_track > 0)
mov_read_chapters(s);
@@ -2410,9 +2410,9 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
mov->found_mdat = 0;
if (!url_is_streamed(s->pb) ||
mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
- url_feof(s->pb))
+ avio_feof(s->pb))
return AVERROR_EOF;
- av_dlog(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
+ av_dlog(s, "read fragments, offset 0x%llx\n", avio_ftell(s->pb));
goto retry;
}
sc = st->priv_data;
@@ -2420,7 +2420,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
sc->current_sample++;
if (st->discard != AVDISCARD_ALL) {
- if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+ if (avio_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n",
sc->ffindex, sample->pos);
return -1;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5259419..37c4f97 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -38,10 +38,10 @@
//FIXME support 64 bit variant with wide placeholders
static int64_t updateSize(AVIOContext *pb, int64_t pos)
{
- int64_t curpos = url_ftell(pb);
- url_fseek(pb, pos, SEEK_SET);
+ int64_t curpos = avio_ftell(pb);
+ avio_fseek(pb, pos, SEEK_SET);
avio_put_be32(pb, curpos - pos); /* rewrite size */
- url_fseek(pb, curpos, SEEK_SET);
+ avio_fseek(pb, curpos, SEEK_SET);
return curpos - pos;
}
@@ -51,7 +51,7 @@ static int mov_write_stco_tag(AVIOContext *pb, MOVTrack *track)
{
int i;
int mode64 = 0; // use 32 bit size variant if possible
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
if (pos > UINT32_MAX) {
mode64 = 1;
@@ -75,7 +75,7 @@ static int mov_write_stsz_tag(AVIOContext *pb, MOVTrack *track)
int equalChunks = 1;
int i, j, entries = 0, tst = -1, oldtst = -1;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "stsz");
avio_put_be32(pb, 0); /* version & flags */
@@ -112,11 +112,11 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
int index = 0, oldval = -1, i;
int64_t entryPos, curpos;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "stsc");
avio_put_be32(pb, 0); // version & flags
- entryPos = url_ftell(pb);
+ entryPos = avio_ftell(pb);
avio_put_be32(pb, track->entry); // entry count
for (i=0; i<track->entry; i++) {
if(oldval != track->cluster[i].samplesInChunk)
@@ -128,10 +128,10 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track)
index++;
}
}
- curpos = url_ftell(pb);
- url_fseek(pb, entryPos, SEEK_SET);
+ curpos = avio_ftell(pb);
+ avio_fseek(pb, entryPos, SEEK_SET);
avio_put_be32(pb, index); // rewrite size
- url_fseek(pb, curpos, SEEK_SET);
+ avio_fseek(pb, curpos, SEEK_SET);
return updateSize(pb, pos);
}
@@ -141,11 +141,11 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
{
int64_t curpos, entryPos;
int i, index = 0;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); // size
avio_put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
avio_put_be32(pb, 0); // version & flags
- entryPos = url_ftell(pb);
+ entryPos = avio_ftell(pb);
avio_put_be32(pb, track->entry); // entry count
for (i=0; i<track->entry; i++) {
if (track->cluster[i].flags & flag) {
@@ -153,10 +153,10 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag)
index++;
}
}
- curpos = url_ftell(pb);
- url_fseek(pb, entryPos, SEEK_SET);
+ curpos = avio_ftell(pb);
+ avio_fseek(pb, entryPos, SEEK_SET);
avio_put_be32(pb, index); // rewrite size
- url_fseek(pb, curpos, SEEK_SET);
+ avio_fseek(pb, curpos, SEEK_SET);
return updateSize(pb, pos);
}
@@ -254,7 +254,7 @@ static void putDescr(AVIOContext *pb, int tag, unsigned int size)
static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
avio_put_be32(pb, 0); // size
@@ -316,7 +316,7 @@ static int mov_pcm_le_gt16(enum CodecID codec_id)
static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0);
avio_put_le32(pb, track->tag); // store it byteswapped
track->enc->codec_tag = av_bswap16(track->tag >> 16);
@@ -326,7 +326,7 @@ static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "wave");
@@ -399,7 +399,7 @@ static int mov_get_lpcm_flags(enum CodecID codec_id)
static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
int version = 0;
uint32_t tag = track->tag;
@@ -517,7 +517,7 @@ static int mov_write_svq3_tag(AVIOContext *pb)
static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0);
avio_put_tag(pb, "avcC");
@@ -752,7 +752,7 @@ static int mov_write_uuid_tag_ipod(AVIOContext *pb)
static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_le32(pb, track->tag); // store it byteswapped
avio_put_be32(pb, 0); /* Reserved */
@@ -780,7 +780,7 @@ static int mov_write_pasp_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
char compressor_name[32];
avio_put_be32(pb, 0); /* size */
@@ -850,7 +850,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "rtp ");
avio_put_be32(pb, 0); /* Reserved */
@@ -870,7 +870,7 @@ static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "stsd");
avio_put_be32(pb, 0); /* version & flags */
@@ -977,7 +977,7 @@ static int mov_write_dref_tag(AVIOContext *pb)
static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "stbl");
mov_write_stsd_tag(pb, track);
@@ -999,7 +999,7 @@ static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_dinf_tag(AVIOContext *pb)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "dinf");
mov_write_dref_tag(pb);
@@ -1052,7 +1052,7 @@ static int mov_write_vmhd_tag(AVIOContext *pb)
static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
{
const char *hdlr, *descr = NULL, *hdlr_type = NULL;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
if (!track) { /* no media --> data handler */
hdlr = "dhlr";
@@ -1109,7 +1109,7 @@ static int mov_write_hmhd_tag(AVIOContext *pb)
static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "minf");
if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
@@ -1161,7 +1161,7 @@ static int mov_write_mdhd_tag(AVIOContext *pb, MOVTrack *track)
static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "mdia");
mov_write_mdhd_tag(pb, track);
@@ -1297,7 +1297,7 @@ static int mov_write_udta_sdp(AVIOContext *pb, AVCodecContext *ctx, int index)
static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "trak");
mov_write_tkhd_tag(pb, track, st);
@@ -1429,7 +1429,7 @@ static int mov_write_string_data_tag(AVIOContext *pb, const char *data, int lang
static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){
int size = 0;
if (value && value[0]) {
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, name);
mov_write_string_data_tag(pb, value, lang, long_style);
@@ -1488,7 +1488,7 @@ static int mov_write_trkn_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "ilst");
mov_write_string_metadata(s, pb, "\251nam", "title" , 1);
@@ -1517,7 +1517,7 @@ static int mov_write_meta_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
int size = 0;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size */
avio_put_tag(pb, "meta");
avio_put_be32(pb, 0);
@@ -1557,7 +1557,7 @@ static uint16_t language_code(const char *str)
static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
const char *tag, const char *str)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0);
if (!t || !utf8len(t->value))
return 0;
@@ -1578,7 +1578,7 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
int i, nb_chapters = FFMIN(s->nb_chapters, 255);
avio_put_be32(pb, 0); // size
@@ -1674,7 +1674,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
int64_t pos, pos2;
if (title) {
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size placeholder*/
avio_put_tag(pb, "uuid");
avio_put_tag(pb, "USMT");
@@ -1682,7 +1682,7 @@ static int mov_write_uuidusmt_tag(AVIOContext *pb, AVFormatContext *s)
avio_put_be32(pb, 0xbb88695c);
avio_put_be32(pb, 0xfac9c740);
- pos2 = url_ftell(pb);
+ pos2 = avio_ftell(pb);
avio_put_be32(pb, 0); /* size placeholder*/
avio_put_tag(pb, "MTDT");
avio_put_be16(pb, 4);
@@ -1710,7 +1710,7 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
int i;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size placeholder*/
avio_put_tag(pb, "moov");
@@ -1755,7 +1755,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
avio_put_be32(pb, 8); // placeholder for extended size field (64 bit)
avio_put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free");
- mov->mdat_pos = url_ftell(pb);
+ mov->mdat_pos = avio_ftell(pb);
avio_put_be32(pb, 0); /* size placeholder*/
avio_put_tag(pb, "mdat");
return 0;
@@ -1765,7 +1765,7 @@ static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov)
static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
{
MOVMuxContext *mov = s->priv_data;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
int has_h264 = 0, has_video = 0;
int minor = 0x200;
int i;
@@ -1965,7 +1965,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
return -1;
}
- trk->cluster[trk->entry].pos = url_ftell(pb) - size;
+ trk->cluster[trk->entry].pos = avio_ftell(pb) - size;
trk->cluster[trk->entry].samplesInChunk = samplesInChunk;
trk->cluster[trk->entry].size = size;
trk->cluster[trk->entry].entries = samplesInChunk;
@@ -2196,20 +2196,20 @@ static int mov_write_trailer(AVFormatContext *s)
int res = 0;
int i;
- int64_t moov_pos = url_ftell(pb);
+ int64_t moov_pos = avio_ftell(pb);
/* Write size of mdat tag */
if (mov->mdat_size+8 <= UINT32_MAX) {
- url_fseek(pb, mov->mdat_pos, SEEK_SET);
+ avio_fseek(pb, mov->mdat_pos, SEEK_SET);
avio_put_be32(pb, mov->mdat_size+8);
} else {
/* overwrite 'wide' placeholder atom */
- url_fseek(pb, mov->mdat_pos - 8, SEEK_SET);
+ avio_fseek(pb, mov->mdat_pos - 8, SEEK_SET);
avio_put_be32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */
avio_put_tag(pb, "mdat");
avio_put_be64(pb, mov->mdat_size+16);
}
- url_fseek(pb, moov_pos, SEEK_SET);
+ avio_fseek(pb, moov_pos, SEEK_SET);
mov_write_moov_tag(pb, mov, s);
diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c
index 8775bd0..e8582e8 100644
--- a/libavformat/movenchint.c
+++ b/libavformat/movenchint.c
@@ -316,7 +316,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
int64_t count_pos, entries_pos;
int count = 0, entries;
- count_pos = url_ftell(out);
+ count_pos = avio_ftell(out);
/* RTPsample header */
avio_put_be16(out, 0); /* packet count */
avio_put_be16(out, 0); /* reserved */
@@ -358,7 +358,7 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
avio_put_buffer(out, data, 2); /* RTP header */
avio_put_be16(out, seq); /* RTPsequenceseed */
avio_put_be16(out, 0); /* reserved + flags */
- entries_pos = url_ftell(out);
+ entries_pos = avio_ftell(out);
avio_put_be16(out, 0); /* entry count */
data += 12;
@@ -371,16 +371,16 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data,
data += packet_len;
size -= packet_len;
- curpos = url_ftell(out);
- url_fseek(out, entries_pos, SEEK_SET);
+ curpos = avio_ftell(out);
+ avio_fseek(out, entries_pos, SEEK_SET);
avio_put_be16(out, entries);
- url_fseek(out, curpos, SEEK_SET);
+ avio_fseek(out, curpos, SEEK_SET);
}
- curpos = url_ftell(out);
- url_fseek(out, count_pos, SEEK_SET);
+ curpos = avio_ftell(out);
+ avio_fseek(out, count_pos, SEEK_SET);
avio_put_be16(out, count);
- url_fseek(out, curpos, SEEK_SET);
+ avio_fseek(out, curpos, SEEK_SET);
return count;
}
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index e1f65c3..30fc923 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -90,7 +90,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
return -1;
/* Check for Xing / Info tag */
- url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
+ avio_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
v = avio_get_be32(s->pb);
if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
v = avio_get_be32(s->pb);
@@ -101,13 +101,13 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
}
/* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
- url_fseek(s->pb, base + 4 + 32, SEEK_SET);
+ avio_fseek(s->pb, base + 4 + 32, SEEK_SET);
v = avio_get_be32(s->pb);
if(v == MKBETAG('V', 'B', 'R', 'I')) {
/* Check tag version */
if(avio_get_be16(s->pb) == 1) {
/* skip delay and quality */
- url_fseek(s->pb, 4, SEEK_CUR);
+ avio_fseek(s->pb, 4, SEEK_CUR);
frames = avio_get_be32(s->pb);
size = avio_get_be32(s->pb);
}
@@ -117,7 +117,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
return -1;
/* Skip the vbr tag frame */
- url_fseek(s->pb, base + vbrtag_size, SEEK_SET);
+ avio_fseek(s->pb, base + vbrtag_size, SEEK_SET);
spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */
if(frames)
@@ -147,13 +147,13 @@ static int mp3_read_header(AVFormatContext *s,
// lcm of all mp3 sample rates
av_set_pts_info(st, 64, 1, 14112000);
- off = url_ftell(s->pb);
+ off = avio_ftell(s->pb);
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
ff_id3v1_read(s);
if (mp3_parse_vbr_tags(s, st, off) < 0)
- url_fseek(s->pb, off, SEEK_SET);
+ avio_fseek(s->pb, off, SEEK_SET);
/* the parameters will be extracted from the compressed bitstream */
return 0;
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 91c6ae7..a3fe0e5 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -211,7 +211,7 @@ static int mp3_write_header(struct AVFormatContext *s)
avio_put_byte(s->pb, 0); /* flags */
/* reserve space for size */
- size_pos = url_ftell(s->pb);
+ size_pos = avio_ftell(s->pb);
avio_put_be32(s->pb, 0);
ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL);
@@ -237,10 +237,10 @@ static int mp3_write_header(struct AVFormatContext *s)
totlen += ret;
}
- cur_pos = url_ftell(s->pb);
- url_fseek(s->pb, size_pos, SEEK_SET);
+ cur_pos = avio_ftell(s->pb);
+ avio_fseek(s->pb, size_pos, SEEK_SET);
id3v2_put_size(s, totlen);
- url_fseek(s->pb, cur_pos, SEEK_SET);
+ avio_fseek(s->pb, cur_pos, SEEK_SET);
return 0;
}
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index 406933b..26da0e1 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -94,11 +94,11 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* try to read APE tags */
if (!url_is_streamed(s->pb)) {
- int64_t pos = url_ftell(s->pb);
+ int64_t pos = avio_ftell(s->pb);
ff_ape_parse_tag(s);
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
ff_id3v1_read(s);
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
}
return 0;
@@ -114,13 +114,13 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
return -1;
if(c->curframe != c->lastframe + 1){
- url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
+ avio_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET);
c->curbits = c->frames[c->curframe].skip;
}
c->lastframe = c->curframe;
c->curframe++;
curbits = c->curbits;
- pos = url_ftell(s->pb);
+ pos = avio_ftell(s->pb);
tmp = avio_get_le32(s->pb);
if(curbits <= 12){
size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
@@ -129,7 +129,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
}
curbits += 20;
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
size = ((size2 + curbits + 31) & ~31) >> 3;
if(cur == c->frames_noted){
@@ -153,7 +153,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->pts = cur;
ret = avio_get_buffer(s->pb, pkt->data + 4, size);
if(c->curbits)
- url_fseek(s->pb, -4, SEEK_CUR);
+ avio_fseek(s->pb, -4, SEEK_CUR);
if(ret < size){
av_free_packet(pkt);
return AVERROR(EIO);
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 3ead5e9..cd8aa70 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -120,10 +120,10 @@ static inline int64_t gb_get_v(GetBitContext *gb)
static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size)
{
int64_t pos;
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
*tag = avio_get_le16(pb);
*size = ff_get_v(pb);
- *size -= url_ftell(pb) - pos;
+ *size -= avio_ftell(pb) - pos;
}
static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
@@ -135,7 +135,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
int i, t, seekd;
GetBitContext gb;
- url_fseek(s->pb, off, SEEK_SET);
+ avio_fseek(s->pb, off, SEEK_SET);
mpc8_get_chunk_header(s->pb, &tag, &size);
if(tag != TAG_SEEKTABLE){
av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
@@ -176,13 +176,13 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in
switch(tag){
case TAG_SEEKTBLOFF:
- pos = url_ftell(pb) + size;
+ pos = avio_ftell(pb) + size;
off = ff_get_v(pb);
mpc8_parse_seektable(s, chunk_pos + off);
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
break;
default:
- url_fskip(pb, size);
+ avio_fskip(pb, size);
}
}
@@ -194,14 +194,14 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
int tag = 0;
int64_t size, pos;
- c->header_pos = url_ftell(pb);
+ c->header_pos = avio_ftell(pb);
if(avio_get_le32(pb) != TAG_MPCK){
av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
return -1;
}
- while(!url_feof(pb)){
- pos = url_ftell(pb);
+ while(!avio_feof(pb)){
+ pos = avio_ftell(pb);
mpc8_get_chunk_header(pb, &tag, &size);
if(tag == TAG_STREAMHDR)
break;
@@ -211,8 +211,8 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "Stream header not found\n");
return -1;
}
- pos = url_ftell(pb);
- url_fskip(pb, 4); //CRC
+ pos = avio_ftell(pb);
+ avio_fskip(pb, 4); //CRC
c->ver = avio_get_byte(pb);
if(c->ver != 8){
av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
@@ -236,7 +236,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
av_set_pts_info(st, 32, 1152 << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
- size -= url_ftell(pb) - pos;
+ size -= avio_ftell(pb) - pos;
return 0;
}
@@ -247,8 +247,8 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
int tag;
int64_t pos, size;
- while(!url_feof(s->pb)){
- pos = url_ftell(s->pb);
+ while(!avio_feof(s->pb)){
+ pos = avio_ftell(s->pb);
mpc8_get_chunk_header(s->pb, &tag, &size);
if (size < 0)
return -1;
@@ -273,7 +273,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam
int index = av_index_search_timestamp(st, timestamp, flags);
if(index < 0) return -1;
- url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+ avio_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
c->frame = st->index_entries[index].timestamp;
return 0;
}
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 34f80be..d16b94d 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -143,7 +143,7 @@ static int find_next_start_code(AVIOContext *pb, int *size_ptr,
state = *header_state;
n = *size_ptr;
while (n > 0) {
- if (url_feof(pb))
+ if (avio_feof(pb))
break;
v = avio_get_byte(pb);
n--;
@@ -169,13 +169,13 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr)
int max_size, start_code;
max_size = *size_ptr;
- pos_start = url_ftell(pb);
+ pos_start = avio_ftell(pb);
/* in order to go faster, we fill the buffer */
pos = pos_start - 16386;
if (pos < 0)
pos = 0;
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
avio_get_byte(pb);
pos = pos_start;
@@ -185,7 +185,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr)
start_code = -1;
goto the_end;
}
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
start_code = avio_get_be32(pb);
if ((start_code & 0xffffff00) == 0x100)
break;
@@ -212,7 +212,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb)
ps_info_length = avio_get_be16(pb);
/* skip program_stream_info */
- url_fskip(pb, ps_info_length);
+ avio_fskip(pb, ps_info_length);
es_map_length = avio_get_be16(pb);
/* at least one es available? */
@@ -223,7 +223,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *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);
+ avio_fskip(pb, es_info_length);
es_map_length -= 4 + es_info_length;
}
avio_get_be32(pb); /* crc32 */
@@ -241,19 +241,19 @@ static int mpegps_read_pes_header(AVFormatContext *s,
int len, size, startcode, c, flags, header_len;
int pes_ext, ext2_len, id_ext, skip;
int64_t pts, dts;
- int64_t last_sync= url_ftell(s->pb);
+ int64_t last_sync= avio_ftell(s->pb);
error_redo:
- url_fseek(s->pb, last_sync, SEEK_SET);
+ avio_fseek(s->pb, last_sync, SEEK_SET);
redo:
/* next start code (should be immediately after) */
m->header_state = 0xff;
size = MAX_SYNC_SIZE;
startcode = find_next_start_code(s->pb, &size, &m->header_state);
- last_sync = url_ftell(s->pb);
- //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(s->pb));
+ last_sync = avio_ftell(s->pb);
+ //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, avio_ftell(s->pb));
if (startcode < 0){
- if(url_feof(s->pb))
+ if(avio_feof(s->pb))
return AVERROR_EOF;
//FIXME we should remember header_state
return AVERROR(EAGAIN);
@@ -264,7 +264,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
if (startcode == SYSTEM_HEADER_START_CODE)
goto redo;
if (startcode == PADDING_STREAM) {
- url_fskip(s->pb, avio_get_be16(s->pb));
+ avio_fskip(s->pb, avio_get_be16(s->pb));
goto redo;
}
if (startcode == PRIVATE_STREAM_2) {
@@ -281,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
}
m->sofdec -= !m->sofdec;
}
- url_fskip(s->pb, len);
+ avio_fskip(s->pb, len);
goto redo;
}
if (startcode == PROGRAM_STREAM_MAP) {
@@ -295,7 +295,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
(startcode == 0x1bd) || (startcode == 0x1fd)))
goto redo;
if (ppos) {
- *ppos = url_ftell(s->pb) - 4;
+ *ppos = avio_ftell(s->pb) - 4;
}
len = avio_get_be16(s->pb);
pts =
@@ -359,7 +359,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext);
pes_ext=skip=0;
}
- url_fskip(s->pb, skip);
+ avio_fskip(s->pb, skip);
header_len -= skip;
if (pes_ext & 0x01) { /* PES extension 2 */
@@ -375,7 +375,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
}
if(header_len < 0)
goto error_redo;
- url_fskip(s->pb, header_len);
+ avio_fskip(s->pb, header_len);
}
else if( c!= 0xf )
goto redo;
@@ -433,7 +433,7 @@ static int mpegps_read_packet(AVFormatContext *s,
if(startcode == 0x1bd) {
dvdaudio_substream_type = avio_get_byte(s->pb);
- url_fskip(s->pb, 3);
+ avio_fskip(s->pb, 3);
len -= 4;
}
@@ -475,7 +475,7 @@ static int mpegps_read_packet(AVFormatContext *s,
static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
unsigned char buf[8];
avio_get_buffer(s->pb, buf, 8);
- url_fseek(s->pb, -8, SEEK_CUR);
+ avio_fseek(s->pb, -8, SEEK_CUR);
if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
codec_id = CODEC_ID_CAVS;
else
@@ -525,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s,
} else {
skip:
/* skip packet */
- url_fskip(s->pb, len);
+ avio_fskip(s->pb, len);
goto redo;
}
/* no stream found: add a new stream */
@@ -587,7 +587,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
#ifdef DEBUG_SEEK
printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next);
#endif
- if (url_fseek(s->pb, pos, SEEK_SET) < 0)
+ if (avio_fseek(s->pb, pos, SEEK_SET) < 0)
return AV_NOPTS_VALUE;
for(;;) {
@@ -602,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
dts != AV_NOPTS_VALUE) {
break;
}
- url_fskip(s->pb, len);
+ avio_fskip(s->pb, len);
}
#ifdef DEBUG_SEEK
printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0);
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 42d54bd..ba71fe5 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1264,7 +1264,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
if (p >= p_end)
return 0;
- pos = url_ftell(ts->stream->pb);
+ pos = avio_ftell(ts->stream->pb);
ts->pos47= pos % ts->raw_packet_size;
if (tss->type == MPEGTS_SECTION) {
@@ -1315,7 +1315,7 @@ static int mpegts_resync(AVFormatContext *s)
if (c < 0)
return -1;
if (c == 0x47) {
- url_fseek(pb, -1, SEEK_CUR);
+ avio_fseek(pb, -1, SEEK_CUR);
return 0;
}
}
@@ -1337,7 +1337,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
/* check paquet sync byte */
if (buf[0] != 0x47) {
/* find a new packet start */
- url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR);
+ avio_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR);
if (mpegts_resync(s) < 0)
return AVERROR(EAGAIN);
else
@@ -1345,7 +1345,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
} else {
skip = raw_packet_size - TS_PACKET_SIZE;
if (skip > 0)
- url_fskip(pb, skip);
+ avio_fskip(pb, skip);
break;
}
}
@@ -1453,7 +1453,7 @@ static int mpegts_read_header(AVFormatContext *s,
}
/* read the first 1024 bytes to get packet size */
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
len = avio_get_buffer(pb, buf, sizeof(buf));
if (len != sizeof(buf))
goto fail;
@@ -1467,7 +1467,7 @@ static int mpegts_read_header(AVFormatContext *s,
/* normal demux */
/* first do a scaning to get all the services */
- if (url_fseek(pb, pos, SEEK_SET) < 0)
+ if (avio_fseek(pb, pos, SEEK_SET) < 0)
av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n");
mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1);
@@ -1532,7 +1532,7 @@ static int mpegts_read_header(AVFormatContext *s,
#endif
}
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
return 0;
fail:
return -1;
@@ -1551,7 +1551,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
if (av_new_packet(pkt, TS_PACKET_SIZE) < 0)
return AVERROR(ENOMEM);
- pkt->pos= url_ftell(s->pb);
+ pkt->pos= avio_ftell(s->pb);
ret = read_packet(s, pkt->data, ts->raw_packet_size);
if (ret < 0) {
av_free_packet(pkt);
@@ -1561,9 +1561,9 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
/* compute exact PCR for each packet */
if (parse_pcr(&pcr_h, &pcr_l, pkt->data) == 0) {
/* we read the next PCR (XXX: optimize it by using a bigger buffer */
- pos = url_ftell(s->pb);
+ pos = avio_ftell(s->pb);
for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
- url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
+ avio_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
avio_get_buffer(s->pb, pcr_buf, 12);
if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
/* XXX: not precise enough */
@@ -1572,7 +1572,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s,
break;
}
}
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
/* no next PCR found: we use previous increment */
ts->cur_pcr = pcr_h * 300 + pcr_l;
}
@@ -1590,7 +1590,7 @@ static int mpegts_read_packet(AVFormatContext *s,
MpegTSContext *ts = s->priv_data;
int ret, i;
- if (url_ftell(s->pb) != ts->last_pos) {
+ if (avio_ftell(s->pb) != ts->last_pos) {
/* seek detected, flush pes buffer */
for (i = 0; i < NB_PID_MAX; i++) {
if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
@@ -1619,7 +1619,7 @@ static int mpegts_read_packet(AVFormatContext *s,
}
}
- ts->last_pos = url_ftell(s->pb);
+ ts->last_pos = avio_ftell(s->pb);
return ret;
}
@@ -1648,7 +1648,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47;
if (find_next) {
for(;;) {
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
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) &&
@@ -1662,7 +1662,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index,
pos -= ts->raw_packet_size;
if (pos < 0)
return AV_NOPTS_VALUE;
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
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) &&
@@ -1770,17 +1770,17 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
return -1;
- pos= url_ftell(s->pb);
+ pos= avio_ftell(s->pb);
for(;;) {
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
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;
pos += ts->raw_packet_size;
}
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
return 0;
}
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 7d2973e..26bbffb 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -595,7 +595,7 @@ static void retransmit_si_info(AVFormatContext *s)
static int64_t get_pcr(const MpegTSWrite *ts, AVIOContext *pb)
{
- return av_rescale(url_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
+ return av_rescale(avio_ftell(pb) + 11, 8 * PCR_TIME_BASE, ts->mux_rate) +
ts->first_pcr;
}
diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index 13aabcd..b5a7c6e 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -88,9 +88,9 @@ 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(avio_get_byte(pb) != HEADER_SIZE && !url_feof(pb));
+ while(avio_get_byte(pb) != HEADER_SIZE && !avio_feof(pb));
- if(url_feof(pb)) {
+ if(avio_feof(pb)) {
av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
return -1;
}
@@ -104,19 +104,19 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
uint16_t keyframe;
uint32_t size, timestamp;
- url_fskip(pb, 1); /* one byte has been read ahead */
- url_fskip(pb, 2);
- url_fskip(pb, 2);
+ avio_fskip(pb, 1); /* one byte has been read ahead */
+ avio_fskip(pb, 2);
+ avio_fskip(pb, 2);
keyframe = avio_get_le16(pb);
size = avio_get_le32(pb);
- url_fskip(pb, 4);
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
+ avio_fskip(pb, 4);
timestamp = avio_get_le32(pb);
if(!size || av_get_packet(pb, pkt, size) != size)
return -1;
- url_fskip(pb, 1); /* Read ahead one byte of struct size like read_header */
+ avio_fskip(pb, 1); /* Read ahead one byte of struct size like read_header */
pkt->pts = timestamp;
pkt->dts = timestamp;
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index f46d914..4ff8249 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -83,10 +83,10 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st;
unsigned int audio_subsegments;
- url_fskip(pb, 3);
+ avio_fskip(pb, 3);
mtv->file_size = avio_get_le32(pb);
mtv->segments = avio_get_le32(pb);
- url_fskip(pb, 32);
+ avio_fskip(pb, 32);
mtv->audio_identifier = avio_get_le24(pb);
mtv->audio_br = avio_get_le16(pb);
mtv->img_colorfmt = avio_get_le24(pb);
@@ -105,7 +105,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3)
/ mtv->img_width;
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
audio_subsegments = avio_get_le16(pb);
mtv->full_segment_size =
audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
@@ -146,7 +146,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
// Jump over header
- if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
+ if(avio_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE)
return AVERROR(EIO);
return 0;
@@ -162,9 +162,9 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
int i;
#endif
- if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
+ if((avio_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
{
- url_fskip(pb, MTV_AUDIO_PADDING_SIZE);
+ avio_fskip(pb, MTV_AUDIO_PADDING_SIZE);
ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE);
if(ret < 0)
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 1e73e6d..983a2c8 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -179,7 +179,7 @@ static int64_t klv_decode_ber_length(AVIOContext *pb)
static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size)
{
int i, b;
- for (i = 0; i < size && !url_feof(pb); i++) {
+ for (i = 0; i < size && !avio_feof(pb); i++) {
b = avio_get_byte(pb);
if (b == key[0])
i = 0;
@@ -193,7 +193,7 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb)
{
if (!mxf_read_sync(pb, mxf_klv_key, 4))
return -1;
- klv->offset = url_ftell(pb) - 4;
+ klv->offset = avio_ftell(pb) - 4;
memcpy(klv->key, mxf_klv_key, 4);
avio_get_buffer(pb, klv->key + 4, 12);
klv->length = klv_decode_ber_length(pb);
@@ -247,7 +247,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b};
MXFContext *mxf = s->priv_data;
AVIOContext *pb = s->pb;
- int64_t end = url_ftell(pb) + klv->length;
+ int64_t end = avio_ftell(pb) + klv->length;
uint64_t size;
uint64_t orig_size;
uint64_t plaintext_size;
@@ -262,7 +262,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
av_aes_init(mxf->aesc, s->key, 128, 1);
}
// crypto context
- url_fskip(pb, klv_decode_ber_length(pb));
+ avio_fskip(pb, klv_decode_ber_length(pb));
// plaintext offset
klv_decode_ber_length(pb);
plaintext_size = avio_get_be64(pb);
@@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
&pkt->data[plaintext_size], size >> 4, ivec, 1);
pkt->size = orig_size;
pkt->stream_index = index;
- url_fskip(pb, end - url_ftell(pb));
+ avio_fskip(pb, end - avio_ftell(pb));
return 0;
}
@@ -305,7 +305,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
{
KLVPacket klv;
- while (!url_feof(s->pb)) {
+ while (!avio_feof(s->pb)) {
if (klv_read_packet(&klv, s->pb) < 0)
return -1;
PRINT_KEY(s, "read packet", klv.key);
@@ -339,7 +339,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
} else
skip:
- url_fskip(s->pb, klv.length);
+ avio_fskip(s->pb, klv.length);
}
return AVERROR_EOF;
}
@@ -397,7 +397,7 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz
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 */
+ avio_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
avio_get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
break;
}
@@ -416,7 +416,7 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U
break;
case 0x1101:
/* UMID, only get last 16 bytes */
- url_fskip(pb, 16);
+ avio_fskip(pb, 16);
avio_get_buffer(pb, source_clip->source_package_uid, 16);
break;
case 0x1102:
@@ -437,7 +437,7 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si
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 */
+ avio_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
avio_get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
break;
}
@@ -482,7 +482,7 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID
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 */
+ avio_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
avio_get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
break;
}
@@ -500,12 +500,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size
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 */
+ avio_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
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);
+ avio_fskip(pb, 16);
avio_get_buffer(pb, package->package_uid, 16);
break;
case 0x4701:
@@ -558,7 +558,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int
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 */
+ avio_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
avio_get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
break;
case 0x3004:
@@ -866,14 +866,14 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
{
AVIOContext *pb = mxf->fc->pb;
MXFMetadataSet *ctx = ctx_size ? av_mallocz(ctx_size) : mxf;
- uint64_t klv_end = url_ftell(pb) + klv->length;
+ uint64_t klv_end = avio_ftell(pb) + klv->length;
if (!ctx)
return -1;
- while (url_ftell(pb) + 4 < klv_end) {
+ while (avio_ftell(pb) + 4 < klv_end) {
int tag = avio_get_be16(pb);
int size = avio_get_be16(pb); /* KLV specified by 0x53 */
- uint64_t next = url_ftell(pb) + size;
+ uint64_t next = avio_ftell(pb) + size;
UID uid = {0};
av_dlog(mxf->fc, "local tag %#04x size %d\n", tag, size);
@@ -897,7 +897,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
else if (read_child(ctx, pb, tag, size, uid) < 0)
return -1;
- url_fseek(pb, next, SEEK_SET);
+ avio_fseek(pb, next, SEEK_SET);
}
if (ctx_size) ctx->type = type;
return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0;
@@ -912,9 +912,9 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n");
return -1;
}
- url_fseek(s->pb, -14, SEEK_CUR);
+ avio_fseek(s->pb, -14, SEEK_CUR);
mxf->fc = s;
- while (!url_feof(s->pb)) {
+ while (!avio_feof(s->pb)) {
const MXFMetadataReadTableEntry *metadata;
if (klv_read_packet(&klv, s->pb) < 0)
@@ -924,7 +924,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) ||
IS_KLV_KEY(klv.key, mxf_essence_element_key)) {
/* FIXME avoid seek */
- url_fseek(s->pb, klv.offset, SEEK_SET);
+ avio_fseek(s->pb, klv.offset, SEEK_SET);
break;
}
@@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
if (!metadata->read)
- url_fskip(s->pb, klv.length);
+ avio_fskip(s->pb, klv.length);
}
return mxf_parse_structural_metadata(mxf);
}
@@ -1009,7 +1009,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
if (sample_time < 0)
sample_time = 0;
seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den);
- url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
+ avio_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET);
av_update_cur_dts(s, st, sample_time);
return 0;
}
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 2af3271..1c07e18 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1171,14 +1171,14 @@ static void mxf_write_index_table_segment(AVFormatContext *s)
static void mxf_write_klv_fill(AVFormatContext *s)
{
- unsigned pad = klv_fill_size(url_ftell(s->pb));
+ unsigned pad = klv_fill_size(avio_ftell(s->pb));
if (pad) {
avio_put_buffer(s->pb, klv_fill_key, 16);
pad -= 16 + 4;
klv_encode_ber4_length(s->pb, pad);
for (; pad; pad--)
avio_put_byte(s->pb, 0);
- assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
+ assert(!(avio_ftell(s->pb) & (KAG_SIZE-1)));
}
}
@@ -1190,7 +1190,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
AVIOContext *pb = s->pb;
int64_t header_byte_count_offset;
unsigned index_byte_count = 0;
- uint64_t partition_offset = url_ftell(pb);
+ uint64_t partition_offset = avio_ftell(pb);
if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
@@ -1233,7 +1233,7 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
avio_put_be64(pb, mxf->footer_partition_offset); // footerPartition
// set offset
- header_byte_count_offset = url_ftell(pb);
+ header_byte_count_offset = avio_ftell(pb);
avio_put_be64(pb, 0); // headerByteCount, update later
// indexTable
@@ -1260,16 +1260,16 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid,
unsigned header_byte_count;
mxf_write_klv_fill(s);
- start = url_ftell(s->pb);
+ start = avio_ftell(s->pb);
mxf_write_primer_pack(s);
mxf_write_header_metadata_sets(s);
- pos = url_ftell(s->pb);
+ pos = avio_ftell(s->pb);
header_byte_count = pos - start + klv_fill_size(pos);
// update header_byte_count
- url_fseek(pb, header_byte_count_offset, SEEK_SET);
+ avio_fseek(pb, header_byte_count_offset, SEEK_SET);
avio_put_be64(pb, header_byte_count);
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
put_flush_packet(pb);
@@ -1617,7 +1617,7 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke
klv_encode_ber4_length(s->pb, pad);
for (; pad; pad--)
avio_put_byte(s->pb, 0);
- assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
+ assert(!(avio_ftell(s->pb) & (KAG_SIZE-1)));
} else {
av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n");
for (; pad > 0; pad--)
@@ -1740,7 +1740,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s)
{
MXFContext *mxf = s->priv_data;
AVIOContext *pb = s->pb;
- uint64_t pos = url_ftell(pb);
+ uint64_t pos = avio_ftell(pb);
int i;
avio_put_buffer(pb, random_index_pack_key, 16);
@@ -1760,7 +1760,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s)
avio_put_be32(pb, 0); // BodySID of footer partition
avio_put_be64(pb, mxf->footer_partition_offset);
- avio_put_be32(pb, url_ftell(pb) - pos + 4);
+ avio_put_be32(pb, avio_ftell(pb) - pos + 4);
}
static int mxf_write_footer(AVFormatContext *s)
@@ -1771,7 +1771,7 @@ static int mxf_write_footer(AVFormatContext *s)
mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;
mxf_write_klv_fill(s);
- mxf->footer_partition_offset = url_ftell(pb);
+ mxf->footer_partition_offset = avio_ftell(pb);
if (mxf->edit_unit_byte_count) { // no need to repeat index
mxf_write_partition(s, 0, 0, footer_partition_key, 0);
} else {
@@ -1785,7 +1785,7 @@ static int mxf_write_footer(AVFormatContext *s)
mxf_write_random_index_pack(s);
if (!url_is_streamed(s->pb)) {
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
if (mxf->edit_unit_byte_count) {
mxf_write_partition(s, 1, 2, header_closed_partition_key, 1);
mxf_write_klv_fill(s);
diff --git a/libavformat/mxg.c b/libavformat/mxg.c
index eb3a03d..acbd624 100644
--- a/libavformat/mxg.c
+++ b/libavformat/mxg.c
@@ -132,7 +132,7 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt)
uint8_t *startmarker_ptr, *end, *search_end, marker;
MXGContext *mxg = s->priv_data;
- while (!url_feof(s->pb) && !url_ferror(s->pb)){
+ while (!avio_feof(s->pb) && !avio_ferror(s->pb)){
if (mxg->cache_size <= OVERREAD_SIZE) {
/* update internal buffer */
ret = mxg_update_cache(s, DEFAULT_PACKET_SIZE + OVERREAD_SIZE);
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
index 0936a82..66b5c15 100644
--- a/libavformat/ncdec.c
+++ b/libavformat/ncdec.c
@@ -66,14 +66,14 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
uint32_t state=-1;
while (state != NC_VIDEO_FLAG) {
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
state = (state<<8) + avio_get_byte(s->pb);
}
avio_get_byte(s->pb);
size = avio_get_le16(s->pb);
- url_fskip(s->pb, 9);
+ avio_fskip(s->pb, 9);
if (size == 0) {
av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n");
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index d71c181..d50c116 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -225,12 +225,12 @@ static int nsv_resync(AVFormatContext *s)
uint32_t v = 0;
int i;
- av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, url_ftell(pb), nsv->state);
+ av_dlog(s, "%s(), offset = %"PRId64", state = %d\n", __FUNCTION__, avio_ftell(pb), nsv->state);
//nsv->state = NSV_UNSYNC;
for (i = 0; i < NSV_MAX_RESYNC; i++) {
- if (url_feof(pb)) {
+ if (avio_feof(pb)) {
av_dlog(s, "NSV EOF\n");
nsv->state = NSV_UNSYNC;
return -1;
@@ -296,10 +296,10 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
table_entries_used = avio_get_le32(pb);
av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
strings_size, table_entries, table_entries_used);
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
- av_dlog(s, "NSV got header; filepos %"PRId64"\n", url_ftell(pb));
+ av_dlog(s, "NSV got header; filepos %"PRId64"\n", avio_ftell(pb));
if (strings_size > 0) {
char *strings; /* last byte will be '\0' to play safe with str*() */
@@ -331,10 +331,10 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
}
av_free(strings);
}
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
- av_dlog(s, "NSV got infos; filepos %"PRId64"\n", url_ftell(pb));
+ av_dlog(s, "NSV got infos; filepos %"PRId64"\n", avio_ftell(pb));
if (table_entries_used > 0) {
int i;
@@ -355,7 +355,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
- av_dlog(s, "NSV got index; filepos %"PRId64"\n", url_ftell(pb));
+ av_dlog(s, "NSV got index; filepos %"PRId64"\n", avio_ftell(pb));
#ifdef DEBUG_DUMP_INDEX
#define V(v) ((v<0x20 || v > 127)?'.':v)
@@ -364,7 +364,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
av_dlog(s, "NSV [dataoffset][fileoffset]\n", table_entries);
for (i = 0; i < table_entries; i++) {
unsigned char b[8];
- url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
+ avio_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
avio_get_buffer(pb, b, 8);
av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
"%c%c%c%c%c%c%c%c\n",
@@ -372,13 +372,13 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap)
b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) );
}
- //url_fseek(pb, size, SEEK_SET); /* go back to end of header */
+ //avio_fseek(pb, size, SEEK_SET); /* go back to end of header */
#undef V
#endif
- url_fseek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */
+ avio_fseek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
nsv->state = NSV_HAS_READ_NSVF;
return 0;
@@ -554,7 +554,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header)
return 0; //-1; /* hey! eat what you've in your plate first! */
null_chunk_retry:
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++)
@@ -584,11 +584,11 @@ null_chunk_retry:
((auxtag >> 16) & 0x0ff),
((auxtag >> 24) & 0x0ff),
auxsize);
- url_fskip(pb, auxsize);
+ avio_fskip(pb, auxsize);
vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */
}
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
if (!vsize && !asize) {
nsv->state = NSV_UNSYNC;
@@ -700,7 +700,7 @@ static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
if(index < 0)
return -1;
- url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+ avio_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
nst->frame_offset = st->index_entries[index].timestamp;
nsv->state = NSV_UNSYNC;
return 0;
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ac43ad3..65a688b 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -98,7 +98,7 @@ static inline uint64_t get_vb_trace(AVIOContext *bc, char *file, char *func, int
static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode)
{
int64_t size;
-// start= url_ftell(bc) - 8;
+// start= avio_ftell(bc) - 8;
startcode= av_be2ne64(startcode);
startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8);
@@ -119,9 +119,9 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){
uint64_t state=0;
if(pos >= 0)
- 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
+ avio_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)){
+ while(!avio_feof(bc)){
state= (state<<8) | avio_get_byte(bc);
if((state>>56) != 'N')
continue;
@@ -148,7 +148,7 @@ static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos){
for(;;){
uint64_t startcode= find_any_startcode(bc, pos);
if(startcode == code)
- return url_ftell(bc) - 8;
+ return avio_ftell(bc) - 8;
else if(startcode == 0)
return -1;
pos=-1;
@@ -176,9 +176,9 @@ static int nut_probe(AVProbeData *p){
dst= tmp;
static int skip_reserved(AVIOContext *bc, int64_t pos){
- pos -= url_ftell(bc);
+ pos -= avio_ftell(bc);
if(pos<0){
- url_fseek(bc, pos, SEEK_CUR);
+ avio_fseek(bc, pos, SEEK_CUR);
return -1;
}else{
while(pos--)
@@ -196,7 +196,7 @@ static int decode_main_header(NUTContext *nut){
int64_t tmp_match;
end= get_packetheader(nut, bc, 1, MAIN_STARTCODE);
- end += url_ftell(bc);
+ end += avio_ftell(bc);
GET_V(tmp , tmp >=2 && tmp <= 3)
GET_V(stream_count , tmp > 0 && tmp <= NUT_MAX_STREAMS)
@@ -267,7 +267,7 @@ static int decode_main_header(NUTContext *nut){
}
assert(nut->frame_code['N'].flags == FLAG_INVALID);
- if(end > url_ftell(bc) + 4){
+ if(end > avio_ftell(bc) + 4){
int rem= 1024;
GET_V(nut->header_count, tmp<128U)
nut->header_count++;
@@ -306,7 +306,7 @@ static int decode_stream_header(NUTContext *nut){
AVStream *st;
end= get_packetheader(nut, bc, 1, STREAM_STARTCODE);
- end += url_ftell(bc);
+ end += avio_ftell(bc);
GET_V(stream_id, tmp < s->nb_streams && !nut->stream[tmp].time_base);
stc= &nut->stream[stream_id];
@@ -409,7 +409,7 @@ static int decode_info_header(NUTContext *nut){
AVMetadata **metadata = NULL;
end= get_packetheader(nut, bc, 1, INFO_STARTCODE);
- end += url_ftell(bc);
+ end += avio_ftell(bc);
GET_V(stream_id_plus1, tmp <= s->nb_streams)
chapter_id = get_s(bc);
@@ -480,10 +480,10 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){
AVIOContext *bc = s->pb;
int64_t end, tmp;
- nut->last_syncpoint_pos= url_ftell(bc)-8;
+ nut->last_syncpoint_pos= avio_ftell(bc)-8;
end= get_packetheader(nut, bc, 1, SYNCPOINT_STARTCODE);
- end += url_ftell(bc);
+ end += avio_ftell(bc);
tmp= ff_get_v(bc);
*back_ptr= nut->last_syncpoint_pos - 16*ff_get_v(bc);
@@ -508,20 +508,20 @@ static int find_and_decode_index(NUTContext *nut){
AVIOContext *bc = s->pb;
uint64_t tmp, end;
int i, j, syncpoint_count;
- int64_t filesize= url_fsize(bc);
+ int64_t filesize= avio_fsize(bc);
int64_t *syncpoints;
int8_t *has_keyframe;
int ret= -1;
- url_fseek(bc, filesize-12, SEEK_SET);
- url_fseek(bc, filesize-avio_get_be64(bc), SEEK_SET);
+ avio_fseek(bc, filesize-12, SEEK_SET);
+ avio_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;
}
end= get_packetheader(nut, bc, 1, INDEX_STARTCODE);
- end += url_ftell(bc);
+ end += avio_ftell(bc);
ff_get_v(bc); //max_pts
GET_V(syncpoint_count, tmp < INT_MAX/8 && tmp > 0)
@@ -635,7 +635,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
pos=0;
for(;;){
uint64_t startcode= find_any_startcode(bc, pos);
- pos= url_ftell(bc);
+ pos= avio_ftell(bc);
if(startcode==0){
av_log(s, AV_LOG_ERROR, "EOF before video frames\n");
@@ -653,9 +653,9 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)
s->data_offset= pos-8;
if(!url_is_streamed(bc)){
- int64_t orig_pos= url_ftell(bc);
+ int64_t orig_pos= avio_ftell(bc);
find_and_decode_index(nut);
- url_fseek(bc, orig_pos, SEEK_SET);
+ avio_fseek(bc, orig_pos, SEEK_SET);
}
assert(nut->next_startcode == SYNCPOINT_STARTCODE);
@@ -671,8 +671,8 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui
int size, flags, size_mul, pts_delta, i, reserved_count;
uint64_t tmp;
- if(url_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
- av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", url_ftell(bc), nut->last_syncpoint_pos, nut->max_distance);
+ if(avio_ftell(bc) > nut->last_syncpoint_pos + nut->max_distance){
+ av_log(s, AV_LOG_ERROR, "Last frame must have been damaged %"PRId64" > %"PRId64" + %d\n", avio_ftell(bc), nut->last_syncpoint_pos, nut->max_distance);
return AVERROR_INVALIDDATA;
}
@@ -757,13 +757,13 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
|| discard >= AVDISCARD_ALL
|| stc->skip_until_key_frame){
- url_fskip(bc, size);
+ avio_fskip(bc, size);
return 1;
}
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
+ pkt->pos= avio_ftell(bc); //FIXME
avio_get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
pkt->stream_index = stream_id;
@@ -782,7 +782,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t ts, back_ptr;
for(;;){
- int64_t pos= url_ftell(bc);
+ int64_t pos= avio_ftell(bc);
uint64_t tmp= nut->next_startcode;
nut->next_startcode=0;
@@ -790,7 +790,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
pos-=8;
}else{
frame_code = avio_get_byte(bc);
- if(url_feof(bc))
+ if(avio_feof(bc))
return -1;
if(frame_code == 'N'){
tmp= frame_code;
@@ -803,7 +803,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
case STREAM_STARTCODE:
case INDEX_STARTCODE:
skip= get_packetheader(nut, bc, 0, tmp);
- url_fseek(bc, skip, SEEK_CUR);
+ avio_fseek(bc, skip, SEEK_CUR);
break;
case INFO_STARTCODE:
if(decode_info_header(nut)<0)
@@ -900,7 +900,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag
}
av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2);
pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2);
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos);
if(pos2 > pos || pos2 + 15 < pos){
av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index dde0359..052c833 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -639,13 +639,13 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
if(pkt->pts < 0)
return -1;
- if(1LL<<(20+3*nut->header_count) <= url_ftell(bc))
+ if(1LL<<(20+3*nut->header_count) <= avio_ftell(bc))
write_headers(s, bc);
if(key_frame && !(nus->last_flags & FLAG_KEY))
store_sp= 1;
- if(pkt->size + 30/*FIXME check*/ + url_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
+ if(pkt->size + 30/*FIXME check*/ + avio_ftell(bc) >= nut->last_syncpoint_pos + nut->max_distance)
store_sp= 1;
//FIXME: Ensure store_sp is 1 in the first place.
@@ -668,7 +668,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
sp= av_tree_find(nut->syncpoints, &dummy, (void *) ff_nut_sp_pos_cmp,
NULL);
- nut->last_syncpoint_pos= url_ftell(bc);
+ nut->last_syncpoint_pos= avio_ftell(bc);
ret = url_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 4a5fca6..924958f 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -60,13 +60,13 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
nuv_frametype frametype;
if (!vst && !myth)
return 1; // no codec data needed
- while (!url_feof(pb)) {
+ while (!avio_feof(pb)) {
int size, subtype;
frametype = avio_get_byte(pb);
switch (frametype) {
case NUV_EXTRADATA:
subtype = avio_get_byte(pb);
- url_fskip(pb, 6);
+ avio_fskip(pb, 6);
size = PKTSIZE(avio_get_le32(pb));
if (vst && subtype == 'R') {
vst->codec->extradata_size = size;
@@ -78,7 +78,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
}
break;
case NUV_MYTHEXT:
- url_fskip(pb, 7);
+ avio_fskip(pb, 7);
size = PKTSIZE(avio_get_le32(pb));
if (size != 128 * 4)
break;
@@ -90,7 +90,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
vst->codec->codec_id = CODEC_ID_NUV;
} else
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
if (ast) {
ast->codec->codec_tag = avio_get_le32(pb);
@@ -102,20 +102,20 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
ast->codec->bits_per_coded_sample);
ast->need_parsing = AVSTREAM_PARSE_FULL;
} else
- url_fskip(pb, 4 * 4);
+ avio_fskip(pb, 4 * 4);
size -= 6 * 4;
- url_fskip(pb, size);
+ avio_fskip(pb, size);
return 1;
case NUV_SEEKP:
size = 11;
break;
default:
- url_fskip(pb, 7);
+ avio_fskip(pb, 7);
size = PKTSIZE(avio_get_le32(pb));
break;
}
- url_fskip(pb, size);
+ avio_fskip(pb, size);
}
return 0;
}
@@ -130,14 +130,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *vst = NULL, *ast = NULL;
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
+ avio_fskip(pb, 5); // version string
+ avio_fskip(pb, 3); // padding
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
+ avio_fskip(pb, 3); // padding
aspect = av_int2dbl(avio_get_le64(pb));
if (aspect > 0.9999 && aspect < 1.0001)
aspect = 4.0 / 3.0;
@@ -195,9 +195,9 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
uint8_t hdr[HDRSIZE];
nuv_frametype frametype;
int ret, size;
- while (!url_feof(pb)) {
+ while (!avio_feof(pb)) {
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
- uint64_t pos = url_ftell(pb);
+ uint64_t pos = avio_ftell(pb);
ret = avio_get_buffer(pb, hdr, HDRSIZE);
if (ret < HDRSIZE)
return ret < 0 ? ret : AVERROR(EIO);
@@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
switch (frametype) {
case NUV_EXTRADATA:
if (!ctx->rtjpg_video) {
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
case NUV_VIDEO:
if (ctx->v_id < 0) {
av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n");
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
ret = av_new_packet(pkt, copyhdrsize + size);
@@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
case NUV_AUDIO:
if (ctx->a_id < 0) {
av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n");
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
ret = av_get_packet(pb, pkt, size);
@@ -250,7 +250,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
// contains no data, size value is invalid
break;
default:
- url_fskip(pb, size);
+ avio_fskip(pb, size);
break;
}
}
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 055abe7..1366cc1 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -62,7 +62,7 @@ ogg_save (AVFormatContext * s)
struct ogg_state *ost =
av_malloc(sizeof (*ost) + (ogg->nstreams-1) * sizeof (*ogg->streams));
int i;
- ost->pos = url_ftell (s->pb);
+ ost->pos = avio_ftell (s->pb);
ost->curidx = ogg->curidx;
ost->next = ogg->state;
ost->nstreams = ogg->nstreams;
@@ -97,7 +97,7 @@ ogg_restore (AVFormatContext * s, int discard)
for (i = 0; i < ogg->nstreams; i++)
av_free (ogg->streams[i].buf);
- url_fseek (bc, ost->pos, SEEK_SET);
+ avio_fseek (bc, ost->pos, SEEK_SET);
ogg->curidx = ost->curidx;
ogg->nstreams = ost->nstreams;
memcpy(ogg->streams, ost->streams,
@@ -247,7 +247,7 @@ ogg_read_page (AVFormatContext * s, int *str)
}
os = ogg->streams + idx;
- os->page_pos = url_ftell(bc) - 27;
+ os->page_pos = avio_ftell(bc) - 27;
if(os->psize > 0)
ogg_new_buf(ogg, idx);
@@ -462,13 +462,13 @@ ogg_get_length (AVFormatContext * s)
if (s->duration != AV_NOPTS_VALUE)
return 0;
- size = url_fsize(s->pb);
+ size = avio_fsize(s->pb);
if(size < 0)
return 0;
end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0;
ogg_save (s);
- url_fseek (s->pb, end, SEEK_SET);
+ avio_fseek (s->pb, end, SEEK_SET);
while (!ogg_read_page (s, &i)){
if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
@@ -604,10 +604,10 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
AVIOContext *bc = s->pb;
int64_t pts = AV_NOPTS_VALUE;
int i;
- url_fseek(bc, *pos_arg, SEEK_SET);
+ avio_fseek(bc, *pos_arg, SEEK_SET);
ogg_reset(ogg);
- while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
+ while (avio_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
if (i == stream_index) {
pts = ogg_calc_pts(s, i, NULL);
if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 77c3236..2aed2a0 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -66,11 +66,11 @@ typedef struct {
static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
{
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
uint32_t checksum = get_checksum(pb);
- url_fseek(pb, crc_offset, SEEK_SET);
+ avio_fseek(pb, crc_offset, SEEK_SET);
avio_put_be32(pb, checksum);
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
@@ -91,7 +91,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
avio_put_le64(pb, page->granule);
avio_put_le32(pb, oggstream->serial_num);
avio_put_le32(pb, oggstream->page_counter++);
- crc_offset = url_ftell(pb);
+ crc_offset = avio_ftell(pb);
avio_put_le32(pb, 0); // crc
avio_put_byte(pb, page->segments_count);
avio_put_buffer(pb, page->segments, page->segments_count);
diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index 5de23af..66866e1 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -49,7 +49,7 @@ int pcm_read_seek(AVFormatContext *s,
/* recompute exact position */
st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
- if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
+ if ((ret = avio_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
return ret;
return 0;
}
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 1057282..e4fdd78 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -112,7 +112,7 @@ static int str_read_header(AVFormatContext *s,
else
start = 0;
- url_fseek(pb, start, SEEK_SET);
+ avio_fseek(pb, start, SEEK_SET);
for(i=0; i<32; i++){
str->channels[i].video_stream_index=
@@ -186,7 +186,7 @@ static int str_read_packet(AVFormatContext *s,
if (av_new_packet(pkt, sector_count*VIDEO_DATA_CHUNK_SIZE))
return AVERROR(EIO);
- pkt->pos= url_ftell(pb) - RAW_CD_SECTOR_SIZE;
+ pkt->pos= avio_ftell(pb) - RAW_CD_SECTOR_SIZE;
pkt->stream_index =
str->channels[channel].video_stream_index;
}
@@ -241,7 +241,7 @@ static int str_read_packet(AVFormatContext *s,
break;
}
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
}
}
diff --git a/libavformat/pva.c b/libavformat/pva.c
index 3fcab62..262def9 100644
--- a/libavformat/pva.c
+++ b/libavformat/pva.c
@@ -73,7 +73,7 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts,
int64_t pva_pts = AV_NOPTS_VALUE, startpos;
recover:
- startpos = url_ftell(pb);
+ startpos = avio_ftell(pb);
syncword = avio_get_be16(pb);
streamid = avio_get_byte(pb);
@@ -122,7 +122,7 @@ recover:
if (pes_signal != 1) {
pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, "
"trying to recover\n");
- url_fskip(pb, length - 9);
+ avio_fskip(pb, length - 9);
if (!read_packet)
return AVERROR(EIO);
goto recover;
@@ -182,7 +182,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
while (*pos < pos_limit) {
res = AV_NOPTS_VALUE;
- url_fseek(pb, *pos, SEEK_SET);
+ avio_fseek(pb, *pos, SEEK_SET);
pvactx->continue_pes = 0;
if (read_part_of_packet(s, &res, &length, &streamid, 0)) {
@@ -190,7 +190,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index,
continue;
}
if (streamid - 1 != stream_index || res == AV_NOPTS_VALUE) {
- *pos = url_ftell(pb) + length;
+ *pos = avio_ftell(pb) + length;
continue;
}
break;
diff --git a/libavformat/qcp.c b/libavformat/qcp.c
index b2ccdcf..3d0bf4f 100644
--- a/libavformat/qcp.c
+++ b/libavformat/qcp.c
@@ -93,7 +93,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
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
+ avio_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->channels = 1;
@@ -110,13 +110,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n");
return AVERROR_INVALIDDATA;
}
- url_fskip(pb, 2 + 80); // codec-version + codec-name
+ avio_fskip(pb, 2 + 80); // codec-version + codec-name
st->codec->bit_rate = avio_get_le16(pb);
s->packet_size = avio_get_le16(pb);
- url_fskip(pb, 2); // block-size
+ avio_fskip(pb, 2); // block-size
st->codec->sample_rate = avio_get_le16(pb);
- url_fskip(pb, 2); // sample-size
+ avio_fskip(pb, 2); // sample-size
memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode));
nb_rates = avio_get_le32(pb);
@@ -129,7 +129,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
} else
c->rates_per_mode[mode] = size;
}
- url_fskip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved
+ avio_fskip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved
return 0;
}
@@ -140,7 +140,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
QCPContext *c = s->priv_data;
unsigned int chunk_size, tag;
- while(!url_feof(pb)) {
+ while(!avio_feof(pb)) {
if (c->data_size) {
int pkt_size, ret, mode = avio_get_byte(pb);
@@ -165,7 +165,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
}
- if (url_ftell(pb) & 1 && avio_get_byte(pb))
+ if (avio_ftell(pb) & 1 && avio_get_byte(pb))
av_log(s, AV_LOG_WARNING, "Padding should be 0.\n");
tag = avio_get_le32(pb);
@@ -174,14 +174,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
case MKTAG('v', 'r', 'a', 't'):
if (avio_get_le32(pb)) // var-rate-flag
s->packet_size = 0;
- url_fskip(pb, 4); // size-in-packets
+ avio_fskip(pb, 4); // size-in-packets
break;
case MKTAG('d', 'a', 't', 'a'):
c->data_size = chunk_size;
break;
default:
- url_fskip(pb, chunk_size);
+ avio_fskip(pb, chunk_size);
}
}
return AVERROR_EOF;
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 91f6c00..bd997a0 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -38,7 +38,7 @@ typedef struct {
static int read_atom(AVFormatContext *s, Atom *atom)
{
- atom->offset = url_ftell(s->pb);
+ atom->offset = avio_ftell(s->pb);
atom->size = avio_get_be32(s->pb);
if (atom->size < 8)
return -1;
@@ -72,7 +72,7 @@ static int r3d_read_red1(AVFormatContext *s)
tmp = avio_get_be32(s->pb); // filenum
av_dlog(s, "filenum %d\n", tmp);
- url_fskip(s->pb, 32); // unknown
+ avio_fskip(s->pb, 32); // unknown
st->codec->width = avio_get_be32(s->pb);
st->codec->height = avio_get_be32(s->pb);
@@ -152,7 +152,7 @@ static void r3d_read_reos(AVFormatContext *s)
tmp = avio_get_be32(s->pb);
av_dlog(s, "num audio chunks %d\n", tmp);
- url_fskip(s->pb, 6*4);
+ avio_fskip(s->pb, 6*4);
}
static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
@@ -175,12 +175,12 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
- s->data_offset = url_ftell(s->pb);
+ s->data_offset = avio_ftell(s->pb);
av_dlog(s, "data offset %#llx\n", s->data_offset);
if (url_is_streamed(s->pb))
return 0;
// find REOB/REOF/REOS to load index
- url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET);
+ avio_fseek(s->pb, avio_fsize(s->pb)-48-8, SEEK_SET);
if (read_atom(s, &atom) < 0)
av_log(s, AV_LOG_ERROR, "error reading end atom\n");
@@ -192,7 +192,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
r3d_read_reos(s);
if (r3d->rdvo_offset) {
- url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET);
+ avio_fseek(s->pb, r3d->rdvo_offset, SEEK_SET);
if (read_atom(s, &atom) < 0)
av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n");
if (atom.tag == MKTAG('R','D','V','O')) {
@@ -202,7 +202,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
out:
- url_fseek(s->pb, s->data_offset, SEEK_SET);
+ avio_fseek(s->pb, s->data_offset, SEEK_SET);
return 0;
}
@@ -210,7 +210,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
{
AVStream *st = s->streams[0];
int tmp, tmp2;
- uint64_t pos = url_ftell(s->pb);
+ uint64_t pos = avio_ftell(s->pb);
unsigned dts;
int ret;
@@ -241,7 +241,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
tmp = avio_get_be32(s->pb);
av_dlog(s, "metadata len %d\n", tmp);
}
- tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
+ tmp = atom->size - 8 - (avio_ftell(s->pb) - pos);
if (tmp < 0)
return -1;
ret = av_get_packet(s->pb, pkt, tmp);
@@ -264,7 +264,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
{
AVStream *st = s->streams[1];
int tmp, tmp2, samples, size;
- uint64_t pos = url_ftell(s->pb);
+ uint64_t pos = avio_ftell(s->pb);
unsigned dts;
int ret;
@@ -287,7 +287,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
tmp = avio_get_be32(s->pb); // unknown
av_dlog(s, "unknown %d\n", tmp);
- size = atom->size - 8 - (url_ftell(s->pb) - pos);
+ size = atom->size - 8 - (avio_ftell(s->pb) - pos);
if (size < 0)
return -1;
ret = av_get_packet(s->pb, pkt, size);
@@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
break;
default:
skip:
- url_fskip(s->pb, atom.size-8);
+ avio_fskip(s->pb, atom.size-8);
}
}
return err;
@@ -359,7 +359,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i
av_dlog(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time);
if (frame_num < r3d->video_offsets_count) {
- url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET);
+ avio_fseek(s->pb, r3d->video_offsets_count, SEEK_SET);
} else {
av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num);
return -1;
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index cf565ee..eaf67da 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -79,7 +79,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
if (av_new_packet(pkt, size) < 0)
return AVERROR(ENOMEM);
- pkt->pos= url_ftell(s->pb);
+ pkt->pos= avio_ftell(s->pb);
pkt->stream_index = 0;
ret = avio_get_partial_buffer(s->pb, pkt->data, size);
if (ret < 0) {
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index a8d0208..bf3e6af 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -160,20 +160,20 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
num = avio_get_be16(&pb);
if (rule_nr < 0 || rule_nr >= num)
return -1;
- url_fskip(&pb, rule_nr * 2);
+ avio_fskip(&pb, rule_nr * 2);
chunk_nr = avio_get_be16(&pb);
- url_fskip(&pb, (num - 1 - rule_nr) * 2);
+ avio_fskip(&pb, (num - 1 - rule_nr) * 2);
/* read MDPR chunks */
num = avio_get_be16(&pb);
if (chunk_nr >= num)
return -1;
while (chunk_nr--)
- url_fskip(&pb, avio_get_be32(&pb));
+ avio_fskip(&pb, avio_get_be32(&pb));
size = avio_get_be32(&pb);
} else {
size = rdt->mlti_data_size;
- url_fseek(&pb, 0, SEEK_SET);
+ avio_fseek(&pb, 0, SEEK_SET);
}
if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[st->index], size) < 0)
return -1;
@@ -304,7 +304,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
&seq, flags, *timestamp);
- pos = url_ftell(&pb);
+ pos = avio_ftell(&pb);
if (res < 0)
return res;
if (res > 0) {
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 1d785af..b41ae93 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -323,17 +323,17 @@ int64_t ff_start_tag(AVIOContext *pb, const char *tag)
{
avio_put_tag(pb, tag);
avio_put_le32(pb, 0);
- return url_ftell(pb);
+ return avio_ftell(pb);
}
void ff_end_tag(AVIOContext *pb, int64_t start)
{
int64_t pos;
- pos = url_ftell(pb);
- url_fseek(pb, start - 4, SEEK_SET);
+ pos = avio_ftell(pb);
+ avio_fseek(pb, start - 4, SEEK_SET);
avio_put_le32(pb, (uint32_t)(pos - start));
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
/* WAVEFORMATEX header */
@@ -500,7 +500,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
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 */
+ avio_fskip(pb, 12); /* skip end of GUID */
cbSize -= 22;
size -= 22;
}
@@ -513,7 +513,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
/* It is possible for the chunk to contain garbage at the end */
if (size > 0)
- url_fskip(pb, size);
+ avio_fskip(pb, size);
}
codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample);
if (codec->codec_id == CODEC_ID_AAC_LATM) {
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index 7748fbc..5f70a9e 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -95,7 +95,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
int i;
int ret = 0;
- url_fskip(pb,4); /* skip FORM tag */
+ avio_fskip(pb,4); /* skip FORM tag */
back_size = avio_get_le32(pb); /**< get size of the background frame */
signature = avio_get_be32(pb);
data_size = avio_get_be32(pb);
@@ -237,7 +237,7 @@ static int rl2_read_packet(AVFormatContext *s,
++rl2->index_pos[stream_id];
/** position the stream (will probably be there anyway) */
- url_fseek(pb, sample->pos, SEEK_SET);
+ avio_fseek(pb, sample->pos, SEEK_SET);
/** fill the packet */
ret = av_get_packet(pb, pkt, sample->size);
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 2dcf0e9..83f3161 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -131,17 +131,17 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
version = avio_get_be16(pb); /* version */
if (version == 3) {
int header_size = avio_get_be16(pb);
- int64_t startpos = url_ftell(pb);
- url_fskip(pb, 14);
+ int64_t startpos = avio_ftell(pb);
+ avio_fskip(pb, 14);
rm_read_metadata(s, 0);
- if ((startpos + header_size) >= url_ftell(pb) + 2) {
+ if ((startpos + header_size) >= avio_ftell(pb) + 2) {
// fourcc (should always be "lpcJ")
avio_get_byte(pb);
get_str8(pb, buf, sizeof(buf));
}
// Skip extra header crap (this should never happen)
- if ((startpos + header_size) > url_ftell(pb))
- url_fskip(pb, header_size + startpos - url_ftell(pb));
+ if ((startpos + header_size) > avio_ftell(pb))
+ avio_fskip(pb, header_size + startpos - avio_ftell(pb));
st->codec->sample_rate = 8000;
st->codec->channels = 1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -150,7 +150,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
int flavor, sub_packet_h, coded_framesize, sub_packet_size;
int codecdata_length;
/* old version (4) */
- url_fskip(pb, 2); /* unused */
+ avio_fskip(pb, 2); /* unused */
avio_get_be32(pb); /* .ra4 */
avio_get_be32(pb); /* data size */
avio_get_be16(pb); /* version2 */
@@ -273,7 +273,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
int ret;
av_set_pts_info(st, 64, 1, 1000);
- codec_pos = url_ftell(pb);
+ codec_pos = avio_ftell(pb);
v = avio_get_be32(pb);
if (v == MKTAG(0xfd, 'a', 'r', '.')) {
/* ra type header */
@@ -301,7 +301,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *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)
+ if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (avio_ftell(pb) - codec_pos))) < 0)
return ret;
// av_log(s, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2);
@@ -320,8 +320,8 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
skip:
/* skip codec info */
- size = url_ftell(pb) - codec_pos;
- url_fskip(pb, codec_data_size - size);
+ size = avio_ftell(pb) - codec_pos;
+ avio_fskip(pb, codec_data_size - size);
return 0;
}
@@ -340,7 +340,7 @@ static int rm_read_index(AVFormatContext *s)
size = avio_get_be32(pb);
if (size < 20)
return -1;
- url_fskip(pb, 2);
+ avio_fskip(pb, 2);
n_pkts = avio_get_be32(pb);
str_id = avio_get_be16(pb);
next_off = avio_get_be32(pb);
@@ -353,17 +353,17 @@ static int rm_read_index(AVFormatContext *s)
goto skip;
for (n = 0; n < n_pkts; n++) {
- url_fskip(pb, 2);
+ avio_fskip(pb, 2);
pts = avio_get_be32(pb);
pos = avio_get_be32(pb);
- url_fskip(pb, 4); /* packet no. */
+ avio_fskip(pb, 4); /* packet no. */
av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME);
}
skip:
- if (next_off && url_ftell(pb) != next_off &&
- url_fseek(pb, next_off, SEEK_SET) < 0)
+ if (next_off && avio_ftell(pb) != next_off &&
+ avio_fseek(pb, next_off, SEEK_SET) < 0)
return -1;
} while (next_off);
@@ -409,7 +409,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_get_be32(pb); /* number of headers */
for(;;) {
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
tag = avio_get_le32(pb);
tag_size = avio_get_be32(pb);
@@ -469,7 +469,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto header_end;
default:
/* unknown tag: skip it */
- url_fskip(pb, tag_size - 10);
+ avio_fskip(pb, tag_size - 10);
break;
}
}
@@ -480,11 +480,11 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_get_be32(pb); /* next data header */
if (!data_off)
- data_off = url_ftell(pb) - 18;
+ data_off = avio_ftell(pb) - 18;
if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) &&
- url_fseek(pb, indx_off, SEEK_SET) >= 0) {
+ avio_fseek(pb, indx_off, SEEK_SET) >= 0) {
rm_read_index(s);
- url_fseek(pb, data_off + 18, SEEK_SET);
+ avio_fseek(pb, data_off + 18, SEEK_SET);
}
return 0;
@@ -515,9 +515,9 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
AVStream *st;
uint32_t state=0xFFFFFFFF;
- while(!url_feof(pb)){
+ while(!avio_feof(pb)){
int len, num, i;
- *pos= url_ftell(pb) - 3;
+ *pos= avio_ftell(pb) - 3;
if(rm->remaining_len > 0){
num= rm->current_stream;
len= rm->remaining_len;
@@ -529,7 +529,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
if(state == MKBETAG('I', 'N', 'D', 'X')){
int n_pkts, expected_len;
len = avio_get_be32(pb);
- url_fskip(pb, 2);
+ avio_fskip(pb, 2);
n_pkts = avio_get_be32(pb);
expected_len = 20 + n_pkts * 14;
if (len == 20)
@@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
if (i == s->nb_streams) {
skip:
/* skip packet if unknown number */
- url_fskip(pb, len);
+ avio_fskip(pb, len);
rm->remaining_len = 0;
continue;
}
@@ -624,7 +624,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb,
vst->videobufpos = 8*vst->slices + 1;
vst->cur_slice = 0;
vst->curpic_num = pic_num;
- vst->pktpos = url_ftell(pb);
+ vst->pktpos = avio_ftell(pb);
}
if(type == 2)
len = FFMIN(len, pos);
@@ -841,14 +841,14 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
len = !ast->audio_framesize ? RAW_PACKET_SIZE :
ast->coded_framesize * ast->sub_packet_h / 2;
flags = (seq++ == 1) ? 2 : 0;
- pos = url_ftell(s->pb);
+ pos = avio_ftell(s->pb);
} else {
len=sync(s, ×tamp, &flags, &i, &pos);
if (len > 0)
st = s->streams[i];
}
- if(len<0 || url_feof(s->pb))
+ if(len<0 || avio_feof(s->pb))
return AVERROR(EIO);
res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
@@ -904,7 +904,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
if(rm->old_format)
return AV_NOPTS_VALUE;
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
rm->remaining_len=0;
for(;;){
int seq=1;
@@ -929,7 +929,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
break;
}
- url_fskip(s->pb, len);
+ avio_fskip(s->pb, len);
}
*ppos = pos;
return dts;
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index a5452b3..3754ca5 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -434,7 +434,7 @@ static int rm_write_trailer(AVFormatContext *s)
if (!url_is_streamed(s->pb)) {
/* end of file: finish to write header */
- index_pos = url_fseek(pb, 0, SEEK_CUR);
+ index_pos = avio_fseek(pb, 0, SEEK_CUR);
data_size = index_pos - rm->data_pos;
/* FIXME: write index */
@@ -443,7 +443,7 @@ static int rm_write_trailer(AVFormatContext *s)
avio_put_be32(pb, 0);
avio_put_be32(pb, 0);
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
for(i=0;i<s->nb_streams;i++)
rm->streams[i].total_frames = rm->streams[i].nb_frames;
rv10_write_header(s, data_size, 0);
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index 8c836dd..18e2bf8 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -250,7 +250,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap)
error |= read_line(pb, line, sizeof(line)); // offset to key frame list
// Read the index
- url_fseek(pb, chunk_catalog_offset, SEEK_SET);
+ avio_fseek(pb, chunk_catalog_offset, SEEK_SET);
total_audio_size = 0;
for (i = 0; i < number_of_chunks; i++) {
int64_t offset, video_size, audio_size;
@@ -292,7 +292,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
index_entry = &stream->index_entries[rpl->chunk_number];
if (rpl->frame_in_part == 0)
- if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0)
+ if (avio_fseek(pb, index_entry->pos, SEEK_SET) < 0)
return AVERROR(EIO);
if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
@@ -303,7 +303,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt)
frame_flags = avio_get_le32(pb);
frame_size = avio_get_le32(pb);
- if (url_fseek(pb, -8, SEEK_CUR) < 0)
+ if (avio_fseek(pb, -8, SEEK_CUR) < 0)
return AVERROR(EIO);
ret = av_get_packet(pb, pkt, frame_size);
diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c
index 6e2e953..356fc9e 100644
--- a/libavformat/rsoenc.c
+++ b/libavformat/rsoenc.c
@@ -77,7 +77,7 @@ static int rso_write_trailer(AVFormatContext *s)
int64_t file_size;
uint16_t coded_file_size;
- file_size = url_ftell(pb);
+ file_size = avio_ftell(pb);
if (file_size < 0)
return file_size;
@@ -91,9 +91,9 @@ static int rso_write_trailer(AVFormatContext *s)
}
/* update file size */
- url_fseek(pb, 2, SEEK_SET);
+ avio_fseek(pb, 2, SEEK_SET);
avio_put_be16(pb, coded_file_size);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index bed22bd..35338ed 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -113,7 +113,7 @@ int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
if (ret < 0)
return ret;
av_metadata_copy(&s->metadata, rt->asf_ctx->metadata, 0);
- rt->asf_pb_pos = url_ftell(&pb);
+ rt->asf_pb_pos = avio_ftell(&pb);
av_free(buf);
rt->asf_ctx->pb = NULL;
}
@@ -178,20 +178,20 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
avio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL);
- while (url_ftell(pb) + 4 < len) {
- int start_off = url_ftell(pb);
+ while (avio_ftell(pb) + 4 < len) {
+ int start_off = avio_ftell(pb);
mflags = avio_get_byte(pb);
if (mflags & 0x80)
flags |= RTP_FLAG_KEY;
len_off = avio_get_be24(pb);
if (mflags & 0x20) /**< relative timestamp */
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
if (mflags & 0x10) /**< has duration */
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
if (mflags & 0x8) /**< has location ID */
- url_fskip(pb, 4);
- off = url_ftell(pb);
+ avio_fskip(pb, 4);
+ off = avio_ftell(pb);
if (!(mflags & 0x40)) {
/**
@@ -200,7 +200,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
* ASF packet. This is used to spread one ASF packet over
* multiple RTP packets.
*/
- if (asf->pktbuf && len_off != url_ftell(asf->pktbuf)) {
+ if (asf->pktbuf && len_off != avio_ftell(asf->pktbuf)) {
uint8_t *p;
url_close_dyn_buf(asf->pktbuf, &p);
asf->pktbuf = NULL;
@@ -213,7 +213,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
return AVERROR(EIO);
avio_put_buffer(asf->pktbuf, buf + off, len - off);
- url_fskip(pb, len - off);
+ avio_fskip(pb, len - off);
if (!(flags & RTP_FLAG_MARKER))
return -1;
out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf);
@@ -233,7 +233,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
asf->buf = av_realloc(asf->buf, out_len);
memcpy(asf->buf + prev_len, buf + off,
FFMIN(cur_len, len - off));
- url_fskip(pb, cur_len);
+ avio_fskip(pb, cur_len);
}
}
@@ -247,7 +247,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
int i;
res = av_read_packet(rt->asf_ctx, pkt);
- rt->asf_pb_pos = url_ftell(pb);
+ rt->asf_pb_pos = avio_ftell(pb);
if (res != 0)
break;
for (i = 0; i < s->nb_streams; i++) {
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index d36f666..895c8cd 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -102,7 +102,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
skip_bits(&gb, 12); // reserved
data_len = get_bits(&gb, 16);
- url_fseek(&pb, pos + 4, SEEK_SET);
+ avio_fseek(&pb, pos + 4, SEEK_SET);
tag = avio_get_le32(&pb);
if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
tag != MKTAG('v','i','d','e')) ||
@@ -114,10 +114,10 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
if (pos + data_len > len)
return AVERROR_INVALIDDATA;
/* TLVs */
- while (url_ftell(&pb) + 4 < pos + data_len) {
+ while (avio_ftell(&pb) + 4 < pos + data_len) {
int tlv_len = avio_get_be16(&pb);
tag = avio_get_le16(&pb);
- if (url_ftell(&pb) + tlv_len > pos + data_len)
+ if (avio_ftell(&pb) + tlv_len > pos + data_len)
return AVERROR_INVALIDDATA;
#define MKTAG16(a,b) MKTAG(a,b,0,0)
@@ -148,22 +148,22 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
break;
}
default:
- url_fskip(&pb, tlv_len);
+ avio_fskip(&pb, tlv_len);
break;
}
}
/* 32-bit alignment */
- url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb));
+ avio_fskip(&pb, ((avio_ftell(&pb) + 3) & ~3) - avio_ftell(&pb));
} else
- url_fseek(&pb, 4, SEEK_SET);
+ avio_fseek(&pb, 4, SEEK_SET);
if (has_packet_info) {
av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1);
return AVERROR_NOTSUPP;
}
- alen = len - url_ftell(&pb);
+ alen = len - avio_ftell(&pb);
if (alen <= 0)
return AVERROR_INVALIDDATA;
@@ -181,7 +181,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
}
if (!qt->pkt.data)
return AVERROR(ENOMEM);
- memcpy(qt->pkt.data + qt->pkt.size, buf + url_ftell(&pb), alen);
+ memcpy(qt->pkt.data + qt->pkt.size, buf + avio_ftell(&pb), alen);
qt->pkt.size += alen;
if (has_marker_bit) {
*pkt = qt->pkt;
@@ -202,7 +202,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
qt->remaining = (alen / qt->bytes_per_frame) - 1;
if (av_new_packet(pkt, qt->bytes_per_frame))
return AVERROR(ENOMEM);
- memcpy(pkt->data, buf + url_ftell(&pb), qt->bytes_per_frame);
+ memcpy(pkt->data, buf + avio_ftell(&pb), qt->bytes_per_frame);
pkt->flags = flags & RTP_FLAG_KEY ? AV_PKT_FLAG_KEY : 0;
pkt->stream_index = st->index;
if (qt->remaining > 0) {
@@ -214,7 +214,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
}
qt->pkt.size = qt->remaining * qt->bytes_per_frame;
memcpy(qt->pkt.data,
- buf + url_ftell(&pb) + qt->bytes_per_frame,
+ buf + avio_ftell(&pb) + qt->bytes_per_frame,
qt->remaining * qt->bytes_per_frame);
qt->pkt.flags = pkt->flags;
return 1;
diff --git a/libavformat/sauce.c b/libavformat/sauce.c
index b121e39..ab4ae67 100644
--- a/libavformat/sauce.c
+++ b/libavformat/sauce.c
@@ -33,9 +33,9 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
AVIOContext *pb = avctx->pb;
char buf[36];
int datatype, filetype, t1, t2, nb_comments, flags;
- uint64_t start_pos = url_fsize(pb) - 128;
+ uint64_t start_pos = avio_fsize(pb) - 128;
- url_fseek(pb, start_pos, SEEK_SET);
+ avio_fseek(pb, start_pos, SEEK_SET);
if (avio_get_buffer(pb, buf, 7) != 7)
return -1;
if (memcmp(buf, "SAUCE00", 7))
@@ -51,14 +51,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
GET_SAUCE_META("artist", 20)
GET_SAUCE_META("publisher", 20)
GET_SAUCE_META("date", 8)
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
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);
+ avio_fskip(pb, 4);
GET_SAUCE_META("encoder", 22);
if (got_width && datatype && filetype) {
@@ -82,7 +82,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
*fsize -= 128;
if (nb_comments > 0) {
- url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
+ avio_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
if (avio_get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
int i;
char *str = av_malloc(65*nb_comments + 1);
diff --git a/libavformat/seek.c b/libavformat/seek.c
index 26b622f..f90144e 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -313,7 +313,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s,
step = s->pb->buffer_size;
curpos = FFMAX(pos - step / 2, 0);
for (;;) {
- url_fseek(s->pb, curpos, SEEK_SET);
+ avio_fseek(s->pb, curpos, SEEK_SET);
search_hi_lo_keyframes(s,
ts, time_base,
flags,
@@ -385,7 +385,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s,
}
}
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
av_free(sync);
return pos;
}
@@ -405,7 +405,7 @@ AVParserState *ff_store_parser_state(AVFormatContext *s)
return NULL;
}
- state->fpos = url_ftell(s->pb);
+ state->fpos = avio_ftell(s->pb);
// copy context structures
state->cur_st = s->cur_st;
@@ -456,7 +456,7 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state)
if (!state)
return;
- url_fseek(s->pb, state->fpos, SEEK_SET);
+ avio_fseek(s->pb, state->fpos, SEEK_SET);
// copy context structures
s->cur_st = state->cur_st;
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 70bab71..8393b90 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -217,12 +217,12 @@ static int film_read_packet(AVFormatContext *s,
sample = &film->sample_table[film->current_sample];
/* position the stream (will probably be there anyway) */
- url_fseek(pb, sample->sample_offset, SEEK_SET);
+ avio_fseek(pb, sample->sample_offset, SEEK_SET);
/* do a special song and dance when loading FILM Cinepak chunks */
if ((sample->stream == film->video_stream_index) &&
(film->video_type == CODEC_ID_CINEPAK)) {
- pkt->pos= url_ftell(pb);
+ pkt->pos= avio_ftell(pb);
if (av_new_packet(pkt, sample->sample_size))
return AVERROR(ENOMEM);
avio_get_buffer(pb, pkt->data, sample->sample_size);
@@ -240,7 +240,7 @@ static int film_read_packet(AVFormatContext *s,
film->stereo_buffer = av_malloc(film->stereo_buffer_size);
}
- pkt->pos= url_ftell(pb);
+ pkt->pos= avio_ftell(pb);
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 2857654..e8dc70c 100644
--- a/libavformat/sierravmd.c
+++ b/libavformat/sierravmd.c
@@ -95,7 +95,7 @@ static int vmd_read_header(AVFormatContext *s,
int sound_buffers;
/* fetch the main header, including the 2 header length bytes */
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
if (avio_get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
return AVERROR(EIO);
@@ -155,7 +155,7 @@ static int vmd_read_header(AVFormatContext *s,
toc_offset = AV_RL32(&vmd->vmd_header[812]);
vmd->frame_count = AV_RL16(&vmd->vmd_header[6]);
vmd->frames_per_block = AV_RL16(&vmd->vmd_header[18]);
- url_fseek(pb, toc_offset, SEEK_SET);
+ avio_fseek(pb, toc_offset, SEEK_SET);
raw_frame_table = NULL;
vmd->frame_table = NULL;
@@ -243,11 +243,11 @@ static int vmd_read_packet(AVFormatContext *s,
frame = &vmd->frame_table[vmd->current_frame];
/* position the stream (will probably be there already) */
- url_fseek(pb, frame->frame_offset, SEEK_SET);
+ avio_fseek(pb, frame->frame_offset, SEEK_SET);
if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
return AVERROR(ENOMEM);
- pkt->pos= url_ftell(pb);
+ pkt->pos= avio_ftell(pb);
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
if(vmd->is_indeo3)
ret = avio_get_buffer(pb, pkt->data, frame->frame_size);
diff --git a/libavformat/siff.c b/libavformat/siff.c
index 2a9a651..89930be 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -103,7 +103,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
}
width = avio_get_le16(pb);
height = avio_get_le16(pb);
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
c->frames = avio_get_le16(pb);
if(!c->frames){
av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
@@ -113,7 +113,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
c->rate = avio_get_le16(pb);
c->block_align = c->rate * (c->bits >> 3);
- url_fskip(pb, 16); //zeroes
+ avio_fskip(pb, 16); //zeroes
st = av_new_stream(s, 0);
if (!st)
@@ -145,7 +145,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
return -1;
}
- url_fskip(pb, 4); //unknown value
+ avio_fskip(pb, 4); //unknown value
c->rate = avio_get_le16(pb);
c->bits = avio_get_le16(pb);
c->block_align = c->rate * (c->bits >> 3);
@@ -160,7 +160,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (avio_get_le32(pb) != TAG_SIFF)
return -1;
- url_fskip(pb, 4); //ignore size
+ avio_fskip(pb, 4); //ignore size
tag = avio_get_le32(pb);
if (tag != TAG_VBV1 && tag != TAG_SOUN){
@@ -176,7 +176,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
return -1;
}
- url_fskip(pb, 4); //ignore size
+ avio_fskip(pb, 4); //ignore size
return 0;
}
diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 12ce80f..b2dfee6 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -219,7 +219,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap)
((int32_t*)st->codec->extradata)[3] = av_le2ne32(smk->type_size);
smk->curstream = -1;
- smk->nextpos = url_ftell(pb);
+ smk->nextpos = avio_ftell(pb);
return 0;
}
@@ -235,16 +235,16 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
int palchange = 0;
int pos;
- if (url_feof(s->pb) || smk->cur_frame >= smk->frames)
+ if (avio_feof(s->pb) || smk->cur_frame >= smk->frames)
return AVERROR_EOF;
/* if we demuxed all streams, pass another frame */
if(smk->curstream < 0) {
- url_fseek(s->pb, smk->nextpos, 0);
+ avio_fseek(s->pb, smk->nextpos, 0);
frame_size = smk->frm_size[smk->cur_frame] & (~3);
flags = smk->frm_flags[smk->cur_frame];
/* handle palette change event */
- pos = url_ftell(s->pb);
+ pos = avio_ftell(s->pb);
if(flags & SMACKER_PAL){
int size, sz, t, off, j, pos;
uint8_t *pal = smk->pal;
@@ -256,7 +256,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
frame_size -= size;
frame_size--;
sz = 0;
- pos = url_ftell(s->pb) + size;
+ pos = avio_ftell(s->pb) + size;
while(sz < 256){
t = avio_get_byte(s->pb);
if(t & 0x80){ /* skip palette entries */
@@ -279,7 +279,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
sz++;
}
}
- url_fseek(s->pb, pos, 0);
+ avio_fseek(s->pb, pos, 0);
palchange |= 1;
}
flags >>= 1;
@@ -313,7 +313,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = smk->videoindex;
pkt->size = ret + 769;
smk->cur_frame++;
- smk->nextpos = url_ftell(s->pb);
+ smk->nextpos = avio_ftell(s->pb);
} else {
if (av_new_packet(pkt, smk->buf_sizes[smk->curstream]))
return AVERROR(ENOMEM);
diff --git a/libavformat/sol.c b/libavformat/sol.c
index fb42ddc..586c3e3 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -130,7 +130,7 @@ static int sol_read_packet(AVFormatContext *s,
{
int ret;
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
ret= av_get_packet(s->pb, pkt, MAX_SIZE);
pkt->stream_index = 0;
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index 3e3f01d..7c19819 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -58,14 +58,14 @@ static int sox_read_header(AVFormatContext *s,
if (avio_get_le32(pb) == SOX_TAG) {
st->codec->codec_id = CODEC_ID_PCM_S32LE;
header_size = avio_get_le32(pb);
- url_fskip(pb, 8); /* sample count */
+ avio_fskip(pb, 8); /* sample count */
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 = avio_get_be32(pb);
- url_fskip(pb, 8); /* sample count */
+ avio_fskip(pb, 8); /* sample count */
sample_rate = av_int2dbl(avio_get_be64(pb));
st->codec->channels = avio_get_be32(pb);
comment_size = avio_get_be32(pb);
@@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s,
AV_METADATA_DONT_STRDUP_VAL);
}
- url_fskip(pb, header_size - SOX_FIXED_HDR - comment_size);
+ avio_fskip(pb, header_size - SOX_FIXED_HDR - comment_size);
st->codec->sample_rate = sample_rate;
st->codec->bits_per_coded_sample = 32;
@@ -127,7 +127,7 @@ static int sox_read_packet(AVFormatContext *s,
{
int ret, size;
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR_EOF;
size = SOX_SAMPLES*s->streams[0]->codec->block_align;
diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c
index c17e456..4d15baa 100644
--- a/libavformat/soxenc.c
+++ b/libavformat/soxenc.c
@@ -97,14 +97,14 @@ static int sox_write_trailer(AVFormatContext *s)
if (!url_is_streamed(s->pb)) {
/* update number of samples */
- int64_t file_size = url_ftell(pb);
+ int64_t file_size = avio_ftell(pb);
int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL;
- url_fseek(pb, 8, SEEK_SET);
+ avio_fseek(pb, 8, SEEK_SET);
if (enc->codec_id == CODEC_ID_PCM_S32LE) {
avio_put_le64(pb, num_samples);
} else
avio_put_be64(pb, num_samples);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
}
diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index eb26bcb..8e45418 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -171,7 +171,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) {
state = (state << 8) | avio_get_byte(pb);
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR_EOF;
}
@@ -185,7 +185,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret)
return ret;
- pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE;
+ pkt->pos = avio_ftell(pb) - BURST_HEADER_SIZE;
if (avio_get_buffer(pb, pkt->data, pkt->size) < pkt->size) {
av_free_packet(pkt);
@@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
}
/* skip over the padding to the beginning of the next frame */
- url_fskip(pb, offset - pkt->size - BURST_HEADER_SIZE);
+ avio_fskip(pb, offset - pkt->size - BURST_HEADER_SIZE);
if (!s->nb_streams) {
/* first packet, create a stream */
diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 17de8c9..c091d62 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -75,13 +75,13 @@ static inline int is_eol(char c)
static int srt_read_packet(AVFormatContext *s, AVPacket *pkt)
{
char buffer[2048], *ptr = buffer, *ptr2;
- int64_t pos = url_ftell(s->pb);
+ int64_t pos = avio_ftell(s->pb);
int res = AVERROR_EOF;
do {
ptr2 = ptr;
ptr += ff_get_line(s->pb, ptr, sizeof(buffer)+buffer-ptr);
- } while (!is_eol(*ptr2) && !url_feof(s->pb) && ptr-buffer<sizeof(buffer)-1);
+ } while (!is_eol(*ptr2) && !avio_feof(s->pb) && ptr-buffer<sizeof(buffer)-1);
if (buffer[0] && !(res = av_new_packet(pkt, ptr-buffer))) {
memcpy(pkt->data, buffer, pkt->size);
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index aef0118..9eb1181 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -27,7 +27,7 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr)
{
int tag, len;
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
tag = avio_get_le16(pb);
@@ -70,7 +70,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* skip rectangle size */
nbits = avio_get_byte(pb) >> 3;
len = (4 * nbits - 3 + 7) / 8;
- url_fskip(pb, len);
+ avio_fskip(pb, len);
swf->frame_rate = avio_get_le16(pb); /* 8.8 fixed */
avio_get_le16(pb); /* frame count */
@@ -87,7 +87,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
int tag, len, i, frame, v;
for(;;) {
- uint64_t pos = url_ftell(pb);
+ uint64_t pos = avio_ftell(pb);
tag = get_swf_tag(pb, &len);
if (tag < 0)
return AVERROR(EIO);
@@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
st = s->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
if (st->codec->codec_id == CODEC_ID_MP3) {
- url_fskip(pb, 4);
+ avio_fskip(pb, 4);
av_get_packet(pb, pkt, len-4);
} else { // ADPCM, PCM
av_get_packet(pb, pkt, len);
@@ -202,7 +202,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
return pkt->size;
}
skip:
- url_fskip(pb, len);
+ avio_fskip(pb, len);
}
return 0;
}
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index c685491..4c69832 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -29,7 +29,7 @@ static void put_swf_tag(AVFormatContext *s, int tag)
SWFContext *swf = s->priv_data;
AVIOContext *pb = s->pb;
- swf->tag_pos = url_ftell(pb);
+ swf->tag_pos = avio_ftell(pb);
swf->tag = tag;
/* reserve some room for the tag */
if (tag & TAG_LONG) {
@@ -47,10 +47,10 @@ static void put_swf_end_tag(AVFormatContext *s)
int64_t pos;
int tag_len, tag;
- pos = url_ftell(pb);
+ pos = avio_ftell(pb);
tag_len = pos - swf->tag_pos - 2;
tag = swf->tag;
- url_fseek(pb, swf->tag_pos, SEEK_SET);
+ avio_fseek(pb, swf->tag_pos, SEEK_SET);
if (tag & TAG_LONG) {
tag &= ~TAG_LONG;
avio_put_le16(pb, (tag << 6) | 0x3f);
@@ -59,7 +59,7 @@ static void put_swf_end_tag(AVFormatContext *s)
assert(tag_len < 0x3f);
avio_put_le16(pb, (tag << 6) | tag_len);
}
- url_fseek(pb, pos, SEEK_SET);
+ avio_fseek(pb, pos, SEEK_SET);
}
static inline void max_nbits(int *nbits_ptr, int val)
@@ -246,7 +246,7 @@ static int swf_write_header(AVFormatContext *s)
put_swf_rect(pb, 0, width * 20, 0, height * 20);
avio_put_le16(pb, (rate * 256) / rate_base); /* frame rate */
- swf->duration_pos = url_ftell(pb);
+ swf->duration_pos = avio_ftell(pb);
avio_put_le16(pb, (uint16_t)(DUMMY_DURATION * (int64_t)rate / rate_base)); /* frame count */
/* avm2/swf v9 (also v8?) files require a file attribute tag */
@@ -346,7 +346,7 @@ static int swf_write_video(AVFormatContext *s,
/* create a new video object */
put_swf_tag(s, TAG_VIDEOSTREAM);
avio_put_le16(pb, VIDEO_ID);
- swf->vframes_pos = url_ftell(pb);
+ swf->vframes_pos = avio_ftell(pb);
avio_put_le16(pb, 15000); /* hard flash player limit */
avio_put_le16(pb, enc->width);
avio_put_le16(pb, enc->height);
@@ -493,14 +493,14 @@ static int swf_write_trailer(AVFormatContext *s)
/* patch file size and number of frames if not streamed */
if (!url_is_streamed(s->pb) && video_enc) {
- file_size = url_ftell(pb);
- url_fseek(pb, 4, SEEK_SET);
+ file_size = avio_ftell(pb);
+ avio_fseek(pb, 4, SEEK_SET);
avio_put_le32(pb, file_size);
- url_fseek(pb, swf->duration_pos, SEEK_SET);
+ avio_fseek(pb, swf->duration_pos, SEEK_SET);
avio_put_le16(pb, swf->video_frame_number);
- url_fseek(pb, swf->vframes_pos, SEEK_SET);
+ avio_fseek(pb, swf->vframes_pos, SEEK_SET);
avio_put_le16(pb, swf->video_frame_number);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
}
return 0;
}
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 2a1981d..b4b8600 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -81,7 +81,7 @@ static int thp_read_header(AVFormatContext *s,
thp->next_frame = thp->first_frame;
/* Read the component structure. */
- url_fseek (pb, thp->compoff, SEEK_SET);
+ avio_fseek (pb, thp->compoff, SEEK_SET);
thp->compcount = avio_get_be32(pb);
/* Read the list of component types. */
@@ -149,7 +149,7 @@ static int thp_read_packet(AVFormatContext *s,
if (thp->frame >= thp->framecnt)
return AVERROR(EIO);
- url_fseek(pb, thp->next_frame, SEEK_SET);
+ avio_fseek(pb, thp->next_frame, SEEK_SET);
/* Locate the next frame and read out its size. */
thp->next_frame += thp->next_framesz;
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index 132f974..6bf8ac6 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -83,7 +83,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb)
int i, sz;
TiertexSeqFrameBuffer *seq_buffer;
- url_fseek(pb, 256, SEEK_SET);
+ avio_fseek(pb, 256, SEEK_SET);
for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) {
sz = avio_get_le16(pb);
@@ -113,7 +113,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num
if (seq_buffer->fill_size + data_size > seq_buffer->data_size || data_size <= 0)
return AVERROR_INVALIDDATA;
- url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
+ avio_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
if (avio_get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
return AVERROR(EIO);
@@ -128,7 +128,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb)
int i, e, err;
seq->current_frame_offs += SEQ_FRAME_SIZE;
- url_fseek(pb, seq->current_frame_offs, SEEK_SET);
+ avio_fseek(pb, seq->current_frame_offs, SEEK_SET);
/* sound data */
seq->current_audio_data_offs = avio_get_le16(pb);
@@ -256,7 +256,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->data[0] = 0;
if (seq->current_pal_data_size) {
pkt->data[0] |= 1;
- url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
+ avio_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
if (avio_get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
return AVERROR(EIO);
}
@@ -279,7 +279,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt)
if (seq->current_audio_data_offs == 0) /* end of data reached */
return AVERROR(EIO);
- url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET);
+ avio_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET);
rc = av_get_packet(pb, pkt, seq->current_audio_data_size);
if (rc < 0)
return rc;
diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index dece429..cac08c5 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -146,13 +146,13 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt)
int ret, pkt_size = tmv->stream_index ?
tmv->audio_chunk_size : tmv->video_chunk_size;
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR_EOF;
ret = av_get_packet(pb, pkt, pkt_size);
if (tmv->stream_index)
- url_fskip(pb, tmv->padding);
+ avio_fskip(pb, tmv->padding);
pkt->stream_index = tmv->stream_index;
tmv->stream_index ^= 1;
@@ -173,7 +173,7 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index,
pos = timestamp *
(tmv->audio_chunk_size + tmv->video_chunk_size + tmv->padding);
- url_fseek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET);
+ avio_fseek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET);
tmv->stream_index = 0;
return 0;
}
diff --git a/libavformat/tta.c b/libavformat/tta.c
index 1c7f482..c0bbb51 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -46,11 +46,11 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
ff_id3v1_read(s);
- start_offset = url_ftell(s->pb);
+ start_offset = avio_ftell(s->pb);
if (avio_get_le32(s->pb) != AV_RL32("TTA1"))
return -1; // not tta file
- url_fskip(s->pb, 2); // FIXME: flags
+ avio_fskip(s->pb, 2); // FIXME: flags
channels = avio_get_le16(s->pb);
bps = avio_get_le16(s->pb);
samplerate = avio_get_le32(s->pb);
@@ -65,7 +65,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1;
}
- url_fskip(s->pb, 4); // header crc
+ avio_fskip(s->pb, 4); // header crc
framelen = samplerate*256/245;
c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
@@ -84,14 +84,14 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->start_time = 0;
st->duration = datalen;
- framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
+ framepos = avio_ftell(s->pb) + 4*c->totalframes + 4;
for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_get_le32(s->pb);
av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
framepos += size;
}
- url_fskip(s->pb, 4); // seektable crc
+ avio_fskip(s->pb, 4); // seektable crc
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_TTA;
@@ -99,14 +99,14 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->sample_rate = samplerate;
st->codec->bits_per_coded_sample = bps;
- st->codec->extradata_size = url_ftell(s->pb) - start_offset;
+ st->codec->extradata_size = avio_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 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);
+ avio_fseek(s->pb, start_offset, SEEK_SET);
avio_get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
return 0;
@@ -138,7 +138,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
return -1;
c->currentframe = index;
- url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+ avio_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
return 0;
}
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 5b8b8af..4ca0930 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -46,7 +46,7 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos)
char buf[37];
int len;
- url_fseek(pb, start_pos, SEEK_SET);
+ avio_fseek(pb, start_pos, SEEK_SET);
if (avio_get_byte(pb) != 0x1A)
return -1;
@@ -89,13 +89,13 @@ static int read_header(AVFormatContext *avctx,
s->chars_per_frame = FFMAX(av_q2d(st->time_base) * (ap->sample_rate ? ap->sample_rate : LINE_RATE), 1);
if (!url_is_streamed(avctx->pb)) {
- s->fsize = url_fsize(avctx->pb);
+ s->fsize = avio_fsize(avctx->pb);
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
efi_read(avctx, s->fsize - 51);
- url_fseek(avctx->pb, 0, SEEK_SET);
+ avio_fseek(avctx->pb, 0, SEEK_SET);
}
return 0;
@@ -106,13 +106,13 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
TtyDemuxContext *s = avctx->priv_data;
int n;
- if (url_feof(avctx->pb))
+ if (avio_feof(avctx->pb))
return AVERROR_EOF;
n = s->chars_per_frame;
if (s->fsize) {
// ignore metadata buffer
- uint64_t p = url_ftell(avctx->pb);
+ uint64_t p = avio_ftell(avctx->pb);
if (p + s->chars_per_frame > s->fsize)
n = s->fsize - p;
}
diff --git a/libavformat/txd.c b/libavformat/txd.c
index 6dbfb4d..9dff612 100644
--- a/libavformat/txd.c
+++ b/libavformat/txd.c
@@ -61,7 +61,7 @@ next_chunk:
chunk_size = avio_get_le32(pb);
marker = avio_get_le32(pb);
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR_EOF;
if (marker != TXD_MARKER && marker != TXD_MARKER2) {
av_log(s, AV_LOG_ERROR, "marker does not match\n");
@@ -73,7 +73,7 @@ next_chunk:
if (chunk_size > 100)
break;
case TXD_EXTRA:
- url_fskip(s->pb, chunk_size);
+ avio_fskip(s->pb, chunk_size);
case TXD_FILE:
case TXD_TEXTURE:
goto next_chunk;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d13fb50..f83e720 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -330,7 +330,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
if(ret<0)
return ret;
- pkt->pos= url_ftell(s);
+ pkt->pos= avio_ftell(s);
ret= avio_get_buffer(s, pkt->data, size);
if(ret<=0)
@@ -490,7 +490,7 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
}
if (pb && !ic->data_offset)
- ic->data_offset = url_ftell(ic->pb);
+ ic->data_offset = avio_ftell(ic->pb);
#if FF_API_OLD_METADATA
ff_metadata_demux_compat(ic);
@@ -1531,7 +1531,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts
return -1;
/* do the seek */
- if ((ret = url_fseek(s->pb, pos, SEEK_SET)) < 0)
+ if ((ret = avio_fseek(s->pb, pos, SEEK_SET)) < 0)
return ret;
av_update_cur_dts(s, st, ts);
@@ -1557,7 +1557,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
if(ts_max == AV_NOPTS_VALUE){
int step= 1024;
- filesize = url_fsize(s->pb);
+ filesize = avio_fsize(s->pb);
pos_max = filesize - 1;
do{
pos_max -= step;
@@ -1666,12 +1666,12 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos,
#endif
pos_min = s->data_offset;
- pos_max = url_fsize(s->pb) - 1;
+ pos_max = avio_fsize(s->pb) - 1;
if (pos < pos_min) pos= pos_min;
else if(pos > pos_max) pos= pos_max;
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
#if 0
av_update_cur_dts(s, st, ts);
@@ -1701,11 +1701,11 @@ static int av_seek_frame_generic(AVFormatContext *s,
if(st->nb_index_entries){
assert(st->index_entries);
ie= &st->index_entries[st->nb_index_entries-1];
- if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
+ if ((ret = avio_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
return ret;
av_update_cur_dts(s, st, ie->timestamp);
}else{
- if ((ret = url_fseek(s->pb, s->data_offset, SEEK_SET)) < 0)
+ if ((ret = avio_fseek(s->pb, s->data_offset, SEEK_SET)) < 0)
return ret;
}
for(i=0;; i++) {
@@ -1732,7 +1732,7 @@ static int av_seek_frame_generic(AVFormatContext *s,
return 0;
}
ie = &st->index_entries[index];
- if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
+ if ((ret = avio_fseek(s->pb, ie->pos, SEEK_SET)) < 0)
return ret;
av_update_cur_dts(s, st, ie->timestamp);
@@ -1956,7 +1956,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
if (offset < 0)
offset = 0;
- url_fseek(ic->pb, offset, SEEK_SET);
+ avio_fseek(ic->pb, offset, SEEK_SET);
read_size = 0;
for(;;) {
if (read_size >= DURATION_MAX_READ_SIZE<<(FFMAX(retry-1,0)))
@@ -1991,7 +1991,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset
fill_all_stream_timings(ic);
- url_fseek(ic->pb, old_offset, SEEK_SET);
+ avio_fseek(ic->pb, old_offset, SEEK_SET);
for (i=0; i<ic->nb_streams; i++) {
st= ic->streams[i];
st->cur_dts= st->first_dts;
@@ -2007,7 +2007,7 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
if (ic->iformat->flags & AVFMT_NOFILE) {
file_size = 0;
} else {
- file_size = url_fsize(ic->pb);
+ file_size = avio_fsize(ic->pb);
if (file_size < 0)
file_size = 0;
}
@@ -2212,7 +2212,7 @@ int av_find_stream_info(AVFormatContext *ic)
int i, count, ret, read_size, j;
AVStream *st;
AVPacket pkt1, *pkt;
- int64_t old_offset = url_ftell(ic->pb);
+ int64_t old_offset = avio_ftell(ic->pb);
for(i=0;i<ic->nb_streams;i++) {
AVCodec *codec;
@@ -2988,7 +2988,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
ret= s->oformat->write_packet(s, pkt);
if(!ret)
- ret= url_ferror(s->pb);
+ ret= avio_ferror(s->pb);
return ret;
}
@@ -3110,8 +3110,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
if(ret<0)
return ret;
- if(url_ferror(s->pb))
- return url_ferror(s->pb);
+ if(avio_ferror(s->pb))
+ return avio_ferror(s->pb);
}
}
@@ -3133,7 +3133,7 @@ int av_write_trailer(AVFormatContext *s)
if(ret<0)
goto fail;
- if(url_ferror(s->pb))
+ if(avio_ferror(s->pb))
goto fail;
}
@@ -3141,7 +3141,7 @@ int av_write_trailer(AVFormatContext *s)
ret = s->oformat->write_trailer(s);
fail:
if(ret == 0)
- ret=url_ferror(s->pb);
+ ret=avio_ferror(s->pb);
for(i=0;i<s->nb_streams;i++) {
av_freep(&s->streams[i]->priv_data);
av_freep(&s->streams[i]->index_entries);
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index 2120670..66f734f 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -68,7 +68,7 @@ static int vc1t_read_header(AVFormatContext *s,
st->codec->width = avio_get_le32(pb);
if(avio_get_le32(pb) != 0xC)
return -1;
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
fps = avio_get_le32(pb);
if(fps == 0xFFFFFFFF)
av_set_pts_info(st, 32, 1, 1000);
@@ -92,7 +92,7 @@ static int vc1t_read_packet(AVFormatContext *s,
int keyframe = 0;
uint32_t pts;
- if(url_feof(pb))
+ if(avio_feof(pb))
return AVERROR(EIO);
frame_size = avio_get_le24(pb);
diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c
index 8b61892..b348a2f 100644
--- a/libavformat/vc1testenc.c
+++ b/libavformat/vc1testenc.c
@@ -74,7 +74,7 @@ static int vc1test_write_trailer(AVFormatContext *s)
AVIOContext *pb = s->pb;
if (!url_is_streamed(s->pb)) {
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
avio_put_le24(pb, ctx->frames);
put_flush_packet(pb);
}
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index 347685a..b082b50 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -45,13 +45,13 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
int header_size;
AVStream *st;
- url_fskip(pb, 20);
+ avio_fskip(pb, 20);
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);
}
- url_fskip(pb, header_size);
+ avio_fskip(pb, header_size);
st = av_new_stream(s, 0);
if (!st)
return AVERROR(ENOMEM);
@@ -80,7 +80,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
if (!voc->remaining_size) {
if (url_is_streamed(s->pb))
return AVERROR(EIO);
- voc->remaining_size = url_fsize(pb) - url_ftell(pb);
+ voc->remaining_size = avio_fsize(pb) - avio_ftell(pb);
}
max_size -= 4;
@@ -114,13 +114,13 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
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);
+ avio_fskip(pb, 4);
voc->remaining_size -= 12;
max_size -= 12;
break;
default:
- url_fskip(pb, voc->remaining_size);
+ avio_fskip(pb, voc->remaining_size);
max_size -= voc->remaining_size;
voc->remaining_size = 0;
break;
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index 47f87ec..dae4fd6 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -72,7 +72,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st)
return AVERROR(ENOMEM);
- url_fskip(s->pb, 12);
+ avio_fskip(s->pb, 12);
header_size = avio_get_be32(s->pb);
@@ -101,7 +101,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
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);
+ avio_fskip(s->pb, len-12);
st->codec->bit_rate = read_bitrate*1000;
st->codec->bits_per_coded_sample = 16;
@@ -140,7 +140,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n",
((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1],
((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]);
- url_fskip(s->pb, FFMIN(len, header_size));
+ avio_fskip(s->pb, FFMIN(len, header_size));
break;
}
@@ -200,7 +200,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt)
int ret;
int size = (c->frame_bit_len - c->remaining_bits + 7)>>3;
- pkt->pos = url_ftell(s->pb);
+ pkt->pos = avio_ftell(s->pb);
pkt->stream_index = 0;
if (av_new_packet(pkt, size+2) < 0)
@@ -240,7 +240,7 @@ static int vqf_read_seek(AVFormatContext *s,
st->cur_dts = av_rescale(pos, st->time_base.den,
st->codec->bit_rate * (int64_t)st->time_base.num);
- if ((ret = url_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
+ if ((ret = avio_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0)
return ret;
c->remaining_bits = -7 - ((pos-7)&7);
diff --git a/libavformat/wav.c b/libavformat/wav.c
index ed8fa21..9b78e66 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -101,10 +101,10 @@ static int wav_write_trailer(AVFormatContext *s)
ff_end_tag(pb, wav->data);
/* update file size */
- file_size = url_ftell(pb);
- url_fseek(pb, 4, SEEK_SET);
+ file_size = avio_ftell(pb);
+ avio_fseek(pb, 4, SEEK_SET);
avio_put_le32(pb, (uint32_t)(file_size - 8));
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
@@ -114,9 +114,9 @@ static int wav_write_trailer(AVFormatContext *s)
number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration,
s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num,
s->streams[0]->time_base.den);
- url_fseek(pb, wav->data-12, SEEK_SET);
+ avio_fseek(pb, wav->data-12, SEEK_SET);
avio_put_le32(pb, number_of_samples);
- url_fseek(pb, file_size, SEEK_SET);
+ avio_fseek(pb, file_size, SEEK_SET);
put_flush_packet(pb);
}
}
@@ -154,12 +154,12 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1)
int64_t size;
for (;;) {
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
size = next_tag(pb, &tag);
if (tag == tag1)
break;
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
}
return size;
}
@@ -216,7 +216,7 @@ static int wav_read_header(AVFormatContext *s,
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 */
+ avio_fskip(pb, size - 16); /* skip rest of ds64 chunk */
}
/* parse fmt header */
@@ -233,7 +233,7 @@ static int wav_read_header(AVFormatContext *s,
av_set_pts_info(st, 64, 1, st->codec->sample_rate);
for (;;) {
- if (url_feof(pb))
+ if (avio_feof(pb))
return -1;
size = next_tag(pb, &tag);
if (tag == MKTAG('d', 'a', 't', 'a')){
@@ -242,7 +242,7 @@ static int wav_read_header(AVFormatContext *s,
sample_count = avio_get_le32(pb);
size -= 4;
}
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
}
if (rf64)
size = data_size;
@@ -251,7 +251,7 @@ static int wav_read_header(AVFormatContext *s,
if (!size) {
wav->data_end = INT64_MAX;
} else
- wav->data_end= url_ftell(pb) + size;
+ wav->data_end= avio_ftell(pb) + size;
if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
sample_count = (size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
@@ -268,14 +268,14 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
uint8_t guid[16];
int64_t size;
- while (!url_feof(pb)) {
+ while (!avio_feof(pb)) {
avio_get_buffer(pb, guid, 16);
size = avio_get_le64(pb);
if (size <= 24)
return -1;
if (!memcmp(guid, guid1, 16))
return size;
- url_fskip(pb, FFALIGN(size, INT64_C(8)) - 24);
+ avio_fskip(pb, FFALIGN(size, INT64_C(8)) - 24);
}
return -1;
}
@@ -295,7 +295,7 @@ static int wav_read_packet(AVFormatContext *s,
st = s->streams[0];
- left = wav->data_end - url_ftell(s->pb);
+ left = wav->data_end - avio_ftell(s->pb);
if (left <= 0){
if (CONFIG_W64_DEMUXER && wav->w64)
left = find_guid(s->pb, guid_data) - 24;
@@ -303,7 +303,7 @@ static int wav_read_packet(AVFormatContext *s,
left = find_tag(s->pb, MKTAG('d', 'a', 't', 'a'));
if (left < 0)
return AVERROR_EOF;
- wav->data_end= url_ftell(s->pb) + left;
+ wav->data_end= avio_ftell(s->pb) + left;
}
size = MAX_SIZE;
@@ -409,7 +409,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* subtract chunk header size - normal wav file doesn't count it */
ff_get_wav_header(pb, st->codec, size - 24);
- url_fskip(pb, FFALIGN(size, INT64_C(8)) - size);
+ avio_fskip(pb, FFALIGN(size, INT64_C(8)) - size);
st->need_parsing = AVSTREAM_PARSE_FULL;
@@ -420,7 +420,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "could not find data guid\n");
return -1;
}
- wav->data_end = url_ftell(pb) + size - 24;
+ wav->data_end = avio_ftell(pb) + size - 24;
wav->w64 = 1;
return 0;
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 57ae93d..7637360 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -101,7 +101,7 @@ static int wc3_read_header(AVFormatContext *s,
wc3->vpkt.data = NULL; wc3->vpkt.size = 0;
/* skip the first 3 32-bit numbers */
- url_fseek(pb, 12, SEEK_CUR);
+ avio_fseek(pb, 12, SEEK_CUR);
/* traverse through the chunks and load the header information before
* the first BRCH tag */
@@ -114,12 +114,12 @@ static int wc3_read_header(AVFormatContext *s,
case SOND_TAG:
case INDX_TAG:
/* SOND unknown, INDX unnecessary; ignore both */
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
break;
case PC__TAG:
/* number of palettes, unneeded */
- url_fseek(pb, 12, SEEK_CUR);
+ avio_fseek(pb, 12, SEEK_CUR);
break;
case BNAM_TAG:
@@ -142,7 +142,7 @@ static int wc3_read_header(AVFormatContext *s,
case PALT_TAG:
/* one of several palettes */
- url_fseek(pb, -8, SEEK_CUR);
+ avio_fseek(pb, -8, SEEK_CUR);
av_append_packet(pb, &wc3->vpkt, 8 + PALETTE_SIZE);
break;
@@ -157,7 +157,7 @@ static int wc3_read_header(AVFormatContext *s,
fourcc_tag = avio_get_le32(pb);
/* chunk sizes are 16-bit aligned */
size = (avio_get_be32(pb) + 1) & (~1);
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
} while (fourcc_tag != BRCH_TAG);
@@ -208,7 +208,7 @@ static int wc3_read_packet(AVFormatContext *s,
fourcc_tag = avio_get_le32(pb);
/* chunk sizes are 16-bit aligned */
size = (avio_get_be32(pb) + 1) & (~1);
- if (url_feof(pb))
+ if (avio_feof(pb))
return AVERROR(EIO);
switch (fourcc_tag) {
@@ -219,13 +219,13 @@ static int wc3_read_packet(AVFormatContext *s,
case SHOT_TAG:
/* load up new palette */
- url_fseek(pb, -8, SEEK_CUR);
+ avio_fseek(pb, -8, SEEK_CUR);
av_append_packet(pb, &wc3->vpkt, 8 + 4);
break;
case VGA__TAG:
/* send out video chunk */
- url_fseek(pb, -8, SEEK_CUR);
+ avio_fseek(pb, -8, SEEK_CUR);
ret= av_append_packet(pb, &wc3->vpkt, 8 + size);
// ignore error if we have some data
if (wc3->vpkt.size > 0)
@@ -240,7 +240,7 @@ static int wc3_read_packet(AVFormatContext *s,
case TEXT_TAG:
/* subtitle chunk */
#if 0
- url_fseek(pb, size, SEEK_CUR);
+ avio_fseek(pb, size, SEEK_CUR);
#else
if ((unsigned)size > sizeof(text) || (ret = avio_get_buffer(pb, text, size)) != size)
ret = AVERROR(EIO);
diff --git a/libavformat/westwood.c b/libavformat/westwood.c
index dac04d3..df817b2 100644
--- a/libavformat/westwood.c
+++ b/libavformat/westwood.c
@@ -231,7 +231,7 @@ static int wsvqa_read_header(AVFormatContext *s,
st->codec->codec_tag = 0; /* no fourcc */
/* skip to the start of the VQA header */
- url_fseek(pb, 20, SEEK_SET);
+ avio_fseek(pb, 20, SEEK_SET);
/* the VQA header needs to go to the decoder */
st->codec->extradata_size = VQA_HEADER_SIZE;
@@ -303,7 +303,7 @@ static int wsvqa_read_header(AVFormatContext *s,
break;
}
- url_fseek(pb, chunk_size, SEEK_CUR);
+ avio_fseek(pb, chunk_size, SEEK_CUR);
} while (chunk_tag != FINF_TAG);
return 0;
@@ -348,7 +348,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
}
/* stay on 16-bit alignment */
if (skip_byte)
- url_fseek(pb, 1, SEEK_CUR);
+ avio_fseek(pb, 1, SEEK_CUR);
return ret;
} else {
@@ -359,7 +359,7 @@ static int wsvqa_read_packet(AVFormatContext *s,
default:
av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type);
}
- url_fseek(pb, chunk_size + skip_byte, SEEK_CUR);
+ avio_fseek(pb, chunk_size + skip_byte, SEEK_CUR);
}
}
diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index e47149c..aa21ea0 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -77,9 +77,9 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
AVIOContext *pb = wf->pb_filesystem;
int nread = 0;
- if (wf->error || url_ferror(pb))
+ if (wf->error || avio_ferror(pb))
return -1;
- if (wf->position >= wf->length || url_feof(pb))
+ if (wf->position >= wf->length || avio_feof(pb))
return 0;
buf_size = FFMIN(buf_size, wf->length - wf->position);
@@ -98,7 +98,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size)
int i = wf->position >> wf->sector_bits;
if (i >= wf->nb_sectors ||
(wf->sectors[i] != wf->sectors[i - 1] + (1 << (wf->sector_bits - WTV_SECTOR_BITS)) &&
- url_fseek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) {
+ avio_fseek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) {
wf->error = 1;
break;
}
@@ -123,7 +123,7 @@ static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence)
offset = wf->length;
wf->error = offset < 0 || offset >= wf->length ||
- url_fseek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS)
+ avio_fseek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS)
+ (offset & ((1 << wf->sector_bits) - 1)), SEEK_SET) < 0;
wf->position = offset;
return offset;
@@ -159,7 +159,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
WtvFile *wf;
uint8_t *buffer;
- if (url_fseek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0)
+ if (avio_fseek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0)
return NULL;
wf = av_mallocz(sizeof(WtvFile));
@@ -195,7 +195,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
}
wf->nb_sectors = 0;
for (i = 0; i < nb_sectors1; i++) {
- if (url_fseek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)
+ if (avio_fseek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)
break;
wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4);
}
@@ -222,7 +222,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
/* seek to intial sector */
wf->position = 0;
- if (url_fseek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) {
+ if (avio_fseek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) {
av_free(wf->sectors);
av_free(wf);
return NULL;
@@ -468,7 +468,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
char description[1024];
unsigned int filesize;
AVStream *st;
- int64_t pos = url_ftell(pb);
+ int64_t pos = avio_ftell(pb);
avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));
if (strcmp(mime, "image/jpeg"))
@@ -492,7 +492,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
st->codec->extradata_size = filesize;
avio_get_buffer(pb, st->codec->extradata, filesize);
done:
- url_fseek(pb, pos + length, SEEK_SET);
+ avio_fseek(pb, pos + length, SEEK_SET);
}
static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length)
@@ -539,7 +539,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty
} else {
av_freep(&buf);
av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length);
- url_fskip(pb, length);
+ avio_fskip(pb, length);
return;
}
@@ -554,7 +554,7 @@ static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb)
{
ff_asf_guid guid;
int length, type;
- while(!url_feof(pb)) {
+ while(!avio_feof(pb)) {
char key[1024];
ff_get_guid(pb, &guid);
type = avio_get_le32(pb);
@@ -582,7 +582,7 @@ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st)
WtvContext *wtv = s->priv_data;
AVIOContext *pb = wtv->pb;
- url_fskip(pb, 72); // picture aspect ratio is unreliable
+ avio_fskip(pb, 72); // picture aspect ratio is unreliable
ff_get_bmp_header(pb, st);
return 72 + 40;
@@ -658,17 +658,17 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
if (size < 32) {
av_log(s, AV_LOG_WARNING, "format buffer size underflow\n");
- url_fskip(pb, size);
+ avio_fskip(pb, size);
return NULL;
}
- url_fskip(pb, size - 32);
+ avio_fskip(pb, size - 32);
ff_get_guid(pb, &actual_subtype);
ff_get_guid(pb, &actual_formattype);
- url_fseek(pb, -size, SEEK_CUR);
+ avio_fseek(pb, -size, SEEK_CUR);
st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32);
- url_fskip(pb, 32);
+ avio_fskip(pb, 32);
return st;
} else if (!ff_guidcmp(mediatype, mediatype_audio)) {
st = new_stream(s, st, sid, AVMEDIA_TYPE_AUDIO);
@@ -679,7 +679,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
} else {
if (ff_guidcmp(formattype, format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
- url_fskip(pb, size);
+ avio_fskip(pb, size);
}
if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) {
@@ -701,14 +701,14 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
return NULL;
if (!ff_guidcmp(formattype, format_videoinfo2)) {
int consumed = parse_videoinfoheader2(s, st);
- url_fskip(pb, FFMAX(size - consumed, 0));
+ avio_fskip(pb, FFMAX(size - consumed, 0));
} else if (!ff_guidcmp(formattype, format_mpeg2_video)) {
int consumed = parse_videoinfoheader2(s, st);
- url_fskip(pb, FFMAX(size - consumed, 0));
+ avio_fskip(pb, FFMAX(size - consumed, 0));
} else {
if (ff_guidcmp(formattype, format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
- url_fskip(pb, size);
+ avio_fskip(pb, size);
}
if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) {
@@ -726,7 +726,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
return NULL;
if (ff_guidcmp(formattype, format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
- url_fskip(pb, size);
+ avio_fskip(pb, size);
st->codec->codec_id = CODEC_ID_DVB_SUBTITLE;
return st;
} else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) &&
@@ -736,21 +736,21 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid,
return NULL;
if (ff_guidcmp(formattype, format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
- url_fskip(pb, size);
+ avio_fskip(pb, size);
st->codec->codec_id = CODEC_ID_DVB_TELETEXT;
return st;
} else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) &&
!ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) {
if (ff_guidcmp(formattype, format_none))
av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype));
- url_fskip(pb, size);
+ avio_fskip(pb, size);
return NULL;
}
av_log(s, AV_LOG_WARNING, "unknown media type, mediatype:"PRI_GUID
", subtype:"PRI_GUID", formattype:"PRI_GUID"\n",
ARG_GUID(mediatype), ARG_GUID(subtype), ARG_GUID(formattype));
- url_fskip(pb, size);
+ avio_fskip(pb, size);
return NULL;
}
@@ -770,7 +770,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
{
WtvContext *wtv = s->priv_data;
AVIOContext *pb = wtv->pb;
- while (!url_feof(pb)) {
+ while (!avio_feof(pb)) {
ff_asf_guid g;
int len, sid, consumed;
@@ -779,17 +779,17 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
if (len < 32)
break;
sid = avio_get_le32(pb) & 0x7FFF;
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
consumed = 32;
if (!ff_guidcmp(g, stream_guid)) {
if (ff_find_stream_index(s, sid) < 0) {
ff_asf_guid mediatype, subtype, formattype;
int size;
- url_fskip(pb, 28);
+ avio_fskip(pb, 28);
ff_get_guid(pb, &mediatype);
ff_get_guid(pb, &subtype);
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
ff_get_guid(pb, &formattype);
size = avio_get_le32(pb);
parse_media_type(s, 0, sid, mediatype, subtype, formattype, size);
@@ -800,10 +800,10 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) {
ff_asf_guid mediatype, subtype, formattype;
int size;
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
ff_get_guid(pb, &mediatype);
ff_get_guid(pb, &subtype);
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
ff_get_guid(pb, &formattype);
size = avio_get_le32(pb);
parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size);
@@ -822,11 +822,11 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
const uint8_t *pbuf = buf;
int buf_size;
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
consumed += 8;
if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) ||
!ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) {
- url_fskip(pb, 6);
+ avio_fskip(pb, 6);
consumed += 6;
}
@@ -840,7 +840,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
if (stream_index >= 0) {
AVStream *st = s->streams[stream_index];
int audio_type;
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
audio_type = avio_get_byte(pb);
if (audio_type == 2)
st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
@@ -851,7 +851,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
} else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) {
int stream_index = ff_find_stream_index(s, sid);
if (stream_index >= 0) {
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
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;
@@ -861,7 +861,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
if (stream_index >= 0) {
AVStream *st = s->streams[stream_index];
uint8_t language[4];
- url_fskip(pb, 12);
+ avio_fskip(pb, 12);
avio_get_buffer(pb, language, 3);
if (language[0]) {
language[3] = 0;
@@ -874,7 +874,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
} else if (!ff_guidcmp(g, timestamp_guid)) {
int stream_index = ff_find_stream_index(s, sid);
if (stream_index >= 0) {
- url_fskip(pb, 8);
+ avio_fskip(pb, 8);
wtv->pts = avio_get_le64(pb);
consumed += 16;
if (wtv->pts == -1)
@@ -885,7 +885,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
wtv->epoch = wtv->pts;
if (mode == SEEK_TO_PTS && wtv->pts >= seekts) {
#define WTV_PAD8(x) (((x) + 7) & ~7)
- url_fskip(pb, WTV_PAD8(len) - consumed);
+ avio_fskip(pb, WTV_PAD8(len) - consumed);
return 0;
}
}
@@ -923,7 +923,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
} else
av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g));
- url_fskip(pb, WTV_PAD8(len) - consumed);
+ avio_fskip(pb, WTV_PAD8(len) - consumed);
}
return AVERROR_EOF;
}
@@ -954,16 +954,16 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
wtv->last_valid_pts = AV_NOPTS_VALUE;
/* read root directory sector */
- url_fskip(s->pb, 0x30);
+ avio_fskip(s->pb, 0x30);
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);
+ avio_fskip(s->pb, 4);
root_sector = avio_get_le32(s->pb);
- url_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET);
+ avio_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET);
root_size = avio_get_buffer(s->pb, root, root_size);
if (root_size < 0)
return AVERROR_INVALIDDATA;
@@ -978,9 +978,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
ret = parse_chunks(s, SEEK_TO_DATA, 0, 0);
if (ret < 0)
return ret;
- url_fseek(wtv->pb, -32, SEEK_CUR);
+ avio_fseek(wtv->pb, -32, SEEK_CUR);
- timeline_pos = url_ftell(s->pb); // save before opening another file
+ timeline_pos = avio_ftell(s->pb); // save before opening another file
/* read metadata */
pb = wtvfile_open(s, root, root_size, table_0_entries_legacy_attrib_le16);
@@ -997,7 +997,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
while(1) {
uint64_t timestamp = avio_get_le64(pb);
uint64_t frame_nb = avio_get_le64(pb);
- if (url_feof(pb))
+ if (avio_feof(pb))
break;
ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size,
0, timestamp, frame_nb, 0, AVINDEX_KEYFRAME);
@@ -1011,7 +1011,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
while (1) {
uint64_t frame_nb = avio_get_le64(pb);
uint64_t position = avio_get_le64(pb);
- if (url_feof(pb))
+ if (avio_feof(pb))
break;
for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
AVIndexEntry *e = wtv->index_entries + i;
@@ -1028,7 +1028,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
}
}
- url_fseek(s->pb, timeline_pos, SEEK_SET);
+ avio_fseek(s->pb, timeline_pos, SEEK_SET);
return 0;
}
@@ -1047,7 +1047,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return ret;
pkt->stream_index = stream_index;
pkt->pts = wtv->pts;
- url_fskip(pb, WTV_PAD8(len) - len);
+ avio_fskip(pb, WTV_PAD8(len) - len);
return 0;
}
@@ -1072,9 +1072,9 @@ static int read_seek(AVFormatContext *s, int stream_index,
i = ff_index_search_timestamp(wtv->index_entries, wtv->nb_index_entries, ts_relative, flags);
if (i < 0) {
if (wtv->last_valid_pts == AV_NOPTS_VALUE || ts < wtv->last_valid_pts)
- url_fseek(pb, 0, SEEK_SET);
+ avio_fseek(pb, 0, SEEK_SET);
else if (st->duration != AV_NOPTS_VALUE && ts_relative > st->duration && wtv->nb_index_entries)
- url_fseek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET);
+ avio_fseek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET);
if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0)
return AVERROR(ERANGE);
return 0;
@@ -1083,7 +1083,7 @@ static int read_seek(AVFormatContext *s, int stream_index,
if (wtv->epoch != AV_NOPTS_VALUE)
wtv->pts += wtv->epoch;
wtv->last_valid_pts = wtv->pts;
- url_fseek(pb, wtv->index_entries[i].pos, SEEK_SET);
+ avio_fseek(pb, wtv->index_entries[i].pos, SEEK_SET);
return 0;
}
diff --git a/libavformat/wv.c b/libavformat/wv.c
index e6d0268..9fb4463 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -84,7 +84,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
int rate, bpp, chan;
uint32_t chmask;
- wc->pos = url_ftell(pb);
+ wc->pos = avio_ftell(pb);
if(!append){
tag = avio_get_le32(pb);
if (tag != MKTAG('w', 'v', 'p', 'k'))
@@ -120,12 +120,12 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
chmask = wc->chmask;
}
if((rate == -1 || !chan) && !wc->block_parsed){
- int64_t block_end = url_ftell(pb) + wc->blksize - 24;
+ int64_t block_end = avio_ftell(pb) + wc->blksize - 24;
if(url_is_streamed(pb)){
av_log(ctx, AV_LOG_ERROR, "Cannot determine additional parameters\n");
return -1;
}
- while(url_ftell(pb) < block_end){
+ while(avio_ftell(pb) < block_end){
int id, size;
id = avio_get_byte(pb);
size = (id & 0x80) ? avio_get_le24(pb) : avio_get_byte(pb);
@@ -153,7 +153,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
chmask = avio_get_le32(pb);
break;
case 5:
- url_fskip(pb, 1);
+ avio_fskip(pb, 1);
chan |= (avio_get_byte(pb) & 0xF) << 8;
chmask = avio_get_le24(pb);
break;
@@ -166,16 +166,16 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
rate = avio_get_le24(pb);
break;
default:
- url_fskip(pb, size);
+ avio_fskip(pb, size);
}
if(id&0x40)
- url_fskip(pb, 1);
+ avio_fskip(pb, 1);
}
if(rate == -1){
av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
return -1;
}
- url_fseek(pb, block_end - wc->blksize + 24, SEEK_SET);
+ avio_fseek(pb, block_end - wc->blksize + 24, SEEK_SET);
}
if(!wc->bpp) wc->bpp = bpp;
if(!wc->chan) wc->chan = chan;
@@ -224,11 +224,11 @@ static int wv_read_header(AVFormatContext *s,
st->duration = wc->samples;
if(!url_is_streamed(s->pb)) {
- int64_t cur = url_ftell(s->pb);
+ int64_t cur = avio_ftell(s->pb);
ff_ape_parse_tag(s);
if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX))
ff_id3v1_read(s);
- url_fseek(s->pb, cur, SEEK_SET);
+ avio_fseek(s->pb, cur, SEEK_SET);
}
return 0;
@@ -241,7 +241,7 @@ static int wv_read_packet(AVFormatContext *s,
int ret;
int size, ver, off;
- if (url_feof(s->pb))
+ if (avio_feof(s->pb))
return AVERROR(EIO);
if(wc->block_parsed){
if(wv_read_block_header(s, s->pb, 0) < 0)
@@ -320,18 +320,18 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
/* if found, seek there */
if (index >= 0){
wc->block_parsed = 1;
- url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
+ avio_fseek(s->pb, st->index_entries[index].pos, SEEK_SET);
return 0;
}
/* if timestamp is out of bounds, return error */
if(timestamp < 0 || timestamp >= s->duration)
return -1;
- pos = url_ftell(s->pb);
+ pos = avio_ftell(s->pb);
do{
ret = av_read_frame(s, pkt);
if (ret < 0){
- url_fseek(s->pb, pos, SEEK_SET);
+ avio_fseek(s->pb, pos, SEEK_SET);
return -1;
}
pts = pkt->pts;
diff --git a/libavformat/xa.c b/libavformat/xa.c
index f0ec228..3946ed9 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -76,9 +76,9 @@ 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 */
+ avio_fskip(pb, 4); /* Skip the XA ID */
xa->out_size = avio_get_le32(pb);
- url_fskip(pb, 2); /* Skip the tag */
+ avio_fskip(pb, 2); /* Skip the tag */
st->codec->channels = avio_get_le16(pb);
st->codec->sample_rate = avio_get_le32(pb);
/* Value in file is average byte rate*/
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 4cfc3a6..070e6c3 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -81,7 +81,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
video_dec->codec_type = AVMEDIA_TYPE_VIDEO;
video_dec->codec_id = CODEC_ID_YOP;
- url_fskip(pb, 6);
+ avio_fskip(pb, 6);
frame_rate = avio_get_byte(pb);
yop->frame_size = avio_get_byte(pb) * 2048;
@@ -104,7 +104,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR_INVALIDDATA;
}
- url_fseek(pb, 2048, SEEK_SET);
+ avio_fseek(pb, 2048, SEEK_SET);
av_set_pts_info(video_stream, 32, 1, frame_rate);
@@ -136,7 +136,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0)
return ret;
- yop->video_packet.pos = url_ftell(pb);
+ yop->video_packet.pos = avio_ftell(pb);
ret = avio_get_buffer(pb, yop->video_packet.data, yop->palette_size);
if (ret < 0) {
@@ -153,7 +153,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
// Set position to the start of the frame
pkt->pos = yop->video_packet.pos;
- url_fskip(pb, yop->audio_block_length - ret);
+ avio_fskip(pb, yop->audio_block_length - ret);
ret = avio_get_buffer(pb, yop->video_packet.data + yop->palette_size,
actual_video_data_size);
@@ -190,7 +190,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
return -1;
pos_min = s->data_offset;
- pos_max = url_fsize(s->pb) - yop->frame_size;
+ pos_max = avio_fsize(s->pb) - yop->frame_size;
frame_count = (pos_max - pos_min) / yop->frame_size;
timestamp = FFMAX(0, FFMIN(frame_count, timestamp));
@@ -198,7 +198,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
frame_pos = timestamp * yop->frame_size + pos_min;
yop->odd_frame = timestamp & 1;
- url_fseek(s->pb, frame_pos, SEEK_SET);
+ avio_fseek(s->pb, frame_pos, SEEK_SET);
return 0;
}
--
1.7.2.3
More information about the ffmpeg-devel
mailing list