Revision a2704c97

View differences:

ffmpeg.c
1352 1352

  
1353 1353
    total_size = url_fsize(oc->pb);
1354 1354
    if(total_size<0) // FIXME improve url_fsize() so it works with non seekable output too
1355
        total_size= url_ftell(oc->pb);
1355
        total_size= avio_tell(oc->pb);
1356 1356

  
1357 1357
    buf[0] = '\0';
1358 1358
    ti1 = 1e10;
......
2555 2555
        }
2556 2556

  
2557 2557
        /* finish if limit size exhausted */
2558
        if (limit_filesize != 0 && limit_filesize <= url_ftell(output_files[0]->pb))
2558
        if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb))
2559 2559
            break;
2560 2560

  
2561 2561
        /* read a frame from it and output it in the fifo */
ffplay.c
2805 2805
                        }else if(cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos>=0){
2806 2806
                            pos= cur_stream->audio_pkt.pos;
2807 2807
                        }else
2808
                            pos = url_ftell(cur_stream->ic->pb);
2808
                            pos = avio_tell(cur_stream->ic->pb);
2809 2809
                        if (cur_stream->ic->bit_rate)
2810 2810
                            incr *= cur_stream->ic->bit_rate / 8.0;
2811 2811
                        else
libavformat/4xm.c
283 283
                return AVERROR(EIO);
284 284
            pkt->stream_index = fourxm->video_stream_index;
285 285
            pkt->pts = fourxm->video_pts;
286
            pkt->pos = url_ftell(s->pb);
286
            pkt->pos = avio_tell(s->pb);
287 287
            memcpy(pkt->data, header, 8);
288 288
            ret = avio_read(s->pb, &pkt->data[8], size);
289 289

  
libavformat/aiffdec.c
232 232
            get_meta(s, "comment"  , size);
233 233
            break;
234 234
        case MKTAG('S', 'S', 'N', 'D'):     /* Sampled sound chunk */
235
            aiff->data_end = url_ftell(pb) + size;
235
            aiff->data_end = avio_tell(pb) + size;
236 236
            offset = avio_rb32(pb);      /* Offset of sound data */
237 237
            avio_rb32(pb);               /* BlockSize... don't care */
238
            offset += url_ftell(pb);    /* Compute absolute data offset */
238
            offset += avio_tell(pb);    /* Compute absolute data offset */
239 239
            if (st->codec->block_align)    /* Assume COMM already parsed */
240 240
                goto got_sound;
241 241
            if (url_is_streamed(pb)) {
......
292 292
    int res, size;
293 293

  
294 294
    /* calculate size of remaining data */
295
    max_size = aiff->data_end - url_ftell(s->pb);
295
    max_size = aiff->data_end - avio_tell(s->pb);
296 296
    if (max_size <= 0)
297 297
        return AVERROR_EOF;
298 298

  
libavformat/aiffenc.c
45 45

  
46 46
    /* FORM AIFF header */
47 47
    ffio_wfourcc(pb, "FORM");
48
    aiff->form = url_ftell(pb);
48
    aiff->form = avio_tell(pb);
49 49
    avio_wb32(pb, 0);                    /* file length */
50 50
    ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF");
51 51

  
......
66 66
    avio_wb32(pb, aifc ? 24 : 18); /* size */
67 67
    avio_wb16(pb, enc->channels);  /* Number of channels */
68 68

  
69
    aiff->frames = url_ftell(pb);
69
    aiff->frames = avio_tell(pb);
70 70
    avio_wb32(pb, 0);              /* Number of frames */
71 71

  
72 72
    if (!enc->bits_per_coded_sample)
......
90 90

  
91 91
    /* Sound data chunk */
92 92
    ffio_wfourcc(pb, "SSND");
93
    aiff->ssnd = url_ftell(pb);         /* Sound chunk size */
93
    aiff->ssnd = avio_tell(pb);         /* Sound chunk size */
94 94
    avio_wb32(pb, 0);                    /* Sound samples data size */
95 95
    avio_wb32(pb, 0);                    /* Data offset */
96 96
    avio_wb32(pb, 0);                    /* Block-size (block align) */
......
118 118

  
119 119
    /* Chunks sizes must be even */
120 120
    int64_t file_size, end_size;
121
    end_size = file_size = url_ftell(pb);
121
    end_size = file_size = avio_tell(pb);
122 122
    if (file_size & 1) {
123 123
        avio_w8(pb, 0);
124 124
        end_size++;
libavformat/amr.c
154 154
    }
155 155

  
156 156
    pkt->stream_index = 0;
157
    pkt->pos= url_ftell(s->pb);
157
    pkt->pos= avio_tell(s->pb);
158 158
    pkt->data[0]=toc;
159 159
    pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
160 160
    read = avio_read(s->pb, pkt->data+1, size-1);
libavformat/anm.c
208 208
    }
209 209

  
210 210
    /* fetch record size */
211
    tmp = url_ftell(pb);
211
    tmp = avio_tell(pb);
212 212
    avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
213 213
              8 + anm->record * 2, SEEK_SET);
214 214
    record_size = avio_rl16(pb);
libavformat/asfdec.c
160 160
static void get_tag(AVFormatContext *s, const char *key, int type, int len)
161 161
{
162 162
    char *value;
163
    int64_t off = url_ftell(s->pb);
163
    int64_t off = avio_tell(s->pb);
164 164

  
165 165
    if ((unsigned)len >= (UINT_MAX - 1)/2)
166 166
        return;
......
226 226
        return AVERROR(EINVAL);
227 227
    }
228 228

  
229
    pos1 = url_ftell(pb);
229
    pos1 = avio_tell(pb);
230 230

  
231 231
    st = av_new_stream(s, 0);
232 232
    if (!st)
......
301 301
            st->need_parsing = AVSTREAM_PARSE_FULL;
302 302
        }
303 303
        /* We have to init the frame size at some point .... */
304
        pos2 = url_ftell(pb);
304
        pos2 = avio_tell(pb);
305 305
        if (size >= (pos2 + 8 - pos1 + 24)) {
306 306
            asf_st->ds_span = avio_r8(pb);
307 307
            asf_st->ds_packet_size = avio_rl16(pb);
......
338 338
                break;
339 339
        }
340 340
    } else if (type == AVMEDIA_TYPE_VIDEO &&
341
            size - (url_ftell(pb) - pos1 + 24) >= 51) {
341
            size - (avio_tell(pb) - pos1 + 24) >= 51) {
342 342
        avio_rl32(pb);
343 343
        avio_rl32(pb);
344 344
        avio_r8(pb);
......
387 387
        if(st->codec->codec_id == CODEC_ID_H264)
388 388
            st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
389 389
    }
390
    pos2 = url_ftell(pb);
390
    pos2 = avio_tell(pb);
391 391
    avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR);
392 392

  
393 393
    return 0;
......
595 595
    avio_r8(pb);
596 596
    memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
597 597
    for(;;) {
598
        uint64_t gpos= url_ftell(pb);
598
        uint64_t gpos= avio_tell(pb);
599 599
        ff_get_guid(pb, &g);
600 600
        gsize = avio_rl64(pb);
601 601
        av_dlog(s, "%08"PRIx64": ", gpos);
602 602
        print_guid(&g);
603 603
        av_dlog(s, "  size=0x%"PRIx64"\n", gsize);
604 604
        if (!ff_guidcmp(&g, &ff_asf_data_header)) {
605
            asf->data_object_offset = url_ftell(pb);
605
            asf->data_object_offset = avio_tell(pb);
606 606
            // if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
607 607
            if (!(asf->hdr.flags & 0x01) && gsize >= 100) {
608 608
                asf->data_object_size = gsize - 24;
......
652 652
                }
653 653
            }
654 654
        }
655
        if(url_ftell(pb) != gpos + gsize)
656
            av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize);
655
        if(avio_tell(pb) != gpos + gsize)
656
            av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", avio_tell(pb)-gpos, gsize);
657 657
        avio_seek(pb, gpos + gsize, SEEK_SET);
658 658
    }
659 659
    ff_get_guid(pb, &g);
......
662 662
    avio_r8(pb);
663 663
    if (url_feof(pb))
664 664
        return -1;
665
    asf->data_offset = url_ftell(pb);
665
    asf->data_offset = avio_tell(pb);
666 666
    asf->packet_size_left = 0;
667 667

  
668 668

  
......
726 726
    // if we do not know packet size, allow skipping up to 32 kB
727 727
    off= 32768;
728 728
    if (s->packet_size > 0)
729
        off= (url_ftell(pb) - s->data_offset) % s->packet_size + 3;
729
        off= (avio_tell(pb) - s->data_offset) % s->packet_size + 3;
730 730

  
731 731
    c=d=e=-1;
732 732
    while(off-- > 0){
......
746 746
        if (url_ferror(pb) == AVERROR(EAGAIN))
747 747
            return AVERROR(EAGAIN);
748 748
        if (!url_feof(pb))
749
            av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, url_ftell(pb));
749
            av_log(s, AV_LOG_ERROR, "ff asf bad header %x  at:%"PRId64"\n", c, avio_tell(pb));
750 750
    }
751 751
    if ((c & 0x8f) == 0x82) {
752 752
        if (d || e) {
......
770 770

  
771 771
    //the following checks prevent overflows and infinite loops
772 772
    if(!packet_length || packet_length >= (1U<<29)){
773
        av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, url_ftell(pb));
773
        av_log(s, AV_LOG_ERROR, "invalid packet_length %d at:%"PRId64"\n", packet_length, avio_tell(pb));
774 774
        return -1;
775 775
    }
776 776
    if(padsize >= packet_length){
777
        av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, url_ftell(pb));
777
        av_log(s, AV_LOG_ERROR, "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb));
778 778
        return -1;
779 779
    }
780 780

  
......
892 892
            || asf->packet_segments < 1) {
893 893
            //asf->packet_size_left <= asf->packet_padsize) {
894 894
            int ret = asf->packet_size_left + asf->packet_padsize;
895
            //printf("PacketLeftSize:%d  Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
895
            //printf("PacketLeftSize:%d  Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, avio_tell(pb));
896 896
            assert(ret>=0);
897 897
            /* fail safe */
898 898
            avio_seek(pb, ret, SEEK_CUR);
899 899

  
900
            asf->packet_pos= url_ftell(pb);
900
            asf->packet_pos= avio_tell(pb);
901 901
            if (asf->data_object_size != (uint64_t)-1 &&
902 902
                (asf->packet_pos - asf->data_object_offset >= asf->data_object_size))
903 903
                return AVERROR_EOF; /* Do not exceed the size of the data object */
......
1185 1185
{
1186 1186
    ff_asf_guid g;
1187 1187
    ASFContext *asf = s->priv_data;
1188
    int64_t current_pos= url_ftell(s->pb);
1188
    int64_t current_pos= avio_tell(s->pb);
1189 1189
    int i;
1190 1190

  
1191 1191
    avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
......
1268 1268
    //    avio_seek(s->pb, pos, SEEK_SET);
1269 1269
    //    key_pos = pos;
1270 1270
    //     for(i=0;i<16;i++){
1271
    //         pos = url_ftell(s->pb);
1271
    //         pos = avio_tell(s->pb);
1272 1272
    //         if (av_read_frame(s, &pkt) < 0){
1273 1273
    //             av_log(s, AV_LOG_INFO, "seek failed\n");
1274 1274
    //             return -1;
libavformat/asfenc.c
248 248
{
249 249
    int64_t pos;
250 250

  
251
    pos = url_ftell(pb);
251
    pos = avio_tell(pb);
252 252
    put_guid(pb, g);
253 253
    avio_wl64(pb, 24);
254 254
    return pos;
......
259 259
{
260 260
    int64_t pos1;
261 261

  
262
    pos1 = url_ftell(pb);
262
    pos1 = avio_tell(pb);
263 263
    avio_seek(pb, pos + 16, SEEK_SET);
264 264
    avio_wl64(pb, pos1 - pos);
265 265
    avio_seek(pb, pos1, SEEK_SET);
......
337 337
    avio_w8(pb, 2); /* ??? */
338 338

  
339 339
    /* file header */
340
    header_offset = url_ftell(pb);
340
    header_offset = avio_tell(pb);
341 341
    hpos = put_header(pb, &ff_asf_file_header);
342 342
    put_guid(pb, &ff_asf_my_guid);
343 343
    avio_wl64(pb, file_size);
......
425 425
            put_guid(pb, &ff_asf_video_conceal_none);
426 426
        }
427 427
        avio_wl64(pb, 0); /* ??? */
428
        es_pos = url_ftell(pb);
428
        es_pos = avio_tell(pb);
429 429
        avio_wl32(pb, extra_size); /* wav header len */
430 430
        avio_wl32(pb, extra_size2); /* additional data len */
431 431
        avio_wl16(pb, n + 1); /* stream number */
......
442 442
            if (wavsize < 0)
443 443
                return -1;
444 444
            if (wavsize != extra_size) {
445
                cur_pos = url_ftell(pb);
445
                cur_pos = avio_tell(pb);
446 446
                avio_seek(pb, es_pos, SEEK_SET);
447 447
                avio_wl32(pb, wavsize); /* wav header len */
448 448
                avio_seek(pb, cur_pos, SEEK_SET);
......
525 525

  
526 526
    /* patch the header size fields */
527 527

  
528
    cur_pos = url_ftell(pb);
528
    cur_pos = avio_tell(pb);
529 529
    header_size = cur_pos - header_offset;
530 530
    if (asf->is_streamed) {
531 531
        header_size += 8 + 30 + 50;
......
605 605
    ASFContext *asf = s->priv_data;
606 606
    AVIOContext *pb = s->pb;
607 607
    int ppi_size, i;
608
    int64_t start= url_ftell(pb);
608
    int64_t start= avio_tell(pb);
609 609

  
610 610
    int iLengthTypeFlags = ASF_PPI_LENGTH_TYPE_FLAGS;
611 611

  
......
642 642
    if (asf->multi_payloads_present)
643 643
        avio_w8(pb, nb_payloads | ASF_PAYLOAD_FLAGS);
644 644

  
645
    ppi_size = url_ftell(pb) - start;
645
    ppi_size = avio_tell(pb) - start;
646 646

  
647 647
    return ppi_size;
648 648
}
......
860 860
        flush_packet(s);
861 861

  
862 862
    /* write index */
863
    data_size = url_ftell(s->pb);
863
    data_size = avio_tell(s->pb);
864 864
    if ((!asf->is_streamed) && (asf->nb_index_count != 0)) {
865 865
        asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
866 866
    }
......
870 870
        put_chunk(s, 0x4524, 0, 0); /* end of stream */
871 871
    } else {
872 872
        /* rewrite an updated header */
873
        file_size = url_ftell(s->pb);
873
        file_size = avio_tell(s->pb);
874 874
        avio_seek(s->pb, 0, SEEK_SET);
875 875
        asf_write_header1(s, file_size, data_size - asf->data_offset);
876 876
    }
libavformat/au.c
94 94
    if (!url_is_streamed(s->pb)) {
95 95

  
96 96
        /* update file size */
97
        file_size = url_ftell(pb);
97
        file_size = avio_tell(pb);
98 98
        avio_seek(pb, 8, SEEK_SET);
99 99
        avio_wb32(pb, (uint32_t)(file_size - 24));
100 100
        avio_seek(pb, file_size, SEEK_SET);
libavformat/avidec.c
109 109
    /* check RIFF header */
110 110
    avio_read(pb, header, 4);
111 111
    avi->riff_end = avio_rl32(pb);  /* RIFF chunk size */
112
    avi->riff_end += url_ftell(pb); /* RIFF chunk end */
112
    avi->riff_end += avio_tell(pb); /* RIFF chunk end */
113 113
    avio_read(pb, header+4, 4);
114 114

  
115 115
    for(i=0; avi_headers[i][0]; i++)
......
198 198
            if(url_feof(pb))
199 199
                return -1;
200 200

  
201
            pos = url_ftell(pb);
201
            pos = avio_tell(pb);
202 202

  
203 203
            if(avi->odml_depth > MAX_ODML_DEPTH){
204 204
                av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n");
......
267 267

  
268 268
static void avi_read_info(AVFormatContext *s, uint64_t end)
269 269
{
270
    while (url_ftell(s->pb) < end) {
270
    while (avio_tell(s->pb) < end) {
271 271
        uint32_t tag  = avio_rl32(s->pb);
272 272
        uint32_t size = avio_rl32(s->pb);
273 273
        avi_read_tag(s, NULL, tag, size);
......
298 298

  
299 299
static void avi_read_nikon(AVFormatContext *s, uint64_t end)
300 300
{
301
    while (url_ftell(s->pb) < end) {
301
    while (avio_tell(s->pb) < end) {
302 302
        uint32_t tag  = avio_rl32(s->pb);
303 303
        uint32_t size = avio_rl32(s->pb);
304 304
        switch (tag) {
305 305
        case MKTAG('n', 'c', 't', 'g'): {  /* Nikon Tags */
306
            uint64_t tag_end = url_ftell(s->pb) + size;
307
            while (url_ftell(s->pb) < tag_end) {
306
            uint64_t tag_end = avio_tell(s->pb) + size;
307
            while (avio_tell(s->pb) < tag_end) {
308 308
                uint16_t tag  = avio_rl16(s->pb);
309 309
                uint16_t size = avio_rl16(s->pb);
310 310
                const char *name = NULL;
......
369 369

  
370 370
        switch(tag) {
371 371
        case MKTAG('L', 'I', 'S', 'T'):
372
            list_end = url_ftell(pb) + size;
372
            list_end = avio_tell(pb) + size;
373 373
            /* Ignored, except at start of video packets. */
374 374
            tag1 = avio_rl32(pb);
375 375

  
376 376
            print_tag("list", tag1, 0);
377 377

  
378 378
            if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
379
                avi->movi_list = url_ftell(pb) - 4;
379
                avi->movi_list = avio_tell(pb) - 4;
380 380
                if(size) avi->movi_end = avi->movi_list + size + (size & 1);
381 381
                else     avi->movi_end = url_fsize(pb);
382 382
                av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
......
549 549
            if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
550 550
                avio_seek(pb, size, SEEK_CUR);
551 551
            } else {
552
                uint64_t cur_pos = url_ftell(pb);
552
                uint64_t cur_pos = avio_tell(pb);
553 553
                if (cur_pos < list_end)
554 554
                    size = FFMIN(size, list_end - cur_pos);
555 555
                st = s->streams[stream_index];
......
664 664
            }
665 665
            break;
666 666
        case MKTAG('i', 'n', 'd', 'x'):
667
            i= url_ftell(pb);
667
            i= avio_tell(pb);
668 668
            if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){
669 669
                read_braindead_odml_indx(s, 0);
670 670
            }
......
704 704
            if(size > 1000000){
705 705
                av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "
706 706
                                        "I will ignore it and try to continue anyway.\n");
707
                avi->movi_list = url_ftell(pb) - 4;
707
                avi->movi_list = avio_tell(pb) - 4;
708 708
                avi->movi_end  = url_fsize(pb);
709 709
                goto end_of_header;
710 710
            }
......
923 923

  
924 924
        if(size > ast->remaining)
925 925
            size= ast->remaining;
926
        avi->last_pkt_pos= url_ftell(pb);
926
        avi->last_pkt_pos= avio_tell(pb);
927 927
        err= av_get_packet(pb, pkt, size);
928 928
        if(err<0)
929 929
            return err;
......
989 989
    }
990 990

  
991 991
    memset(d, -1, sizeof(int)*8);
992
    for(i=sync=url_ftell(pb); !url_feof(pb); i++) {
992
    for(i=sync=avio_tell(pb); !url_feof(pb); i++) {
993 993
        int j;
994 994

  
995 995
        for(j=0; j<7; j++)
......
1092 1092
                ast->remaining= size;
1093 1093

  
1094 1094
                if(size || !ast->sample_size){
1095
                    uint64_t pos= url_ftell(pb) - 8;
1095
                    uint64_t pos= avio_tell(pb) - 8;
1096 1096
                    if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
1097 1097
                        av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
1098 1098
                    }
......
1162 1162
    int i;
1163 1163
    int64_t last_start=0;
1164 1164
    int64_t first_end= INT64_MAX;
1165
    int64_t oldpos= url_ftell(s->pb);
1165
    int64_t oldpos= avio_tell(s->pb);
1166 1166

  
1167 1167
    for(i=0; i<s->nb_streams; i++){
1168 1168
        AVStream *st = s->streams[i];
......
1194 1194
    AVIContext *avi = s->priv_data;
1195 1195
    AVIOContext *pb = s->pb;
1196 1196
    uint32_t tag, size;
1197
    int64_t pos= url_ftell(pb);
1197
    int64_t pos= avio_tell(pb);
1198 1198
    int ret = -1;
1199 1199

  
1200 1200
    if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0)
libavformat/avienc.c
124 124
    int64_t file_size;
125 125
    AVCodecContext* stream;
126 126

  
127
    file_size = url_ftell(pb);
127
    file_size = avio_tell(pb);
128 128
    for(n = 0; n < s->nb_streams; n++) {
129 129
        AVIStream *avist= s->streams[n]->priv_data;
130 130

  
......
201 201
        avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
202 202
    else
203 203
        avio_wl32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
204
    avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
204
    avi->frames_hdr_all = avio_tell(pb); /* remember this offset to fill later */
205 205
    avio_wl32(pb, nb_frames); /* nb frames, filled later */
206 206
    avio_wl32(pb, 0); /* initial frame */
207 207
    avio_wl32(pb, s->nb_streams); /* nb streams */
......
258 258
        av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
259 259

  
260 260
        avio_wl32(pb, 0); /* start */
261
        avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */
261
        avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */
262 262
        if (url_is_streamed(pb))
263 263
            avio_wl32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
264 264
        else
......
419 419
         ix_tag[3] = '0' + i;
420 420

  
421 421
         /* Writing AVI OpenDML leaf index chunk */
422
         ix = url_ftell(pb);
422
         ix = avio_tell(pb);
423 423
         ffio_wfourcc(pb, ix_tag);     /* ix?? */
424 424
         avio_wl32(pb, avist->indexes.entry * 8 + 24);
425 425
                                      /* chunk size */
......
439 439
                          (ie->flags & 0x10 ? 0 : 0x80000000));
440 440
         }
441 441
         put_flush_packet(pb);
442
         pos = url_ftell(pb);
442
         pos = avio_tell(pb);
443 443

  
444 444
         /* Updating one entry in the AVI OpenDML master index */
445 445
         avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET);
......
533 533

  
534 534
    // Make sure to put an OpenDML chunk when the file size exceeds the limits
535 535
    if (!url_is_streamed(pb) &&
536
        (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
536
        (avio_tell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
537 537

  
538 538
        avi_write_ix(s);
539 539
        ff_end_tag(pb, avi->movi_list);
......
567 567
        }
568 568

  
569 569
        idx->cluster[cl][id].flags = flags;
570
        idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
570
        idx->cluster[cl][id].pos = avio_tell(pb) - avi->movi_list;
571 571
        idx->cluster[cl][id].len = size;
572 572
        idx->entry++;
573 573
    }
......
600 600
            ff_end_tag(pb, avi->movi_list);
601 601
            ff_end_tag(pb, avi->riff_start);
602 602

  
603
            file_size = url_ftell(pb);
603
            file_size = avio_tell(pb);
604 604
            avio_seek(pb, avi->odml_list - 8, SEEK_SET);
605 605
            ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */
606 606
            avio_seek(pb, 16, SEEK_CUR);
libavformat/avio.h
422 422
attribute_deprecated int url_fclose(AVIOContext *s);
423 423
attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence);
424 424
attribute_deprecated int url_fskip(AVIOContext *s, int64_t offset);
425
attribute_deprecated int64_t url_ftell(AVIOContext *s);
425 426
/**
426 427
 * @}
427 428
 */
......
473 474
 * ftell() equivalent for AVIOContext.
474 475
 * @return position or AVERROR.
475 476
 */
476
int64_t url_ftell(AVIOContext *s);
477
#define avio_tell(s) avio_seek((s), 0, SEEK_CUR)
477 478

  
478 479
/**
479 480
 * Get the filesize.
libavformat/aviobuf.c
239 239
    int64_t ret = avio_seek(s, offset, SEEK_CUR);
240 240
    return ret < 0 ? ret : 0;
241 241
}
242
#endif
243 242

  
244 243
int64_t url_ftell(AVIOContext *s)
245 244
{
246 245
    return avio_seek(s, 0, SEEK_CUR);
247 246
}
247
#endif
248 248

  
249 249
int64_t url_fsize(AVIOContext *s)
250 250
{
libavformat/avs.c
123 123
    AvsFormat *avs = s->priv_data;
124 124
    int ret, size;
125 125

  
126
    size = url_ftell(s->pb);
126
    size = avio_tell(s->pb);
127 127
    ret = voc_get_packet(s, pkt, avs->st_audio, avs->remaining_audio_size);
128
    size = url_ftell(s->pb) - size;
128
    size = avio_tell(s->pb) - size;
129 129
    avs->remaining_audio_size -= size;
130 130

  
131 131
    if (ret == AVERROR(EIO))
libavformat/bethsoftvid.c
112 112
        return AVERROR(ENOMEM);
113 113

  
114 114
    // save the file position for the packet, include block type
115
    position = url_ftell(pb) - 1;
115
    position = avio_tell(pb) - 1;
116 116

  
117 117
    vidbuf_start[vidbuf_nbytes++] = block_type;
118 118

  
libavformat/cafdec.c
106 106
        int strt, skip;
107 107
        MOVAtom atom;
108 108

  
109
        strt = url_ftell(pb);
109
        strt = avio_tell(pb);
110 110
        ff_mov_read_esds(s, pb, atom);
111
        skip = size - (url_ftell(pb) - strt);
111
        skip = size - (avio_tell(pb) - strt);
112 112
        if (skip < 0 || !st->codec->extradata ||
113 113
            st->codec->codec_id != CODEC_ID_AAC) {
114 114
            av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n");
......
150 150
    int64_t pos = 0, ccount;
151 151
    int num_packets, i;
152 152

  
153
    ccount = url_ftell(pb);
153
    ccount = avio_tell(pb);
154 154

  
155 155
    num_packets = avio_rb64(pb);
156 156
    if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
......
167 167
        st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);
168 168
    }
169 169

  
170
    if (url_ftell(pb) - ccount != size) {
170
    if (avio_tell(pb) - ccount != size) {
171 171
        av_log(s, AV_LOG_ERROR, "error reading packet table\n");
172 172
        return -1;
173 173
    }
......
234 234
        switch (tag) {
235 235
        case MKBETAG('d','a','t','a'):
236 236
            avio_seek(pb, 4, SEEK_CUR); /* edit count */
237
            caf->data_start = url_ftell(pb);
237
            caf->data_start = avio_tell(pb);
238 238
            caf->data_size  = size < 0 ? -1 : size - 4;
239 239
            if (caf->data_size > 0 && !url_is_streamed(pb))
240 240
                avio_seek(pb, caf->data_size, SEEK_CUR);
......
312 312

  
313 313
    /* don't read past end of data chunk */
314 314
    if (caf->data_size > 0) {
315
        left = (caf->data_start + caf->data_size) - url_ftell(pb);
315
        left = (caf->data_start + caf->data_size) - avio_tell(pb);
316 316
        if (left <= 0)
317 317
            return AVERROR(EIO);
318 318
    }
libavformat/dv.c
417 417
            return -1;
418 418
        }
419 419
        if (state == 0x003f0700 || state == 0xff3f0700)
420
            marker_pos = url_ftell(s->pb);
421
        if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
420
            marker_pos = avio_tell(s->pb);
421
        if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) {
422 422
            avio_seek(s->pb, -163, SEEK_CUR);
423 423
            state = avio_rb32(s->pb);
424 424
            break;
libavformat/dxa.c
95 95
        uint32_t size, fsize;
96 96
        c->has_sound = 1;
97 97
        size = avio_rb32(pb);
98
        c->vidpos = url_ftell(pb) + size;
98
        c->vidpos = avio_tell(pb) + size;
99 99
        avio_seek(pb, 16, SEEK_CUR);
100 100
        fsize = avio_rl32(pb);
101 101

  
......
104 104
            return -1;
105 105
        ff_get_wav_header(pb, ast->codec, fsize);
106 106
        // find 'data' chunk
107
        while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
107
        while(avio_tell(pb) < c->vidpos && !url_feof(pb)){
108 108
            tag = avio_rl32(pb);
109 109
            fsize = avio_rl32(pb);
110 110
            if(tag == MKTAG('d', 'a', 't', 'a')) break;
......
114 114
        if(ast->codec->block_align)
115 115
            c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align;
116 116
        c->bytes_left = fsize;
117
        c->wavpos = url_ftell(pb);
117
        c->wavpos = avio_tell(pb);
118 118
        avio_seek(pb, c->vidpos, SEEK_SET);
119 119
    }
120 120

  
......
133 133
        st->codec->height >>= 1;
134 134
    }
135 135
    c->readvid = !c->has_sound;
136
    c->vidpos  = url_ftell(pb);
136
    c->vidpos  = avio_tell(pb);
137 137
    s->start_time = 0;
138 138
    s->duration = (int64_t)c->frames * AV_TIME_BASE * num / den;
139 139
    av_log(s, AV_LOG_DEBUG, "%d frame(s)\n",c->frames);
......
158 158
        if(ret != size)
159 159
            return AVERROR(EIO);
160 160
        c->bytes_left -= size;
161
        c->wavpos = url_ftell(s->pb);
161
        c->wavpos = avio_tell(s->pb);
162 162
        return 0;
163 163
    }
164 164
    avio_seek(s->pb, c->vidpos, SEEK_SET);
......
172 172
            if(pal_size) memcpy(pkt->data, pal, pal_size);
173 173
            memcpy(pkt->data + pal_size, buf, 4);
174 174
            c->frames--;
175
            c->vidpos = url_ftell(s->pb);
175
            c->vidpos = avio_tell(s->pb);
176 176
            c->readvid = 0;
177 177
            return 0;
178 178
        case MKTAG('C', 'M', 'A', 'P'):
......
198 198
            if(pal_size) memcpy(pkt->data, pal, pal_size);
199 199
            pkt->stream_index = 0;
200 200
            c->frames--;
201
            c->vidpos = url_ftell(s->pb);
201
            c->vidpos = avio_tell(s->pb);
202 202
            c->readvid = 0;
203 203
            return 0;
204 204
        default:
libavformat/electronicarts.c
293 293
    int i;
294 294

  
295 295
    for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
296
        unsigned int startpos = url_ftell(pb);
296
        unsigned int startpos = avio_tell(pb);
297 297
        int err = 0;
298 298

  
299 299
        blockid = avio_rl32(pb);
libavformat/ffmdec.c
65 65
    len = ffm->packet_end - ffm->packet_ptr;
66 66
    if (size <= len)
67 67
        return 1;
68
    pos = url_ftell(s->pb);
68
    pos = avio_tell(s->pb);
69 69
    if (!ffm->write_index) {
70 70
        if (pos == ffm->file_size)
71 71
            return AVERROR_EOF;
......
117 117
        if (len > size)
118 118
            len = size;
119 119
        if (len == 0) {
120
            if (url_ftell(pb) == ffm->file_size)
120
            if (avio_tell(pb) == ffm->file_size)
121 121
                avio_seek(pb, ffm->packet_size, SEEK_SET);
122 122
    retry_read:
123 123
            id = avio_rb16(pb); /* PACKET_ID */
......
136 136
            if (ffm->first_packet || (frame_offset & 0x8000)) {
137 137
                if (!frame_offset) {
138 138
                    /* This packet has no frame headers in it */
139
                    if (url_ftell(pb) >= ffm->packet_size * 3) {
139
                    if (avio_tell(pb) >= ffm->packet_size * 3) {
140 140
                        avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR);
141 141
                        goto retry_read;
142 142
                    }
......
203 203
    //int64_t orig_write_index = ffm->write_index;
204 204
    int64_t pos_min, pos_max;
205 205
    int64_t pts_start;
206
    int64_t ptr = url_ftell(pb);
206
    int64_t ptr = avio_tell(pb);
207 207

  
208 208

  
209 209
    pos_min = 0;
......
381 381
    }
382 382

  
383 383
    /* get until end of block reached */
384
    while ((url_ftell(pb) % ffm->packet_size) != 0)
384
    while ((avio_tell(pb) % ffm->packet_size) != 0)
385 385
        avio_r8(pb);
386 386

  
387 387
    /* init packet demux */
......
410 410
            return ret;
411 411

  
412 412
        av_dlog(s, "pos=%08"PRIx64" spos=%"PRIx64", write_index=%"PRIx64" size=%"PRIx64"\n",
413
               url_ftell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
413
               avio_tell(s->pb), s->pb->pos, ffm->write_index, ffm->file_size);
414 414
        if (ffm_read_data(s, ffm->header, FRAME_HEADER_SIZE, 1) !=
415 415
            FRAME_HEADER_SIZE)
416 416
            return -1;
......
437 437
            ffm->read_state = READ_HEADER;
438 438
            return -1;
439 439
        }
440
        pkt->pos = url_ftell(s->pb);
440
        pkt->pos = avio_tell(s->pb);
441 441
        if (ffm->header[1] & FLAG_KEY_FRAME)
442 442
            pkt->flags |= AV_PKT_FLAG_KEY;
443 443

  
libavformat/ffmenc.c
32 32
    fill_size = ffm->packet_end - ffm->packet_ptr;
33 33
    memset(ffm->packet_ptr, 0, fill_size);
34 34

  
35
    if (url_ftell(pb) % ffm->packet_size)
35
    if (avio_tell(pb) % ffm->packet_size)
36 36
        av_abort();
37 37

  
38 38
    /* put header */
......
184 184
    }
185 185

  
186 186
    /* flush until end of block reached */
187
    while ((url_ftell(pb) % ffm->packet_size) != 0)
187
    while ((avio_tell(pb) % ffm->packet_size) != 0)
188 188
        avio_w8(pb, 0);
189 189

  
190 190
    put_flush_packet(pb);
libavformat/filmstripdec.c
82 82

  
83 83
    if (url_feof(s->pb))
84 84
        return AVERROR(EIO);
85
    pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
85
    pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
86 86
    pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
87 87
    avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR);
88 88
    if (pkt->size < 0)
libavformat/flacenc.c
100 100

  
101 101
    if (!url_is_streamed(pb)) {
102 102
        /* rewrite the STREAMINFO header block data */
103
        file_size = url_ftell(pb);
103
        file_size = avio_tell(pb);
104 104
        avio_seek(pb, 8, SEEK_SET);
105 105
        avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE);
106 106
        avio_seek(pb, file_size, SEEK_SET);
libavformat/flic.c
223 223
            }
224 224
            pkt->stream_index = flic->video_stream_index;
225 225
            pkt->pts = flic->frame_number++;
226
            pkt->pos = url_ftell(pb);
226
            pkt->pos = avio_tell(pb);
227 227
            memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
228 228
            ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE,
229 229
                size - FLIC_PREAMBLE_SIZE);
......
242 242
            avio_seek(pb, 10, SEEK_CUR);
243 243

  
244 244
            pkt->stream_index = flic->audio_stream_index;
245
            pkt->pos = url_ftell(pb);
245
            pkt->pos = avio_tell(pb);
246 246
            ret = avio_read(pb, pkt->data, size);
247 247

  
248 248
            if (ret != size) {
libavformat/flvdec.c
148 148
        case AMF_DATA_TYPE_OBJECT: {
149 149
            unsigned int keylen;
150 150

  
151
            while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
151
            while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
152 152
                avio_seek(ioc, keylen, SEEK_CUR); //skip key string
153 153
                if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
154 154
                    return -1; //if we couldn't skip, bomb out.
......
163 163
            break; //these take up no additional space
164 164
        case AMF_DATA_TYPE_MIXEDARRAY:
165 165
            avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index
166
            while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
166
            while(avio_tell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
167 167
                //this is the only case in which we would want a nested parse to not skip over the object
168 168
                if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
169 169
                    return -1;
......
175 175
            unsigned int arraylen, i;
176 176

  
177 177
            arraylen = avio_rb32(ioc);
178
            for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
178
            for(i = 0; i < arraylen && avio_tell(ioc) < max_pos - 1; i++) {
179 179
                if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
180 180
                    return -1; //if we couldn't skip, bomb out.
181 181
            }
......
305 305
    AVStream *st = NULL;
306 306

  
307 307
 for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */
308
    pos = url_ftell(s->pb);
308
    pos = avio_tell(s->pb);
309 309
    type = avio_r8(s->pb);
310 310
    size = avio_rb24(s->pb);
311 311
    dts = avio_rb24(s->pb);
......
319 319
    if(size == 0)
320 320
        continue;
321 321

  
322
    next= size + url_ftell(s->pb);
322
    next= size + avio_tell(s->pb);
323 323

  
324 324
    if (type == FLV_TAG_TYPE_AUDIO) {
325 325
        is_audio=1;
......
372 372
    // if not streamed and no duration from metadata then seek to end to find the duration from the timestamps
373 373
    if(!url_is_streamed(s->pb) && (!s->duration || s->duration==AV_NOPTS_VALUE)){
374 374
        int size;
375
        const int64_t pos= url_ftell(s->pb);
375
        const int64_t pos= avio_tell(s->pb);
376 376
        const int64_t fsize= url_fsize(s->pb);
377 377
        avio_seek(s->pb, fsize-4, SEEK_SET);
378 378
        size= avio_rb32(s->pb);
libavformat/flvenc.c
221 221

  
222 222
    /* write meta_tag */
223 223
    avio_w8(pb, 18);         // tag type META
224
    metadata_size_pos= url_ftell(pb);
224
    metadata_size_pos= avio_tell(pb);
225 225
    avio_wb24(pb, 0);          // size of data part (sum of all parts below)
226 226
    avio_wb24(pb, 0);          // time stamp
227 227
    avio_wb32(pb, 0);          // reserved
......
237 237
    avio_wb32(pb, 5*!!video_enc + 5*!!audio_enc + 2); // +2 for duration and file size
238 238

  
239 239
    put_amf_string(pb, "duration");
240
    flv->duration_offset= url_ftell(pb);
240
    flv->duration_offset= avio_tell(pb);
241 241
    put_amf_double(pb, s->duration / AV_TIME_BASE); // fill in the guessed duration, it'll be corrected later if incorrect
242 242

  
243 243
    if(video_enc){
......
281 281
    }
282 282

  
283 283
    put_amf_string(pb, "filesize");
284
    flv->filesize_offset= url_ftell(pb);
284
    flv->filesize_offset= avio_tell(pb);
285 285
    put_amf_double(pb, 0); // delayed write
286 286

  
287 287
    put_amf_string(pb, "");
288 288
    avio_w8(pb, AMF_END_OF_OBJECT);
289 289

  
290 290
    /* write total size of tag */
291
    data_size= url_ftell(pb) - metadata_size_pos - 10;
291
    data_size= avio_tell(pb) - metadata_size_pos - 10;
292 292
    avio_seek(pb, metadata_size_pos, SEEK_SET);
293 293
    avio_wb24(pb, data_size);
294 294
    avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
......
304 304
            avio_wb24(pb, 0); // ts
305 305
            avio_w8(pb, 0); // ts ext
306 306
            avio_wb24(pb, 0); // streamid
307
            pos = url_ftell(pb);
307
            pos = avio_tell(pb);
308 308
            if (enc->codec_id == CODEC_ID_AAC) {
309 309
                avio_w8(pb, get_audio_flags(enc));
310 310
                avio_w8(pb, 0); // AAC sequence header
......
315 315
                avio_wb24(pb, 0); // composition time
316 316
                ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size);
317 317
            }
318
            data_size = url_ftell(pb) - pos;
318
            data_size = avio_tell(pb) - pos;
319 319
            avio_seek(pb, -data_size - 10, SEEK_CUR);
320 320
            avio_wb24(pb, data_size);
321 321
            avio_seek(pb, data_size + 10 - 3, SEEK_CUR);
......
343 343
        }
344 344
    }
345 345

  
346
    file_size = url_ftell(pb);
346
    file_size = avio_tell(pb);
347 347

  
348 348
    /* update informations */
349 349
    avio_seek(pb, flv->duration_offset, SEEK_SET);
libavformat/gxf.c
396 396
    READ_ONE();
397 397
    if (tmp != 1)
398 398
        goto start;
399
    last_pos = url_ftell(pb);
399
    last_pos = avio_tell(pb);
400 400
    if (avio_seek(pb, -5, SEEK_CUR) < 0)
401 401
        goto out;
402 402
    if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) {
......
407 407
    avio_r8(pb);
408 408
    cur_track = avio_r8(pb);
409 409
    cur_timestamp = avio_rb32(pb);
410
    last_found_pos = url_ftell(pb) - 16 - 6;
410
    last_found_pos = avio_tell(pb) - 16 - 6;
411 411
    if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
412 412
        if (avio_seek(pb, last_pos, SEEK_SET) >= 0)
413 413
            goto start;
......
511 511
    if (avio_seek(pb, *pos, SEEK_SET) < 0)
512 512
        return AV_NOPTS_VALUE;
513 513
    res = gxf_resync_media(s, pos_limit - *pos, -1, -1);
514
    *pos = url_ftell(pb);
514
    *pos = avio_tell(pb);
515 515
    return res;
516 516
}
517 517

  
libavformat/gxfenc.c
125 125
    int64_t curpos;
126 126
    int size;
127 127

  
128
    size = url_ftell(pb) - pos;
128
    size = avio_tell(pb) - pos;
129 129
    if (size % 4) {
130 130
        gxf_write_padding(pb, 4 - size % 4);
131
        size = url_ftell(pb) - pos;
131
        size = avio_tell(pb) - pos;
132 132
    }
133
    curpos = url_ftell(pb);
133
    curpos = avio_tell(pb);
134 134
    avio_seek(pb, pos + 6, SEEK_SET);
135 135
    avio_wb32(pb, size);
136 136
    avio_seek(pb, curpos, SEEK_SET);
......
141 141
{
142 142
    int64_t curpos;
143 143

  
144
    curpos = url_ftell(pb);
144
    curpos = avio_tell(pb);
145 145
    avio_seek(pb, pos, SEEK_SET);
146 146
    avio_wb16(pb, curpos - pos - 2);
147 147
    avio_seek(pb, curpos, SEEK_SET);
......
218 218
    avio_w8(pb, sc->media_type + 0x80);
219 219
    avio_w8(pb, index + 0xC0);
220 220

  
221
    pos = url_ftell(pb);
221
    pos = avio_tell(pb);
222 222
    avio_wb16(pb, 0); /* size */
223 223

  
224 224
    /* media file name */
......
272 272
    int len;
273 273
    const char *filename = strrchr(s->filename, '/');
274 274

  
275
    pos = url_ftell(pb);
275
    pos = avio_tell(pb);
276 276
    avio_wb16(pb, 0); /* size */
277 277

  
278 278
    /* name */
......
322 322
    int64_t pos;
323 323
    int i;
324 324

  
325
    pos = url_ftell(pb);
325
    pos = avio_tell(pb);
326 326
    avio_wb16(pb, 0); /* size */
327 327
    for (i = 0; i < s->nb_streams; ++i)
328 328
        gxf_write_track_description(s, s->streams[i]->priv_data, i);
......
336 336
{
337 337
    GXFContext *gxf = s->priv_data;
338 338
    AVIOContext *pb = s->pb;
339
    int64_t pos = url_ftell(pb);
339
    int64_t pos = avio_tell(pb);
340 340

  
341 341
    if (!rewrite) {
342 342
        if (!(gxf->map_offsets_nb % 30)) {
......
366 366
{
367 367
    GXFContext *gxf = s->priv_data;
368 368
    AVIOContext *pb = s->pb;
369
    int64_t pos = url_ftell(pb);
369
    int64_t pos = avio_tell(pb);
370 370
    int fields_per_flt = (gxf->nb_fields+1) / 1000 + 1;
371 371
    int flt_entries = gxf->nb_fields / fields_per_flt;
372 372
    int i = 0;
......
442 442
{
443 443
    AVIOContext *pb = s->pb;
444 444
    GXFContext *gxf = s->priv_data;
445
    int64_t pos = url_ftell(pb);
445
    int64_t pos = avio_tell(pb);
446 446
    int i;
447 447

  
448 448
    gxf->umf_track_offset = pos - gxf->umf_start_offset;
......
455 455
    avio_wl16(pb, gxf->timecode_track.media_info);
456 456
    avio_wl16(pb, 1);
457 457

  
458
    return url_ftell(pb) - pos;
458
    return avio_tell(pb) - pos;
459 459
}
460 460

  
461 461
static int gxf_write_umf_media_mpeg(AVIOContext *pb, AVStream *st)
......
533 533
    int64_t pos;
534 534
    int i, j;
535 535

  
536
    pos = url_ftell(pb);
536
    pos = avio_tell(pb);
537 537
    gxf->umf_media_offset = pos - gxf->umf_start_offset;
538 538
    for (i = 0; i <= s->nb_streams; ++i) {
539 539
        GXFStreamContext *sc;
......
544 544
        else
545 545
            sc = s->streams[i]->priv_data;
546 546

  
547
        startpos = url_ftell(pb);
547
        startpos = avio_tell(pb);
548 548
        avio_wl16(pb, 0); /* length */
549 549
        avio_wl16(pb, sc->media_info);
550 550
        avio_wl16(pb, 0); /* reserved */
......
580 580
            }
581 581
        }
582 582

  
583
        curpos = url_ftell(pb);
583
        curpos = avio_tell(pb);
584 584
        avio_seek(pb, startpos, SEEK_SET);
585 585
        avio_wl16(pb, curpos - startpos);
586 586
        avio_seek(pb, curpos, SEEK_SET);
587 587
    }
588
    return url_ftell(pb) - pos;
588
    return avio_tell(pb) - pos;
589 589
}
590 590

  
591 591
static int gxf_write_umf_packet(AVFormatContext *s)
592 592
{
593 593
    GXFContext *gxf = s->priv_data;
594 594
    AVIOContext *pb = s->pb;
595
    int64_t pos = url_ftell(pb);
595
    int64_t pos = avio_tell(pb);
596 596

  
597 597
    gxf_write_packet_header(pb, PKT_UMF);
598 598

  
......
600 600
    avio_w8(pb, 3); /* first and last (only) packet */
601 601
    avio_wb32(pb, gxf->umf_length); /* data length */
602 602

  
603
    gxf->umf_start_offset = url_ftell(pb);
603
    gxf->umf_start_offset = avio_tell(pb);
604 604
    gxf_write_umf_payload(s);
605 605
    gxf_write_umf_material_description(s);
606 606
    gxf->umf_track_size = gxf_write_umf_track_description(s);
607 607
    gxf->umf_media_size = gxf_write_umf_media_description(s);
608
    gxf->umf_length = url_ftell(pb) - gxf->umf_start_offset;
608
    gxf->umf_length = avio_tell(pb) - gxf->umf_start_offset;
609 609
    return updatePacketSize(pb, pos);
610 610
}
611 611

  
......
759 759

  
760 760
static int gxf_write_eos_packet(AVIOContext *pb)
761 761
{
762
    int64_t pos = url_ftell(pb);
762
    int64_t pos = avio_tell(pb);
763 763

  
764 764
    gxf_write_packet_header(pb, PKT_EOS);
765 765
    return updatePacketSize(pb, pos);
......
775 775
    ff_audio_interleave_close(s);
776 776

  
777 777
    gxf_write_eos_packet(pb);
778
    end = url_ftell(pb);
778
    end = avio_tell(pb);
779 779
    avio_seek(pb, 0, SEEK_SET);
780 780
    /* overwrite map, flt and umf packets with new values */
781 781
    gxf_write_map_packet(s, 1);
......
861 861
    GXFContext *gxf = s->priv_data;
862 862
    AVIOContext *pb = s->pb;
863 863
    AVStream *st = s->streams[pkt->stream_index];
864
    int64_t pos = url_ftell(pb);
864
    int64_t pos = avio_tell(pb);
865 865
    int padding = 0;
866
    int packet_start_offset = url_ftell(pb) / 1024;
866
    int packet_start_offset = avio_tell(pb) / 1024;
867 867

  
868 868
    gxf_write_packet_header(pb, PKT_MEDIA);
869 869
    if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO && pkt->size % 4) /* MPEG-2 frames must be padded */
libavformat/id3v2.c
196 196
        if (len < 0)
197 197
            break;
198 198

  
199
        next = url_ftell(s->pb) + tlen;
199
        next = avio_tell(s->pb) + tlen;
200 200

  
201 201
        if (tflags & ID3v2_FLAG_DATALEN) {
202 202
            avio_rb32(s->pb);
......
258 258

  
259 259
    do {
260 260
        /* save the current offset in case there's nothing to read/skip */
261
        off = url_ftell(s->pb);
261
        off = avio_tell(s->pb);
262 262
        ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE);
263 263
        if (ret != ID3v2_HEADER_SIZE)
264 264
            break;
libavformat/idroqdec.c
141 141

  
142 142
        case RoQ_QUAD_CODEBOOK:
143 143
            /* packet needs to contain both this codebook and next VQ chunk */
144
            codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
144
            codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
145 145
            codebook_size = chunk_size;
146 146
            avio_seek(pb, codebook_size, SEEK_CUR);
147 147
            if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
......
197 197
                roq->audio_frame_count += (chunk_size / roq->audio_channels);
198 198
            }
199 199

  
200
            pkt->pos= url_ftell(pb);
200
            pkt->pos= avio_tell(pb);
201 201
            ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
202 202
                chunk_size);
203 203
            if (ret != chunk_size)
libavformat/iff.c
144 144
        const char *metadata_tag = NULL;
145 145
        chunk_id = avio_rl32(pb);
146 146
        data_size = avio_rb32(pb);
147
        orig_pos = url_ftell(pb);
147
        orig_pos = avio_tell(pb);
148 148

  
149 149
        switch(chunk_id) {
150 150
        case ID_VHDR:
......
161 161
            break;
162 162

  
163 163
        case ID_BODY:
164
            iff->body_pos = url_ftell(pb);
164
            iff->body_pos = avio_tell(pb);
165 165
            iff->body_size = data_size;
166 166
            break;
167 167

  
......
223 223
                return res;
224 224
            }
225 225
        }
226
        avio_seek(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1), SEEK_CUR);
226
        avio_seek(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1), SEEK_CUR);
227 227
    }
228 228

  
229 229
    avio_seek(pb, iff->body_pos, SEEK_SET);
libavformat/ingenientdec.c
47 47
    if (av_new_packet(pkt, size) < 0)
48 48
        return AVERROR(ENOMEM);
49 49

  
50
    pkt->pos = url_ftell(s->pb);
50
    pkt->pos = avio_tell(s->pb);
51 51
    pkt->stream_index = 0;
52 52
    ret = avio_read(s->pb, pkt->data, size);
53 53
    if (ret < 0) {
libavformat/ipmovie.c
405 405
            debug_ipmovie("audio frame\n");
406 406

  
407 407
            /* log position and move on for now */
408
            s->audio_chunk_offset = url_ftell(pb);
408
            s->audio_chunk_offset = avio_tell(pb);
409 409
            s->audio_chunk_size = opcode_size;
410 410
            avio_seek(pb, opcode_size, SEEK_CUR);
411 411
            break;
......
471 471
            debug_ipmovie("set decoding map\n");
472 472

  
473 473
            /* log position and move on for now */
474
            s->decode_map_chunk_offset = url_ftell(pb);
474
            s->decode_map_chunk_offset = avio_tell(pb);
475 475
            s->decode_map_chunk_size = opcode_size;
476 476
            avio_seek(pb, opcode_size, SEEK_CUR);
477 477
            break;
......
480 480
            debug_ipmovie("set video data\n");
481 481

  
482 482
            /* log position and move on for now */
483
            s->video_chunk_offset = url_ftell(pb);
483
            s->video_chunk_offset = avio_tell(pb);
484 484
            s->video_chunk_size = opcode_size;
485 485
            avio_seek(pb, opcode_size, SEEK_CUR);
486 486
            break;
......
494 494
    }
495 495

  
496 496
    /* make a note of where the stream is sitting */
497
    s->next_chunk_offset = url_ftell(pb);
497
    s->next_chunk_offset = avio_tell(pb);
498 498

  
499 499
    /* dispatch the first of any pending packets */
500 500
    if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY))
......
541 541
    ipmovie->decode_map_chunk_offset = 0;
542 542

  
543 543
    /* on the first read, this will position the stream at the first chunk */
544
    ipmovie->next_chunk_offset = url_ftell(pb) + 4;
544
    ipmovie->next_chunk_offset = avio_tell(pb) + 4;
545 545

  
546 546
    /* process the first chunk which should be CHUNK_INIT_VIDEO */
547 547
    if (process_ipmovie_chunk(ipmovie, pb, &pkt) != CHUNK_INIT_VIDEO)
libavformat/iss.c
87 87
    get_token(pb, token, sizeof(token)); //Version ID
88 88
    get_token(pb, token, sizeof(token)); //Size
89 89

  
90
    iss->sample_start_pos = url_ftell(pb);
90
    iss->sample_start_pos = avio_tell(pb);
91 91

  
92 92
    st = av_new_stream(s, 0);
93 93
    if (!st)
......
116 116
        return AVERROR(EIO);
117 117

  
118 118
    pkt->stream_index = 0;
119
    pkt->pts = url_ftell(s->pb) - iss->sample_start_pos;
119
    pkt->pts = avio_tell(s->pb) - iss->sample_start_pos;
120 120
    if(s->streams[0]->codec->channels > 0)
121 121
        pkt->pts /= s->streams[0]->codec->channels*2;
122 122
    return 0;
libavformat/libnut.c
272 272
    if (pd.flags & NUT_FLAG_KEY) pkt->flags |= AV_PKT_FLAG_KEY;
273 273
    pkt->pts = pd.pts;
274 274
    pkt->stream_index = pd.stream;
275
    pkt->pos = url_ftell(avf->pb);
275
    pkt->pos = avio_tell(avf->pb);
276 276

  
277 277
    ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
278 278

  
libavformat/matroskadec.c
517 517
static int ebml_level_end(MatroskaDemuxContext *matroska)
518 518
{
519 519
    AVIOContext *pb = matroska->ctx->pb;
520
    int64_t pos = url_ftell(pb);
520
    int64_t pos = avio_tell(pb);
521 521

  
522 522
    if (matroska->num_levels > 0) {
523 523
        MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
......
549 549
    if (!(total = avio_r8(pb))) {
550 550
        /* we might encounter EOS here */
551 551
        if (!url_feof(pb)) {
552
            int64_t pos = url_ftell(pb);
552
            int64_t pos = avio_tell(pb);
553 553
            av_log(matroska->ctx, AV_LOG_ERROR,
554 554
                   "Read error at pos. %"PRIu64" (0x%"PRIx64")\n",
555 555
                   pos, pos);
......
560 560
    /* get the length of the EBML number */
561 561
    read = 8 - ff_log2_tab[total];
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff