From: Matthieu Bouron <[email protected]>

And export the information in field_order.

Signed-off-by: Luca Barbato <[email protected]>
---
 libavformat/mxfdec.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c51841f..8777965 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -134,6 +134,9 @@ typedef struct {
     int width;
     int height; /* Field height, not frame height */
     int frame_layout; /* See MXFFrameLayout enum */
+#define MXF_TFF 1
+#define MXF_BFF 2
+    int field_dominance;
     int channels;
     int bits_per_sample;
     unsigned int component_depth;
@@ -830,6 +833,9 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, int
         descriptor->aspect_ratio.num = avio_rb32(pb);
         descriptor->aspect_ratio.den = avio_rb32(pb);
         break;
+    case 0x3212:
+        descriptor->field_dominance = avio_r8(pb);
+        break;
     case 0x3301:
         descriptor->component_depth = avio_rb32(pb);
         break;
@@ -1493,6 +1499,17 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
                 case MixedFields:
                     /* Turn field height into frame height. */
                     st->codec->height *= 2;
+                    switch (descriptor->field_dominance) {
+                        case MXF_TFF:
+                            st->codec->field_order = AV_FIELD_TT;
+                            break;
+                        case MXF_BFF:
+                            st->codec->field_order = AV_FIELD_BB;
+                            break;
+                        default:
+                            break;
+                    }
+                    break;
                 default:
                     av_log(mxf->fc, AV_LOG_INFO,
                            "Unknown frame layout type: %d\n",
-- 
1.8.5.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to