qtmux: Update modification times when sending the moov

https://bugzilla.gnome.org/show_bug.cgi?id=779422
This commit is contained in:
Sebastian Dröge 2017-02-27 13:55:58 +02:00
parent f7b1eae3a2
commit 7709920ca3
3 changed files with 18 additions and 4 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;