[FFmpeg-devel] [PATCH 2/3] avformat: use ff_standardize_creation_time for formats writing all format string metadata

wm4 nfxjfg at googlemail.com
Sun Feb 28 15:55:00 CET 2016


On Sun, 28 Feb 2016 14:28:20 +0100
Marton Balint <cus at passwd.hu> wrote:

> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/apetag.c    | 1 +
>  libavformat/cafenc.c    | 1 +
>  libavformat/flvenc.c    | 1 +
>  libavformat/id3v2enc.c  | 1 +
>  libavformat/lrcenc.c    | 1 +
>  libavformat/nutenc.c    | 1 +
>  libavformat/smjpegenc.c | 1 +
>  libavformat/wtvenc.c    | 1 +
>  8 files changed, 8 insertions(+)
> 
> diff --git a/libavformat/apetag.c b/libavformat/apetag.c
> index 2ee277f..9d415b8 100644
> --- a/libavformat/apetag.c
> +++ b/libavformat/apetag.c
> @@ -193,6 +193,7 @@ int ff_ape_write_tag(AVFormatContext *s)
>                       APE_TAG_FLAG_IS_HEADER);
>      ffio_fill(dyn_bc, 0, 8);             // reserved
>  
> +    ff_standardize_creation_time(s);
>      while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) {
>          int val_len;
>  
> diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
> index 544bc4a..0b2f649 100644
> --- a/libavformat/cafenc.c
> +++ b/libavformat/cafenc.c
> @@ -175,6 +175,7 @@ static int caf_write_header(AVFormatContext *s)
>          avio_write(pb, enc->extradata, enc->extradata_size);
>      }
>  
> +    ff_standardize_creation_time(s);
>      if (av_dict_count(s->metadata)) {
>          ffio_wfourcc(pb, "info"); //< Information chunk
>          while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 8fd5d29..ab71d41 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -281,6 +281,7 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
>          put_amf_double(pb, 0.0);
>      }
>  
> +    ff_standardize_creation_time(s);
>      while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
>          if(   !strcmp(tag->key, "width")
>              ||!strcmp(tag->key, "height")
> diff --git a/libavformat/id3v2enc.c b/libavformat/id3v2enc.c
> index 8b804c4..e4ccdf9 100644
> --- a/libavformat/id3v2enc.c
> +++ b/libavformat/id3v2enc.c
> @@ -242,6 +242,7 @@ int ff_id3v2_write_metadata(AVFormatContext *s, ID3v2EncContext *id3)
>                                    ID3v2_ENCODING_UTF8;
>      int i, ret;
>  
> +    ff_standardize_creation_time(s);
>      if ((ret = write_metadata(s->pb, &s->metadata, id3, enc)) < 0)
>          return ret;
>  
> diff --git a/libavformat/lrcenc.c b/libavformat/lrcenc.c
> index b316ccd..74268cc 100644
> --- a/libavformat/lrcenc.c
> +++ b/libavformat/lrcenc.c
> @@ -52,6 +52,7 @@ static int lrc_write_header(AVFormatContext *s)
>      }
>      avpriv_set_pts_info(s->streams[0], 64, 1, 100);
>  
> +    ff_standardize_creation_time(s);
>      ff_metadata_conv_ctx(s, ff_lrc_metadata_conv, NULL);
>      if(!(s->flags & AVFMT_FLAG_BITEXACT)) { // avoid breaking regression tests
>          /* LRC provides a metadata slot for specifying encoder version
> diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
> index b6582ef..bf596ba 100644
> --- a/libavformat/nutenc.c
> +++ b/libavformat/nutenc.c
> @@ -489,6 +489,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc)
>      if (ret < 0)
>          return ret;
>  
> +    ff_standardize_creation_time(s);
>      while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)))
>          count += add_info(dyn_bc, t->key, t->value);
>  
> diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
> index 430a497..4553c86 100644
> --- a/libavformat/smjpegenc.c
> +++ b/libavformat/smjpegenc.c
> @@ -46,6 +46,7 @@ static int smjpeg_write_header(AVFormatContext *s)
>      avio_wb32(pb, 0);
>      avio_wb32(pb, 0);
>  
> +    ff_standardize_creation_time(s);
>      while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) {
>          avio_wl32(pb, SMJPEG_TXT);
>          avio_wb32(pb, strlen(t->key) + strlen(t->value) + 3);
> diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
> index 0894b7f..908448f 100644
> --- a/libavformat/wtvenc.c
> +++ b/libavformat/wtvenc.c
> @@ -672,6 +672,7 @@ static void write_table_entries_attrib(AVFormatContext *s)
>      AVIOContext *pb = s->pb;
>      AVDictionaryEntry *tag = 0;
>  
> +    ff_standardize_creation_time(s);
>      //FIXME: translate special tags (e.g. WM/Bitrate) to binary representation
>      ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);
>      while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))

Patches 1 and 2 LGTM.


More information about the ffmpeg-devel mailing list