#include "libavutil/avstring.h"
#include "libavutil/avutil.h"
#include "libavutil/internal.h"
-#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/avassert.h"
#include "libavutil/timestamp.h"
avi->movi_list = ff_start_tag(pb, "LIST");
ffio_wfourcc(pb, "movi");
- avio_flush(pb);
-
return 0;
}
int64_t pos;
int au_byterate, au_ssize, au_scale;
- avio_flush(pb);
pos = avio_tell(pb);
/* Updating one entry in the AVI OpenDML master index */
AVIContext *avi = s->priv_data;
AVIOContext *pb = s->pb;
int res = 0;
- int i, j, n, nb_frames;
+ int i, n, nb_frames;
int64_t file_size;
for (i = 0; i < s->nb_streams; i++) {
for (i = 0; i < s->nb_streams; i++) {
AVIStream *avist = s->streams[i]->priv_data;
- for (j = 0; j < avist->indexes.ents_allocated / AVI_INDEX_CLUSTER_SIZE; j++)
- av_freep(&avist->indexes.cluster[j]);
- av_freep(&avist->indexes.cluster);
- avist->indexes.ents_allocated = avist->indexes.entry = 0;
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
avio_seek(pb, avist->frames_hdr_strm + 4, SEEK_SET);
avio_wl32(pb, avist->max_size);
return res;
}
+static void avi_deinit(AVFormatContext *s)
+{
+ for (int i = 0; i < s->nb_streams; i++) {
+ AVIStream *avist = s->streams[i]->priv_data;
+ if (!avist)
+ continue;
+ for (int j = 0; j < avist->indexes.ents_allocated / AVI_INDEX_CLUSTER_SIZE; j++)
+ av_freep(&avist->indexes.cluster[j]);
+ av_freep(&avist->indexes.cluster);
+ avist->indexes.ents_allocated = avist->indexes.entry = 0;
+ }
+}
+
#define OFFSET(x) offsetof(AVIContext, x)
#define ENC AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
.audio_codec = CONFIG_LIBMP3LAME ? AV_CODEC_ID_MP3 : AV_CODEC_ID_AC3,
.video_codec = AV_CODEC_ID_MPEG4,
.init = avi_init,
+ .deinit = avi_deinit,
.write_header = avi_write_header,
.write_packet = avi_write_packet,
.write_trailer = avi_write_trailer,