Hi Josh, Here are all the patches that are currently applied to the Debian packages for flac. You may disagree with some of them but as the current maintainer, I'm submitting them all for your consideration. (I should've submitted them earlier, but I've been quite busy. Sorry!) Here is a listing of the patches that I'll be sending: Patch 1 fixes a simple typo in metaflac documentation. Patch 2 changes how 'flac -t' progress is displayed. The way the code currently is, it causes problems when the length of the filename is longer than the width of the terminal. Patch 3 changes EOF warnings to errors. The reason for doing this is that someone complained that he specified flac --delete-input-file when encoding, received an EOF warning, and since the warning was not fatal, the file was deleted anyway, and it was no longer possible to check the input file. Patch 4 adds a mention of --no-utf8-convert to the manpage. Patch 5 causes metaflac to exit nonzero if an illegal option was entered. Please let me know what you think. -- Joshua Kwan -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 881 bytes Desc: Digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20070108/5b9a428f/attachment.pgp
Joshua Kwan
2007-Jan-08 17:06 UTC
[Flac-dev] [PATCH 1/5] 'stdin' -> 'stdout' in metaflac documentation
This patch fixes a simple typo in metaflac documentation. -- Joshua Kwan --- flac-1.1.2/man/metaflac.sgml~ 2005-08-18 01:40:33.000000000 -0700 +++ flac-1.1.2/man/metaflac.sgml 2005-08-18 01:39:50.000000000 -0700 @@ -258,7 +258,7 @@ <term><option>--export-tags-to=file</option></term> <listitem> <para> - Export tags to a file. Use '-' for stdin. Each + Export tags to a file. Use '-' for stdout. Each line will be of the form NAME=VALUE. Specify --no-utf8-convert if necessary. </para> --- flac-1.1.2/man/metaflac.1~ 2005-08-18 01:37:10.000000000 -0700 +++ flac-1.1.2/man/metaflac.1 2005-08-18 01:39:53.000000000 -0700 @@ -88,7 +89,7 @@ --no-utf8-convert before --import-tags-from if necessary. .TP \fB--export-tags-to=file\fR -Export tags to a file. Use '-' for stdin. Each +Export tags to a file. Use '-' for stdout. Each line will be of the form NAME=VALUE. Specify --no-utf8-convert if necessary. .TP --- flac-1.1.2/src/metaflac/usage.c~ 2005-08-18 01:41:39.000000000 -0700 +++ flac-1.1.2/src/metaflac/usage.c 2005-08-18 01:41:50.000000000 -0700 @@ -127,8 +127,8 @@ fprintf(out, " are currently not supported. Specify --remove-all-tags\n"); fprintf(out, " and/or --no-utf8-convert before --import-tags-from if\n"); fprintf(out, " necessary. If FILE is '-' (stdin), only one FLAC file\n"); fprintf(out, " may be specified.\n"); - fprintf(out, "--export-tags-to=FILE Export tags to a file. Use '-' for stdin. Each line\n"); + fprintf(out, "--export-tags-to=FILE Export tags to a file. Use '-' for stdout. Each line\n"); fprintf(out, " will be of the form NAME=VALUE. Specify\n"); fprintf(out, " --no-utf8-convert if necessary.\n"); fprintf(out, "--import-cuesheet-from=FILE Import a cuesheet from a file. Use '-' for stdin.\n"); -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 881 bytes Desc: Digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20070108/bed1b2f6/attachment.pgp
Joshua Kwan
2007-Jan-08 17:07 UTC
[Flac-dev] [PATCH 2/5]: Change 'flac -t' progress display
This patch changes how 'flac -t' progress is displayed. The way the code currently is, it causes problems when the length of the filename is longer than the width of the terminal. -- Joshua Kwan --- flac-1.1.2/src/flac/decode.c~ 2005-08-18 02:16:46.000000000 -0700 +++ flac-1.1.2/src/flac/decode.c 2005-08-18 02:14:59.000000000 -0700 @@ -1182,6 +1182,7 @@ void print_stats(const DecoderSession *decoder_session) { + static int count = 0; if(flac__utils_verbosity_ >= 2) { #if defined _MSC_VER || defined __MINGW32__ /* with MSVC you have to spoon feed it the casting */ @@ -1190,7 +1191,13 @@ const double progress = (double)decoder_session->samples_processed / (double)decoder_session->total_samples * 100.0; #endif if(decoder_session->total_samples > 0) { - fprintf(stderr, "\r%s: %s%u%% complete", + while (count > 0 && count--) + fprintf(stderr, "\b"); + + if ((unsigned)floor(progress + 0.5) == 100) + return; + + count = fprintf(stderr, "%s: %s%u%% complete", decoder_session->inbasefilename, decoder_session->test_only? "testing, " : decoder_session->analysis_mode? "analyzing, " : "", (unsigned)floor(progress + 0.5) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 881 bytes Desc: Digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20070108/32b1a0c7/attachment.pgp
This patch changes EOF warnings to errors. The reason for doing this is that someone complained that he specified flac --delete-input-file when encoding, received an EOF warning, and since the warning was not fatal, the file was deleted anyway, and it was no longer possible to check the input file. -- Joshua Kwan --- flac-1.1.2.orig/src/flac/encode.c +++ flac-1.1.2/src/flac/encode.c @@ -448,8 +448,8 @@ return EncoderSession_finish_error(&encoder_session); } else if(feof(infile)) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned int)encoder_session.total_samples_to_encode, (unsigned int)encoder_session.samples_written); - data_bytes= 0; + flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned int)encoder_session.total_samples_to_encode, (unsigned int)encoder_session.samples_written); + return EncoderSession_finish_error(&encoder_session); } } else { @@ -508,7 +508,8 @@ return EncoderSession_finish_error(&encoder_session); } else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_frame) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned int)bytes_read, (unsigned int)encoder_session.total_samples_to_encode, (unsigned int)encoder_session.samples_written); + flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned int)bytes_read, (unsigned int)encoder_session.total_samples_to_encode, (unsigned int)encoder_session.samples_written); + return EncoderSession_finish_error(&encoder_session); } else { info_align_carry= *options.common.align_reservoir_samples; @@ -968,8 +969,8 @@ return EncoderSession_finish_error(&encoder_session); } else if(feof(infile)) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - data_bytes = 0; + flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); + return EncoderSession_finish_error(&encoder_session); } } else { @@ -1027,7 +1028,8 @@ return EncoderSession_finish_error(&encoder_session); } else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_wide_sample) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); + flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); + return EncoderSession_finish_error(&encoder_session); } else { info_align_carry = *options.common.align_reservoir_samples; @@ -1282,8 +1284,8 @@ return EncoderSession_finish_error(&encoder_session); } else if(feof(infile)) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - total_input_bytes_read = max_input_bytes; + flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); + return EncoderSession_finish_error(&encoder_session); } } else { @@ -1334,7 +1336,8 @@ return EncoderSession_finish_error(&encoder_session); } else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_wide_sample) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); + flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); + return EncoderSession_finish_error(&encoder_session); } else { info_align_carry = *options.common.align_reservoir_samples; -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 881 bytes Desc: Digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20070108/c2c17dac/attachment-0001.pgp
Joshua Kwan
2007-Jan-08 17:10 UTC
[Flac-dev] [PATCH 4/5]: Mention --no-utf8-convert in metaflac manpage
This patch simply adds a mention of --no-utf8-convert to the manpage. -- Joshua Kwan diff -ur /tmp/flac-1.1.2/man/metaflac.sgml man/metaflac.sgml --- a/man/metaflac.sgml 2005-02-02 11:44:43.000000000 -0700 +++ b/man/metaflac.sgml 2006-05-27 16:21:30.000000000 -0600 @@ -106,6 +106,15 @@ </listitem> </varlistentry> <varlistentry> + <term><option>--no-utf8-convert</option></term> + <listitem> + <para> + Do not convert tags from UTF-8 to local charset, or vice versa. This is + useful for scripts. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--dont-use-padding</option></term> <listitem> <para> diff -ur /tmp/flac-1.1.2/man/metaflac.1 man/metaflac.1 --- a/man/metaflac.1 2005-02-02 11:45:01.000000000 -0700 +++ b/man/metaflac.1 2006-05-27 23:01:07.000000000 -0600 @@ -28,6 +29,10 @@ Do not prefix each output line with the FLAC file name (the default if only one FLAC file is specified). .TP +\fB--no-utf8-convert\fR +Do not convert tags from UTF-8 to local charset, or vice versa. This is +useful for scripts. +.TP \fB--dont-use-padding\fR By default metaflac tries to use padding where possible to avoid rewriting the entire file if the metadata size changes. Use this -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 881 bytes Desc: Digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20070108/8de778b1/attachment.pgp
Joshua Kwan
2007-Jan-08 17:11 UTC
[Flac-dev] [PATCH 5/5]: Make metaflac exit nonzero on bad option
This patch causes metaflac to exit nonzero if an illegal option was entered. -- Joshua Kwan --- flac-1.1.2/src/metaflac/options.c~ 2006-05-27 23:13:33.000000000 -0600 +++ flac-1.1.2/src/metaflac/options.c 2006-05-27 23:15:07.000000000 -0600 @@ -229,7 +229,7 @@ } } - return !had_error; + return had_error; } void free_options(CommandLineOptions *options) --- flac-1.1.2/src/metaflac/main.c~ 2006-05-27 23:07:51.000000000 -0600 +++ flac-1.1.2/src/metaflac/main.c 2006-05-27 23:14:47.000000000 -0600 @@ -32,7 +32,7 @@ setlocale(LC_ALL, ""); init_options(&options); - if(parse_options(argc, argv, &options)) + if ((ret = parse_options(argc, argv, &options)) == 0) ret = !do_operations(&options); free_options(&options); -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 881 bytes Desc: Digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20070108/cb7844d3/attachment.pgp
--- Joshua Kwan <joshk@triplehelix.org> wrote:> Hi Josh, > > Here are all the patches that are currently applied to the Debian > packages for flac. You may disagree with some of them but as the > current > maintainer, I'm submitting them all for your consideration. > > (I should've submitted them earlier, but I've been quite busy. > Sorry!) > > Here is a listing of the patches that I'll be sending: > > Patch 1 fixes a simple typo in metaflac documentation. > > Patch 2 changes how 'flac -t' progress is displayed. The way the code > currently is, it causes problems when the length of the filename is > longer than the width of the terminal. > > Patch 3 changes EOF warnings to errors. The reason for doing this is > that someone complained that he specified flac --delete-input-file > when > encoding, received an EOF warning, and since the warning was not > fatal, > the file was deleted anyway, and it was no longer possible to check > the > input file. > > Patch 4 adds a mention of --no-utf8-convert to the manpage. > > Patch 5 causes metaflac to exit nonzero if an illegal option was > entered. > > Please let me know what you think.ok, thanks, I checked in 1,4,5. 2 I patched but want to test in a windows dos box first. #3 I want to think about a little. some programs use flac at the end of a pipe a send wave files with oversized chunk sizes to signal that they don't know how many samples there are and this patch will break that functionality. Josh ____________________________________________________________________________________ TV dinner still cooling? Check out "Tonight's Picks" on Yahoo! TV. http://tv.yahoo.com/