diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-03-04 21:57:36 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-07 19:03:39 +0300 |
commit | 76aa876e69cf78a40821e66dec0a1006e4eb23ec (patch) | |
tree | 48122de51aeb99266e25f78bc715296e7fe85d59 | |
parent | e51975392d85e72801193123945a35fb5221248f (diff) |
avio: avio_ prefix for url_fsize
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
-rw-r--r-- | ffmpeg.c | 4 | ||||
-rw-r--r-- | ffplay.c | 2 | ||||
-rw-r--r-- | libavformat/apetag.c | 2 | ||||
-rw-r--r-- | libavformat/avidec.c | 8 | ||||
-rw-r--r-- | libavformat/avio.h | 3 | ||||
-rw-r--r-- | libavformat/aviobuf.c | 6 | ||||
-rw-r--r-- | libavformat/cafdec.c | 2 | ||||
-rw-r--r-- | libavformat/cdg.c | 2 | ||||
-rw-r--r-- | libavformat/dv.c | 2 | ||||
-rw-r--r-- | libavformat/ffmdec.c | 2 | ||||
-rw-r--r-- | libavformat/filmstripdec.c | 2 | ||||
-rw-r--r-- | libavformat/flvdec.c | 2 | ||||
-rw-r--r-- | libavformat/gxfenc.c | 2 | ||||
-rw-r--r-- | libavformat/id3v1.c | 2 | ||||
-rw-r--r-- | libavformat/img2.c | 2 | ||||
-rw-r--r-- | libavformat/libnut.c | 2 | ||||
-rw-r--r-- | libavformat/mov.c | 4 | ||||
-rw-r--r-- | libavformat/nutdec.c | 2 | ||||
-rw-r--r-- | libavformat/oggdec.c | 2 | ||||
-rw-r--r-- | libavformat/r3d.c | 2 | ||||
-rw-r--r-- | libavformat/sauce.c | 2 | ||||
-rw-r--r-- | libavformat/tty.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 6 | ||||
-rw-r--r-- | libavformat/vocdec.c | 2 | ||||
-rw-r--r-- | libavformat/yop.c | 2 |
25 files changed, 37 insertions, 32 deletions
@@ -1350,8 +1350,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'; @@ -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_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 c3c57717bd..fb46d2bac2 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 79e86ad613..83b86d8146 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 22f11bb6ba..6da0cfa1bb 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); /** @@ -491,7 +492,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 b21d3e3cf0..aebdd7211a 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 bc0a7760ea..9db7608ddd 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 ed3d78285b..8fa38f74e9 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 4e256d7d39..1e32125c23 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 2977527b97..53eaa8e6f7 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 1741d57d30..8d56b0e340 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 6113d951bf..7e02cdd3b4 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 ea9755fcd2..44b5020db0 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 e17e785ad5..0152e39654 100644 --- a/libavformat/id3v1.c +++ b/libavformat/id3v1.c @@ -230,7 +230,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 a9a4a49023..c909078ecf 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 28bf76dc84..1c13e295f7 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 e9435a93c6..34b5f8e754 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 8c1ba28599..107ff6815f 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 2eb9e03f76..379de7eac1 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 6cda30fd31..39f97ff9aa 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 ba737df1ce..8f1acb4a77 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 dabbe972cb..71c00e7e0a 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 91bc4a2025..abe3cf9021 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 07aeb8b321..f4fb8cc37b 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 6c450c7cf7..20de06ca85 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)); |