Revision 384c9c2f libavformat/mov.c

View differences:

libavformat/mov.c
298 298
        if (!parse) { /* skip leaf atoms data */
299 299
            avio_seek(pb, a.size, SEEK_CUR);
300 300
        } else {
301
            int64_t start_pos = url_ftell(pb);
301
            int64_t start_pos = avio_tell(pb);
302 302
            int64_t left;
303 303
            int err = parse(c, pb, a);
304 304
            if (err < 0)
......
306 306
            if (c->found_moov && c->found_mdat &&
307 307
                (url_is_streamed(pb) || start_pos + a.size == url_fsize(pb)))
308 308
                return 0;
309
            left = a.size - url_ftell(pb) + start_pos;
309
            left = a.size - avio_tell(pb) + start_pos;
310 310
            if (left > 0) /* skip garbage at atom end */
311 311
                avio_seek(pb, left, SEEK_CUR);
312 312
        }
......
343 343
    for (i = 0; i < sc->drefs_count; i++) {
344 344
        MOVDref *dref = &sc->drefs[i];
345 345
        uint32_t size = avio_rb32(pb);
346
        int64_t next = url_ftell(pb) + size - 4;
346
        int64_t next = avio_tell(pb) + size - 4;
347 347

  
348 348
        if (size < 12)
349 349
            return -1;
......
383 383

  
384 384
            avio_seek(pb, 16, SEEK_CUR);
385 385

  
386
            for (type = 0; type != -1 && url_ftell(pb) < next; ) {
386
            for (type = 0; type != -1 && avio_tell(pb) < next; ) {
387 387
                type = avio_rb16(pb);
388 388
                len = avio_rb16(pb);
389 389
                av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
......
583 583

  
584 584
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
585 585
{
586
    c->fragment.moof_offset = url_ftell(pb) - 8;
586
    c->fragment.moof_offset = avio_tell(pb) - 8;
587 587
    av_dlog(c->fc, "moof offset %llx\n", c->fragment.moof_offset);
588 588
    return mov_read_default(c, pb, atom);
589 589
}
......
925 925
        enum CodecID id;
926 926
        int dref_id = 1;
927 927
        MOVAtom a = { AV_RL32("stsd") };
928
        int64_t start_pos = url_ftell(pb);
928
        int64_t start_pos = avio_tell(pb);
929 929
        int size = avio_rb32(pb); /* size */
930 930
        uint32_t format = avio_rl32(pb); /* data format */
931 931

  
......
945 945
             * in the MOV demuxer, patch welcome. */
946 946
        multiple_stsd:
947 947
            av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");
948
            avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR);
948
            avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR);
949 949
            continue;
950 950
        }
951 951
        /* we cannot demux concatenated h264 streams because of different extradata */
......
1166 1166
        } else if(st->codec->codec_type==AVMEDIA_TYPE_SUBTITLE){
1167 1167
            // ttxt stsd contains display flags, justification, background
1168 1168
            // color, fonts, and default styles, so fake an atom to read it
1169
            MOVAtom fake_atom = { .size = size - (url_ftell(pb) - start_pos) };
1169
            MOVAtom fake_atom = { .size = size - (avio_tell(pb) - start_pos) };
1170 1170
            if (format != AV_RL32("mp4s")) // mp4s contains a regular esds atom
1171 1171
                mov_read_glbl(c, pb, fake_atom);
1172 1172
            st->codec->codec_id= id;
......
1174 1174
            st->codec->height = sc->height;
1175 1175
        } else {
1176 1176
            /* other codec type, just skip (rtp, mp4s, tmcd ...) */
1177
            avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR);
1177
            avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR);
1178 1178
        }
1179 1179
        /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */
1180
        a.size = size - (url_ftell(pb) - start_pos);
1180
        a.size = size - (avio_tell(pb) - start_pos);
1181 1181
        if (a.size > 8) {
1182 1182
            if (mov_read_default(c, pb, a) < 0)
1183 1183
                return -1;
......
2299 2299

  
2300 2300
    st->discard = AVDISCARD_ALL;
2301 2301
    sc = st->priv_data;
2302
    cur_pos = url_ftell(sc->pb);
2302
    cur_pos = avio_tell(sc->pb);
2303 2303

  
2304 2304
    for (i = 0; i < st->nb_index_entries; i++) {
2305 2305
        AVIndexEntry *sample = &st->index_entries[i];
......
2364 2364
        av_log(s, AV_LOG_ERROR, "moov atom not found\n");
2365 2365
        return -1;
2366 2366
    }
2367
    av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", url_ftell(pb));
2367
    av_dlog(mov->fc, "on_parse_exit_offset=%lld\n", avio_tell(pb));
2368 2368

  
2369 2369
    if (!url_is_streamed(pb) && mov->chapter_track > 0)
2370 2370
        mov_read_chapters(s);
......
2413 2413
            mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 ||
2414 2414
            url_feof(s->pb))
2415 2415
            return AVERROR_EOF;
2416
        av_dlog(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
2416
        av_dlog(s, "read fragments, offset 0x%llx\n", avio_tell(s->pb));
2417 2417
        goto retry;
2418 2418
    }
2419 2419
    sc = st->priv_data;

Also available in: Unified diff