diff mbox series

[FFmpeg-devel,MXF] - Add "footer_with_hmd" option

Message ID 437d32e7-19a2-48c1-978c-84e8f195b1a3@ektacom.com
State New
Headers show
Series [FFmpeg-devel,MXF] - Add "footer_with_hmd" option | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Cédric Le Barz Jan. 26, 2024, 6:04 p.m. UTC
Add "footer_with_hmd" option: this option activates the writing of the 
header metadata in the footer partition.
Signed-off-by: Cedric Le Barz <clebarz@ektacom.com>
---
 ffmpeg/libavformat/mxfenc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
index 0f13068..79c92e1 100644
--- a/ffmpeg/libavformat/mxfenc.c
+++ b/ffmpeg/libavformat/mxfenc.c
@@ -480,6 +480,7 @@  typedef struct MXFContext {
     int cbr_index;           ///< use a constant bitrate index
     uint8_t unused_tags[MXF_NUM_TAGS];  ///< local tags that we know will not be used
     MXFStreamContext timecode_track_priv;
+    int footer_with_hmd; // Flag to activate header metadata writing in footer partition
 } MXFContext;
 
 static void mxf_write_uuid(AVIOContext *pb, enum MXFMetadataSetType type, int value)
@@ -3420,10 +3421,10 @@  static int mxf_write_footer(AVFormatContext *s)
     mxf_write_klv_fill(s);
     mxf->footer_partition_offset = avio_tell(pb);
     if (mxf->edit_unit_byte_count && !IS_OPATOM(s)) { // no need to repeat index
-        if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, 0)) < 0)
+        if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, mxf->footer_with_hmd)) < 0)
             return err;
     } else {
-        if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, 0)) < 0)
+        if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, mxf->footer_with_hmd)) < 0)
             return err;
         mxf_write_klv_fill(s);
         mxf_write_index_table_segment(s);
@@ -3567,6 +3568,8 @@  static const AVOption mxf_options[] = {
     MXF_COMMON_OPTIONS
     { "store_user_comments", "",
       offsetof(MXFContext, store_user_comments), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
+    { "footer_with_hmd", "",
+      offsetof(MXFContext, footer_with_hmd), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
     { NULL },
 };