changeset 4475:fc3806848a49 libavformat

simplify
author bcoudurier
date Fri, 13 Feb 2009 07:46:03 +0000
parents cfd03b6fab13
children b9d03c68660b
files mxfenc.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mxfenc.c	Fri Feb 13 07:34:01 2009 +0000
+++ b/mxfenc.c	Fri Feb 13 07:46:03 2009 +0000
@@ -169,7 +169,6 @@
 typedef struct MXFContext {
     int64_t footer_partition_offset;
     int essence_container_count;
-    uint8_t essence_containers_indices[FF_ARRAY_ELEMS(mxf_essence_container_uls)];
     AVRational time_base;
     int header_written;
     MXFIndexEntry *index_entries;
@@ -427,8 +426,8 @@
     mxf_write_refs_count(pb, c->essence_container_count);
     av_log(s,AV_LOG_DEBUG, "essence container count:%d\n", c->essence_container_count);
     for (i = 0; i < c->essence_container_count; i++) {
-        put_buffer(pb, mxf_essence_container_uls[c->essence_containers_indices[i]].container_ul, 16);
-        PRINT_KEY(s, "essence container ul:\n", mxf_essence_container_uls[c->essence_containers_indices[i]].container_ul);
+        MXFStreamContext *sc = s->streams[i]->priv_data;
+        put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
     }
 }
 
@@ -731,8 +730,10 @@
     mxf_write_local_tag(pb, 16, 0x3004);
     if (mxf->essence_container_count > 1)
         ul = multiple_desc_ul;
-    else
-        ul = mxf_essence_container_uls[mxf->essence_containers_indices[0]].container_ul;
+    else {
+        MXFStreamContext *sc = s->streams[0]->priv_data;
+        ul = mxf_essence_container_uls[sc->index].container_ul;
+    }
     put_buffer(pb, ul, 16);
 
     // write sub descriptor refs
@@ -1467,8 +1468,8 @@
         sc->codec_ul = &mxf_essence_container_uls[sc->index].codec_ul;
 
         if (!present[sc->index]) {
-            mxf->essence_containers_indices[mxf->essence_container_count++] = sc->index;
             present[sc->index] = 1;
+            mxf->essence_container_count++;
         } else
             present[sc->index]++;
 
@@ -1548,8 +1549,10 @@
     put_be16(pb, frame); // continuity count
     if (mxf->essence_container_count > 1)
         put_buffer(pb, multiple_desc_ul, 16);
-    else
-        put_buffer(pb, mxf_essence_container_uls[mxf->essence_containers_indices[0]].container_ul, 16);
+    else {
+        MXFStreamContext *sc = s->streams[0]->priv_data;
+        put_buffer(pb, mxf_essence_container_uls[sc->index].container_ul, 16);
+    }
     put_byte(pb, 0);
     put_be64(pb, 0);
     put_be64(pb, 0); // creation date/time stamp