mxfmux: Rewrite body partition pack on EOS and mark it as complete/closed
authorSebastian Dröge <sebastian@centricular.com>
Fri, 29 Jan 2016 15:38:23 +0000 (16:38 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 29 Jan 2016 16:02:32 +0000 (17:02 +0100)
gst/mxf/mxfmux.c

index 97b87d881fa4c2fda9cf99828ac057e992dccff0..d9ceb96e8cde98f6cf02402b9582b4fc1f7c257e 100644 (file)
@@ -1466,6 +1466,7 @@ gst_mxf_mux_handle_eos (GstMXFMux * mux)
     GList *index_entries = NULL, *l;
     guint index_byte_count = 0;
     guint i;
+    GstBuffer *buf;
 
     for (i = 0; i < mux->index_table->len; i++) {
       MXFIndexTableSegment *segment =
@@ -1538,6 +1539,28 @@ gst_mxf_mux_handle_eos (GstMXFMux * mux)
         GST_ERROR_OBJECT (mux, "Rewriting header partition failed");
         return ret;
       }
+
+      g_assert (mux->offset == body_partition);
+
+      mux->partition.type = MXF_PARTITION_PACK_BODY;
+      mux->partition.closed = TRUE;
+      mux->partition.complete = TRUE;
+      mux->partition.this_partition = mux->offset;
+      mux->partition.prev_partition = 0;
+      mux->partition.footer_partition = footer_partition;
+      mux->partition.header_byte_count = 0;
+      mux->partition.index_byte_count = 0;
+      mux->partition.index_sid = 0;
+      mux->partition.body_offset = 0;
+      mux->partition.body_sid =
+          mux->preface->content_storage->essence_container_data[0]->body_sid;
+
+      buf = mxf_partition_pack_to_buffer (&mux->partition);
+      ret = gst_mxf_mux_push (mux, buf);
+      if (ret != GST_FLOW_OK) {
+        GST_ERROR_OBJECT (mux, "Rewriting body partition failed");
+        return ret;
+      }
     } else {
       GST_WARNING_OBJECT (mux, "Can't rewrite header partition");
     }