On Fri, 25 Jul 2014 07:36:06 -0700, John Stebbins <[email protected]> wrote: > 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. >
Yes, you should check the flag from the AVFormatContext instead of the AVStream.codec one. You could just store a pointer to the format context in the muxer private context. -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
