Commit b05d4ee3 authored by Josh Coalson's avatar Josh Coalson

add --warnings-as-errors option to flac; for picture importing, allow MIME...

add --warnings-as-errors option to flac; for picture importing, allow MIME type in specification to be blank and filled in automatically; allow specification to be just the filename, with other fields filled in automatically
parent 559321c7
......@@ -83,6 +83,8 @@
<ul>
<li>Improved compression with no impact on format or decoding speed.</li>
<li>Encoding and decoding speedups across the board. Encoding at -8 is twice as fast.</li>
<li>Added a new option <span class="argument"><a href="documentation_tools_flac.html#flac_options_warnings_as_errors">-w,-@@@@@@-warnings-as-errors</a></span> for treating all warnings as errors.</li>
<li>Allow <span class="argument"><a href="documentation_tools_flac.html#flac_options_picture">-@@@@@@-picture</a></span> option to take only a filename, and have all other attributes extracted from the file itself.</li>
<li>Fixed a bug that caused suboptimal default compression settings in some locales (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1608883&amp;group_id=13478&amp;atid=113478">SF #1608883</a>).</li>
<li>Fixed a bug where FLAC-to-FLAC transcoding of a corrupted FLAC file would truncate the transcoded file at the first error (<a href="http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1615019&amp;group_id=13478&amp;atid=113478">SF #1615019</a>).</li>
<li>Fixed a bug where using <span class="argument"><a href="documentation_tools_flac.html#flac_options_decode_through_errors">-F</a></span> with FLAC-to-FLAC transcoding of a corrupted FLAC would have no effect (<a href="http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1615391&amp;group_id=13478&amp;atid=113478">SF #1615391</a>).</li>
......@@ -92,6 +94,7 @@
<li>
metaflac:
<ul>
<li>Allow <span class="argument"><a href="documentation_tools_metaflac.html#metaflac_shorthand_import_picture_from">-@@@@@@-import-picture-from</a></span> option to take only a filename, and have all other attributes extracted from the file itself.</li>
<li>(none)</li>
</ul>
</li>
......
......@@ -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_warnings_as_errors" />
<span class="argument">-w</span>, <span class="argument">--warnings-as-errors</span>
</td>
<td>
Treat all warnings as errors (which cause <span class="commandname">flac</span> to terminate with a non-zero exit code).
</td>
</tr>
<tr>
<td nowrap="nowrap" align="right" valign="top" bgcolor="#F4F4CC">
<a name="flac_options_force" />
......@@ -465,12 +474,12 @@
<tr>
<td nowrap="nowrap" align="right" valign="top" bgcolor="#F4F4CC">
<a name="flac_options_picture" />
<span class="argument">--picture=SPECIFICATION</span>
<span class="argument">--picture={FILENAME|SPECIFICATION}</span>
</td>
<td>
Import a picture and store it in a <a href="format.html#def_PICTURE"><span class="code">PICTURE</span></a> metadata block. More than one <span class="argument">--picture</span> command can be specified. The <span class="argument">SPECIFICATION</span> is a string whose parts are separated by <span class="argument">|</span> (pipe) characters. Some parts may be left empty to invoke default values. The format of <span class="argument">SPECIFICATION</span> is<br />
Import a picture and store it in a <a href="format.html#def_PICTURE"><span class="code">PICTURE</span></a> metadata block. More than one <span class="argument">--picture</span> command can be specified. Either a filename for the picture file or a more complete specification form can be used. The <span class="argument">SPECIFICATION</span> is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. <span class="argument">FILENAME</span> is just shorthand for <span class="argument">||||FILENAME</span>. The format of <span class="argument">SPECIFICATION</span> is<br />
<br />
<tt>&nbsp;&nbsp;[TYPE]|MIME-TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE</tt><br />
<tt>&nbsp;&nbsp;[TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE</tt><br />
<br />
<span class="argument">TYPE</span> is optional; it is a number from one of:<br />
<ul>
......@@ -498,7 +507,7 @@
</ul>
The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file.<br/>
<br />
<span class="argument">MIME-TYPE</span> is mandatory; for best compatibility with players, use pictures with MIME type <tt>image/jpeg</tt> or <tt>image/png</tt>. The MIME type can also be --&gt; to mean that <span class="argument">FILE</span> is actually a URL to an image, though this use is discouraged.<br />
<span class="argument">MIME-TYPE</span> is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type <tt>image/jpeg</tt> or <tt>image/png</tt>. The MIME type can also be --&gt; to mean that <span class="argument">FILE</span> is actually a URL to an image, though this use is discouraged.<br />
<br />
<span class="argument">DESCRIPTION</span> is optional; the default is an empty string.<br />
<br />
......@@ -887,6 +896,7 @@
<span class="argument">--no-seektable</span><br />
<span class="argument">--no-silent</span><br />
<span class="argument">--no-verify</span>
<span class="argument">--no-warnings-as-errors</span>
</td>
<td>
Can all be used to turn off a particular option.
......@@ -972,6 +982,7 @@
<a href="#negative_options" /><span class="argument">--no-seektable</span></a><br />
<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_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 />
......@@ -1008,6 +1019,8 @@
<a href="#flac_options_verify" /><span class="argument">-V</span></a><br />
<a href="#flac_options_version" /><span class="argument">-v</span></a><br />
<a href="#flac_options_verify" /><span class="argument">--verify</span></a><br />
<a href="#flac_options_warnings_as_errors" /><span class="argument">-w</span></a><br />
<a href="#flac_options_warnings_as_errors" /><span class="argument">--warnings-as-errors</span></a><br />
<a href="#flac_options_version" /><span class="argument">--version</span></a><br />
</div>
......
......@@ -329,7 +329,7 @@
<tr>
<td nowrap="nowrap" align="right" valign="top" bgcolor="#F4F4CC">
<a name="metaflac_shorthand_import_picture_from" />
<span class="argument">--import-picture-from=SPECIFICATION</span>
<span class="argument">--import-picture-from={FILENAME|SPECIFICATION}</span>
</td>
<td>
Import a picture and store it in a <a href="format.html#def_PICTURE"><span class="code">PICTURE</span></a> metadata block. See the <span class="commandname">flac</span> option <span class="argument"><a href="documentation_tools_flac.html#flac_options_picture">--picture</a></span> for an explanation of the <span class="argument">SPECIFICATION</span> syntax.
......
......@@ -157,6 +157,14 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>-w</option>, <option>--warnings-as-errors</option>
</term>
<listitem>
<para>Treat all warnings as errors (which cause flac to terminate with a non-zero exit code).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f</option>, <option>--force</option>
</term>
......@@ -303,11 +311,11 @@
</varlistentry>
<varlistentry>
<term><option>--picture</option>=<replaceable>SPECIFICATION</replaceable></term>
<term><option>--picture</option>={<replaceable>FILENAME</replaceable>|<replaceable>SPECIFICATION</replaceable>}</term>
<listitem>
<para>Import a picture and store it in a PICTURE metadata block. More than one --picture command can be specified. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. The format of SPECIFICATION is</para>
<para>[TYPE]|MIME-TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE</para>
<para>Import a picture and store it in a PICTURE metadata block. More than one --picture command can be specified. Either a filename for the picture file or a more complete specification form can be used. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. FILENAME is just shorthand for "||||FILENAME". The format of SPECIFICATION is</para>
<para>[TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE</para>
<para>TYPE is optional; it is a number from one of:</para>
<para>0: Other</para>
<para>1: 32x32 pixels 'file icon' (PNG only)</para>
......@@ -332,7 +340,7 @@
<para>20: Publisher/Studio logotype</para>
<para>The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file.</para>
<para>MIME-TYPE is mandatory; for best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --&gt; to mean that FILE is actually a URL to an image, though this use is discouraged.</para>
<para>MIME-TYPE is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --&gt; to mean that FILE is actually a URL to an image, though this use is discouraged.</para>
<para>DESCRIPTION is optional; the default is an empty string.</para>
......@@ -656,6 +664,7 @@
<term><option>--no-seektable</option></term>
<term><option>--no-silent</option></term>
<term><option>--no-verify</option></term>
<term><option>--no-warnings-as-errors</option></term>
<listitem>
<para>These flags can be used to invert the sense of the corresponding normal option.</para>
</listitem>
......
......@@ -49,6 +49,7 @@ typedef struct {
FLAC__bool is_aiff_out;
FLAC__bool is_wave_out;
FLAC__bool treat_warnings_as_errors;
FLAC__bool continue_through_decode_errors;
FLAC__bool channel_map_none;
......@@ -102,7 +103,7 @@ static FLAC__bool is_big_endian_host_;
/*
* local routines
*/
static FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, const char *infilename, const char *outfilename);
static FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, const char *infilename, const char *outfilename);
static void DecoderSession_destroy(DecoderSession *d, FLAC__bool error_occurred);
static FLAC__bool DecoderSession_init_decoder(DecoderSession *d, decode_options_t decode_options, const char *infilename);
static FLAC__bool DecoderSession_process(DecoderSession *d);
......@@ -141,6 +142,7 @@ int flac__decode_aiff(const char *infilename, const char *outfilename, FLAC__boo
#endif
/*is_aiff_out=*/true,
/*is_wave_out=*/false,
options.common.treat_warnings_as_errors,
options.common.continue_through_decode_errors,
options.common.channel_map_none,
options.common.replaygain_synthesis_spec,
......@@ -178,6 +180,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
#endif
/*is_aiff_out=*/false,
/*is_wave_out=*/true,
options.common.treat_warnings_as_errors,
options.common.continue_through_decode_errors,
options.common.channel_map_none,
options.common.replaygain_synthesis_spec,
......@@ -218,6 +221,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
#endif
/*is_aiff_out=*/false,
/*is_wave_out=*/false,
options.common.treat_warnings_as_errors,
options.common.continue_through_decode_errors,
options.common.channel_map_none,
options.common.replaygain_synthesis_spec,
......@@ -241,7 +245,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
return DecoderSession_finish_ok(&decoder_session);
}
FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, const char *infilename, const char *outfilename)
FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, const char *infilename, const char *outfilename)
{
#if FLAC__HAS_OGG
d->is_ogg = is_ogg;
......@@ -251,6 +255,7 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__
d->is_aiff_out = is_aiff_out;
d->is_wave_out = is_wave_out;
d->treat_warnings_as_errors = treat_warnings_as_errors;
d->continue_through_decode_errors = continue_through_decode_errors;
d->channel_map_none = channel_map_none;
d->replaygain.spec = replaygain_synthesis_spec;
......@@ -470,9 +475,11 @@ int DecoderSession_finish_ok(DecoderSession *d)
else {
if(!d->got_stream_info) {
flac__utils_printf(stderr, 1, "\r%s: WARNING, cannot check MD5 signature since there was no STREAMINFO\n", d->inbasefilename);
ok = !d->treat_warnings_as_errors;
}
else if(!d->has_md5sum) {
flac__utils_printf(stderr, 1, "\r%s: WARNING, cannot check MD5 signature since it was unset in the STREAMINFO\n", d->inbasefilename);
ok = !d->treat_warnings_as_errors;
}
flac__utils_printf(stderr, 2, "\r%s: %s \n", d->inbasefilename, d->test_only? "ok ":d->analysis_mode?"done ":"done");
}
......@@ -551,6 +558,8 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin
flac__utils_printf(stderr, 1, "%s: WARNING, don't have accurate sample count available for %s header.\n", decoder_session->inbasefilename, fmt_desc);
flac__utils_printf(stderr, 1, " Generated %s file will have a data chunk size of 0. Try\n", fmt_desc);
flac__utils_printf(stderr, 1, " decoding directly to a file instead.\n");
if(decoder_session->treat_warnings_as_errors)
return false;
}
else {
decoder_session->iff_headers_need_fixup = true;
......@@ -1076,6 +1085,10 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet
double reference, gain, peak;
if (!(decoder_session->replaygain.apply = grabbag__replaygain_load_from_vorbiscomment(metadata, decoder_session->replaygain.spec.use_album_gain, /*strict=*/false, &reference, &gain, &peak))) {
flac__utils_printf(stderr, 1, "%s: WARNING: can't get %s (or even %s) ReplayGain tags\n", decoder_session->inbasefilename, decoder_session->replaygain.spec.use_album_gain? "album":"track", decoder_session->replaygain.spec.use_album_gain? "track":"album");
if(decoder_session->treat_warnings_as_errors) {
decoder_session->abort_flag = true;
return;
}
}
else {
const char *ls[] = { "no", "peak", "hard" };
......@@ -1085,6 +1098,7 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet
FLAC__replaygain_synthesis__init_dither_context(&decoder_session->replaygain.dither_context, decoder_session->bps, decoder_session->replaygain.spec.noise_shaping);
flac__utils_printf(stderr, 1, "%s: INFO: applying %s ReplayGain (gain=%0.2fdB+preamp=%0.1fdB, %s noise shaping, %s limiting) to output\n", decoder_session->inbasefilename, decoder_session->replaygain.spec.use_album_gain? "album":"track", gain, decoder_session->replaygain.spec.preamp, ns[decoder_session->replaygain.spec.noise_shaping], ls[decoder_session->replaygain.spec.limiter]);
flac__utils_printf(stderr, 1, "%s: WARNING: applying ReplayGain is not lossless\n", decoder_session->inbasefilename);
/* don't check if(decoder_session->treat_warnings_as_errors) because the user explicitly asked for it */
}
}
(void)flac__utils_get_channel_mask_tag(metadata, &decoder_session->channel_mask);
......
......@@ -36,6 +36,7 @@ typedef struct {
} replaygain_synthesis_spec_t;
typedef struct {
FLAC__bool treat_warnings_as_errors;
FLAC__bool continue_through_decode_errors;
replaygain_synthesis_spec_t replaygain_synthesis_spec;
#if FLAC__HAS_OGG
......
This diff is collapsed.
......@@ -73,6 +73,7 @@ typedef struct {
char *requested_seek_points;
int num_requested_seek_points;
const char *cuesheet_filename;
FLAC__bool treat_warnings_as_errors;
FLAC__bool continue_through_decode_errors; /* currently only obeyed when encoding from FLAC or Ogg FLAC */
FLAC__bool cued_seekpoints;
FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */
......
This diff is collapsed.
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