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 ?
>
> The rest sounds fine, not sure if we should provide the descr using a
> dictionary key "description" or "descriptor" instead of title.
>
> lu

We could call it what it is, e.g. "handler" and leave it to the calling 
application to know that some players use this
field for track titles.  I would be fine with it either way.  Is there some 
place that metadata keys are documented?  If
so, that would need to be updated.

I have a question.  In the function mov_write_track_udta_tag I am checking 
st->codec->flags for BITEXACT.  It occurs to
me that maybe I should be using AVFormatContext.flags instead. Is this true?  
If so, then the flag needs to be
propagated somehow since mov_write_udta_tag nor the function that calls it is 
given AVFormatContext.  I could create
FF_MOV_FLAG_BITEXACT and add the flag to MOVMuxContext.flags if this is how it 
should be done.

I also noticed that there is a minor issue in mov_write_udta_tag.  It tests 
AVFormatContext.flags repeatedly for no
reason.  A remnant from when it used to check st->codec->flags for every 
stream.  The loop should be removed.  I can do
that in a separate patch if you would like.

-- 
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