Commit af47e93b authored by Vivia Nikolaidou's avatar Vivia Nikolaidou Committed by Sebastian Dröge

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
parent 03db3741
......@@ -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++;
......
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