[FFmpeg-devel] [PATCH] matroskaenc: write tags.

Tomas Härdin tomas.hardin
Tue Oct 5 08:22:41 CEST 2010


On Tue, 2010-10-05 at 07:38 +0200, Anton Khirnov wrote:
> On Mon, Oct 04, 2010 at 10:43:14PM +0200, Aurelien Jacobs wrote:
> > On Mon, Oct 04, 2010 at 09:35:37AM +0200, Anton Khirnov wrote:
> > > Apparrently attempt to convert the keys to uppercase during metadata conversion
> > > step isn't going anywhere, so i've moved it directly to the muxer
> > > instead.
> > > 
> > > Please review.
> > > 
> > > [...]
> > > 
> > > +static void mkv_write_simpletag(ByteIOContext *pb, AVMetadataTag *t)
> > > +{
> > > +    uint8_t *key = av_strdup(t->key);
> > > +    uint8_t *p   = key;
> > > +    const uint8_t *lang = NULL;
> > > +    ebml_master tag;
> > > +
> > > +    while ((p = strchr(p, '-'))) {
> > 
> > Why not using strrchr() instead ? This should avoid the loop...
> right, fixed
> > 
> > > +        if ((lang = av_convert_lang_to(p + 1, AV_LANG_ISO639_2_BIBL))) {
> > > +            *p = 0;
> > > +            break;
> > > +        }
> > > +        p++;
> > > +    }
> > > +
> > > +    p = key;
> > > +    while (*p) {
> > > +        if (*p == ' ')
> > > +            *p = '_';
> > > +        else if (*p >= 'a' && *p <= 'z')
> > > +            *p = toupper(*p);
> > 
> > I'm not sure about all the implications about using toupper (especially
> > depending on the $LANG and friends)... It may be safe as you already
> > check the range of the source character, but I wouldn't bet on it.
> > Maybe this would be better:
> >     *p -= 'a' - 'A';
> yeah, done. as Reimar said, it might not always be right, but at least i
> won't get any weird non-utf8 characters.

For the future, maybe lavu should have some more UTF-8 processing
routines?

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101005/cbd1c12d/attachment.pgp>



More information about the ffmpeg-devel mailing list