Ticket #2818: patchmaxsize.diff

File patchmaxsize.diff, 1.0 KB (added by Carl Eugen Hoyos, 12 years ago)
  • libavformat/avienc.c

    diff --git a/libavformat/avienc.c b/libavformat/avienc.c
    index 89e2a53..18871ec 100644
    a b typedef struct {  
    6464    int64_t audio_strm_length;
    6565    int packet_count;
    6666    int entry;
     67    int max_size;
    6768
    6869    AVIIndex indexes;
    6970} AVIStream;
    … … static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)  
    628629        idx->cluster[cl][id].flags = flags;
    629630        idx->cluster[cl][id].pos   = avio_tell(pb) - avi->movi_list;
    630631        idx->cluster[cl][id].len   = size;
     632        avist->max_size = FFMAX(avist->max_size, size);
    631633        idx->entry++;
    632634    }
    633635
    … … static int avi_write_trailer(AVFormatContext *s)  
    689691            av_freep(&avist->indexes.cluster[j]);
    690692        av_freep(&avist->indexes.cluster);
    691693        avist->indexes.ents_allocated = avist->indexes.entry = 0;
     694        if (pb->seekable) {
     695            avio_seek(pb, avist->frames_hdr_strm + 4, SEEK_SET);
     696            avio_wl32(pb, avist->max_size);
     697        }
    692698    }
    693699
    694700    return res;