mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
Improved error message when user attempts to decode a non-FLAC file (SF#2222789: https://sourceforge.net/tracker2/?func=detail&aid=2222789&group_id=13478&atid=113478
This commit is contained in:
@@ -83,8 +83,9 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Added support for encoding from and decoding to the RF64 format, and a new corresponding option <span class="argument"><a href="#flac_options_force_rf64_format" />--force-rf64-format</a></span>. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1762502&group_id=13478&atid=363478">SF #1762502</a>). <span class="argument"><a href="documentation_tools_flac.html#flac_options_keep_foreign_metadata">--keep-foreign-metadata</a></span> is also supported.</li>
|
<li>Added support for encoding from and decoding to the RF64 format, and a new corresponding option <span class="argument"><a href="#flac_options_force_rf64_format" />--force-rf64-format</a></span>. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1762502&group_id=13478&atid=363478">SF #1762502</a>). <span class="argument"><a href="documentation_tools_flac.html#flac_options_keep_foreign_metadata">--keep-foreign-metadata</a></span> is also supported.</li>
|
||||||
<li>Added support for encoding from and decoding to the Sony Wave64 format, and a new corresponding option <span class="argument"><a href="#flac_options_force_wave64_format" />--force-wave64-format</a></span>. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1769582&group_id=13478&atid=363478">SF #1769582</a>). <span class="argument"><a href="documentation_tools_flac.html#flac_options_keep_foreign_metadata">--keep-foreign-metadata</a></span> is also supported.</li>
|
<li>Added support for encoding from and decoding to the Sony Wave64 format, and a new corresponding option <span class="argument"><a href="#flac_options_force_wave64_format" />--force-wave64-format</a></span>. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1769582&group_id=13478&atid=363478">SF #1769582</a>). <span class="argument"><a href="documentation_tools_flac.html#flac_options_keep_foreign_metadata">--keep-foreign-metadata</a></span> is also supported.</li>
|
||||||
<li>Added a new options <span class="argument"><a href="documentation_tools_flac.html#flac_options_preserve_modtime">--preserve-modtime</a></span> and <span class="argument"><a href="documentation_tools_flac.html#flac_options_no_preserve_modtime">--no-preserve-modtime</a></span> to specify whether or not output files should copy the timestamp and permissions from their input files. The default is <span class="argument"><a href="documentation_tools_flac.html#flac_options_preserve_modtime">--preserve-modtime</a></span> as in previous versions. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1805428&group_id=13478&atid=363478">SF #1805428</a>).</li>
|
<li>Added new options <span class="argument"><a href="documentation_tools_flac.html#flac_options_preserve_modtime">--preserve-modtime</a></span> and <span class="argument"><a href="documentation_tools_flac.html#flac_options_no_preserve_modtime">--no-preserve-modtime</a></span> to specify whether or not output files should copy the timestamp and permissions from their input files. The default is <span class="argument"><a href="documentation_tools_flac.html#flac_options_preserve_modtime">--preserve-modtime</a></span> as in previous versions. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1805428&group_id=13478&atid=363478">SF #1805428</a>).</li>
|
||||||
<li>The <span class="argument"><a href="documentation_tools_flac.html#flac_options_sector_align">--sector-align</a></span> option of <span class="commandname">flac</span> has been deprecated and may not exist in future versions. <a href="http://www.etree.org/shnutils/shntool/">shntool</a> provides similar functionality. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1805946&group_id=13478&atid=363478">SF #1805946</a>)</li>
|
<li>The <span class="argument"><a href="documentation_tools_flac.html#flac_options_sector_align">--sector-align</a></span> option of <span class="commandname">flac</span> has been deprecated and may not exist in future versions. <a href="http://www.etree.org/shnutils/shntool/">shntool</a> provides similar functionality. (<a href="https://sourceforge.net/tracker/index.php?func=detail&aid=1805946&group_id=13478&atid=363478">SF #1805946</a>)</li>
|
||||||
|
<li>Improved error message when user attempts to decode a non-FLAC file (<a href="https://sourceforge.net/tracker2/?func=detail&aid=2222789&group_id=13478&atid=113478">SF #2222789</a>).</li>
|
||||||
<li>Fix bug where <span class="commandname">flac</span> was disallowing use of <span class="argument">--replay-gain</span> when encoding from stdin (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1840124&group_id=13478&atid=113478">SF #1840124</a>).</li>
|
<li>Fix bug where <span class="commandname">flac</span> was disallowing use of <span class="argument">--replay-gain</span> when encoding from stdin (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1840124&group_id=13478&atid=113478">SF #1840124</a>).</li>
|
||||||
<li>Fix bug with fractional seconds on some locales (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1815517&group_id=13478&atid=113478">SF #1815517</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=1858012&group_id=13478&atid=113478">SF #1858012</a>).</li>
|
<li>Fix bug with fractional seconds on some locales (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1815517&group_id=13478&atid=113478">SF #1815517</a>, <a href="https://sourceforge.net/tracker2/?func=detail&aid=1858012&group_id=13478&atid=113478">SF #1858012</a>).</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ typedef struct {
|
|||||||
FLAC__bool abort_flag;
|
FLAC__bool abort_flag;
|
||||||
FLAC__bool aborting_due_to_until; /* true if we intentionally abort decoding prematurely because we hit the --until point */
|
FLAC__bool aborting_due_to_until; /* true if we intentionally abort decoding prematurely because we hit the --until point */
|
||||||
FLAC__bool aborting_due_to_unparseable; /* true if we abort decoding because we hit an unparseable frame */
|
FLAC__bool aborting_due_to_unparseable; /* true if we abort decoding because we hit an unparseable frame */
|
||||||
|
FLAC__bool error_callback_suppress_messages; /* turn on to prevent repeating messages from the error callback */
|
||||||
|
|
||||||
FLAC__bool iff_headers_need_fixup;
|
FLAC__bool iff_headers_need_fixup;
|
||||||
|
|
||||||
@@ -228,6 +229,7 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__
|
|||||||
d->abort_flag = false;
|
d->abort_flag = false;
|
||||||
d->aborting_due_to_until = false;
|
d->aborting_due_to_until = false;
|
||||||
d->aborting_due_to_unparseable = false;
|
d->aborting_due_to_unparseable = false;
|
||||||
|
d->error_callback_suppress_messages = false;
|
||||||
|
|
||||||
d->iff_headers_need_fixup = false;
|
d->iff_headers_need_fixup = false;
|
||||||
|
|
||||||
@@ -1357,11 +1359,26 @@ void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderError
|
|||||||
{
|
{
|
||||||
DecoderSession *decoder_session = (DecoderSession*)client_data;
|
DecoderSession *decoder_session = (DecoderSession*)client_data;
|
||||||
(void)decoder;
|
(void)decoder;
|
||||||
flac__utils_printf(stderr, 1, "%s: *** Got error code %d:%s\n", decoder_session->inbasefilename, status, FLAC__StreamDecoderErrorStatusString[status]);
|
if(!decoder_session->error_callback_suppress_messages)
|
||||||
|
flac__utils_printf(stderr, 1, "%s: *** Got error code %d:%s\n", decoder_session->inbasefilename, status, FLAC__StreamDecoderErrorStatusString[status]);
|
||||||
if(!decoder_session->continue_through_decode_errors) {
|
if(!decoder_session->continue_through_decode_errors) {
|
||||||
decoder_session->abort_flag = true;
|
/* if we got a sync error while looking for metadata, either it's not a FLAC file (more likely) or the file is corrupted */
|
||||||
if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM)
|
if(
|
||||||
|
!decoder_session->error_callback_suppress_messages &&
|
||||||
|
status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC &&
|
||||||
|
FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA
|
||||||
|
) {
|
||||||
|
flac__utils_printf(stderr, 1,
|
||||||
|
"\n"
|
||||||
|
"The input file is either not a FLAC file or is corrupted. If you are\n"
|
||||||
|
"convinced it is a FLAC file, you can rerun the same command and add the\n"
|
||||||
|
"-F parameter to try and recover as much as possible from the file.\n"
|
||||||
|
);
|
||||||
|
decoder_session->error_callback_suppress_messages = true;
|
||||||
|
}
|
||||||
|
else if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM)
|
||||||
decoder_session->aborting_due_to_unparseable = true;
|
decoder_session->aborting_due_to_unparseable = true;
|
||||||
|
decoder_session->abort_flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user