[PATCH 1/5] add MXFContainerUL struct for containers UL dict

storyparts storyparts
Thu Apr 15 11:24:04 CEST 2010


---
 libavformat/mxfdec.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 168fd8d..83dd791 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -146,6 +146,13 @@ typedef struct {
     enum MXFMetadataSetType type;
 } MXFMetadataReadTableEntry;
 
+typedef struct {
+    UID uid;
+    unsigned matching_len;
+    int id;
+    enum MXFWrappingScheme wrapping;
+} MXFContainerUL;
+
 /* partial keys to match */
 static const uint8_t mxf_header_partition_pack_key[]       = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
 static const uint8_t mxf_essence_element_key[]             = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
@@ -627,6 +634,16 @@ static const MXFCodecUL *mxf_get_codec_ul(const MXFCodecUL *uls, UID *uid)
     return uls;
 }
 
+static const MXFContainerUL *mxf_get_container_ul(const MXFContainerUL *uls, UID *uid)
+{
+    while (uls->uid[0]) {
+        if(mxf_match_uid(uls->uid, *uid, uls->matching_len))
+            break;
+        uls++;
+    }
+    return uls;
+}
+
 static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type)
 {
     int i;
@@ -642,7 +659,7 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe
     return NULL;
 }
 
-static const MXFCodecUL mxf_essence_container_uls[] = {
+static const MXFContainerUL 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 */
@@ -679,7 +696,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
         MXFStructuralComponent *component = NULL;
         UID *essence_container_ul = NULL;
         const MXFCodecUL *codec_ul = NULL;
-        const MXFCodecUL *container_ul = NULL;
+        const MXFContainerUL *container_ul = NULL;
         AVStream *st;
 
         if (!(material_track = mxf_resolve_strong_ref(mxf, &material_package->tracks_refs[i], Track))) {
@@ -796,7 +813,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
             st->codec->extradata_size = descriptor->extradata_size;
         }
         if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
-            container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul);
+            container_ul = mxf_get_container_ul(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;
@@ -804,7 +821,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
             st->codec->bits_per_coded_sample = descriptor->bits_per_sample; /* Uncompressed */
             st->need_parsing = AVSTREAM_PARSE_HEADERS;
         } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
-            container_ul = mxf_get_codec_ul(mxf_essence_container_uls, essence_container_ul);
+            container_ul = mxf_get_container_ul(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;
-- 
1.6.6.1


--------------000300090005060804010403
Content-Type: text/x-patch;
 name="0002-revert-container-wrapping-detection-from-r11567.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="0002-revert-container-wrapping-detection-from-r11567.patch"




More information about the ffmpeg-devel mailing list