[xiph-cvs] cvs commit: vorbis-tools/ogginfo ogginfo.c
Segher Boessenkool
segher at xiph.org
Thu Jan 3 02:40:42 PST 2002
segher 02/01/03 02:40:41
Modified: ogg123 Makefile.am ogg123.c oggvorbis_format.c
ogginfo ogginfo.c
Log:
Support utf8 in ogg123 and ogginfo.
Revision Changes Path
1.20 +1 -1 vorbis-tools/ogg123/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/Makefile.am,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Makefile.am 2001/12/21 18:34:00 1.19
+++ Makefile.am 2002/01/03 10:40:40 1.20
@@ -12,7 +12,7 @@
@PTHREAD_CFLAGS@ @SHARE_CFLAGS@
ogg123_LDADD = @VORBISFILE_LIBS@ @VORBIS_LIBS@ @OGG_LIBS@ @AO_LIBS@ \
- @SOCKET_LIBS@ @SHARE_LIBS@ @CURL_LIBS@ @PTHREAD_CFLAGS@ \
+ @SOCKET_LIBS@ @LIBICONV@ @SHARE_LIBS@ @CURL_LIBS@ @PTHREAD_CFLAGS@ \
@PTHREAD_LIBS@
ogg123_DEPENDENCIES = @SHARE_LIBS@
ogg123_SOURCES = audio.c buffer.c callbacks.c \
1.58 +4 -1 vorbis-tools/ogg123/ogg123.c
Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- ogg123.c 2002/01/01 15:43:29 1.57
+++ ogg123.c 2002/01/03 10:40:40 1.58
@@ -14,7 +14,7 @@
* *
********************************************************************
- last mod: $Id: ogg123.c,v 1.57 2002/01/01 15:43:29 volsung Exp $
+ last mod: $Id: ogg123.c,v 1.58 2002/01/03 10:40:40 segher Exp $
********************************************************************/
@@ -28,6 +28,7 @@
#include <signal.h>
#include <unistd.h>
#include <sys/time.h>
+#include <locale.h>
#include "audio.h"
#include "buffer.h"
@@ -266,6 +267,8 @@
int main(int argc, char **argv)
{
int optind;
+
+ setlocale(LC_ALL, "");
ao_initialize();
stat_format = stat_format_create();
1.4 +11 -3 vorbis-tools/ogg123/oggvorbis_format.c
Index: oggvorbis_format.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/oggvorbis_format.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- oggvorbis_format.c 2001/12/28 00:22:36 1.3
+++ oggvorbis_format.c 2002/01/03 10:40:40 1.4
@@ -11,7 +11,7 @@
* *
********************************************************************
- last mod: $Id: oggvorbis_format.c,v 1.3 2001/12/28 00:22:36 segher Exp $
+ last mod: $Id: oggvorbis_format.c,v 1.4 2002/01/03 10:40:40 segher Exp $
********************************************************************/
@@ -22,6 +22,7 @@
#include <vorbis/vorbisfile.h>
#include "transport.h"
#include "format.h"
+#include "utf8.h"
typedef struct ovf_private_t {
@@ -339,10 +340,17 @@
return;
for (i = 0; i < priv->vc->comments; i++) {
+ char *decoded_value;
+
comment = priv->vc->user_comments[i];
comment_formatstr = lookup_comment_formatstr(comment, &offset);
-
- cb->printf_metadata(decoder->callback_arg, 1,
+
+ if (utf8_decode(comment + offset, &decoded_value) >= 0) {
+ cb->printf_metadata(decoder->callback_arg, 1,
+ comment_formatstr, decoded_value);
+ free(decoded_value);
+ } else
+ cb->printf_metadata(decoder->callback_arg, 1,
comment_formatstr, comment + offset);
}
}
1.8 +10 -1 vorbis-tools/ogginfo/ogginfo.c
Index: ogginfo.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogginfo/ogginfo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ogginfo.c 2001/12/19 03:47:41 1.7
+++ ogginfo.c 2002/01/03 10:40:41 1.8
@@ -14,6 +14,8 @@
#include <string.h>
#include <ogg/ogg.h>
#include <vorbis/codec.h>
+#include <locale.h>
+#include "utf8.h"
int dointegritycheck(char *filename);
@@ -21,6 +23,8 @@
{
int i;
+ setlocale(LC_ALL, "");
+
if ( ac < 2 ) {
fprintf(stderr,"Usage: %s [filename1.ogg] ... [filenameN.ogg]\n",av[0]);
return(0);
@@ -49,7 +53,12 @@
int i;
for (i=0; i < vc->comments; i++) {
- printf("%s\n",vc->user_comments[i]);
+ char *decoded_value;
+
+ if (utf8_decode(vc->user_comments[i], &decoded_value) >= 0)
+ printf("%s\n",decoded_value);
+ else
+ printf("%s\n",vc->user_comments[i]);
}
printf("vendor=%s\n", vc->vendor);
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list