diff mbox series

[FFmpeg-devel,3/5] avformat/mxfenc: prefer to use the existing metadata

Message ID 1609947331-6849-3-git-send-email-lance.lmwang@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/5] avformat/udp: add memory alloc checks
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Limin Wang Jan. 6, 2021, 3:35 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Please check metadata with below command:
./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf
./ffmpeg -i out.mxf

    company_name    : FFmpeg
    product_name    : OP1a Muxer
    product_version : 58.65.101o
    =>
    company_name    : SONY
    product_name    : eVTR
    product_version : 1.00

So need to update fate-mxf fate test.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/mxfenc.c                    | 12 ++++++++----
 tests/ref/fate/mxf-d10-user-comments    |  2 +-
 tests/ref/fate/mxf-opatom-user-comments |  2 +-
 tests/ref/fate/mxf-reel_name            |  2 +-
 tests/ref/fate/mxf-user-comments        |  2 +-
 5 files changed, 12 insertions(+), 8 deletions(-)

Comments

Tomas Härdin Jan. 14, 2021, 11:50 a.m. UTC | #1
ons 2021-01-06 klockan 23:35 +0800 skrev lance.lmwang@gmail.com:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Please check metadata with below command:
> ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy
> out.mxf
> ./ffmpeg -i out.mxf
> 
>     company_name    : FFmpeg
>     product_name    : OP1a Muxer
>     product_version : 58.65.101o
>     =>
>     company_name    : SONY
>     product_name    : eVTR
>     product_version : 1.00

Why? This patch would just create confusion. CompanyName is there so it
is possible to track down what software wrote the file. If you copy it 
from the input file then you'd be lying.

/Tomas
Limin Wang Jan. 14, 2021, 2:50 p.m. UTC | #2
On Thu, Jan 14, 2021 at 12:50:34PM +0100, Tomas Härdin wrote:
> ons 2021-01-06 klockan 23:35 +0800 skrev lance.lmwang@gmail.com:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Please check metadata with below command:
> > ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy
> > out.mxf
> > ./ffmpeg -i out.mxf
> > 
> >     company_name    : FFmpeg
> >     product_name    : OP1a Muxer
> >     product_version : 58.65.101o
> >     =>
> >     company_name    : SONY
> >     product_name    : eVTR
> >     product_version : 1.00
> 
> Why? This patch would just create confusion. CompanyName is there so it
> is possible to track down what software wrote the file. If you copy it 
> from the input file then you'd be lying.

I have updated the patch to remove the metadata from input to avoid it,
please help to review:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/1610168848-17933-3-git-send-email-lance.lmwang@gmail.com/


> 
> /Tomas
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 7fce7b9..a76a69c 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -724,16 +724,20 @@  static void mxf_write_identification(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
     AVIOContext *pb = s->pb;
-    const char *company = "FFmpeg";
-    const char *product = mxf->mode != MODE_OPA ? "OP1a Muxer" : "OPAtom Muxer";
-    const char *version;
+    AVDictionaryEntry *com_entry =  av_dict_get(s->metadata, "company_name", NULL, 0);
+    AVDictionaryEntry *product_entry =  av_dict_get(s->metadata, "product_name", NULL, 0);
+    AVDictionaryEntry *version_entry =  av_dict_get(s->metadata, "product_version", NULL, 0);
+    const char *company = com_entry ? com_entry->value : "FFmpeg";
+    const char *product = product_entry ? product_entry->value : mxf->mode != MODE_OPA ? "OP1a Muxer" : "OPAtom Muxer";
+    const char *version = NULL;
+    const char *product_version = version_entry ? version_entry->value : AV_STRINGIFY(LIBAVFORMAT_VERSION);
     int length;
 
     mxf_write_metadata_key(pb, 0x013000);
     PRINT_KEY(s, "identification key", pb->buf_ptr - 16);
 
     version = s->flags & AVFMT_FLAG_BITEXACT ?
-        "0.0.0" : AV_STRINGIFY(LIBAVFORMAT_VERSION);
+        "0.0.0" : product_version;
     length = 100 +mxf_utf16_local_tag_length(company) +
                   mxf_utf16_local_tag_length(product) +
                   mxf_utf16_local_tag_length(version);
diff --git a/tests/ref/fate/mxf-d10-user-comments b/tests/ref/fate/mxf-d10-user-comments
index de4f26c..4aebcaf 100644
--- a/tests/ref/fate/mxf-d10-user-comments
+++ b/tests/ref/fate/mxf-d10-user-comments
@@ -1 +1 @@ 
-68f0fa62b6a676894afbbe4c34ebf70b
+84e289a83797e793bfa0d3a31f94ac6c
diff --git a/tests/ref/fate/mxf-opatom-user-comments b/tests/ref/fate/mxf-opatom-user-comments
index 90e3fb2..374a72a 100644
--- a/tests/ref/fate/mxf-opatom-user-comments
+++ b/tests/ref/fate/mxf-opatom-user-comments
@@ -1 +1 @@ 
-f6760a9e710ba478bc3949f3e5c9b34a
+e7c41639b79ac54c4df05475fb0eea66
diff --git a/tests/ref/fate/mxf-reel_name b/tests/ref/fate/mxf-reel_name
index 16022b1..6e3218f 100644
--- a/tests/ref/fate/mxf-reel_name
+++ b/tests/ref/fate/mxf-reel_name
@@ -1 +1 @@ 
-73a891041b2fc836a893ffb49fff4fff
+be4c1b76138c855ac3e2d2579cbecc17
diff --git a/tests/ref/fate/mxf-user-comments b/tests/ref/fate/mxf-user-comments
index ddf51d9..46db6a3 100644
--- a/tests/ref/fate/mxf-user-comments
+++ b/tests/ref/fate/mxf-user-comments
@@ -1 +1 @@ 
-1255faf854223a74d707553121e5eca3
+8f2360104655971dc5fb68f98eda1b84