You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
movenc: Write edit lists for fragmented files as well, if necessary
This is necessary to get the right timestamp offset for content that starts with dts != 0. This currently only helps when writing fragmented files with a non-empty moov atom. When writing an empty moov atom, we don't have any packets yet, so we don't know the starting dts for the tracks. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
@@ -1595,7 +1595,8 @@ static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This box seems important for the psp playback ... without it the movie seems to hang
|
// This box seems important for the psp playback ... without it the movie seems to hang
|
||||||
static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
|
static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov,
|
||||||
|
MOVTrack *track)
|
||||||
{
|
{
|
||||||
int64_t duration = av_rescale_rnd(track->track_duration, MOV_TIMESCALE,
|
int64_t duration = av_rescale_rnd(track->track_duration, MOV_TIMESCALE,
|
||||||
track->timescale, AV_ROUND_UP);
|
track->timescale, AV_ROUND_UP);
|
||||||
@@ -1645,6 +1646,13 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track)
|
|||||||
duration += delay;
|
duration += delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For fragmented files, we don't know the full length yet. Setting
|
||||||
|
* duration to 0 allows us to only specify the offset, including
|
||||||
|
* the rest of the content (from all future fragments) without specifying
|
||||||
|
* an explicit duration. */
|
||||||
|
if (mov->flags & FF_MOV_FLAG_FRAGMENT)
|
||||||
|
duration = 0;
|
||||||
|
|
||||||
/* duration */
|
/* duration */
|
||||||
if (version == 1) {
|
if (version == 1) {
|
||||||
avio_wb64(pb, duration);
|
avio_wb64(pb, duration);
|
||||||
@@ -1758,8 +1766,7 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov,
|
|||||||
if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||
|
if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS ||
|
||||||
(track->entry && track->cluster[0].dts) ||
|
(track->entry && track->cluster[0].dts) ||
|
||||||
is_clcp_track(track)) {
|
is_clcp_track(track)) {
|
||||||
if (!(mov->flags & FF_MOV_FLAG_FRAGMENT))
|
mov_write_edts_tag(pb, mov, track); // PSP Movies require edts box
|
||||||
mov_write_edts_tag(pb, track); // PSP Movies require edts box
|
|
||||||
}
|
}
|
||||||
if (track->tref_tag)
|
if (track->tref_tag)
|
||||||
mov_write_tref_tag(pb, track);
|
mov_write_tref_tag(pb, track);
|
||||||
|
Reference in New Issue
Block a user