1*600f14f4SXin Li /* metaflac - Command-line FLAC metadata editor
2*600f14f4SXin Li * Copyright (C) 2001-2009 Josh Coalson
3*600f14f4SXin Li * Copyright (C) 2011-2023 Xiph.Org Foundation
4*600f14f4SXin Li *
5*600f14f4SXin Li * This program is free software; you can redistribute it and/or
6*600f14f4SXin Li * modify it under the terms of the GNU General Public License
7*600f14f4SXin Li * as published by the Free Software Foundation; either version 2
8*600f14f4SXin Li * of the License, or (at your option) any later version.
9*600f14f4SXin Li *
10*600f14f4SXin Li * This program is distributed in the hope that it will be useful,
11*600f14f4SXin Li * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*600f14f4SXin Li * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*600f14f4SXin Li * GNU General Public License for more details.
14*600f14f4SXin Li *
15*600f14f4SXin Li * You should have received a copy of the GNU General Public License along
16*600f14f4SXin Li * with this program; if not, write to the Free Software Foundation, Inc.,
17*600f14f4SXin Li * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18*600f14f4SXin Li */
19*600f14f4SXin Li
20*600f14f4SXin Li #ifdef HAVE_CONFIG_H
21*600f14f4SXin Li # include <config.h>
22*600f14f4SXin Li #endif
23*600f14f4SXin Li
24*600f14f4SXin Li #include "utils.h"
25*600f14f4SXin Li #include "usage.h"
26*600f14f4SXin Li #include "FLAC/format.h"
27*600f14f4SXin Li #include <stdarg.h>
28*600f14f4SXin Li #include <stdio.h>
29*600f14f4SXin Li #include "share/compat.h"
30*600f14f4SXin Li
usage_header(FILE * out)31*600f14f4SXin Li static void usage_header(FILE *out)
32*600f14f4SXin Li {
33*600f14f4SXin Li fprintf(out, "==============================================================================\n");
34*600f14f4SXin Li fprintf(out, "metaflac - Command-line FLAC metadata editor version %s\n", FLAC__VERSION_STRING);
35*600f14f4SXin Li fprintf(out, "Copyright (C) 2001-2009 Josh Coalson\n");
36*600f14f4SXin Li fprintf(out, "Copyright (C) 2011-2023 Xiph.Org Foundation\n");
37*600f14f4SXin Li fprintf(out, "\n");
38*600f14f4SXin Li fprintf(out, "This program is free software; you can redistribute it and/or\n");
39*600f14f4SXin Li fprintf(out, "modify it under the terms of the GNU General Public License\n");
40*600f14f4SXin Li fprintf(out, "as published by the Free Software Foundation; either version 2\n");
41*600f14f4SXin Li fprintf(out, "of the License, or (at your option) any later version.\n");
42*600f14f4SXin Li fprintf(out, "\n");
43*600f14f4SXin Li fprintf(out, "This program is distributed in the hope that it will be useful,\n");
44*600f14f4SXin Li fprintf(out, "but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
45*600f14f4SXin Li fprintf(out, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n");
46*600f14f4SXin Li fprintf(out, "GNU General Public License for more details.\n");
47*600f14f4SXin Li fprintf(out, "\n");
48*600f14f4SXin Li fprintf(out, "You should have received a copy of the GNU General Public License along\n");
49*600f14f4SXin Li fprintf(out, "with this program; if not, write to the Free Software Foundation, Inc.,\n");
50*600f14f4SXin Li fprintf(out, "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n");
51*600f14f4SXin Li fprintf(out, "==============================================================================\n");
52*600f14f4SXin Li }
53*600f14f4SXin Li
usage_summary(FILE * out)54*600f14f4SXin Li static void usage_summary(FILE *out)
55*600f14f4SXin Li {
56*600f14f4SXin Li fprintf(out, "Usage:\n");
57*600f14f4SXin Li fprintf(out, " metaflac [options] [operations] FLACfile [FLACfile ...]\n");
58*600f14f4SXin Li fprintf(out, "\n");
59*600f14f4SXin Li fprintf(out, "Use metaflac to list, add, remove, or edit metadata in one or more FLAC files.\n");
60*600f14f4SXin Li fprintf(out, "You may perform one major operation, or many shorthand operations at a time.\n");
61*600f14f4SXin Li fprintf(out, "\n");
62*600f14f4SXin Li fprintf(out, "Options:\n");
63*600f14f4SXin Li fprintf(out, "--preserve-modtime Preserve the original modification time in spite of edits\n");
64*600f14f4SXin Li fprintf(out, "--with-filename Prefix each output line with the FLAC file name\n");
65*600f14f4SXin Li fprintf(out, " (the default if more than one FLAC file is specified).\n");
66*600f14f4SXin Li fprintf(out, " This option has no effect for options exporting to a\n");
67*600f14f4SXin Li fprintf(out, " file, like --export-tags-to.\n");
68*600f14f4SXin Li fprintf(out, "--no-filename Do not prefix each output line with the FLAC file name\n");
69*600f14f4SXin Li fprintf(out, " (the default if only one FLAC file is specified)\n");
70*600f14f4SXin Li fprintf(out, "--no-utf8-convert Do not convert tags from UTF-8 to local charset,\n");
71*600f14f4SXin Li fprintf(out, " or vice versa. This is useful for scripts, and setting\n");
72*600f14f4SXin Li fprintf(out, " tags in situations where the locale is wrong.\n");
73*600f14f4SXin Li fprintf(out, "--dont-use-padding By default metaflac tries to use padding where possible\n");
74*600f14f4SXin Li fprintf(out, " to avoid rewriting the entire file if the metadata size\n");
75*600f14f4SXin Li fprintf(out, " changes. Use this option to tell metaflac to not take\n");
76*600f14f4SXin Li fprintf(out, " advantage of padding this way.\n");
77*600f14f4SXin Li }
78*600f14f4SXin Li
short_usage(const char * message,...)79*600f14f4SXin Li int short_usage(const char *message, ...)
80*600f14f4SXin Li {
81*600f14f4SXin Li va_list args;
82*600f14f4SXin Li
83*600f14f4SXin Li if(message) {
84*600f14f4SXin Li va_start(args, message);
85*600f14f4SXin Li
86*600f14f4SXin Li (void) vfprintf(stderr, message, args);
87*600f14f4SXin Li
88*600f14f4SXin Li va_end(args);
89*600f14f4SXin Li
90*600f14f4SXin Li }
91*600f14f4SXin Li usage_header(stderr);
92*600f14f4SXin Li flac_fprintf(stderr, "\n");
93*600f14f4SXin Li flac_fprintf(stderr, "This is the short help; for full help use 'metaflac --help'\n");
94*600f14f4SXin Li flac_fprintf(stderr, "\n");
95*600f14f4SXin Li usage_summary(stderr);
96*600f14f4SXin Li
97*600f14f4SXin Li return message? 1 : 0;
98*600f14f4SXin Li }
99*600f14f4SXin Li
long_usage(const char * message,...)100*600f14f4SXin Li int long_usage(const char *message, ...)
101*600f14f4SXin Li {
102*600f14f4SXin Li FILE *out = (message? stderr : stdout);
103*600f14f4SXin Li va_list args;
104*600f14f4SXin Li
105*600f14f4SXin Li if(message) {
106*600f14f4SXin Li va_start(args, message);
107*600f14f4SXin Li
108*600f14f4SXin Li (void) vfprintf(stderr, message, args);
109*600f14f4SXin Li
110*600f14f4SXin Li va_end(args);
111*600f14f4SXin Li
112*600f14f4SXin Li }
113*600f14f4SXin Li usage_header(out);
114*600f14f4SXin Li fprintf(out, "\n");
115*600f14f4SXin Li usage_summary(out);
116*600f14f4SXin Li fprintf(out, "\n");
117*600f14f4SXin Li fprintf(out, "Shorthand operations:\n");
118*600f14f4SXin Li fprintf(out, "--show-md5sum Show the MD5 signature from the STREAMINFO block.\n");
119*600f14f4SXin Li fprintf(out, "--show-min-blocksize Show the minimum block size from the STREAMINFO block.\n");
120*600f14f4SXin Li fprintf(out, "--show-max-blocksize Show the maximum block size from the STREAMINFO block.\n");
121*600f14f4SXin Li fprintf(out, "--show-min-framesize Show the minimum frame size from the STREAMINFO block.\n");
122*600f14f4SXin Li fprintf(out, "--show-max-framesize Show the maximum frame size from the STREAMINFO block.\n");
123*600f14f4SXin Li fprintf(out, "--show-sample-rate Show the sample rate from the STREAMINFO block.\n");
124*600f14f4SXin Li fprintf(out, "--show-channels Show the number of channels from the STREAMINFO block.\n");
125*600f14f4SXin Li fprintf(out, "--show-bps Show the # of bits per sample from the STREAMINFO block.\n");
126*600f14f4SXin Li fprintf(out, "--show-total-samples Show the total # of samples from the STREAMINFO block.\n");
127*600f14f4SXin Li fprintf(out, "\n");
128*600f14f4SXin Li fprintf(out, "--show-vendor-tag Show the vendor string from the VORBIS_COMMENT block.\n");
129*600f14f4SXin Li fprintf(out, "--show-tag=NAME Show all tags where the field name matches 'NAME'.\n");
130*600f14f4SXin Li fprintf(out, "--show-all-tags Show all tags. This is an alias for --export-tags-to=-.\n");
131*600f14f4SXin Li fprintf(out, "--remove-tag=NAME Remove all tags whose field name is 'NAME'.\n");
132*600f14f4SXin Li fprintf(out, "--remove-first-tag=NAME Remove first tag whose field name is 'NAME'.\n");
133*600f14f4SXin Li fprintf(out, "--remove-all-tags Remove all tags, leaving only the vendor string.\n");
134*600f14f4SXin Li fprintf(out, "--remove-all-tags-except=NAME1[=NAME2[=...]] Remove all tags, except the vendor\n");
135*600f14f4SXin Li fprintf(out, " string and the tag names specified. Tag names must be\n");
136*600f14f4SXin Li fprintf(out, " separated by an = character.\n");
137*600f14f4SXin Li fprintf(out, "--set-tag=FIELD Add a tag. The FIELD must comply with the Vorbis comment\n");
138*600f14f4SXin Li fprintf(out, " spec, of the form \"NAME=VALUE\". If there is currently\n");
139*600f14f4SXin Li fprintf(out, " no tag block, one will be created.\n");
140*600f14f4SXin Li fprintf(out, "--set-tag-from-file=FIELD Like --set-tag, except the VALUE is a filename\n");
141*600f14f4SXin Li fprintf(out, " whose contents will be read verbatim to set the tag value.\n");
142*600f14f4SXin Li fprintf(out, " Unless --no-utf8-convert is specified, the contents will\n");
143*600f14f4SXin Li fprintf(out, " be converted to UTF-8 from the local charset. This can\n");
144*600f14f4SXin Li fprintf(out, " be used to store a cuesheet in a tag (e.g.\n");
145*600f14f4SXin Li fprintf(out, " --set-tag-from-file=\"CUESHEET=image.cue\"). Do not try\n");
146*600f14f4SXin Li fprintf(out, " to store binary data in tag fields! Use APPLICATION\n");
147*600f14f4SXin Li fprintf(out, " blocks for that.\n");
148*600f14f4SXin Li fprintf(out, "--import-tags-from=FILE Import tags from a file. Use '-' for stdin. Each line\n");
149*600f14f4SXin Li fprintf(out, " should be of the form NAME=VALUE. Multi-line comments\n");
150*600f14f4SXin Li fprintf(out, " are currently not supported. Specify --remove-all-tags\n");
151*600f14f4SXin Li fprintf(out, " and/or --no-utf8-convert before --import-tags-from if\n");
152*600f14f4SXin Li fprintf(out, " necessary. If FILE is '-' (stdin), only one FLAC file\n");
153*600f14f4SXin Li fprintf(out, " may be specified.\n");
154*600f14f4SXin Li fprintf(out, "--export-tags-to=FILE Export tags to a file. Use '-' for stdout. Each line\n");
155*600f14f4SXin Li fprintf(out, " will be of the form NAME=VALUE. Specify\n");
156*600f14f4SXin Li fprintf(out, " --no-utf8-convert if necessary.\n");
157*600f14f4SXin Li fprintf(out, "--import-cuesheet-from=FILE Import a cuesheet from a file. Use '-' for stdin.\n");
158*600f14f4SXin Li fprintf(out, " Only one FLAC file may be specified. A seekpoint will be\n");
159*600f14f4SXin Li fprintf(out, " added for each index point in the cuesheet to the\n");
160*600f14f4SXin Li fprintf(out, " SEEKTABLE unless --no-cued-seekpoints is specified.\n");
161*600f14f4SXin Li fprintf(out, "--export-cuesheet-to=FILE Export CUESHEET block to a cuesheet file, suitable\n");
162*600f14f4SXin Li fprintf(out, " for use by CD authoring software. Use '-' for stdout.\n");
163*600f14f4SXin Li fprintf(out, " Only one FLAC file may be specified on the command line.\n");
164*600f14f4SXin Li fprintf(out, "--import-picture-from=FILENAME|SPECIFICATION Import a picture and store it in a\n");
165*600f14f4SXin Li fprintf(out, " PICTURE block. Either a filename for the picture file or\n");
166*600f14f4SXin Li fprintf(out, " a more complete specification form can be used. The\n");
167*600f14f4SXin Li fprintf(out, " SPECIFICATION is a string whose parts are separated by |\n");
168*600f14f4SXin Li fprintf(out, " characters. Some parts may be left empty to invoke\n");
169*600f14f4SXin Li fprintf(out, " default values. FILENAME is just shorthand for\n");
170*600f14f4SXin Li fprintf(out, " \"||||FILENAME\". The format of SPECIFICATION is:\n");
171*600f14f4SXin Li fprintf(out, " [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE\n");
172*600f14f4SXin Li fprintf(out, " TYPE is optional; it is a number from one of:\n");
173*600f14f4SXin Li fprintf(out, " 0: Other\n");
174*600f14f4SXin Li fprintf(out, " 1: 32x32 pixels 'file icon' (PNG only)\n");
175*600f14f4SXin Li fprintf(out, " 2: Other file icon\n");
176*600f14f4SXin Li fprintf(out, " 3: Cover (front)\n");
177*600f14f4SXin Li fprintf(out, " 4: Cover (back)\n");
178*600f14f4SXin Li fprintf(out, " 5: Leaflet page\n");
179*600f14f4SXin Li fprintf(out, " 6: Media (e.g. label side of CD)\n");
180*600f14f4SXin Li fprintf(out, " 7: Lead artist/lead performer/soloist\n");
181*600f14f4SXin Li fprintf(out, " 8: Artist/performer\n");
182*600f14f4SXin Li fprintf(out, " 9: Conductor\n");
183*600f14f4SXin Li fprintf(out, " 10: Band/Orchestra\n");
184*600f14f4SXin Li fprintf(out, " 11: Composer\n");
185*600f14f4SXin Li fprintf(out, " 12: Lyricist/text writer\n");
186*600f14f4SXin Li fprintf(out, " 13: Recording Location\n");
187*600f14f4SXin Li fprintf(out, " 14: During recording\n");
188*600f14f4SXin Li fprintf(out, " 15: During performance\n");
189*600f14f4SXin Li fprintf(out, " 16: Movie/video screen capture\n");
190*600f14f4SXin Li fprintf(out, " 17: A bright coloured fish\n");
191*600f14f4SXin Li fprintf(out, " 18: Illustration\n");
192*600f14f4SXin Li fprintf(out, " 19: Band/artist logotype\n");
193*600f14f4SXin Li fprintf(out, " 20: Publisher/Studio logotype\n");
194*600f14f4SXin Li fprintf(out, " The default is 3 (front cover). There may only be one picture each\n");
195*600f14f4SXin Li fprintf(out, " of type 1 and 2 in a file.\n");
196*600f14f4SXin Li fprintf(out, " MIME-TYPE is optional; if left blank, it will be detected from the\n");
197*600f14f4SXin Li fprintf(out, " file. For best compatibility with players, use pictures with MIME\n");
198*600f14f4SXin Li fprintf(out, " type image/jpeg or image/png. The MIME type can also be --> to\n");
199*600f14f4SXin Li fprintf(out, " mean that FILE is actually a URL to an image, though this use is\n");
200*600f14f4SXin Li fprintf(out, " discouraged.\n");
201*600f14f4SXin Li fprintf(out, " DESCRIPTION is optional; the default is an empty string\n");
202*600f14f4SXin Li fprintf(out, " The next part specifies the resolution and color information. If\n");
203*600f14f4SXin Li fprintf(out, " the MIME-TYPE is image/jpeg, image/png, or image/gif, you can\n");
204*600f14f4SXin Li fprintf(out, " usually leave this empty and they can be detected from the file.\n");
205*600f14f4SXin Li fprintf(out, " Otherwise, you must specify the width in pixels, height in pixels,\n");
206*600f14f4SXin Li fprintf(out, " and color depth in bits-per-pixel. If the image has indexed colors\n");
207*600f14f4SXin Li fprintf(out, " you should also specify the number of colors used.\n");
208*600f14f4SXin Li fprintf(out, " FILE is the path to the picture file to be imported, or the URL if\n");
209*600f14f4SXin Li fprintf(out, " MIME type is -->\n");
210*600f14f4SXin Li fprintf(out, "--export-picture-to=FILE Export PICTURE block to a file. Use '-' for stdout.\n");
211*600f14f4SXin Li fprintf(out, " Only one FLAC file may be specified. The first PICTURE\n");
212*600f14f4SXin Li fprintf(out, " block will be exported unless --export-picture-to is\n");
213*600f14f4SXin Li fprintf(out, " preceded by a --block-number=# option to specify the exact\n");
214*600f14f4SXin Li fprintf(out, " metadata block to extract. Note that the block number is\n");
215*600f14f4SXin Li fprintf(out, " the one shown by --list.\n");
216*600f14f4SXin Li fprintf(out, "--add-replay-gain Calculates the title and album gains/peaks of the given\n");
217*600f14f4SXin Li fprintf(out, " FLAC files as if all the files were part of one album,\n");
218*600f14f4SXin Li fprintf(out, " then stores them in the VORBIS_COMMENT block. The tags\n");
219*600f14f4SXin Li fprintf(out, " are the same as those used by vorbisgain. Existing\n");
220*600f14f4SXin Li fprintf(out, " ReplayGain tags will be replaced. If only one FLAC file\n");
221*600f14f4SXin Li fprintf(out, " is given, the album and title gains will be the same.\n");
222*600f14f4SXin Li fprintf(out, " Since this operation requires two passes, it is always\n");
223*600f14f4SXin Li fprintf(out, " executed last, after all other operations have been\n");
224*600f14f4SXin Li fprintf(out, " completed and written to disk. All FLAC files specified\n");
225*600f14f4SXin Li fprintf(out, " must have the same resolution, sample rate, and number\n");
226*600f14f4SXin Li fprintf(out, " of channels. Only mono and stereo files are allowed,\n");
227*600f14f4SXin Li fprintf(out, " and the sample rate must be 8, 11.025, 12, 16, 18.9,\n");
228*600f14f4SXin Li fprintf(out, " 22.05, 24, 28, 32, 36, 37.8, 44.1, 48, 56, 64, 72, 75.6,\n");
229*600f14f4SXin Li fprintf(out, " 88.2, 96, 112, 128, 144, 151.2, 176.4, 192, 224, 256,\n");
230*600f14f4SXin Li fprintf(out, " 288, 302.4, 352.8, 384, 448, 512, 576, or 604.8 kHz.\n");
231*600f14f4SXin Li fprintf(out, "--scan-replay-gain Like --add-replay-gain, but only analyzes the files\n");
232*600f14f4SXin Li fprintf(out, " rather than writing them to tags.\n");
233*600f14f4SXin Li fprintf(out, "--remove-replay-gain Removes the ReplayGain tags.\n");
234*600f14f4SXin Li fprintf(out, "--add-seekpoint={#|X|#x|#s} Add seek points to a SEEKTABLE block\n");
235*600f14f4SXin Li fprintf(out, " # : a specific sample number for a seek point\n");
236*600f14f4SXin Li fprintf(out, " X : a placeholder point (always goes at the end of the SEEKTABLE)\n");
237*600f14f4SXin Li fprintf(out, " #x : # evenly spaced seekpoints, the first being at sample 0\n");
238*600f14f4SXin Li fprintf(out, " #s : a seekpoint every # seconds; # does not have to be a whole number\n");
239*600f14f4SXin Li fprintf(out, " If no SEEKTABLE block exists, one will be created. If\n");
240*600f14f4SXin Li fprintf(out, " one already exists, points will be added to the existing\n");
241*600f14f4SXin Li fprintf(out, " table, and any duplicates will be turned into placeholder\n");
242*600f14f4SXin Li fprintf(out, " points. You may use many --add-seekpoint options; the\n");
243*600f14f4SXin Li fprintf(out, " resulting SEEKTABLE will be the unique-ified union of\n");
244*600f14f4SXin Li fprintf(out, " all such values. Example: --add-seekpoint=100x\n");
245*600f14f4SXin Li fprintf(out, " --add-seekpoint=3.5s will add 100 evenly spaced\n");
246*600f14f4SXin Li fprintf(out, " seekpoints and a seekpoint every 3.5 seconds.\n");
247*600f14f4SXin Li fprintf(out, "--add-padding=length Add a padding block of the given length (in bytes).\n");
248*600f14f4SXin Li fprintf(out, " The overall length of the new block will be 4 + length;\n");
249*600f14f4SXin Li fprintf(out, " the extra 4 bytes is for the metadata block header.\n");
250*600f14f4SXin Li fprintf(out, "\n");
251*600f14f4SXin Li fprintf(out, "Major operations:\n");
252*600f14f4SXin Li fprintf(out, "--version\n");
253*600f14f4SXin Li fprintf(out, " Show the metaflac version number.\n");
254*600f14f4SXin Li fprintf(out, "--list\n");
255*600f14f4SXin Li fprintf(out, " List the contents of one or more metadata blocks to stdout. By default,\n");
256*600f14f4SXin Li fprintf(out, " all metadata blocks are listed in text format. Use the following options\n");
257*600f14f4SXin Li fprintf(out, " to change this behavior:\n");
258*600f14f4SXin Li fprintf(out, "\n");
259*600f14f4SXin Li fprintf(out, " --block-number=#[,#[...]]\n");
260*600f14f4SXin Li fprintf(out, " An optional comma-separated list of block numbers to display. The first\n");
261*600f14f4SXin Li fprintf(out, " block, the STREAMINFO block, is block 0.\n");
262*600f14f4SXin Li fprintf(out, "\n");
263*600f14f4SXin Li fprintf(out, " --block-type=type[,type[...]]\n");
264*600f14f4SXin Li fprintf(out, " --except-block-type=type[,type[...]]\n");
265*600f14f4SXin Li fprintf(out, " An optional comma-separated list of block types to be included or ignored\n");
266*600f14f4SXin Li fprintf(out, " with this option. Use only one of --block-type or --except-block-type.\n");
267*600f14f4SXin Li fprintf(out, " The valid block types are: STREAMINFO, PADDING, APPLICATION, SEEKTABLE,\n");
268*600f14f4SXin Li fprintf(out, " VORBIS_COMMENT. You may narrow down the types of APPLICATION blocks\n");
269*600f14f4SXin Li fprintf(out, " displayed as follows:\n");
270*600f14f4SXin Li fprintf(out, " APPLICATION:abcd The APPLICATION block(s) whose textual repre-\n");
271*600f14f4SXin Li fprintf(out, " sentation of the 4-byte ID is \"abcd\"\n");
272*600f14f4SXin Li fprintf(out, " APPLICATION:0xXXXXXXXX The APPLICATION block(s) whose hexadecimal big-\n");
273*600f14f4SXin Li fprintf(out, " endian representation of the 4-byte ID is\n");
274*600f14f4SXin Li fprintf(out, " \"0xXXXXXXXX\". For the example \"abcd\" above the\n");
275*600f14f4SXin Li fprintf(out, " hexadecimal equivalalent is 0x61626364\n");
276*600f14f4SXin Li fprintf(out, "\n");
277*600f14f4SXin Li fprintf(out, " NOTE: if both --block-number and --[except-]block-type are specified,\n");
278*600f14f4SXin Li fprintf(out, " the result is the logical AND of both arguments.\n");
279*600f14f4SXin Li fprintf(out, "\n");
280*600f14f4SXin Li fprintf(out, " --data-format=binary|binary-headerless|text\n");
281*600f14f4SXin Li fprintf(out, " By default a human-readable text representation of the data is displayed.\n");
282*600f14f4SXin Li fprintf(out, " You may specify --data-format=binary to dump the raw binary form of each\n");
283*600f14f4SXin Li fprintf(out, " metadata block. Specify --data-format=binary-headerless to omit output of\n");
284*600f14f4SXin Li fprintf(out, " metadata block headers, including the id of APPLICATION metadata blocks.\n");
285*600f14f4SXin Li fprintf(out, " The output can be read in using a subsequent call to\n");
286*600f14f4SXin Li fprintf(out, " \"metaflac --append\"\n");
287*600f14f4SXin Li fprintf(out, "\n");
288*600f14f4SXin Li fprintf(out, " --application-data-format=hexdump|text\n");
289*600f14f4SXin Li fprintf(out, " If the application block you are displaying contains binary data but your\n");
290*600f14f4SXin Li fprintf(out, " --data-format=text, you can display a hex dump of the application data\n");
291*600f14f4SXin Li fprintf(out, " contents instead using --application-data-format=hexdump\n");
292*600f14f4SXin Li fprintf(out, "\n");
293*600f14f4SXin Li fprintf(out, "--append\n");
294*600f14f4SXin Li fprintf(out, " Insert a metadata block from a file. This must be a binary block as\n");
295*600f14f4SXin Li fprintf(out, " exported with --list --data-format=binary. The insertion point is\n");
296*600f14f4SXin Li fprintf(out, " defined with --block-number=#. The new block will be added after the\n");
297*600f14f4SXin Li fprintf(out, " given block number. This prevents the illegal insertion of a block\n");
298*600f14f4SXin Li fprintf(out, " before the first STREAMINFO block. You may not --append another\n");
299*600f14f4SXin Li fprintf(out, " STREAMINFO block. It is possible to copy a metadata block from one\n");
300*600f14f4SXin Li fprintf(out, " file to another with this option. For example use\n");
301*600f14f4SXin Li fprintf(out, " metaflac --list --data-format=binary --block-number=6 file.flac > block\n");
302*600f14f4SXin Li fprintf(out, " to export the block, and then import it with\n");
303*600f14f4SXin Li fprintf(out, " metaflac --append anotherfile.flac < block\n");
304*600f14f4SXin Li fprintf(out, " Insert a metadata block from a file. The input file must be in the same\n");
305*600f14f4SXin Li fprintf(out, " format as generated with --list.\n");
306*600f14f4SXin Li fprintf(out, "\n");
307*600f14f4SXin Li fprintf(out, " --block-number=#\n");
308*600f14f4SXin Li fprintf(out, " Specify the insertion point (defaults to last block). The new block will\n");
309*600f14f4SXin Li fprintf(out, " be added after the given block number. This prevents the illegal insertion\n");
310*600f14f4SXin Li fprintf(out, " of a block before the first STREAMINFO block. You may not --append another\n");
311*600f14f4SXin Li fprintf(out, " STREAMINFO block.\n");
312*600f14f4SXin Li fprintf(out, "\n");
313*600f14f4SXin Li #if 0
314*600f14f4SXin Li /*@@@ not implemented yet */
315*600f14f4SXin Li fprintf(out, " --from-file=filename\n");
316*600f14f4SXin Li fprintf(out, " Mandatory 'option' to specify the input file containing the block contents.\n");
317*600f14f4SXin Li fprintf(out, "\n");
318*600f14f4SXin Li fprintf(out, " --data-format=binary|text\n");
319*600f14f4SXin Li fprintf(out, " By default the block contents are assumed to be in binary format. You can\n");
320*600f14f4SXin Li fprintf(out, " override this by specifying --data-format=text\n");
321*600f14f4SXin Li fprintf(out, "\n");
322*600f14f4SXin Li #endif
323*600f14f4SXin Li fprintf(out, "--remove\n");
324*600f14f4SXin Li fprintf(out, " Remove one or more metadata blocks from the metadata. Unless\n");
325*600f14f4SXin Li fprintf(out, " --dont-use-padding is specified, the blocks will be replaced with padding.\n");
326*600f14f4SXin Li fprintf(out, " You may not remove the STREAMINFO block.\n");
327*600f14f4SXin Li fprintf(out, "\n");
328*600f14f4SXin Li fprintf(out, " --block-number=#[,#[...]]\n");
329*600f14f4SXin Li fprintf(out, " --block-type=type[,type[...]]\n");
330*600f14f4SXin Li fprintf(out, " --except-block-type=type[,type[...]]\n");
331*600f14f4SXin Li fprintf(out, " See --list above for usage.\n");
332*600f14f4SXin Li fprintf(out, "\n");
333*600f14f4SXin Li fprintf(out, " NOTE: if both --block-number and --[except-]block-type are specified,\n");
334*600f14f4SXin Li fprintf(out, " the result is the logical AND of both arguments.\n");
335*600f14f4SXin Li fprintf(out, "\n");
336*600f14f4SXin Li fprintf(out, "--remove-all\n");
337*600f14f4SXin Li fprintf(out, " Remove all metadata blocks (except the STREAMINFO block) from the\n");
338*600f14f4SXin Li fprintf(out, " metadata. Unless --dont-use-padding is specified, the blocks will be\n");
339*600f14f4SXin Li fprintf(out, " replaced with padding.\n");
340*600f14f4SXin Li fprintf(out, "\n");
341*600f14f4SXin Li fprintf(out, "--merge-padding\n");
342*600f14f4SXin Li fprintf(out, " Merge adjacent PADDING blocks into single blocks.\n");
343*600f14f4SXin Li fprintf(out, "\n");
344*600f14f4SXin Li fprintf(out, "--sort-padding\n");
345*600f14f4SXin Li fprintf(out, " Move all PADDING blocks to the end of the metadata and merge them into a\n");
346*600f14f4SXin Li fprintf(out, " single block.\n");
347*600f14f4SXin Li
348*600f14f4SXin Li return message? 1 : 0;
349*600f14f4SXin Li }
350