Re: [FFmpeg-devel] [PATCH v7 3/3] avformat/mxfenc: prefer to use the configured metadata

2021-02-04 Thread Tomas Härdin
tis 2021-02-02 klockan 20:47 +0800 skrev lance.lmw...@gmail.com:
> From: Limin Wang 
> 
> The metadata company_name, product_name, product_version from input
> file will be deleted to avoid overwriting information
> Please to test with below commands:
> ./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy out.mxf
> and
> ./ffmpeg -i ../fate-suite/mxf/Sony-1.mxf -c:v copy -c:a copy \
> -metadata company_name="xxx" \
> -metadata product_name="xxx" \
> -metadata product_version="xxx" \
> out.mxf
> 
> Reviewed-by: Tomas Härdin 
> Signed-off-by: Limin Wang 
> ---
>  fftools/ffmpeg_opt.c |  3 +++
>  libavformat/mxfenc.c | 10 +++---
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> 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(>metadata, "duration", NULL, 0);
>  av_dict_set(>metadata, "creation_time", NULL, 0);
> +av_dict_set(>metadata, "company_name", NULL, 0);
> +av_dict_set(>metadata, "product_name", NULL, 0);
> +av_dict_set(>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 39ab443..0b39917 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -757,8 +757,12 @@ 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 != _mxf_opatom_muxer ? "OP1a Muxer" 
> : "OPAtom Muxer";
> +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 
> != _mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer";
> +const char *product_version = version_entry ? version_entry->value : 
> AV_STRINGIFY(LIBAVFORMAT_VERSION);
>  const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : 
> PLATFROM_IDENT;
>  const char *version;
>  int length;
> @@ -767,7 +771,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;

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-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v7 3/3] avformat/mxfenc: prefer to use the configured metadata

2021-02-02 Thread lance . lmwang
From: Limin Wang 

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

Reviewed-by: Tomas H??rdin 
Signed-off-by: Limin Wang 
---
 fftools/ffmpeg_opt.c |  3 +++
 libavformat/mxfenc.c | 10 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

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(>metadata, "duration", NULL, 0);
 av_dict_set(>metadata, "creation_time", NULL, 0);
+av_dict_set(>metadata, "company_name", NULL, 0);
+av_dict_set(>metadata, "product_name", NULL, 0);
+av_dict_set(>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 39ab443..0b39917 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -757,8 +757,12 @@ 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 != _mxf_opatom_muxer ? "OP1a Muxer" : 
"OPAtom Muxer";
+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 != 
_mxf_opatom_muxer ? "OP1a Muxer" : "OPAtom Muxer";
+const char *product_version = version_entry ? version_entry->value : 
AV_STRINGIFY(LIBAVFORMAT_VERSION);
 const char *platform = s->flags & AVFMT_FLAG_BITEXACT ? "Lavf" : 
PLATFROM_IDENT;
 const char *version;
 int length;
@@ -767,7 +771,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) +
-- 
1.8.3.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".