diff mbox series

[FFmpeg-devel] MXF - Declare unused JPEG2000 tags in MXF file - Sponsored by INA

Message ID 7a2b39bf-9036-7bfa-3448-335c11f51cac@ektacom.com
State New
Headers show
Series [FFmpeg-devel] MXF - Declare unused JPEG2000 tags in MXF file - Sponsored by INA | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch

Commit Message

Cédric Le Barz March 29, 2023, 9:31 p.m. UTC
Declare unused JPEG2000 tags in MXF file.

Signed-off-by: Cedric Le Barz <clebarz@ektacom.com>
---
  ffmpeg/libavformat/mxfenc.c | 22 +++++++++++++++++++---
  1 file changed, 19 insertions(+), 3 deletions(-)

mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID
          f1 *= 2;
      }
  -
      mxf_write_local_tag(s, 16, 0x320D);
      avio_wb32(pb, 2);
      avio_wb32(pb, 4);
@@ -3406,4 +3423,3 @@ const FFOutputFormat ff_mxf_opatom_muxer = {
      .p.priv_class      = &mxf_opatom_muxer_class,
  };
  -

Comments

Cédric Le Barz April 3, 2023, 8:40 a.m. UTC | #1
Hi,

I've attached the patch to this mail, in order to solve newlines 
insertion issue.

Regards,

Cédric

Le 29/03/2023 à 23:31, Cédric Le Barz a écrit :
>
> Declare unused JPEG2000 tags in MXF file.
>
> Signed-off-by: Cedric Le Barz <clebarz@ektacom.com>
> ---
>  ffmpeg/libavformat/mxfenc.c | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
> index bfbd5a6..67d8f67 100644
> --- a/ffmpeg/libavformat/mxfenc.c
> +++ b/ffmpeg/libavformat/mxfenc.c
> @@ -542,7 +542,7 @@ static void mxf_write_primer_pack(AVFormatContext *s)
>      MXFContext *mxf = s->priv_data;
>      AVIOContext *pb = s->pb;
>      int local_tag_number = MXF_NUM_TAGS, i;
> -    int will_have_avc_tags = 0, will_have_mastering_tags = 0;
> +    int will_have_avc_tags = 0, will_have_mastering_tags = 0, 
> will_have_jpeg2000_tags = 0;
>       for (i = 0; i < s->nb_streams; i++) {
>          MXFStreamContext *sc = s->streams[i]->priv_data;
> @@ -552,6 +552,9 @@ static void mxf_write_primer_pack(AVFormatContext *s)
>          if (av_stream_get_side_data(s->streams[i], 
> AV_PKT_DATA_MASTERING_DISPLAY_METADATA, NULL)) {
>              will_have_mastering_tags = 1;
>          }
> +        if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_JPEG2000){
> +            will_have_jpeg2000_tags = 1;
> +        }
>      }
>       if (!mxf->store_user_comments) {
> @@ -574,6 +577,21 @@ static void mxf_write_primer_pack(AVFormatContext 
> *s)
>          mxf_mark_tag_unused(mxf, 0x8304);
>      }
>  +    if (!will_have_jpeg2000_tags) {
> +        mxf_mark_tag_unused(mxf, 0x8401);
> +        mxf_mark_tag_unused(mxf, 0x8402);
> +        mxf_mark_tag_unused(mxf, 0x8403);
> +        mxf_mark_tag_unused(mxf, 0x8404);
> +        mxf_mark_tag_unused(mxf, 0x8405);
> +        mxf_mark_tag_unused(mxf, 0x8406);
> +        mxf_mark_tag_unused(mxf, 0x8407);
> +        mxf_mark_tag_unused(mxf, 0x8408);
> +        mxf_mark_tag_unused(mxf, 0x8409);
> +        mxf_mark_tag_unused(mxf, 0x840A);
> +        mxf_mark_tag_unused(mxf, 0x840B);
> +        mxf_mark_tag_unused(mxf, 0x840C);
> +    }
> +
>      for (i = 0; i < MXF_NUM_TAGS; i++) {
>          if (mxf->unused_tags[i]) {
>              local_tag_number--;
> @@ -1297,7 +1315,6 @@ static int64_t 
> mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID
>          f1 *= 2;
>      }
>  -
>      mxf_write_local_tag(s, 16, 0x320D);
>      avio_wb32(pb, 2);
>      avio_wb32(pb, 4);
> @@ -3406,4 +3423,3 @@ const FFOutputFormat ff_mxf_opatom_muxer = {
>      .p.priv_class      = &mxf_opatom_muxer_class,
>  };
>  -
Signed-off-by: Cedric Le Barz <clebarz@ektacom.com>
---
 ffmpeg/libavformat/mxfenc.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
index bfbd5a6..67d8f67 100644
--- a/ffmpeg/libavformat/mxfenc.c
+++ b/ffmpeg/libavformat/mxfenc.c
@@ -542,7 +542,7 @@ static void mxf_write_primer_pack(AVFormatContext *s)
     MXFContext *mxf = s->priv_data;
     AVIOContext *pb = s->pb;
     int local_tag_number = MXF_NUM_TAGS, i;
-    int will_have_avc_tags = 0, will_have_mastering_tags = 0;
+    int will_have_avc_tags = 0, will_have_mastering_tags = 0, will_have_jpeg2000_tags = 0;
 
     for (i = 0; i < s->nb_streams; i++) {
         MXFStreamContext *sc = s->streams[i]->priv_data;
@@ -552,6 +552,9 @@ static void mxf_write_primer_pack(AVFormatContext *s)
         if (av_stream_get_side_data(s->streams[i], AV_PKT_DATA_MASTERING_DISPLAY_METADATA, NULL)) {
             will_have_mastering_tags = 1;
         }
+        if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_JPEG2000){
+            will_have_jpeg2000_tags = 1;
+        }
     }
 
     if (!mxf->store_user_comments) {
@@ -574,6 +577,21 @@ static void mxf_write_primer_pack(AVFormatContext *s)
         mxf_mark_tag_unused(mxf, 0x8304);
     }
 
+    if (!will_have_jpeg2000_tags) {
+        mxf_mark_tag_unused(mxf, 0x8401);
+        mxf_mark_tag_unused(mxf, 0x8402);
+        mxf_mark_tag_unused(mxf, 0x8403);
+        mxf_mark_tag_unused(mxf, 0x8404);
+        mxf_mark_tag_unused(mxf, 0x8405);
+        mxf_mark_tag_unused(mxf, 0x8406);
+        mxf_mark_tag_unused(mxf, 0x8407);
+        mxf_mark_tag_unused(mxf, 0x8408);
+        mxf_mark_tag_unused(mxf, 0x8409);
+        mxf_mark_tag_unused(mxf, 0x840A);
+        mxf_mark_tag_unused(mxf, 0x840B);
+        mxf_mark_tag_unused(mxf, 0x840C);
+    }
+
     for (i = 0; i < MXF_NUM_TAGS; i++) {
         if (mxf->unused_tags[i]) {
             local_tag_number--;
@@ -1297,7 +1315,6 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID
         f1 *= 2;
     }
 
-
     mxf_write_local_tag(s, 16, 0x320D);
     avio_wb32(pb, 2);
     avio_wb32(pb, 4);
@@ -3406,4 +3423,3 @@ const FFOutputFormat ff_mxf_opatom_muxer = {
     .p.priv_class      = &mxf_opatom_muxer_class,
 };
 
-
Tomas Härdin April 5, 2023, 12:48 p.m. UTC | #2
Looks OK. Some stray whitespace changes but that can be fixed on push.

/Tomas
diff mbox series

Patch

diff --git a/ffmpeg/libavformat/mxfenc.c b/ffmpeg/libavformat/mxfenc.c
index bfbd5a6..67d8f67 100644
--- a/ffmpeg/libavformat/mxfenc.c
+++ b/ffmpeg/libavformat/mxfenc.c
@@ -542,7 +542,7 @@  static void mxf_write_primer_pack(AVFormatContext *s)
      MXFContext *mxf = s->priv_data;
      AVIOContext *pb = s->pb;
      int local_tag_number = MXF_NUM_TAGS, i;
-    int will_have_avc_tags = 0, will_have_mastering_tags = 0;
+    int will_have_avc_tags = 0, will_have_mastering_tags = 0, 
will_have_jpeg2000_tags = 0;
       for (i = 0; i < s->nb_streams; i++) {
          MXFStreamContext *sc = s->streams[i]->priv_data;
@@ -552,6 +552,9 @@  static void mxf_write_primer_pack(AVFormatContext *s)
          if (av_stream_get_side_data(s->streams[i], 
AV_PKT_DATA_MASTERING_DISPLAY_METADATA, NULL)) {
              will_have_mastering_tags = 1;
          }
+        if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_JPEG2000){
+            will_have_jpeg2000_tags = 1;
+        }
      }
       if (!mxf->store_user_comments) {
@@ -574,6 +577,21 @@  static void mxf_write_primer_pack(AVFormatContext *s)
          mxf_mark_tag_unused(mxf, 0x8304);
      }
  +    if (!will_have_jpeg2000_tags) {
+        mxf_mark_tag_unused(mxf, 0x8401);
+        mxf_mark_tag_unused(mxf, 0x8402);
+        mxf_mark_tag_unused(mxf, 0x8403);
+        mxf_mark_tag_unused(mxf, 0x8404);
+        mxf_mark_tag_unused(mxf, 0x8405);
+        mxf_mark_tag_unused(mxf, 0x8406);
+        mxf_mark_tag_unused(mxf, 0x8407);
+        mxf_mark_tag_unused(mxf, 0x8408);
+        mxf_mark_tag_unused(mxf, 0x8409);
+        mxf_mark_tag_unused(mxf, 0x840A);
+        mxf_mark_tag_unused(mxf, 0x840B);
+        mxf_mark_tag_unused(mxf, 0x840C);
+    }
+
      for (i = 0; i < MXF_NUM_TAGS; i++) {
          if (mxf->unused_tags[i]) {
              local_tag_number--;
@@ -1297,7 +1315,6 @@  static int64_t