diff --git a/ffmpeg.c b/ffmpeg.c
index 922aadc6ec76ef89dae342bf77f8f3938825dba0..3b0dd1bdb8d943f2508d3d2c1d22a7269756aac1 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1364,8 +1364,8 @@ 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 = avio_size(oc->pb);
+    if(total_size<0) // FIXME improve avio_size() so it works with non seekable output too
         total_size= avio_tell(oc->pb);
 
     buf[0] = '\0';
diff --git a/ffplay.c b/ffplay.c
index 0492d63cbacb3f53ebf33c6f479e7406b1bc3479..2c014f70d14ed19420eb5d6eb7543f9764bac1ae 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2842,7 +2842,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_size(cur_stream->ic->pb);
                     stream_seek(cur_stream, size*x/cur_stream->width, 0, 1);
                 }else{
                     int64_t ts;
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index c3c57717bd5d92d88fa659413da41819879a498e..fb46d2bac25e3074290dc9e7598acac01ca45f5f 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_size(pb);
     uint32_t val, fields, tag_bytes;
     uint8_t buf[8];
     int i;
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 79e86ad61389d934cfdbba65c32688d93b636e1e..83b86d81462b3b4135b9315b824b5686a3d30704 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -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_size(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",
@@ -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_size(pb);
     if(avi->fsize<=0)
         avi->fsize= avi->riff_end == 8 ? INT64_MAX : avi->riff_end;
 
@@ -378,7 +378,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
             if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
                 avi->movi_list = avio_tell(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_size(pb);
                 av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
                 goto end_of_header;
             }
@@ -705,7 +705,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
                 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 = avio_tell(pb) - 4;
-                avi->movi_end  = url_fsize(pb);
+                avi->movi_end  = avio_size(pb);
                 goto end_of_header;
             }
             /* skip tag */
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 20e1dc4d5a378475fbe0c88a548faf5ee5f966d5..b133ade90625a58405cfed6197c4fc057fa9f4f1 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -426,6 +426,7 @@ attribute_deprecated int url_fclose(AVIOContext *s);
 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);
 #define URL_EOF (-1)
 attribute_deprecated int url_fgetc(AVIOContext *s);
 /**
@@ -485,7 +486,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
  * Get the filesize.
  * @return filesize or AVERROR
  */
-int64_t url_fsize(AVIOContext *s);
+int64_t avio_size(AVIOContext *s);
 
 /**
  * feof() equivalent for AVIOContext.
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index b21d3e3cf0e50acefee99d7dff9524d1fea4279b..aebdd7211a0230ce5ef26d7659949f190cffda0f 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -246,7 +246,7 @@ int64_t url_ftell(AVIOContext *s)
 }
 #endif
 
-int64_t url_fsize(AVIOContext *s)
+int64_t avio_size(AVIOContext *s)
 {
     int64_t size;
 
@@ -371,6 +371,10 @@ int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
 {
     return avio_seek(s, offset, whence);
 }
+int64_t url_fsize(AVIOContext *s)
+{
+    return avio_size(s);
+}
 #endif
 
 int avio_put_str(AVIOContext *s, const char *str)
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 96403d3b9e798ada78c69b88a0b672485147633a..829dff44bbe3c4bbdd2a62e30ef75c20e4cf029b 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -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_size(pb);
     s->file_size = FFMAX(0, s->file_size);
 
     av_set_pts_info(st, 64, 1, st->codec->sample_rate);
diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index ed3d78285b6086d71d2ab0c319a5ab8cc9ba5d90..8fa38f74e936ed4f4b7168fb3c50915968bc43e2 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_size(s->pb);
     if (ret > 0)
         vst->duration = (ret * vst->time_base.den) / (CDG_PACKET_SIZE * 300);
 
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 4e256d7d3937940227641f846767bb2c493e3c1d..1e32125c23660bff8e9bb735cb40cca01324148e 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_size(s->pb) - s->data_offset;
     int64_t max_offset = ((size-1) / sys->frame_size) * sys->frame_size;
 
     offset = sys->frame_size * timestamp;
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index b956c75f86dbed7d381cf0d1a796c8c7c33004e8..eafe4802b7ce30f43628a86e4b2d3bb882956217 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -282,7 +282,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
     ffm->write_index = avio_rb64(pb);
     /* get also filesize */
     if (!url_is_streamed(pb)) {
-        ffm->file_size = url_fsize(pb);
+        ffm->file_size = avio_size(pb);
         if (ffm->write_index)
             adjust_write_index(s);
     } else {
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 1741d57d3000f3813a14239f1233de34e54b6b98..8d56b0e3408e1c11f7611a3a5ae951c3feccd778 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);
 
-    avio_seek(pb, url_fsize(pb) - 36, SEEK_SET);
+    avio_seek(pb, avio_size(pb) - 36, SEEK_SET);
     if (avio_rb32(pb) != RAND_TAG) {
         av_log(s, AV_LOG_ERROR, "magic number not found");
         return AVERROR_INVALIDDATA;
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 6113d951bfeca2b2c4a293b82e31dfe257e06e6f..7e02cdd3b46ca4bb9f571476dca81a7fe464e050 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -373,7 +373,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
     if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){
         int size;
         const int64_t pos= avio_tell(s->pb);
-        const int64_t fsize= url_fsize(s->pb);
+        const int64_t fsize= avio_size(s->pb);
         avio_seek(s->pb, fsize-4, SEEK_SET);
         size= avio_rb32(s->pb);
         avio_seek(s->pb, fsize-3-size, SEEK_SET);
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index ea9755fcd21e842d208321972a326ea829ec1f23..44b5020db0eabbb75bb2177515449843a3dfd4b2 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -310,7 +310,7 @@ static int gxf_write_material_data_section(AVFormatContext *s)
     /* estimated size */
     avio_w8(pb, MAT_SIZE);
     avio_w8(pb, 4);
-    avio_wb32(pb, url_fsize(pb) / 1024);
+    avio_wb32(pb, avio_size(pb) / 1024);
 
     return updateSize(pb, pos);
 }
diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c
index 699869898d3a8876f1b6d44c5f248157c1cc7b02..4f9b5840ecd426dcd366db537eb699d16e2e9844 100644
--- a/libavformat/id3v1.c
+++ b/libavformat/id3v1.c
@@ -231,7 +231,7 @@ void ff_id3v1_read(AVFormatContext *s)
 
     if (!url_is_streamed(s->pb)) {
         /* XXX: change that */
-        filesize = url_fsize(s->pb);
+        filesize = avio_size(s->pb);
         if (filesize > 128) {
             avio_seek(s->pb, filesize - 128, SEEK_SET);
             ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE);
diff --git a/libavformat/img2.c b/libavformat/img2.c
index a9a4a49023465ef01405d9a0559a26477d0a7a8d..c909078ecf3791f411286c7d59106f02ae60c498 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -276,7 +276,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_size(f[i]);
 
             if(codec->codec_id != CODEC_ID_RAWVIDEO)
                 break;
diff --git a/libavformat/libnut.c b/libavformat/libnut.c
index 28bf76dc8463fdb075d59253f940a0633a106204..1c13e295f7cda8f81f971e6d64c6f87b6b650bef 100644
--- a/libavformat/libnut.c
+++ b/libavformat/libnut.c
@@ -179,7 +179,7 @@ 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_size(bc) + pos;
         whence = SEEK_SET;
     }
     return avio_seek(bc, pos, whence);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index be799a4fdcaab24fd9f283d15f48910830a75f5a..d3e95980a98c661ec35a1c4289d03044f08605ea 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -304,7 +304,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
             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_size(pb)))
                 return 0;
             left = a.size - avio_tell(pb) + start_pos;
             if (left > 0) /* skip garbage at atom end */
@@ -2351,7 +2351,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_size(pb);
     else
         atom.size = INT64_MAX;
 
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 8c1ba285992682a6ee26a510b6efc73220017789..107ff6815f396e671e6e6d13442d219cc4fab681 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -508,7 +508,7 @@ 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_size(bc);
     int64_t *syncpoints;
     int8_t *has_keyframe;
     int ret= -1;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 2eb9e03f7618650e7a99097c2ceaa8196172314b..379de7eac1dad91b271a75b9e337ce90700d7ba5 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -462,7 +462,7 @@ ogg_get_length (AVFormatContext * s)
     if (s->duration != AV_NOPTS_VALUE)
         return 0;
 
-    size = url_fsize(s->pb);
+    size = avio_size(s->pb);
     if(size < 0)
         return 0;
     end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0;
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 6cda30fd3116a958a410eaa939a840003d847c9e..39f97ff9aaf843a7ca234e407ac5ff3c39b8338f 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -180,7 +180,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
     if (url_is_streamed(s->pb))
         return 0;
     // find REOB/REOF/REOS to load index
-    avio_seek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET);
+    avio_seek(s->pb, avio_size(s->pb)-48-8, SEEK_SET);
     if (read_atom(s, &atom) < 0)
         av_log(s, AV_LOG_ERROR, "error reading end atom\n");
 
diff --git a/libavformat/sauce.c b/libavformat/sauce.c
index ba737df1ce5519267cc0d0f502c5fab69574f45f..8f1acb4a774e53b7834c0f91e57ccfccb23ffa8d 100644
--- a/libavformat/sauce.c
+++ b/libavformat/sauce.c
@@ -33,7 +33,7 @@ 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_size(pb) - 128;
 
     avio_seek(pb, start_pos, SEEK_SET);
     if (avio_read(pb, buf, 7) != 7)
diff --git a/libavformat/tty.c b/libavformat/tty.c
index dabbe972cbfa4788b69a3201261fda6eb238f13b..71c00e7e0abdba1e2d666ba50b52e0cf979ddc18 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -89,7 +89,7 @@ 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_size(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)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0f239fe99c9652d7482b6baec7709246e411b914..25c600ab0e98b38128db59093d79512985fe9fbf 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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_size(s->pb);
         pos_max = filesize - 1;
         do{
             pos_max -= step;
@@ -1666,7 +1666,7 @@ 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_size(s->pb) - 1;
 
     if     (pos < pos_min) pos= pos_min;
     else if(pos > pos_max) pos= pos_max;
@@ -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_size(ic->pb);
         if (file_size < 0)
             file_size = 0;
     }
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index 07aeb8b321e20741c378af4f53ec79afb78c6289..f4fb8cc37b0612ee2cf42eded758a57410e86e8f 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -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) - avio_tell(pb);
+            voc->remaining_size = avio_size(pb) - avio_tell(pb);
         }
         max_size -= 4;
 
diff --git a/libavformat/yop.c b/libavformat/yop.c
index 6c450c7cf708e24f4fffb01c2aad47ea526ff9ee..20de06ca852fff2dd6f7e6105a21d272a927629f 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -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_size(s->pb) - yop->frame_size;
     frame_count    = (pos_max - pos_min) / yop->frame_size;
 
     timestamp      = FFMAX(0, FFMIN(frame_count, timestamp));