Re: Patch to fix displaying id3v1 info under UTF-8 locale

Jeremy Huddleston <[email protected]>
Newsgroups gmane.comp.multimedia.xmms.devel
Message-ID <[email protected]>
Part of these fixes are in a patch in bug #1711... I like the way you
handled this better, so I'll merge your way into the patch there and
update that bug.

--Jeremy

On Sat, 2004-10-23 at 16:08 +0200, Miklos Szeredi wrote:
> And this patch does the same with id3v1 tags, and applies on top of
> the previous one.
> 
> Miklos
> 
> Index: Input/mpg123/mpg123.c
> ===================================================================
> RCS file: /cvs/xmms/Input/mpg123/mpg123.c,v
> retrieving revision 1.56
> diff -u -r1.56 mpg123.c
> --- Input/mpg123/mpg123.c	18 Jul 2004 23:14:00 -0000	1.56
> +++ Input/mpg123/mpg123.c	23 Oct 2004 14:04:25 -0000
> @@ -2,6 +2,7 @@
>  #include "id3_header.h"
>  #include "libxmms/configfile.h"
>  #include "libxmms/titlestring.h"
> +#include "libxmms/charset.h"
>  #include <string.h>
>  #include <stdlib.h>
>  #include <pthread.h>
> @@ -400,6 +401,14 @@
>  	return ext;
>  }
>  
> +static char *convert_id3v1_field(const char *v1field, unsigned len)
> +{
> +    char *tmp = g_strndup(v1field, len);
> +    char *v2field = xmms_charset_from_latin1(g_strstrip(tmp));
> +    g_free(tmp);
> +    return v2field;
> +}
> +
>  /*
>   * Function id3v1_to_id3v2 (v1, v2)
>   *
> @@ -411,10 +420,10 @@
>  	char *year;
>  	struct id3v2tag_t *v2 = g_malloc0(sizeof (struct id3v2tag_t));
>  
> -	v2->title = g_strstrip(g_strndup(v1->title, 30));
> -	v2->artist = g_strstrip(g_strndup(v1->artist, 30));
> -	v2->album = g_strstrip(g_strndup(v1->album, 30));
> -	v2->comment = g_strstrip(g_strndup(v1->u.v1_0.comment, 30));
> +	v2->title = convert_id3v1_field(v1->title, 30);
> +	v2->artist = convert_id3v1_field(v1->artist, 30);
> +	v2->album = convert_id3v1_field(v1->album, 30);
> +	v2->comment = convert_id3v1_field(v1->u.v1_0.comment, 30);
>  	v2->genre = g_strstrip(g_strdup(get_id3_genre(v1->genre)));
>  	
>  	year = g_strndup(v1->year, 4);
> _______________________________________________
> xmms-devel mailing list
> [email protected]
> http://lists.xmms.org/mailman/listinfo/xmms-devel

-- 
Jeremy Huddleston <[email protected]>

_______________________________________________
xmms-devel mailing list
[email protected]
http://lists.xmms.org/mailman/listinfo/xmms-devel
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBBem+ZOpjtAl+gMRURAiy3AJ0dCAy/c1pTVBAd8c3W+bbpvWm9YACgyKyF
1t1I2sFzfd0cI3dvWdw+3Ak=
=Egge
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.