From 830e7dc14b6e84b5a56b03c0339c6c6e0076d21d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 5 Dec 2018 19:31:25 +0200 Subject: [PATCH] qtmux: Set timescale of closedcaption tracks to the one of the main video track --- gst/isomp4/gstqtmux.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index 508379b232..26c2498234 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -3041,10 +3041,11 @@ gst_qt_mux_start_file (GstQTMux * qtmux) qtmux->timescale = suggested_timescale; } - /* Set width/height of any closed caption tracks to that of the first - * video track */ + /* Set width/height/timescale of any closed caption tracks to that of the + * first video track */ { guint video_width = 0, video_height = 0; + guint32 video_timescale = 0; GSList *walk; for (walk = qtmux->sinkpads; walk; walk = g_slist_next (walk)) { @@ -3058,7 +3059,7 @@ gst_qt_mux_start_file (GstQTMux * qtmux) if (qpad->trak->mdia.hdlr.handler_type != FOURCC_clcp) continue; - if (video_width == 0 || video_height == 0) { + if (video_width == 0 || video_height == 0 || video_timescale == 0) { GSList *walk2; for (walk2 = qtmux->sinkpads; walk2; walk2 = g_slist_next (walk2)) { @@ -3074,11 +3075,13 @@ gst_qt_mux_start_file (GstQTMux * qtmux) video_width = qpad2->trak->tkhd.width; video_height = qpad2->trak->tkhd.height; + video_timescale = qpad2->trak->mdia.mdhd.time_info.timescale; } } qpad->trak->tkhd.width = video_width << 16; qpad->trak->tkhd.height = video_height << 16; + qpad->trak->mdia.mdhd.time_info.timescale = video_timescale; } } @@ -6113,7 +6116,8 @@ gst_qt_mux_caption_sink_set_caps (GstQTPad * qtpad, GstCaps * caps) } else goto refuse_caps; - /* FIXME: Get the timescale from the video track ? */ + /* We set the real timescale later to the one from the video track when + * writing the headers */ timescale = gst_qt_mux_pad_get_timescale (GST_QT_MUX_PAD_CAST (pad)); if (!timescale && qtmux->trak_timescale) timescale = qtmux->trak_timescale;