summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@ahiru.eu>2017-05-16 12:56:15 +0300
committerSebastian Dröge <sebastian@centricular.com>2017-05-16 15:16:58 +0300
commit5f7fe63feaedaa06d2b79f0cd2b04bba0ccc8bb0 (patch)
tree3cd4a7339d84d1adcbe7c574548e7bc6afc1a64e
parent347e8140743fcea40f5e4bbe1b6f9ba440579a6b (diff)
qtmux: Do not check timecode data for mp4 container
Timecode trak is only supported for mov right now, not for mp4. That code would otherwise create an invalid trak if the muxed video contained timecode metadata. https://bugzilla.gnome.org/show_bug.cgi?id=782684
-rw-r--r--gst/isomp4/gstqtmux.c65
1 files changed, 38 insertions, 27 deletions
diff --git a/gst/isomp4/gstqtmux.c b/gst/isomp4/gstqtmux.c
index fb3b68582..36d697882 100644
--- a/gst/isomp4/gstqtmux.c
+++ b/gst/isomp4/gstqtmux.c
@@ -2443,6 +2443,7 @@ gst_qt_mux_prefill_samples (GstQTMux * qtmux)
{
GstQTPad *qpad;
GSList *walk;
+ GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux));
/* Update expected sample sizes/durations as needed, this is for raw
* audio where samples are actual audio samples. */
@@ -2454,41 +2455,43 @@ gst_qt_mux_prefill_samples (GstQTMux * qtmux)
return FALSE;
}
- /* For the first sample check/update timecode as needed. We do that before
- * all actual samples as the code in gst_qt_mux_add_buffer() does it with
- * initial buffer directly, not with last_buf */
- for (walk = qtmux->collect->data; walk; walk = g_slist_next (walk)) {
- GstCollectData *cdata = (GstCollectData *) walk->data;
- GstQTPad *qpad = (GstQTPad *) cdata;
- GstBuffer *buffer =
- gst_collect_pads_peek (qtmux->collect, (GstCollectData *) qpad);
- GstVideoTimeCodeMeta *tc_meta;
+ if (qtmux_klass->format == GST_QT_MUX_FORMAT_QT) {
+ /* For the first sample check/update timecode as needed. We do that before
+ * all actual samples as the code in gst_qt_mux_add_buffer() does it with
+ * initial buffer directly, not with last_buf */
+ for (walk = qtmux->collect->data; walk; walk = g_slist_next (walk)) {
+ GstCollectData *cdata = (GstCollectData *) walk->data;
+ GstQTPad *qpad = (GstQTPad *) cdata;
+ GstBuffer *buffer =
+ gst_collect_pads_peek (qtmux->collect, (GstCollectData *) qpad);
+ GstVideoTimeCodeMeta *tc_meta;
- if (buffer && (tc_meta = gst_buffer_get_video_time_code_meta (buffer))) {
- GstVideoTimeCode *tc = &tc_meta->tc;
+ if (buffer && (tc_meta = gst_buffer_get_video_time_code_meta (buffer))) {
+ GstVideoTimeCode *tc = &tc_meta->tc;
- qpad->tc_trak = atom_trak_new (qtmux->context);
- atom_moov_add_trak (qtmux->moov, qpad->tc_trak);
+ qpad->tc_trak = atom_trak_new (qtmux->context);
+ atom_moov_add_trak (qtmux->moov, qpad->tc_trak);
- qpad->trak->tref = atom_tref_new (FOURCC_tmcd);
- atom_tref_add_entry (qpad->trak->tref, qpad->tc_trak->tkhd.track_ID);
+ 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, tc);
- atom_trak_add_samples (qpad->tc_trak, 1, 1, 4,
- qtmux->mdat_size, FALSE, 0);
+ atom_trak_add_samples (qpad->tc_trak, 1, 1, 4,
+ qtmux->mdat_size, FALSE, 0);
- qpad->tc_pos = qtmux->mdat_size;
- qpad->first_tc = gst_video_time_code_copy (tc);
- qpad->first_pts = GST_BUFFER_PTS (buffer);
+ qpad->tc_pos = qtmux->mdat_size;
+ qpad->first_tc = gst_video_time_code_copy (tc);
+ qpad->first_pts = GST_BUFFER_PTS (buffer);
- qtmux->current_chunk_offset = -1;
- qtmux->current_chunk_size = 0;
- qtmux->current_chunk_duration = 0;
- qtmux->mdat_size += 4;
+ qtmux->current_chunk_offset = -1;
+ qtmux->current_chunk_size = 0;
+ qtmux->current_chunk_duration = 0;
+ qtmux->mdat_size += 4;
+ }
+ if (buffer)
+ gst_buffer_unref (buffer);
}
- if (buffer)
- gst_buffer_unref (buffer);
}
while ((qpad = find_best_pad_prefill (qtmux))) {
@@ -3173,6 +3176,10 @@ gst_qt_mux_update_timecode (GstQTMux * qtmux, GstQTPad * qtpad)
GstBuffer *buf;
GstMapInfo map;
guint64 offset = qtpad->tc_pos;
+ GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux));
+
+ if (qtmux_klass->format != GST_QT_MUX_FORMAT_QT)
+ return GST_FLOW_OK;
g_assert (qtpad->tc_pos != -1);
@@ -3893,6 +3900,10 @@ gst_qt_mux_check_and_update_timecode (GstQTMux * qtmux, GstQTPad * pad,
GstBuffer *tc_buf;
gsize szret;
guint32 frames_since_daily_jam;
+ GstQTMuxClass *qtmux_klass = (GstQTMuxClass *) (G_OBJECT_GET_CLASS (qtmux));
+
+ if (qtmux_klass->format != GST_QT_MUX_FORMAT_QT)
+ return ret;
if (buf == NULL || (pad->tc_trak != NULL && pad->tc_pos == -1))
return ret;