On 07/24/2014 05:10 PM, Luca Barbato wrote:
> 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 ?

For mode != MODE_MOV, 14496-12 says it is a null terminated UTF8 string.
For mode == MODE_MOV, QTFF document only says it is a "counted string".  It 
doesn't define "counted" anywhere and
doesn't mention UTF8 for this field.  So I'm not certain what should be done 
here.

-- 
John      GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7


Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to