Revision a2704c97 libavformat/mxfenc.c

View differences:

libavformat/mxfenc.c
1171 1171

  
1172 1172
static void mxf_write_klv_fill(AVFormatContext *s)
1173 1173
{
1174
    unsigned pad = klv_fill_size(url_ftell(s->pb));
1174
    unsigned pad = klv_fill_size(avio_tell(s->pb));
1175 1175
    if (pad) {
1176 1176
        avio_write(s->pb, klv_fill_key, 16);
1177 1177
        pad -= 16 + 4;
1178 1178
        klv_encode_ber4_length(s->pb, pad);
1179 1179
        for (; pad; pad--)
1180 1180
            avio_w8(s->pb, 0);
1181
        assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
1181
        assert(!(avio_tell(s->pb) & (KAG_SIZE-1)));
1182 1182
    }
1183 1183
}
1184 1184

  
......
1190 1190
    AVIOContext *pb = s->pb;
1191 1191
    int64_t header_byte_count_offset;
1192 1192
    unsigned index_byte_count = 0;
1193
    uint64_t partition_offset = url_ftell(pb);
1193
    uint64_t partition_offset = avio_tell(pb);
1194 1194

  
1195 1195
    if (!mxf->edit_unit_byte_count && mxf->edit_units_count)
1196 1196
        index_byte_count = 85 + 12+(s->nb_streams+1)*6 +
......
1233 1233
    avio_wb64(pb, mxf->footer_partition_offset); // footerPartition
1234 1234

  
1235 1235
    // set offset
1236
    header_byte_count_offset = url_ftell(pb);
1236
    header_byte_count_offset = avio_tell(pb);
1237 1237
    avio_wb64(pb, 0); // headerByteCount, update later
1238 1238

  
1239 1239
    // indexTable
......
1260 1260
        unsigned header_byte_count;
1261 1261

  
1262 1262
        mxf_write_klv_fill(s);
1263
        start = url_ftell(s->pb);
1263
        start = avio_tell(s->pb);
1264 1264
        mxf_write_primer_pack(s);
1265 1265
        mxf_write_header_metadata_sets(s);
1266
        pos = url_ftell(s->pb);
1266
        pos = avio_tell(s->pb);
1267 1267
        header_byte_count = pos - start + klv_fill_size(pos);
1268 1268

  
1269 1269
        // update header_byte_count
......
1617 1617
        klv_encode_ber4_length(s->pb, pad);
1618 1618
        for (; pad; pad--)
1619 1619
            avio_w8(s->pb, 0);
1620
        assert(!(url_ftell(s->pb) & (KAG_SIZE-1)));
1620
        assert(!(avio_tell(s->pb) & (KAG_SIZE-1)));
1621 1621
    } else {
1622 1622
        av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n");
1623 1623
        for (; pad > 0; pad--)
......
1740 1740
{
1741 1741
    MXFContext *mxf = s->priv_data;
1742 1742
    AVIOContext *pb = s->pb;
1743
    uint64_t pos = url_ftell(pb);
1743
    uint64_t pos = avio_tell(pb);
1744 1744
    int i;
1745 1745

  
1746 1746
    avio_write(pb, random_index_pack_key, 16);
......
1760 1760
    avio_wb32(pb, 0); // BodySID of footer partition
1761 1761
    avio_wb64(pb, mxf->footer_partition_offset);
1762 1762

  
1763
    avio_wb32(pb, url_ftell(pb) - pos + 4);
1763
    avio_wb32(pb, avio_tell(pb) - pos + 4);
1764 1764
}
1765 1765

  
1766 1766
static int mxf_write_footer(AVFormatContext *s)
......
1771 1771
    mxf->duration = mxf->last_indexed_edit_unit + mxf->edit_units_count;
1772 1772

  
1773 1773
    mxf_write_klv_fill(s);
1774
    mxf->footer_partition_offset = url_ftell(pb);
1774
    mxf->footer_partition_offset = avio_tell(pb);
1775 1775
    if (mxf->edit_unit_byte_count) { // no need to repeat index
1776 1776
        mxf_write_partition(s, 0, 0, footer_partition_key, 0);
1777 1777
    } else {

Also available in: Unified diff