Commit 4b8ddf71 authored by Martin Storsjö's avatar Martin Storsjö

movenc: Factorize a function for finishing a written fragment

Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent 0b67c83b
......@@ -5994,6 +5994,16 @@ static int mov_write_squashed_packets(AVFormatContext *s)
return 0;
}
static int mov_finish_fragment(MOVTrack *track)
{
if (!track->entry)
return 0;
track->entry = 0;
track->entries_flushed = 0;
track->end_reliable = 0;
return 0;
}
static int mov_flush_fragment(AVFormatContext *s, int force)
{
MOVMuxContext *mov = s->priv_data;
......@@ -6103,10 +6113,8 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
mov->moov_written = 1;
mov->mdat_size = 0;
for (i = 0; i < mov->nb_tracks; i++) {
mov->tracks[i].entry = 0;
mov->tracks[i].end_reliable = 0;
}
for (i = 0; i < mov->nb_tracks; i++)
mov_finish_fragment(&mov->tracks[i]);
avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT);
return 0;
}
......@@ -6177,9 +6185,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force)
ffio_wfourcc(s->pb, "mdat");
}
track->entry = 0;
track->entries_flushed = 0;
track->end_reliable = 0;
mov_finish_fragment(&mov->tracks[i]);
if (!mov->frag_interleave) {
if (!track->mdat_buf)
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment