From 3d2f7c9ca06e9809272cbd4c3112eabc7c919280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 16 Mar 2009 12:15:46 +0100 Subject: [PATCH] mxfmux: Only add an essence container UL once to the partition and preface --- gst/mxf/mxfmux.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/gst/mxf/mxfmux.c b/gst/mxf/mxfmux.c index d6bcc30bc2..973415e0a3 100644 --- a/gst/mxf/mxfmux.c +++ b/gst/mxf/mxfmux.c @@ -446,11 +446,24 @@ gst_mxf_mux_create_metadata (GstMXFMux * mux) tmp = g_array_new (FALSE, FALSE, sizeof (MXFUL)); for (l = mux->collect->data; l; l = l->next) { GstMXFMuxPad *cpad = l->data; + guint i; + gboolean found = FALSE; if (!cpad || !cpad->descriptor || mxf_ul_is_zero (&cpad->descriptor->essence_container)) return GST_FLOW_ERROR; + for (i = 0; i < tmp->len; i++) { + if (mxf_ul_is_equal (&cpad->descriptor->essence_container, + &g_array_index (tmp, MXFUL, i))) { + found = TRUE; + break; + } + } + + if (found) + continue; + g_array_append_val (tmp, cpad->descriptor->essence_container); } mux->preface->n_essence_containers = tmp->len; @@ -893,13 +906,19 @@ gst_mxf_mux_create_header_partition_pack (GstMXFMux * mux) for (l = mux->collect->data; l; l = l->next) { GstMXFMuxPad *cpad = l->data; guint j; + gboolean found = FALSE; - for (j = 0; j < i; j++) { + for (j = 0; j <= i; j++) { if (mxf_ul_is_equal (&cpad->descriptor->essence_container, - &mux->partition.essence_containers[j])) - continue; + &mux->partition.essence_containers[j])) { + found = TRUE; + break; + } } + if (found) + continue; + memcpy (&mux->partition.essence_containers[i], &cpad->descriptor->essence_container, 16); i++;