From 21a4b6b297f1773b08c80d6d81da38411f0595a3 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Thu, 26 Jul 2007 07:57:51 +0000 Subject: [PATCH] add new option --no-utf8-convert to flac (SF#973740: http://sourceforge.net/tracker/index.php?func=detail&aid=973740&group_id=13478&atid=363478) --- doc/html/changelog.html | 74 ++++++++++++++++++++++++++ doc/html/documentation_tools_flac.html | 10 ++++ man/flac.sgml | 8 +++ src/flac/main.c | 15 +++++- src/flac/vorbiscomment.c | 4 +- src/flac/vorbiscomment.h | 2 +- 6 files changed, 108 insertions(+), 5 deletions(-) diff --git a/doc/html/changelog.html b/doc/html/changelog.html index a8f19886..ebb889d8 100644 --- a/doc/html/changelog.html +++ b/doc/html/changelog.html @@ -53,6 +53,80 @@
+ FLAC 1.2.1 + +
+ + + +
+ FLAC 1.2.0
diff --git a/doc/html/documentation_tools_flac.html b/doc/html/documentation_tools_flac.html index d5d3bbd4..77b4a039 100644 --- a/doc/html/documentation_tools_flac.html +++ b/doc/html/documentation_tools_flac.html @@ -210,6 +210,15 @@ Do not print anything of any kind, including warnings or errors. The exit code will be the only way to determine successful completion. + + + + --no-utf8-convert + + + Do not convert tags from local charset to UTF-8. This is useful for scripts, and setting tags in situations where the locale is wrong. This option must appear before any tag options! + + @@ -983,6 +992,7 @@ --no-silent
--no-verify
--no-warnings-as-errors
+ --no-utf8-convert
-o
--ogg
--output-name
diff --git a/man/flac.sgml b/man/flac.sgml index 412e8d6b..35036eaf 100644 --- a/man/flac.sgml +++ b/man/flac.sgml @@ -157,6 +157,14 @@ + + + + + Do not convert tags from local charset to UTF-8. This is useful for scripts, and setting tags in situations where the locale is wrong. This option must appear before any tag options! + + + , diff --git a/src/flac/main.c b/src/flac/main.c index ee9b69d5..9b200d3a 100644 --- a/src/flac/main.c +++ b/src/flac/main.c @@ -190,6 +190,7 @@ static struct share__option long_options_[] = { { "no-replay-gain" , share__no_argument, 0, 0 }, { "no-ignore-chunk-sizes" , share__no_argument, 0, 0 }, { "no-sector-align" , share__no_argument, 0, 0 }, + { "no-utf8-convert" , share__no_argument, 0, 0 }, { "no-lax" , share__no_argument, 0, 0 }, #if FLAC__HAS_OGG { "no-ogg" , share__no_argument, 0, 0 }, @@ -242,6 +243,7 @@ static struct { FLAC__bool replay_gain; FLAC__bool ignore_chunk_sizes; FLAC__bool sector_align; + FLAC__bool utf8_convert; /* true by default, to convert tag strings from locale to utf-8, false if --no-utf8-convert used */ const char *cmdline_forced_outfilename; const char *output_prefix; analysis_options aopts; @@ -545,6 +547,7 @@ FLAC__bool init_options(void) option_values.replay_gain = false; option_values.ignore_chunk_sizes = false; option_values.sector_align = false; + option_values.utf8_convert = true; option_values.cmdline_forced_outfilename = 0; option_values.output_prefix = 0; option_values.aopts.do_residual_text = false; @@ -719,7 +722,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a } else if(0 == strcmp(long_option, "tag-from-file")) { FLAC__ASSERT(0 != option_argument); - if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/true, &violation)) + if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/true, /*raw=*/!option_values.utf8_convert, &violation)) return usage_error("ERROR: (--tag-from-file) %s\n", violation); } else if(0 == strcmp(long_option, "no-cued-seekpoints")) { @@ -816,6 +819,9 @@ int parse_option(int short_option, const char *long_option, const char *option_a else if(0 == strcmp(long_option, "no-sector-align")) { option_values.sector_align = false; } + else if(0 == strcmp(long_option, "no-utf8-convert")) { + option_values.utf8_convert = false; + } else if(0 == strcmp(long_option, "no-lax")) { option_values.lax = false; } @@ -906,7 +912,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a break; case 'T': FLAC__ASSERT(0 != option_argument); - if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/false, &violation)) + if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/false, /*raw=*/!option_values.utf8_convert, &violation)) return usage_error("ERROR: (-T/--tag) %s\n", violation); break; case '0': @@ -1163,6 +1169,7 @@ void show_help(void) printf(" -c, --stdout Write output to stdout\n"); printf(" -s, --silent Do not write runtime encode/decode statistics\n"); printf(" --totally-silent Do not print anything, including errors\n"); + printf(" --no-utf8-convert Do not convert tags from local charset to UTF-8\n"); printf(" -w, --warnings-as-errors Treat all warnings as errors\n"); printf(" -f, --force Force overwriting of output files\n"); printf(" -o, --output-name=FILENAME Force the output file name\n"); @@ -1283,6 +1290,10 @@ void show_explain(void) printf(" --totally-silent Do not print anything of any kind, including\n"); printf(" warnings or errors. The exit code will be the\n"); printf(" only way to determine successful completion.\n"); + printf(" --no-utf8-convert Do not convert tags from local charset to UTF-8.\n"); + printf(" This is useful for scripts, and setting tags in\n"); + printf(" situations where the locale is wrong. This\n"); + printf(" option must appear before any tag options!\n"); printf(" -w, --warnings-as-errors Treat all warnings as errors\n"); printf(" -f, --force Force overwriting of output files\n"); printf(" -o, --output-name=FILENAME Force the output file name; usually flac just\n"); diff --git a/src/flac/vorbiscomment.c b/src/flac/vorbiscomment.c index 23331e5e..6b35a1e6 100644 --- a/src/flac/vorbiscomment.c +++ b/src/flac/vorbiscomment.c @@ -220,7 +220,7 @@ static void free_field(Argument_VcField *obj) free(obj->field_value); } -FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, const char **violation) +FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, FLAC__bool raw, const char **violation) { Argument_VcField parsed; FLAC__bool dummy; @@ -237,7 +237,7 @@ FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comm return false; } - if(!set_vc_field(block, &parsed, &dummy, /*raw=*/false, violation)) { + if(!set_vc_field(block, &parsed, &dummy, raw, violation)) { free_field(&parsed); return false; } diff --git a/src/flac/vorbiscomment.h b/src/flac/vorbiscomment.h index aeca20b0..1ff70067 100644 --- a/src/flac/vorbiscomment.h +++ b/src/flac/vorbiscomment.h @@ -21,6 +21,6 @@ #include "FLAC/metadata.h" -FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, const char **violation); +FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comment, FLAC__bool value_from_file, FLAC__bool raw, const char **violation); #endif