[MPlayer-dev-eng] [PATCH] show ogg subtitle language

Moritz Bunkus moritz at bunkus.org
Fri Sep 24 11:08:19 CEST 2004


Hey,

>      else if (!strncasecmp(*cmt, "LANGUAGE=", 9))
>      {
>        val = *cmt + 9;
> +      // copy this language name into the array
> +      index = demux_ogg_sub_reverse_id(d, id);
> +      if (index >= 0) ogg_d->text_langs[index] = strdup(val);
>        // check for -slang if subs are uninitialized yet
>        if (os->text && d->sub->id == -1 && demux_ogg_check_lang(val, dvdsub_lang))
>        {

In case of malicious files (several LANGUAGE= tags for one track) this
leads to memleaks. Granted, this is uncommon...

> +static int demux_ogg_sub_reverse_id(demuxer_t *demuxer, int id) {

Functions must be documented :)

> +int demux_ogg_sub_lang(demuxer_t *demuxer, int index) {
> +  ogg_demuxer_t *ogg_d = (ogg_demuxer_t *)demuxer->priv;
> +  return (index < 0) ? NULL : (index >= ogg_d->n_text) ? NULL : ogg_d->text_langs[index];
> +}

Same, but what the hell!? int demux... while it returns char * ? In fact
it should return const char *.

> +int demux_ogg_sub_lang(demuxer_t *demuxer, int index);

Same.

Otherwise it looks fine.

Mosu

-- 
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds




More information about the MPlayer-dev-eng mailing list