[FFmpeg-devel] [PATCH 2/2] avformat/mxf: support MCA audio information

Tomas Härdin tjoppen at acc.umu.se
Fri Aug 27 12:04:51 EEST 2021


tis 2021-08-24 klockan 13:18 +0200 skrev Marc-Antoine Arnaud:
---
 libavformat/mxf.h    |   1 +
 libavformat/mxfdec.c | 283 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 278 insertions(+), 6 deletions(-)

diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index fe9c52732c..cddbcb13c9 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -50,6 +50,7 @@ enum MXFMetadataSetType {
     TaggedValue,
     TapeDescriptor,
     AVCSubDescriptor,
+    MCASubDescriptor,
 };
 
 enum MXFFrameLayout {
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index c28549f6a9..034adee413 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -45,17 +45,20 @@
  */
 
 #include <inttypes.h>
+#include <stdbool.h>
 
 #include "libavutil/aes.h"
 #include "libavutil/avstring.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/mathematics.h"
 #include "libavcodec/bytestream.h"
+#include "libavutil/channel_layout.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
 #include "libavutil/opt.h"
 #include "avformat.h"
+#include "avlanguage.h"
 #include "internal.h"
 #include "mxf.h"
 
@@ -177,6 +180,7 @@ typedef struct {
     int body_sid;
     MXFWrappingScheme wrapping;
     int edit_units_per_packet; /* how many edit units to read at a
time (PCM, ClipWrapped) */
+    int* channel_ordering;

Still feel this should be constant size

+static inline int mxf_read_us_ascii_string(AVIOContext *pb, int size,
char** str)
+{
+    int ret;
+    size_t buf_size;
+
+    if (size < 0)
+        return AVERROR(EINVAL);
+
+    buf_size = size + 1;
+    av_free(*str);
+    *str = av_malloc(buf_size);
+    if (!*str)
+        return AVERROR(ENOMEM);

av_realloc()

Nice work on tableizing the parsing :)

/Tomas



More information about the ffmpeg-devel mailing list