changeset 4345:8e3538adb529 libavformat

more flexible mapping selection
author bcoudurier
date Mon, 02 Feb 2009 10:54:10 +0000
parents 582124bb2c15
children 0a142b4b841e
files mxfenc.c
diffstat 1 files changed, 16 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mxfenc.c	Mon Feb 02 10:41:43 2009 +0000
+++ b/mxfenc.c	Mon Feb 02 10:54:10 2009 +0000
@@ -75,10 +75,18 @@
     UID container_ul;
     UID element_ul;
     UID codec_ul;
-    enum CodecID id;
     void (*write_desc)();
 } MXFContainerEssenceEntry;
 
+static const struct {
+    enum CodecID id;
+    int index;
+} mxf_essence_mappings[] = {
+    { CODEC_ID_MPEG2VIDEO, 0 },
+    { CODEC_ID_PCM_S16LE,  1 },
+    { 0 }
+};
+
 static void mxf_write_wav_desc(AVFormatContext *s, AVStream *st);
 static void mxf_write_aes3_desc(AVFormatContext *s, AVStream *st);
 static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st);
@@ -87,19 +95,19 @@
     { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 },
       { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x05,0x00 },
       { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x04,0x01,0x02,0x02,0x01,0x00,0x00,0x00 },
-      CODEC_ID_MPEG2VIDEO, mxf_write_mpegvideo_desc },
+      mxf_write_mpegvideo_desc },
     { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x03,0x00 },
       { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x03,0x00 },
       { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      CODEC_ID_PCM_S16LE, mxf_write_aes3_desc },
+      mxf_write_aes3_desc },
     { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 },
       { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x16,0x01,0x01,0x00 },
       { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00 },
-      CODEC_ID_PCM_S16LE, mxf_write_wav_desc },
+      mxf_write_wav_desc },
     { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
       { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
       { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
-      CODEC_ID_NONE, NULL },
+      NULL },
 };
 
 typedef struct MXFContext {
@@ -264,9 +272,9 @@
 static int mxf_get_essence_container_ul_index(enum CodecID id)
 {
     int i;
-    for (i = 0; i < FF_ARRAY_ELEMS(mxf_essence_container_uls); i++)
-        if (mxf_essence_container_uls[i].id == id)
-            return i;
+    for (i = 0; mxf_essence_mappings[i].id; i++)
+        if (mxf_essence_mappings[i].id == id)
+            return mxf_essence_mappings[i].index;
     return -1;
 }