On 25/07/14 01:13, John Stebbins wrote:
> ---
>  libavformat/movenc.c | 75 
> ++++++++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 64 insertions(+), 11 deletions(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index f16e851..1471c76 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -77,6 +77,17 @@ static const AVClass flavor ## _muxer_class = {\
>      .version    = LIBAVUTIL_VERSION_INT,\
>  };
>  
> +static int utf8len(const uint8_t *b)
> +{
> +    int len = 0;
> +    int val;
> +    while (*b) {
> +        GET_UTF8(val, *b++, return -1;)
> +        len++;
> +    }
> +    return len;
> +}
> +
>  //FIXME support 64 bit variant with wide placeholders
>  static int64_t update_size(AVIOContext *pb, int64_t pos)
>  {
> @@ -1352,6 +1363,15 @@ static int mov_write_hdlr_tag(AVIOContext *pb, 
> MOVTrack *track)
>                     "Unknown hldr_type for %s / 0x%04X, writing dummy 
> values\n",
>                     tag_buf, track->enc->codec_tag);
>          }
> +        if (track->st) {
> +            // hdlr.name is used by some players to identify the content 
> title
> +            // of the track. If we have a title, use it.
> +            AVDictionaryEntry *t;
> +            t = av_dict_get(track->st->metadata, "title", NULL, 0);
> +            if (t && utf8len(t->value)) {
> +                descr = t->value;
> +            }
> +        }
>      }

Shouldn't you use utf8len instead of strlen when writing descr below as
well ?

The rest sounds fine, not sure if we should provide the descr using a
dictionary key "description" or "descriptor" instead of title.

lu

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to