mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
qtmux: Timecode track fixes for STSD entry
The n_frames field (frames per second) should follow the nominal frame rate for drop-frame timecodes. Also, the trak's timescale (and duration, accordingly) should follow the STSD entry's timescale and frame duration (fps_n and fps_d accordingly), not the other way around. https://bugzilla.gnome.org/show_bug.cgi?id=777832
This commit is contained in:
parent
03db374144
commit
af47e93b97
1 changed files with 14 additions and 10 deletions
|
@ -3192,23 +3192,24 @@ timecode_atom_trak_set_duration (AtomTRAK * trak, guint64 duration,
|
|||
g_assert (trak->mdia.minf.gmhd != NULL);
|
||||
g_assert (atom_array_get_len (&trak->mdia.minf.stbl.stts.entries) == 1);
|
||||
|
||||
trak->tkhd.duration = duration;
|
||||
trak->mdia.mdhd.time_info.duration = duration;
|
||||
trak->mdia.mdhd.time_info.timescale = timescale;
|
||||
|
||||
entry = &atom_array_index (&trak->mdia.minf.stbl.stts.entries, 0);
|
||||
entry->sample_delta = duration;
|
||||
|
||||
for (iter = trak->mdia.minf.stbl.stsd.entries; iter;
|
||||
iter = g_list_next (iter)) {
|
||||
SampleTableEntry *entry = iter->data;
|
||||
if (entry->kind == TIMECODE) {
|
||||
SampleTableEntryTMCD *tmcd = (SampleTableEntryTMCD *) entry;
|
||||
|
||||
tmcd->frame_duration = tmcd->frame_duration * timescale / tmcd->timescale;
|
||||
tmcd->timescale = timescale;
|
||||
duration = duration * tmcd->timescale / timescale;
|
||||
timescale = tmcd->timescale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
trak->tkhd.duration = duration;
|
||||
trak->mdia.mdhd.time_info.duration = duration;
|
||||
trak->mdia.mdhd.time_info.timescale = timescale;
|
||||
|
||||
entry = &atom_array_index (&trak->mdia.minf.stbl.stts.entries, 0);
|
||||
entry->sample_delta = duration;
|
||||
}
|
||||
|
||||
static guint32
|
||||
|
@ -3779,7 +3780,10 @@ atom_trak_add_timecode_entry (AtomTRAK * trak, AtomsContext * context,
|
|||
tmcd->name.name = g_strdup ("Tape");
|
||||
tmcd->timescale = tc->config.fps_n;
|
||||
tmcd->frame_duration = tc->config.fps_d;
|
||||
tmcd->n_frames = tc->config.fps_n / tc->config.fps_d;
|
||||
if (tc->config.fps_d == 1001)
|
||||
tmcd->n_frames = tc->config.fps_n / 1000;
|
||||
else
|
||||
tmcd->n_frames = tc->config.fps_n / tc->config.fps_d;
|
||||
|
||||
stsd->entries = g_list_prepend (stsd->entries, tmcd);
|
||||
stsd->n_entries++;
|
||||
|
|
Loading…
Reference in a new issue