Revision a2704c97 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 */
......
113 113
    int index = 0, oldval = -1, i;
114 114
    int64_t entryPos, curpos;
115 115

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

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

  
261 261
    avio_wb32(pb, 0); // size
......
317 317

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

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

  
332 332
    avio_wb32(pb, 0);     /* size */
333 333
    ffio_wfourcc(pb, "wave");
......
400 400

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

  
......
518 518

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

  
523 523
    avio_wb32(pb, 0);
524 524
    ffio_wfourcc(pb, "avcC");
......
764 764

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

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

  
798 798
    avio_wb32(pb, 0); /* size */
......
861 861

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

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

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

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

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

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

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

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

  
1254 1254
    avio_wb32(pb, 0); /* size */
1255 1255
    ffio_wfourcc(pb, "tapt");
......
1338 1338

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

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

  
1630 1630
    avio_wb32(pb, 0);            // size
......
1720 1720
    int64_t pos, pos2;
1721 1721

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

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

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

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

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

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

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

Also available in: Unified diff