url_fseek(pb, mov->tracks[0].mdat_pos, SEEK_SET);
url_fseek(pb, mov->mdat_pos, SEEK_SET);
static int mov_write_trailer(AVFormatContext *s){    MOVContext *mov = s->priv_data;    ByteIOContext *pb = &s->pb;    int res = 0;    int i, j;    offset_t file_size;    file_size = url_ftell(pb);    j = 0;    /* Write size of mdat tag */    for (i=0; i<MAX_STREAMS; i++) {        if(mov->tracks[i].ents_allocated > 0) {            j += mov->tracks[i].mdat_size;        }    }    url_fseek(pb, mov->tracks[0].mdat_pos, SEEK_SET);    put_be32(pb, j+8);    url_fseek(pb, file_size, SEEK_SET);    mov_write_moov_tag(pb, mov);    for (i=0; i<MAX_STREAMS; i++) {        for (j=0; j<mov->tracks[i].ents_allocated/MOV_INDEX_CLUSTER_SIZE; j++) {            av_free(mov->tracks[i].cluster[j]);        }        av_free(mov->tracks[i].cluster);        mov->tracks[i].cluster = NULL;        mov->tracks[i].ents_allocated = mov->tracks[i].entry = 0;    }    put_flush_packet(pb);    return res;}