You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
Merge commit '5ea5a24eb70646a9061b85af407fcbb5dd4f89fd'
* commit '5ea5a24eb70646a9061b85af407fcbb5dd4f89fd': movenc: Honor flush requests with delay_moov, when some tracks lack samples Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
@@ -4109,7 +4109,7 @@ static int mov_flush_fragment_interleaving(AVFormatContext *s, MOVTrack *track)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mov_flush_fragment(AVFormatContext *s)
|
static int mov_flush_fragment(AVFormatContext *s, int force)
|
||||||
{
|
{
|
||||||
MOVMuxContext *mov = s->priv_data;
|
MOVMuxContext *mov = s->priv_data;
|
||||||
int i, first_track = -1;
|
int i, first_track = -1;
|
||||||
@@ -4155,7 +4155,7 @@ static int mov_flush_fragment(AVFormatContext *s)
|
|||||||
if (!mov->tracks[i].entry)
|
if (!mov->tracks[i].entry)
|
||||||
break;
|
break;
|
||||||
/* Don't write the initial moov unless all tracks have data */
|
/* Don't write the initial moov unless all tracks have data */
|
||||||
if (i < mov->nb_streams)
|
if (i < mov->nb_streams && !force)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
moov_size = get_moov_size(s);
|
moov_size = get_moov_size(s);
|
||||||
@@ -4282,17 +4282,17 @@ static int mov_flush_fragment(AVFormatContext *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mov_auto_flush_fragment(AVFormatContext *s)
|
static int mov_auto_flush_fragment(AVFormatContext *s, int force)
|
||||||
{
|
{
|
||||||
MOVMuxContext *mov = s->priv_data;
|
MOVMuxContext *mov = s->priv_data;
|
||||||
int had_moov = mov->moov_written;
|
int had_moov = mov->moov_written;
|
||||||
int ret = mov_flush_fragment(s);
|
int ret = mov_flush_fragment(s, force);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
// If using delay_moov, the first flush only wrote the moov,
|
// If using delay_moov, the first flush only wrote the moov,
|
||||||
// not the actual moof+mdat pair, thus flush once again.
|
// not the actual moof+mdat pair, thus flush once again.
|
||||||
if (!had_moov && mov->flags & FF_MOV_FLAG_DELAY_MOOV)
|
if (!had_moov && mov->flags & FF_MOV_FLAG_DELAY_MOOV)
|
||||||
ret = mov_flush_fragment(s);
|
ret = mov_flush_fragment(s, force);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4583,7 +4583,7 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
// for the other ones that are flushed at the same time.
|
// for the other ones that are flushed at the same time.
|
||||||
trk->track_duration = pkt->dts - trk->start_dts;
|
trk->track_duration = pkt->dts - trk->start_dts;
|
||||||
trk->end_pts = pkt->pts;
|
trk->end_pts = pkt->pts;
|
||||||
mov_auto_flush_fragment(s);
|
mov_auto_flush_fragment(s, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4614,7 +4614,7 @@ static int mov_write_subtitle_end_packet(AVFormatContext *s,
|
|||||||
static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
if (!pkt) {
|
if (!pkt) {
|
||||||
mov_flush_fragment(s);
|
mov_flush_fragment(s, 1);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
@@ -5530,7 +5530,7 @@ static int mov_write_trailer(AVFormatContext *s)
|
|||||||
}
|
}
|
||||||
res = 0;
|
res = 0;
|
||||||
} else {
|
} else {
|
||||||
mov_auto_flush_fragment(s);
|
mov_auto_flush_fragment(s, 1);
|
||||||
for (i = 0; i < mov->nb_streams; i++)
|
for (i = 0; i < mov->nb_streams; i++)
|
||||||
mov->tracks[i].data_offset = 0;
|
mov->tracks[i].data_offset = 0;
|
||||||
if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
|
if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) {
|
||||||
|
Reference in New Issue
Block a user