Commit 21a4b6b2 authored by Josh Coalson's avatar Josh Coalson

add new option --no-utf8-convert to flac (SF#973740:...

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)
parent f9cf27fc
......@@ -53,6 +53,80 @@
<br />
<a name="flac_1_2_1"><b>FLAC 1.2.1</b></a>
<br />
<ul>
<li>
General:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
FLAC format:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
Ogg FLAC format:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
flac:
<ul>
<li>Added a new option <span class="argument"><a href="documentation_tools_flac.html#flac_options_no_utf8_convert">--no-utf8-convert</a></span> which works like it does in <span class="commandname">metaflac</span> (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=973740&amp;group_id=13478&amp;atid=363478">SF #973740</a>).</li>
</ul>
</li>
<li>
metaflac:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
plugins:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
build system:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
libraries:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
Interface changes (see also the <a href="http://flac.sourceforge.net/api/group__porting__1__2__0__to__1__2__1.html">porting guide</a> for specific instructions on porting to FLAC 1.2.1):
<ul>
<li>
libFLAC:
<ul>
<li>(none)</li>
</ul>
</li>
<li>
libFLAC++:
<ul>
<li>(none)</li>
</ul>
</li>
</ul>
</li>
</ul>
<br />
<a name="flac_1_2_0"><b>FLAC 1.2.0</b></a>
<br />
......
......@@ -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.
</td>
</tr>
<tr>
<td nowrap="nowrap" align="right" valign="top" bgcolor="#F4F4CC">
<a name="flac_options_no_utf8_convert" />
<span class="argument">--no-utf8-convert</span>
</td>
<td>
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!
</td>
</tr>
<tr>
<td nowrap="nowrap" align="right" valign="top" bgcolor="#F4F4CC">
<a name="flac_options_warnings_as_errors" />
......@@ -983,6 +992,7 @@
<a href="#negative_options" /><span class="argument">--no-silent</span></a><br />
<a href="#negative_options" /><span class="argument">--no-verify</span></a><br />
<a href="#negative_options" /><span class="argument">--no-warnings-as-errors</span></a><br />
<a href="#flac_options_no_utf8_convert" /><span class="argument">--no-utf8-convert</span></a><br />
<a href="#flac_options_output_name" /><span class="argument">-o</span></a><br />
<a href="#flac_options_ogg" /><span class="argument">--ogg</span></a><br />
<a href="#flac_options_output_name" /><span class="argument">--output-name</span></a><br />
......
......@@ -157,6 +157,14 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-utf8-convert</option>
</term>
<listitem>
<para>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!</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-w</option>, <option>--warnings-as-errors</option>
</term>
......
......@@ -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");
......
......@@ -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;
}
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment