avformat/mov: split off MOVStreamContext freeing into its own function

Signed-off-by: James Almer <jamrial@gmail.com>
release/7.0
James Almer 12 months ago
parent 78a7927df7
commit 0042cf8980
  1. 30
      libavformat/mov.c

@ -8587,22 +8587,17 @@ static void mov_free_encryption_index(MOVEncryptionIndex **index) {
av_freep(index);
}
static int mov_read_close(AVFormatContext *s)
static void mov_free_stream_context(AVFormatContext *s, AVStream *st)
{
MOVContext *mov = s->priv_data;
int i, j;
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
MOVStreamContext *sc = st->priv_data;
if (!sc)
continue;
return;
av_freep(&sc->ctts_data);
for (j = 0; j < sc->drefs_count; j++) {
av_freep(&sc->drefs[j].path);
av_freep(&sc->drefs[j].dir);
for (int i = 0; i < sc->drefs_count; i++) {
av_freep(&sc->drefs[i].path);
av_freep(&sc->drefs[i].dir);
}
av_freep(&sc->drefs);
@ -8629,8 +8624,8 @@ static int mov_read_close(AVFormatContext *s)
av_freep(&sc->index_ranges);
if (sc->extradata)
for (j = 0; j < sc->stsd_count; j++)
av_free(sc->extradata[j]);
for (int i = 0; i < sc->stsd_count; i++)
av_free(sc->extradata[i]);
av_freep(&sc->extradata);
av_freep(&sc->extradata_size);
@ -8642,6 +8637,17 @@ static int mov_read_close(AVFormatContext *s)
av_freep(&sc->spherical);
av_freep(&sc->mastering);
av_freep(&sc->coll);
}
static int mov_read_close(AVFormatContext *s)
{
MOVContext *mov = s->priv_data;
int i, j;
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
mov_free_stream_context(s, st);
}
av_freep(&mov->dv_demux);

Loading…
Cancel
Save