]> 4ch.mooo.com Git - 16.git/blob - src/lib/dl/ext/flac/options.h
refresh wwww
[16.git] / src / lib / dl / ext / flac / options.h
1 /* metaflac - Command-line FLAC metadata editor
2  * Copyright (C) 2001,2002,2003,2004,2005,2006,2007  Josh Coalson
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  */
18
19 #ifndef metaflac__options_h
20 #define metaflac__options_h
21
22 #include "FLAC/format.h"
23
24 #if 0
25 /*[JEC] was:#if HAVE_GETOPT_LONG*/
26 /*[JEC] see flac/include/share/getopt.h as to why the change */
27 #  include <getopt.h>
28 #else
29 #  include "share/getopt.h"
30 #endif
31
32 extern struct share__option long_options_[];
33
34 typedef enum {
35         OP__SHOW_MD5SUM,
36         OP__SHOW_MIN_BLOCKSIZE,
37         OP__SHOW_MAX_BLOCKSIZE,
38         OP__SHOW_MIN_FRAMESIZE,
39         OP__SHOW_MAX_FRAMESIZE,
40         OP__SHOW_SAMPLE_RATE,
41         OP__SHOW_CHANNELS,
42         OP__SHOW_BPS,
43         OP__SHOW_TOTAL_SAMPLES,
44         OP__SET_MD5SUM,
45         OP__SET_MIN_BLOCKSIZE,
46         OP__SET_MAX_BLOCKSIZE,
47         OP__SET_MIN_FRAMESIZE,
48         OP__SET_MAX_FRAMESIZE,
49         OP__SET_SAMPLE_RATE,
50         OP__SET_CHANNELS,
51         OP__SET_BPS,
52         OP__SET_TOTAL_SAMPLES,
53         OP__SHOW_VC_VENDOR,
54         OP__SHOW_VC_FIELD,
55         OP__REMOVE_VC_ALL,
56         OP__REMOVE_VC_FIELD,
57         OP__REMOVE_VC_FIRSTFIELD,
58         OP__SET_VC_FIELD,
59         OP__IMPORT_VC_FROM,
60         OP__EXPORT_VC_TO,
61         OP__IMPORT_CUESHEET_FROM,
62         OP__EXPORT_CUESHEET_TO,
63         OP__IMPORT_PICTURE_FROM,
64         OP__EXPORT_PICTURE_TO,
65         OP__ADD_SEEKPOINT,
66         OP__ADD_REPLAY_GAIN,
67         OP__ADD_PADDING,
68         OP__LIST,
69         OP__APPEND,
70         OP__REMOVE,
71         OP__REMOVE_ALL,
72         OP__MERGE_PADDING,
73         OP__SORT_PADDING
74 } OperationType;
75
76 typedef enum {
77         ARG__BLOCK_NUMBER,
78         ARG__BLOCK_TYPE,
79         ARG__EXCEPT_BLOCK_TYPE,
80         ARG__DATA_FORMAT,
81         ARG__FROM_FILE
82 } ArgumentType;
83
84 typedef struct {
85         FLAC__byte value[16];
86 } Argument_StreaminfoMD5;
87
88 typedef struct {
89         FLAC__uint32 value;
90 } Argument_StreaminfoUInt32;
91
92 typedef struct {
93         FLAC__uint64 value;
94 } Argument_StreaminfoUInt64;
95
96 typedef struct {
97         char *value;
98 } Argument_VcFieldName;
99
100 typedef struct {
101         char *field; /* the whole field as passed on the command line, i.e. "NAME=VALUE" */
102         char *field_name;
103         /* according to the vorbis spec, field values can contain \0 so simple C strings are not enough here */
104         unsigned field_value_length;
105         char *field_value;
106         FLAC__bool field_value_from_file; /* true if field_value holds a filename for the value, false for plain value */
107 } Argument_VcField;
108
109 typedef struct {
110         char *value;
111 } Argument_String;
112
113 typedef struct {
114         unsigned num_entries;
115         unsigned *entries;
116 } Argument_BlockNumber;
117
118 typedef struct {
119         FLAC__MetadataType type;
120         char application_id[4]; /* only relevant if type == FLAC__STREAM_METADATA_TYPE_APPLICATION */
121         FLAC__bool filter_application_by_id;
122 } Argument_BlockTypeEntry;
123
124 typedef struct {
125         unsigned num_entries;
126         Argument_BlockTypeEntry *entries;
127 } Argument_BlockType;
128
129 typedef struct {
130         FLAC__bool is_binary;
131 } Argument_DataFormat;
132
133 typedef struct {
134         char *file_name;
135 } Argument_FromFile;
136
137 typedef struct {
138         char *specification;
139 } Argument_AddSeekpoint;
140
141 typedef struct {
142         char *filename;
143         Argument_AddSeekpoint *add_seekpoint_link;
144 } Argument_ImportCuesheetFrom;
145
146 typedef struct {
147         char *filename;
148         const Argument_BlockNumber *block_number_link; /* may be NULL to mean 'first PICTURE block' */
149 } Argument_ExportPictureTo;
150
151 typedef struct {
152         unsigned length;
153 } Argument_AddPadding;
154
155 typedef struct {
156         OperationType type;
157         union {
158                 Argument_StreaminfoMD5 streaminfo_md5;
159                 Argument_StreaminfoUInt32 streaminfo_uint32;
160                 Argument_StreaminfoUInt64 streaminfo_uint64;
161                 Argument_VcFieldName vc_field_name;
162                 Argument_VcField vc_field;
163                 Argument_String filename;
164                 Argument_String specification;
165                 Argument_ImportCuesheetFrom import_cuesheet_from;
166                 Argument_ExportPictureTo export_picture_to;
167                 Argument_AddSeekpoint add_seekpoint;
168                 Argument_AddPadding add_padding;
169         } argument;
170 } Operation;
171
172 typedef struct {
173         ArgumentType type;
174         union {
175                 Argument_BlockNumber block_number;
176                 Argument_BlockType block_type;
177                 Argument_DataFormat data_format;
178                 Argument_FromFile from_file;
179         } value;
180 } Argument;
181
182 typedef struct {
183         FLAC__bool preserve_modtime;
184         FLAC__bool prefix_with_filename;
185         FLAC__bool utf8_convert;
186         FLAC__bool use_padding;
187         FLAC__bool cued_seekpoints;
188         FLAC__bool show_long_help;
189         FLAC__bool show_version;
190         FLAC__bool application_data_format_is_hexdump;
191         struct {
192                 Operation *operations;
193                 unsigned num_operations;
194                 unsigned capacity;
195         } ops;
196         struct {
197                 struct {
198                         unsigned num_shorthand_ops;
199                         unsigned num_major_ops;
200                         FLAC__bool has_block_type;
201                         FLAC__bool has_except_block_type;
202                 } checks;
203                 Argument *arguments;
204                 unsigned num_arguments;
205                 unsigned capacity;
206         } args;
207         unsigned num_files;
208         char **filenames;
209 } CommandLineOptions;
210
211 void init_options(CommandLineOptions *options);
212 FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options);
213 void free_options(CommandLineOptions *options);
214
215 #endif