[FFmpeg-devel] [PATCH] matroskaenc: write tags.
Aurelien Jacobs
aurel
Tue Oct 5 10:05:14 CEST 2010
On Tue, Oct 05, 2010 at 07:38:18AM +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
>
> [...]
>
> +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 = strrchr(p, '-'))) {
> + if ((lang = av_convert_lang_to(p + 1, AV_LANG_ISO639_2_BIBL))) {
> + *p = 0;
> + break;
> + }
> + p++;
> + }
As I said in my previous mail, the loop should be useless now that you
use strrchr(). What about this instead:
if ((p = strrchr(p, '-')) &&
(lang = av_convert_lang_to(p + 1, AV_LANG_ISO639_2_BIBL)))
*p = 0;
Except this, patch should be OK.
Aurel
More information about the ffmpeg-devel
mailing list