[MPlayer-dev-eng] [PATCH] Recode legacy metadata (was: Moving towards UTF-8)

Reimar Doeffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Jun 25 10:00:13 CEST 2007


Hello,
On Mon, Jun 25, 2007 at 01:23:25PM +0800, Zuxy Meng wrote:
[...]
> +    const char* fallbacks[] = {
> +	"UTF-8",
> +	mp_msg_charset,

In 90% of cases mp_msg_charset is either set to UTF-8 or to something
that can not be auto-detected. It has no place in this list.
There are two kinds of charsets: Those that can be detected _reliable_ i
most cases with > 4 characters. Those should be in this list.
For all others think of a good fallback. I don't think there is any so
I'd just fall back to the old behaviour.

[...]
> +	ret = iconv(cd, (const char**)&inbuf, &inlen, &outbuf, &outlen);
> +	iconv_close(cd);
> +	if (ret != (size_t)(-1)) {

I don't think you should treat E2BIG as an error, esp. since you made
the output buffer "only" twice as big as the input one.

> -		    demux_info_add(demuxer, "name", buf);
> +		    demux_info_add(demuxer, "name",
> +			   demux_legacy_recode(buf, tmp, 2*len));
> +		    free(tmp);

Adding this to so many places increases complexity too much.
Make a demux_info_add_legacy function or similar to handle this instead.
I'm not sure the "legacy" term is a good one. Maybe autoconv or similar
would be better.

Greetings,
Reimar Doeffinger



More information about the MPlayer-dev-eng mailing list