From 7709920ca33af2f0d3566df0c5265c93c719bfbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 27 Feb 2017 13:55:58 +0200 Subject: [PATCH] qtmux: Update modification times when sending the moov https://bugzilla.gnome.org/show_bug.cgi?id=779422 --- gst/isomp4/atoms.c | 8 ++++---- gst/isomp4/atoms.h | 2 ++ gst/isomp4/gstqtmux.c | 12 ++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gst/isomp4/atoms.c b/gst/isomp4/atoms.c index 4c0453fa21..ce5039e30b 100644 --- a/gst/isomp4/atoms.c +++ b/gst/isomp4/atoms.c @@ -75,8 +75,8 @@ atoms_context_free (AtomsContext * context) #define SECS_PER_DAY (24 * 60 * 60) #define LEAP_YEARS_FROM_1904_TO_1970 17 -static guint64 -get_current_qt_time (void) +guint64 +atoms_get_current_qt_time (void) { GTimeVal timeval; @@ -89,7 +89,7 @@ get_current_qt_time (void) static void common_time_info_init (TimeInfo * ti) { - ti->creation_time = ti->modification_time = get_current_qt_time (); + ti->creation_time = ti->modification_time = atoms_get_current_qt_time (); ti->timescale = 0; ti->duration = 0; } @@ -1143,7 +1143,7 @@ atom_tkhd_init (AtomTKHD * tkhd, AtomsContext * context) atom_full_init (&tkhd->header, FOURCC_tkhd, 0, 0, 0, flags); - tkhd->creation_time = tkhd->modification_time = get_current_qt_time (); + tkhd->creation_time = tkhd->modification_time = atoms_get_current_qt_time (); tkhd->duration = 0; tkhd->track_ID = 0; tkhd->reserved = 0; diff --git a/gst/isomp4/atoms.h b/gst/isomp4/atoms.h index fad8b0bdf0..949b79098f 100644 --- a/gst/isomp4/atoms.h +++ b/gst/isomp4/atoms.h @@ -903,6 +903,8 @@ struct _AtomInfo AtomFreeFunc free_func; }; +guint64 atoms_get_current_qt_time (void); + guint64 atom_copy_data (Atom *atom, guint8 **buffer, guint64 *size, guint64* offset); diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c index feff0790b9..d49bc9fd88 100644 --- a/gst/isomp4/gstqtmux.c +++ b/gst/isomp4/gstqtmux.c @@ -1925,6 +1925,18 @@ gst_qt_mux_send_moov (GstQTMux * qtmux, guint64 * _offset, guint8 *data; GstBuffer *buf; GstFlowReturn ret = GST_FLOW_OK; + GSList *walk; + guint64 current_time = atoms_get_current_qt_time (); + + /* update modification times */ + qtmux->moov->mvhd.time_info.modification_time = current_time; + for (walk = qtmux->collect->data; walk; walk = g_slist_next (walk)) { + GstCollectData *cdata = (GstCollectData *) walk->data; + GstQTPad *qtpad = (GstQTPad *) cdata; + + qtpad->trak->mdia.mdhd.time_info.modification_time = current_time; + qtpad->trak->tkhd.modification_time = current_time; + } /* serialize moov */ offset = size = 0;