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

Maksym Veremeyenko verem
Sun Sep 19 11:10:22 CEST 2010


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

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index ac5ea4b..6bc6b77 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -149,6 +149,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 };
@@ -634,6 +641,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;
@@ -649,7 +666,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 */
@@ -686,7 +703,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))) {
@@ -803,7 +820,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;
@@ -812,7 +829,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
                 st->codec->pix_fmt = descriptor->pix_fmt;
             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.7.2.2



--------------010801020806040404030603
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