Revision 384c9c2f libavformat/movenc.c

View differences:

libavformat/movenc.c
39 39
//FIXME support 64 bit variant with wide placeholders
40 40
static int64_t updateSize(AVIOContext *pb, int64_t pos)
41 41
{
42
    int64_t curpos = url_ftell(pb);
42
    int64_t curpos = avio_tell(pb);
43 43
    avio_seek(pb, pos, SEEK_SET);
44 44
    avio_wb32(pb, curpos - pos); /* rewrite size */
45 45
    avio_seek(pb, curpos, SEEK_SET);
......
52 52
{
53 53
    int i;
54 54
    int mode64 = 0; //   use 32 bit size variant if possible
55
    int64_t pos = url_ftell(pb);
55
    int64_t pos = avio_tell(pb);
56 56
    avio_wb32(pb, 0); /* size */
57 57
    if (pos > UINT32_MAX) {
58 58
        mode64 = 1;
......
76 76
    int equalChunks = 1;
77 77
    int i, j, entries = 0, tst = -1, oldtst = -1;
78 78

  
79
    int64_t pos = url_ftell(pb);
79
    int64_t pos = avio_tell(pb);
80 80
    avio_wb32(pb, 0); /* size */
81 81
    ffio_wfourcc(pb, "stsz");
82 82
    avio_wb32(pb, 0); /* version & flags */
......
114 114
    int index = 0, oldval = -1, i;
115 115
    int64_t entryPos, curpos;
116 116

  
117
    int64_t pos = url_ftell(pb);
117
    int64_t pos = avio_tell(pb);
118 118
    avio_wb32(pb, 0); /* size */
119 119
    ffio_wfourcc(pb, "stsc");
120 120
    avio_wb32(pb, 0); // version & flags
121
    entryPos = url_ftell(pb);
121
    entryPos = avio_tell(pb);
122 122
    avio_wb32(pb, track->entry); // entry count
123 123
    for (i=0; i<track->entry; i++) {
124 124
        if(oldval != track->cluster[i].samplesInChunk)
......
130 130
            index++;
131 131
        }
132 132
    }
133
    curpos = url_ftell(pb);
133
    curpos = avio_tell(pb);
134 134
    avio_seek(pb, entryPos, SEEK_SET);
135 135
    avio_wb32(pb, index); // rewrite size
136 136
    avio_seek(pb, curpos, SEEK_SET);
......
143 143
{
144 144
    int64_t curpos, entryPos;
145 145
    int i, index = 0;
146
    int64_t pos = url_ftell(pb);
146
    int64_t pos = avio_tell(pb);
147 147
    avio_wb32(pb, 0); // size
148 148
    ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
149 149
    avio_wb32(pb, 0); // version & flags
150
    entryPos = url_ftell(pb);
150
    entryPos = avio_tell(pb);
151 151
    avio_wb32(pb, track->entry); // entry count
152 152
    for (i=0; i<track->entry; i++) {
153 153
        if (track->cluster[i].flags & flag) {
......
155 155
            index++;
156 156
        }
157 157
    }
158
    curpos = url_ftell(pb);
158
    curpos = avio_tell(pb);
159 159
    avio_seek(pb, entryPos, SEEK_SET);
160 160
    avio_wb32(pb, index); // rewrite size
161 161
    avio_seek(pb, curpos, SEEK_SET);
......
256 256

  
257 257
static int mov_write_esds_tag(AVIOContext *pb, MOVTrack *track) // Basic
258 258
{
259
    int64_t pos = url_ftell(pb);
259
    int64_t pos = avio_tell(pb);
260 260
    int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0;
261 261

  
262 262
    avio_wb32(pb, 0); // size
......
318 318

  
319 319
static int mov_write_ms_tag(AVIOContext *pb, MOVTrack *track)
320 320
{
321
    int64_t pos = url_ftell(pb);
321
    int64_t pos = avio_tell(pb);
322 322
    avio_wb32(pb, 0);
323 323
    avio_wl32(pb, track->tag); // store it byteswapped
324 324
    track->enc->codec_tag = av_bswap16(track->tag >> 16);
......
328 328

  
329 329
static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)
330 330
{
331
    int64_t pos = url_ftell(pb);
331
    int64_t pos = avio_tell(pb);
332 332

  
333 333
    avio_wb32(pb, 0);     /* size */
334 334
    ffio_wfourcc(pb, "wave");
......
401 401

  
402 402
static int mov_write_audio_tag(AVIOContext *pb, MOVTrack *track)
403 403
{
404
    int64_t pos = url_ftell(pb);
404
    int64_t pos = avio_tell(pb);
405 405
    int version = 0;
406 406
    uint32_t tag = track->tag;
407 407

  
......
519 519

  
520 520
static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
521 521
{
522
    int64_t pos = url_ftell(pb);
522
    int64_t pos = avio_tell(pb);
523 523

  
524 524
    avio_wb32(pb, 0);
525 525
    ffio_wfourcc(pb, "avcC");
......
765 765

  
766 766
static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
767 767
{
768
    int64_t pos = url_ftell(pb);
768
    int64_t pos = avio_tell(pb);
769 769
    avio_wb32(pb, 0);    /* size */
770 770
    avio_wl32(pb, track->tag); // store it byteswapped
771 771
    avio_wb32(pb, 0);    /* Reserved */
......
793 793

  
794 794
static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
795 795
{
796
    int64_t pos = url_ftell(pb);
796
    int64_t pos = avio_tell(pb);
797 797
    char compressor_name[32];
798 798

  
799 799
    avio_wb32(pb, 0); /* size */
......
862 862

  
863 863
static int mov_write_rtp_tag(AVIOContext *pb, MOVTrack *track)
864 864
{
865
    int64_t pos = url_ftell(pb);
865
    int64_t pos = avio_tell(pb);
866 866
    avio_wb32(pb, 0); /* size */
867 867
    ffio_wfourcc(pb, "rtp ");
868 868
    avio_wb32(pb, 0); /* Reserved */
......
882 882

  
883 883
static int mov_write_stsd_tag(AVIOContext *pb, MOVTrack *track)
884 884
{
885
    int64_t pos = url_ftell(pb);
885
    int64_t pos = avio_tell(pb);
886 886
    avio_wb32(pb, 0); /* size */
887 887
    ffio_wfourcc(pb, "stsd");
888 888
    avio_wb32(pb, 0); /* version & flags */
......
989 989

  
990 990
static int mov_write_stbl_tag(AVIOContext *pb, MOVTrack *track)
991 991
{
992
    int64_t pos = url_ftell(pb);
992
    int64_t pos = avio_tell(pb);
993 993
    avio_wb32(pb, 0); /* size */
994 994
    ffio_wfourcc(pb, "stbl");
995 995
    mov_write_stsd_tag(pb, track);
......
1011 1011

  
1012 1012
static int mov_write_dinf_tag(AVIOContext *pb)
1013 1013
{
1014
    int64_t pos = url_ftell(pb);
1014
    int64_t pos = avio_tell(pb);
1015 1015
    avio_wb32(pb, 0); /* size */
1016 1016
    ffio_wfourcc(pb, "dinf");
1017 1017
    mov_write_dref_tag(pb);
......
1064 1064
static int mov_write_hdlr_tag(AVIOContext *pb, MOVTrack *track)
1065 1065
{
1066 1066
    const char *hdlr, *descr = NULL, *hdlr_type = NULL;
1067
    int64_t pos = url_ftell(pb);
1067
    int64_t pos = avio_tell(pb);
1068 1068

  
1069 1069
    if (!track) { /* no media --> data handler */
1070 1070
        hdlr = "dhlr";
......
1121 1121

  
1122 1122
static int mov_write_minf_tag(AVIOContext *pb, MOVTrack *track)
1123 1123
{
1124
    int64_t pos = url_ftell(pb);
1124
    int64_t pos = avio_tell(pb);
1125 1125
    avio_wb32(pb, 0); /* size */
1126 1126
    ffio_wfourcc(pb, "minf");
1127 1127
    if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
......
1173 1173

  
1174 1174
static int mov_write_mdia_tag(AVIOContext *pb, MOVTrack *track)
1175 1175
{
1176
    int64_t pos = url_ftell(pb);
1176
    int64_t pos = avio_tell(pb);
1177 1177
    avio_wb32(pb, 0); /* size */
1178 1178
    ffio_wfourcc(pb, "mdia");
1179 1179
    mov_write_mdhd_tag(pb, track);
......
1250 1250
    int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width,
1251 1251
                               track->enc->sample_aspect_ratio.den);
1252 1252

  
1253
    int64_t pos = url_ftell(pb);
1253
    int64_t pos = avio_tell(pb);
1254 1254

  
1255 1255
    avio_wb32(pb, 0); /* size */
1256 1256
    ffio_wfourcc(pb, "tapt");
......
1339 1339

  
1340 1340
static int mov_write_trak_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
1341 1341
{
1342
    int64_t pos = url_ftell(pb);
1342
    int64_t pos = avio_tell(pb);
1343 1343
    avio_wb32(pb, 0); /* size */
1344 1344
    ffio_wfourcc(pb, "trak");
1345 1345
    mov_write_tkhd_tag(pb, track, st);
......
1476 1476
static int mov_write_string_tag(AVIOContext *pb, const char *name, const char *value, int lang, int long_style){
1477 1477
    int size = 0;
1478 1478
    if (value && value[0]) {
1479
        int64_t pos = url_ftell(pb);
1479
        int64_t pos = avio_tell(pb);
1480 1480
        avio_wb32(pb, 0); /* size */
1481 1481
        ffio_wfourcc(pb, name);
1482 1482
        mov_write_string_data_tag(pb, value, lang, long_style);
......
1535 1535
static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
1536 1536
                              AVFormatContext *s)
1537 1537
{
1538
    int64_t pos = url_ftell(pb);
1538
    int64_t pos = avio_tell(pb);
1539 1539
    avio_wb32(pb, 0); /* size */
1540 1540
    ffio_wfourcc(pb, "ilst");
1541 1541
    mov_write_string_metadata(s, pb, "\251nam", "title"    , 1);
......
1564 1564
                              AVFormatContext *s)
1565 1565
{
1566 1566
    int size = 0;
1567
    int64_t pos = url_ftell(pb);
1567
    int64_t pos = avio_tell(pb);
1568 1568
    avio_wb32(pb, 0); /* size */
1569 1569
    ffio_wfourcc(pb, "meta");
1570 1570
    avio_wb32(pb, 0);
......
1604 1604
static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
1605 1605
                                  const char *tag, const char *str)
1606 1606
{
1607
    int64_t pos = url_ftell(pb);
1607
    int64_t pos = avio_tell(pb);
1608 1608
    AVMetadataTag *t = av_metadata_get(s->metadata, str, NULL, 0);
1609 1609
    if (!t || !utf8len(t->value))
1610 1610
        return 0;
......
1625 1625

  
1626 1626
static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
1627 1627
{
1628
    int64_t pos = url_ftell(pb);
1628
    int64_t pos = avio_tell(pb);
1629 1629
    int i, nb_chapters = FFMIN(s->nb_chapters, 255);
1630 1630

  
1631 1631
    avio_wb32(pb, 0);            // size
......
1721 1721
    int64_t pos, pos2;
1722 1722

  
1723 1723
    if (title) {
1724
        pos = url_ftell(pb);
1724
        pos = avio_tell(pb);
1725 1725
        avio_wb32(pb, 0); /* size placeholder*/
1726 1726
        ffio_wfourcc(pb, "uuid");
1727 1727
        ffio_wfourcc(pb, "USMT");
......
1729 1729
        avio_wb32(pb, 0xbb88695c);
1730 1730
        avio_wb32(pb, 0xfac9c740);
1731 1731

  
1732
        pos2 = url_ftell(pb);
1732
        pos2 = avio_tell(pb);
1733 1733
        avio_wb32(pb, 0); /* size placeholder*/
1734 1734
        ffio_wfourcc(pb, "MTDT");
1735 1735
        avio_wb16(pb, 4);
......
1757 1757
                              AVFormatContext *s)
1758 1758
{
1759 1759
    int i;
1760
    int64_t pos = url_ftell(pb);
1760
    int64_t pos = avio_tell(pb);
1761 1761
    avio_wb32(pb, 0); /* size placeholder*/
1762 1762
    ffio_wfourcc(pb, "moov");
1763 1763

  
......
1802 1802
    avio_wb32(pb, 8);    // placeholder for extended size field (64 bit)
1803 1803
    ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free");
1804 1804

  
1805
    mov->mdat_pos = url_ftell(pb);
1805
    mov->mdat_pos = avio_tell(pb);
1806 1806
    avio_wb32(pb, 0); /* size placeholder*/
1807 1807
    ffio_wfourcc(pb, "mdat");
1808 1808
    return 0;
......
1812 1812
static int mov_write_ftyp_tag(AVIOContext *pb, AVFormatContext *s)
1813 1813
{
1814 1814
    MOVMuxContext *mov = s->priv_data;
1815
    int64_t pos = url_ftell(pb);
1815
    int64_t pos = avio_tell(pb);
1816 1816
    int has_h264 = 0, has_video = 0;
1817 1817
    int minor = 0x200;
1818 1818
    int i;
......
2012 2012
            return -1;
2013 2013
    }
2014 2014

  
2015
    trk->cluster[trk->entry].pos = url_ftell(pb) - size;
2015
    trk->cluster[trk->entry].pos = avio_tell(pb) - size;
2016 2016
    trk->cluster[trk->entry].samplesInChunk = samplesInChunk;
2017 2017
    trk->cluster[trk->entry].size = size;
2018 2018
    trk->cluster[trk->entry].entries = samplesInChunk;
......
2243 2243
    int res = 0;
2244 2244
    int i;
2245 2245

  
2246
    int64_t moov_pos = url_ftell(pb);
2246
    int64_t moov_pos = avio_tell(pb);
2247 2247

  
2248 2248
    /* Write size of mdat tag */
2249 2249
    if (mov->mdat_size+8 <= UINT32_MAX) {

Also available in: Unified diff