mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
add the --output-prefix option
This commit is contained in:
@@ -305,7 +305,15 @@
|
|||||||
<TT>-o filename</TT>
|
<TT>-o filename</TT>
|
||||||
</TD>
|
</TD>
|
||||||
<TD>
|
<TD>
|
||||||
Force the output file name (usually <TT><B>flac</B></TT> just changes the extension).
|
Force the output file name (usually <TT><B>flac</B></TT> just changes the extension). May only be used when encoding a single file. May not be used in conjunction with <TT>--output-prefix</T>.
|
||||||
|
</TD>
|
||||||
|
</TR>
|
||||||
|
<TR>
|
||||||
|
<TD NOWRAP ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
|
||||||
|
<TT>--output-prefix string</TT>
|
||||||
|
</TD>
|
||||||
|
<TD>
|
||||||
|
Prefix each output file name with the given string. This can be useful for encoding/decoding files to a different directory. Make sure if your string is a path name that it ends with a trailing '<TT>/</TT>' slash.
|
||||||
</TD>
|
</TD>
|
||||||
</TR>
|
</TR>
|
||||||
<TR>
|
<TR>
|
||||||
|
|||||||
@@ -112,7 +112,20 @@
|
|||||||
<term><option>-o</option> <replaceable>filename</replaceable></term>
|
<term><option>-o</option> <replaceable>filename</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Force the output file name (usually flac just
|
<para>Force the output file name (usually flac just
|
||||||
changes the extension).</para>
|
changes the extension). May only be used when
|
||||||
|
encoding a single file. May not be used in
|
||||||
|
conjunction with --output-prefix.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><option>--output-prefix</option> <replaceable>string</replaceable></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Prefix each output file name with the given
|
||||||
|
string. This can be useful for encoding/decoding
|
||||||
|
files to a different directory. Make sure if your
|
||||||
|
string is a path name that it ends with a trailing
|
||||||
|
`/' (slash).</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ static int decode_file(const char *infilename, const char *forced_outfilename);
|
|||||||
FLAC__bool verify = false, verbose = true, lax = false, test_only = false, analyze = false;
|
FLAC__bool verify = false, verbose = true, lax = false, test_only = false, analyze = false;
|
||||||
FLAC__bool do_mid_side = true, loose_mid_side = false, do_exhaustive_model_search = false, do_qlp_coeff_prec_search = false;
|
FLAC__bool do_mid_side = true, loose_mid_side = false, do_exhaustive_model_search = false, do_qlp_coeff_prec_search = false;
|
||||||
FLAC__bool force_to_stdout = false, delete_input = false, sector_align = false;
|
FLAC__bool force_to_stdout = false, delete_input = false, sector_align = false;
|
||||||
const char *cmdline_forced_outfilename = 0;
|
const char *cmdline_forced_outfilename = 0, *output_prefix = 0;
|
||||||
analysis_options aopts = { false, false };
|
analysis_options aopts = { false, false };
|
||||||
unsigned padding = 0;
|
unsigned padding = 0;
|
||||||
unsigned max_lpc_order = 8;
|
unsigned max_lpc_order = 8;
|
||||||
@@ -96,6 +96,8 @@ int main(int argc, char *argv[])
|
|||||||
delete_input = true;
|
delete_input = true;
|
||||||
else if(0 == strcmp(argv[i], "--delete-input-file-"))
|
else if(0 == strcmp(argv[i], "--delete-input-file-"))
|
||||||
delete_input = false;
|
delete_input = false;
|
||||||
|
else if(0 == strcmp(argv[i], "--output-prefix"))
|
||||||
|
output_prefix = argv[++i];
|
||||||
else if(0 == strcmp(argv[i], "--sector-align"))
|
else if(0 == strcmp(argv[i], "--sector-align"))
|
||||||
sector_align = true;
|
sector_align = true;
|
||||||
else if(0 == strcmp(argv[i], "--sector-align-"))
|
else if(0 == strcmp(argv[i], "--sector-align-"))
|
||||||
@@ -339,6 +341,12 @@ int main(int argc, char *argv[])
|
|||||||
else if(format_sample_rate >= 0 && format_sample_rate != 2)
|
else if(format_sample_rate >= 0 && format_sample_rate != 2)
|
||||||
return usage("ERROR: --sector-align can only be done with sample rate of 44100\n");
|
return usage("ERROR: --sector-align can only be done with sample rate of 44100\n");
|
||||||
}
|
}
|
||||||
|
if(argc - i > 1 && cmdline_forced_outfilename) {
|
||||||
|
return usage("ERROR: -o cannot be used with multiple files\n");
|
||||||
|
}
|
||||||
|
if(cmdline_forced_outfilename && output_prefix) {
|
||||||
|
return usage("ERROR: --output-prefix conflicts with -o\n");
|
||||||
|
}
|
||||||
|
|
||||||
if(verbose) {
|
if(verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
@@ -586,7 +594,8 @@ int encode_file(const char *infilename, const char *forced_outfilename, FLAC__bo
|
|||||||
if(encode_infile == stdin || force_to_stdout)
|
if(encode_infile == stdin || force_to_stdout)
|
||||||
strcpy(outfilename, "-");
|
strcpy(outfilename, "-");
|
||||||
else {
|
else {
|
||||||
strcpy(outfilename, infilename);
|
strcpy(outfilename, output_prefix? output_prefix : "");
|
||||||
|
strcat(outfilename, infilename);
|
||||||
if(0 == (p = strrchr(outfilename, '.')))
|
if(0 == (p = strrchr(outfilename, '.')))
|
||||||
strcat(outfilename, ".flac");
|
strcat(outfilename, ".flac");
|
||||||
else {
|
else {
|
||||||
@@ -637,7 +646,8 @@ int decode_file(const char *infilename, const char *forced_outfilename)
|
|||||||
strcpy(outfilename, "-");
|
strcpy(outfilename, "-");
|
||||||
else {
|
else {
|
||||||
const char *suffix = suffixes[analyze? 2 : format_is_wave? 0 : 1];
|
const char *suffix = suffixes[analyze? 2 : format_is_wave? 0 : 1];
|
||||||
strcpy(outfilename, infilename);
|
strcpy(outfilename, output_prefix? output_prefix : "");
|
||||||
|
strcat(outfilename, infilename);
|
||||||
if(0 == (p = strrchr(outfilename, '.')))
|
if(0 == (p = strrchr(outfilename, '.')))
|
||||||
strcat(outfilename, suffix);
|
strcat(outfilename, suffix);
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user