[FFmpeg-soc] [soc]: r3349 - in mxf: mxf.c mxf.h mxfdec.c mxfenc.c

spyfeng subversion at mplayerhq.hu
Sat Aug 16 14:17:55 CEST 2008


Author: spyfeng
Date: Sat Aug 16 14:17:55 2008
New Revision: 3349

Log:
extract common table mxf_essence_container_uls frm mxfenc.c/mxfdec.c into mxf.ch


Modified:
   mxf/mxf.c
   mxf/mxf.h
   mxf/mxfdec.c
   mxf/mxfenc.c

Modified: mxf/mxf.c
==============================================================================
--- mxf/mxf.c	(original)
+++ mxf/mxf.c	Sat Aug 16 14:17:55 2008
@@ -52,3 +52,15 @@ const MXFCodecUL ff_mxf_codec_uls[] = {
   //{ { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x02,0x02,0x02,0x03,0x02,0x1C,0x00 }, 15,    CODEC_ID_DOLBY_E }, /* Dolby-E */
     { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,       CODEC_ID_NONE },
 };
+
+const MXFCodecUL ff_mxf_essence_container_uls[] = {
+    // video essence container uls
+    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */
+    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14,    CODEC_ID_DVVIDEO }, /* DV 625 25mbps */
+    // sound essence container uls
+    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */
+    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14,       CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */
+    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, 14, CODEC_ID_PCM_S16LE }, /* D-10 Mapping 50Mbps PAL Extended Template */
+    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,      CODEC_ID_NONE },
+};
+

Modified: mxf/mxf.h
==============================================================================
--- mxf/mxf.h	(original)
+++ mxf/mxf.h	Sat Aug 16 14:17:55 2008
@@ -62,6 +62,7 @@ typedef struct {
 
 extern const MXFDataDefinitionUL ff_mxf_data_definition_uls[];
 extern const MXFCodecUL ff_mxf_codec_uls[];
+extern const MXFCodecUL ff_mxf_essence_container_uls[];
 
 #define PRINT_KEY(pc, s, x) dprintf(pc, "%s %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", s, \
                              (x)[0], (x)[1], (x)[2], (x)[3], (x)[4], (x)[5], (x)[6], (x)[7], (x)[8], (x)[9], (x)[10], (x)[11], (x)[12], (x)[13], (x)[14], (x)[15])

Modified: mxf/mxfdec.c
==============================================================================
--- mxf/mxfdec.c	(original)
+++ mxf/mxfdec.c	Sat Aug 16 14:17:55 2008
@@ -583,19 +583,6 @@ static int mxf_read_generic_descriptor(M
     return 0;
 }
 
-static const MXFCodecUL mxf_picture_essence_container_uls[] = {
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14,    CODEC_ID_DVVIDEO }, /* DV 625 25mbps */
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,       CODEC_ID_NONE },
-};
-
-static const MXFCodecUL mxf_sound_essence_container_uls[] = {
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14,       CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, 14, CODEC_ID_PCM_S16LE }, /* D-10 Mapping 50Mbps PAL Extended Template */
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,      CODEC_ID_NONE },
-};
-
 /*
  * Match an uid independently of the version byte and up to len common bytes
  * Returns: boolean
@@ -791,7 +778,7 @@ static int mxf_parse_structural_metadata
             st->codec->extradata_size = descriptor->extradata_size;
         }
         if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
-            container_ul = mxf_get_codec_ul(mxf_picture_essence_container_uls, essence_container_ul);
+            container_ul = mxf_get_codec_ul(ff_mxf_essence_container_uls, essence_container_ul);
             if (st->codec->codec_id == CODEC_ID_NONE)
                 st->codec->codec_id = container_ul->id;
             st->codec->width = descriptor->width;
@@ -799,7 +786,7 @@ static int mxf_parse_structural_metadata
             st->codec->bits_per_sample = descriptor->bits_per_sample; /* Uncompressed */
             st->need_parsing = AVSTREAM_PARSE_HEADERS;
         } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
-            container_ul = mxf_get_codec_ul(mxf_sound_essence_container_uls, essence_container_ul);
+            container_ul = mxf_get_codec_ul(ff_mxf_essence_container_uls, essence_container_ul);
             if (st->codec->codec_id == CODEC_ID_NONE)
                 st->codec->codec_id = container_ul->id;
             st->codec->channels = descriptor->channels;

Modified: mxf/mxfenc.c
==============================================================================
--- mxf/mxfenc.c	(original)
+++ mxf/mxfenc.c	Sat Aug 16 14:17:55 2008
@@ -89,17 +89,6 @@ static const MXFEssenceElementKey mxf_es
 
 static const uint8_t multiple_desc_ul[] = { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x03,0x0D,0x01,0x03,0x01,0x02,0x7F,0x01,0x00 };
 
-static const MXFCodecUL mxf_essence_container_uls[] = {
-    // picture essence container
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 14, CODEC_ID_MPEG2VIDEO }, /* MPEG-ES Frame wrapped */
-//    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x02,0x41,0x01 }, 14,    CODEC_ID_DVVIDEO }, /* DV 625 25mbps */
-    // audio essence conatiner uls
-    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x06,0x01,0x00 }, 14, CODEC_ID_PCM_S16LE }, /* BWF Frame wrapped */
-//    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x40,0x01 }, 14,       CODEC_ID_MP2 }, /* MPEG-ES Frame wrapped, 0x40 ??? stream id */
-//    { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x0D,0x01,0x03,0x01,0x02,0x01,0x01,0x01 }, 14, CODEC_ID_PCM_S16LE }, /* D-10 Mapping 50Mbps PAL Extended Template */
-    { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },  0,      CODEC_ID_NONE },
-};
-
 /**
  * SMPTE RP210 http://www.smpte-ra.org/mdd/index.html
  */
@@ -222,7 +211,7 @@ static int klv_encode_ber_length(ByteIOC
 
 static const MXFCodecUL *mxf_get_essence_container_ul(enum CodecID type)
 {
-    const MXFCodecUL *uls = mxf_essence_container_uls;
+    const MXFCodecUL *uls = ff_mxf_essence_container_uls;
     while (uls->id != CODEC_ID_NONE) {
         if (uls->id == type)
             break;
@@ -839,7 +828,7 @@ static int mxf_build_essence_container_r
     int i;
     const MXFCodecUL *codec_ul = NULL;
 
-    for (codec_ul = mxf_essence_container_uls; codec_ul->id; codec_ul++) {
+    for (codec_ul = ff_mxf_essence_container_uls; codec_ul->id; codec_ul++) {
         for (i = 0; i < s->nb_streams; i++) {
             st = s->streams[i];
             if (st->codec->codec_id == codec_ul->id) {
@@ -848,6 +837,10 @@ static int mxf_build_essence_container_r
                 break;
             }
         }
+        // considering WAV/AES3 frame wrapped, when get the first CODEC_ID_PCM_S16LE, break;
+        // this is a temporary method, when we can get  more information, modofy this.
+        if (codec_ul->id == CODEC_ID_PCM_S16LE)
+            break;
     }
     return 0;
 }



More information about the FFmpeg-soc mailing list