diff mbox series

[FFmpeg-devel,v6,3/3] avformat/mxfenc: prefer to use the configured metadta

Message ID 1612137055-19114-3-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v6,1/3] avformat/mxfdec: set toolkit version metadata
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. 31, 2021, 11:50 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

The metadata company_name, product_name, product_version from input
file will be deleted to avoid overwriting information
Please to test with below command:
./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf
and
./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy \
        -metadata company_name="xxx" \
        -metadata product_name="xxx" \
        -metadata product_version="xxx" \
        out.mxf

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 fftools/ffmpeg_opt.c |  3 +++
 libavformat/mxfenc.c | 12 ++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Andreas Rheinhardt Feb. 1, 2021, 12:42 a.m. UTC | #1
lance.lmwang@gmail.com:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> The metadata company_name, product_name, product_version from input
> file will be deleted to avoid overwriting information
> Please to test with below command:
> ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf
> and
> ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy \
>         -metadata company_name="xxx" \
>         -metadata product_name="xxx" \
>         -metadata product_version="xxx" \
>         out.mxf
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---

There's a typo in the commit message: metadta.

- Andreas
Limin Wang Feb. 1, 2021, 1:15 a.m. UTC | #2
On Mon, Feb 01, 2021 at 01:42:04AM +0100, Andreas Rheinhardt wrote:
> lance.lmwang@gmail.com:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > The metadata company_name, product_name, product_version from input
> > file will be deleted to avoid overwriting information
> > Please to test with below command:
> > ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf
> > and
> > ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy \
> >         -metadata company_name="xxx" \
> >         -metadata product_name="xxx" \
> >         -metadata product_version="xxx" \
> >         out.mxf
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> 
> There's a typo in the commit message: metadta.

yes, fix it locally.

> 
> - Andreas
> _______________________________________________
> 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".
Tomas Härdin Feb. 1, 2021, 11:05 a.m. UTC | #3
mån 2021-02-01 klockan 07:50 +0800 skrev lance.lmwang@gmail.com:
> @@ -724,9 +724,13 @@ static void mxf_write_identification(AVFormatContext *s)
>  {
>      MXFContext *mxf = s->priv_data;
>      AVIOContext *pb = s->pb;
> -    const char *company = "FFmpeg";
> -    const char *product = s->oformat != &ff_mxf_opatom_muxer ? "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 : s->oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer";
> +    const char *version = NULL;

Nit: it's not necessary to NULL version
Looks OK

/Tomas
Limin Wang Feb. 1, 2021, 2:15 p.m. UTC | #4
On Mon, Feb 01, 2021 at 12:05:40PM +0100, Tomas Härdin wrote:
> mån 2021-02-01 klockan 07:50 +0800 skrev lance.lmwang@gmail.com:
> > @@ -724,9 +724,13 @@ static void mxf_write_identification(AVFormatContext *s)
> >  {
> >      MXFContext *mxf = s->priv_data;
> >      AVIOContext *pb = s->pb;
> > -    const char *company = "FFmpeg";
> > -    const char *product = s->oformat != &ff_mxf_opatom_muxer ? "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 : s->oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer";
> > +    const char *version = NULL;
> 
> Nit: it's not necessary to NULL version

OK, fix it.

> Looks OK
> 
> /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/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index bf2eb26..07308cc 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -2641,6 +2641,9 @@  loop_end:
         if(o->recording_time != INT64_MAX)
             av_dict_set(&oc->metadata, "duration", NULL, 0);
         av_dict_set(&oc->metadata, "creation_time", NULL, 0);
+        av_dict_set(&oc->metadata, "company_name", NULL, 0);
+        av_dict_set(&oc->metadata, "product_name", NULL, 0);
+        av_dict_set(&oc->metadata, "product_version", NULL, 0);
     }
     if (!o->metadata_streams_manual)
         for (i = of->ost_index; i < nb_output_streams; i++) {
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 64d6314..26b4b50 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -724,9 +724,13 @@  static void mxf_write_identification(AVFormatContext *s)
 {
     MXFContext *mxf = s->priv_data;
     AVIOContext *pb = s->pb;
-    const char *company = "FFmpeg";
-    const char *product = s->oformat != &ff_mxf_opatom_muxer ? "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 : s->oformat != &ff_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer";
+    const char *version = NULL;
+    const char *product_version = version_entry ? version_entry->value : AV_STRINGIFY(LIBAVFORMAT_VERSION);
     const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : PLATFROM_IDENT;
     int length;
 
@@ -734,7 +738,7 @@  static void mxf_write_identification(AVFormatContext *s)
     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(platform) +