mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-16 21:14:44 +00:00
qtmux: Make sure timecode uses the same timescale as video
Don't blindly derive it from the frame rate, but try to get the per-pad configured timescale first (if it exists) https://bugzilla.gnome.org/show_bug.cgi?id=792680
This commit is contained in:
parent
c71cd08d0e
commit
379059b1c7
3 changed files with 15 additions and 11 deletions
|
@ -3813,17 +3813,18 @@ atom_framerate_to_timescale (gint n, gint d)
|
|||
|
||||
static SampleTableEntryTMCD *
|
||||
atom_trak_add_timecode_entry (AtomTRAK * trak, AtomsContext * context,
|
||||
GstVideoTimeCode * tc)
|
||||
guint32 trak_timescale, GstVideoTimeCode * tc)
|
||||
{
|
||||
AtomSTSD *stsd = &trak->mdia.minf.stbl.stsd;
|
||||
SampleTableEntryTMCD *tmcd = sample_entry_tmcd_new ();
|
||||
|
||||
g_assert (trak_timescale != 0);
|
||||
|
||||
trak->mdia.hdlr.component_type = FOURCC_mhlr;
|
||||
trak->mdia.hdlr.handler_type = FOURCC_tmcd;
|
||||
g_free (trak->mdia.hdlr.name);
|
||||
trak->mdia.hdlr.name = g_strdup ("Time Code Media Handler");
|
||||
trak->mdia.mdhd.time_info.timescale =
|
||||
atom_framerate_to_timescale (tc->config.fps_n, tc->config.fps_d);
|
||||
trak->mdia.mdhd.time_info.timescale = trak_timescale;
|
||||
|
||||
tmcd->se.kind = TIMECODE;
|
||||
tmcd->se.data_reference_index = 1;
|
||||
|
@ -3832,9 +3833,10 @@ atom_trak_add_timecode_entry (AtomTRAK * trak, AtomsContext * context,
|
|||
tmcd->tc_flags |= TC_DROP_FRAME;
|
||||
tmcd->name.language_code = 0;
|
||||
tmcd->name.name = g_strdup ("Tape");
|
||||
tmcd->timescale =
|
||||
atom_framerate_to_timescale (tc->config.fps_n, tc->config.fps_d);
|
||||
tmcd->frame_duration = 100;
|
||||
tmcd->timescale = trak_timescale;
|
||||
tmcd->frame_duration =
|
||||
gst_util_uint64_scale (tmcd->timescale, tc->config.fps_d,
|
||||
tc->config.fps_n);
|
||||
if (tc->config.fps_d == 1001)
|
||||
tmcd->n_frames = tc->config.fps_n / 1000;
|
||||
else
|
||||
|
@ -3991,7 +3993,7 @@ atom_trak_set_audio_type (AtomTRAK * trak, AtomsContext * context,
|
|||
|
||||
SampleTableEntryTMCD *
|
||||
atom_trak_set_timecode_type (AtomTRAK * trak, AtomsContext * context,
|
||||
GstVideoTimeCode * tc)
|
||||
guint32 trak_timescale, GstVideoTimeCode * tc)
|
||||
{
|
||||
SampleTableEntryTMCD *ste;
|
||||
AtomGMHD *gmhd = trak->mdia.minf.gmhd;
|
||||
|
@ -4000,7 +4002,7 @@ atom_trak_set_timecode_type (AtomTRAK * trak, AtomsContext * context,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ste = atom_trak_add_timecode_entry (trak, context, tc);
|
||||
ste = atom_trak_add_timecode_entry (trak, context, trak_timescale, tc);
|
||||
|
||||
gmhd = atom_gmhd_new ();
|
||||
gmhd->gmin.graphics_mode = 0x0040;
|
||||
|
|
|
@ -1039,7 +1039,7 @@ SampleTableEntryTX3G * atom_trak_set_subtitle_type (AtomTRAK * trak, AtomsContex
|
|||
SubtitleSampleEntry * entry);
|
||||
|
||||
SampleTableEntryTMCD *
|
||||
atom_trak_set_timecode_type (AtomTRAK * trak, AtomsContext * context, GstVideoTimeCode * tc);
|
||||
atom_trak_set_timecode_type (AtomTRAK * trak, AtomsContext * context, guint trak_timescale, GstVideoTimeCode * tc);
|
||||
|
||||
void atom_trak_update_bitrates (AtomTRAK * trak, guint32 avg_bitrate,
|
||||
guint32 max_bitrate);
|
||||
|
|
|
@ -2588,7 +2588,8 @@ gst_qt_mux_prefill_samples (GstQTMux * qtmux)
|
|||
qpad->trak->tref = atom_tref_new (FOURCC_tmcd);
|
||||
atom_tref_add_entry (qpad->trak->tref, qpad->tc_trak->tkhd.track_ID);
|
||||
|
||||
atom_trak_set_timecode_type (qpad->tc_trak, qtmux->context, tc);
|
||||
atom_trak_set_timecode_type (qpad->tc_trak, qtmux->context,
|
||||
qpad->trak->mdia.mdhd.time_info.timescale, tc);
|
||||
|
||||
atom_trak_add_samples (qpad->tc_trak, 1, 1, 4,
|
||||
qtmux->mdat_size, FALSE, 0);
|
||||
|
@ -4086,7 +4087,8 @@ gst_qt_mux_check_and_update_timecode (GstQTMux * qtmux, GstQTPad * pad,
|
|||
pad->trak->tref = atom_tref_new (FOURCC_tmcd);
|
||||
atom_tref_add_entry (pad->trak->tref, pad->tc_trak->tkhd.track_ID);
|
||||
|
||||
atom_trak_set_timecode_type (pad->tc_trak, qtmux->context, pad->first_tc);
|
||||
atom_trak_set_timecode_type (pad->tc_trak, qtmux->context,
|
||||
pad->trak->mdia.mdhd.time_info.timescale, pad->first_tc);
|
||||
|
||||
tc_buf = gst_buffer_new_allocate (NULL, 4, NULL);
|
||||
szret = gst_buffer_fill (tc_buf, 0, &frames_since_daily_jam, 4);
|
||||
|
|
Loading…
Reference in a new issue