~ubuntu-branches/ubuntu/feisty/flac/feisty

« back to all changes in this revision

Viewing changes to src/metaflac/options.h

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-04-16 15:14:31 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040416151431-eyloggqxpwbwpogz
Tags: 1.1.0-11
Ensure that libFLAC is linked with -lm on all architectures, and
regardless of whether nasm is present

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* metaflac - Command-line FLAC metadata editor
 
2
 * Copyright (C) 2001,2002,2003  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__ADD_SEEKPOINT,
 
64
        OP__ADD_REPLAY_GAIN,
 
65
        OP__ADD_PADDING,
 
66
        OP__LIST,
 
67
        OP__APPEND,
 
68
        OP__REMOVE,
 
69
        OP__REMOVE_ALL,
 
70
        OP__MERGE_PADDING,
 
71
        OP__SORT_PADDING
 
72
} OperationType;
 
73
 
 
74
typedef enum {
 
75
        ARG__BLOCK_NUMBER,
 
76
        ARG__BLOCK_TYPE,
 
77
        ARG__EXCEPT_BLOCK_TYPE,
 
78
        ARG__DATA_FORMAT,
 
79
        ARG__FROM_FILE
 
80
} ArgumentType;
 
81
 
 
82
typedef struct {
 
83
        FLAC__byte value[16];
 
84
} Argument_StreaminfoMD5;
 
85
 
 
86
typedef struct {
 
87
        FLAC__uint32 value;
 
88
} Argument_StreaminfoUInt32;
 
89
 
 
90
typedef struct {
 
91
        FLAC__uint64 value;
 
92
} Argument_StreaminfoUInt64;
 
93
 
 
94
typedef struct {
 
95
        char *value;
 
96
} Argument_VcFieldName;
 
97
 
 
98
typedef struct {
 
99
        char *field; /* the whole field as passed on the command line, i.e. "NAME=VALUE" */
 
100
        char *field_name;
 
101
        /* according to the vorbis spec, field values can contain \0 so simple C strings are not enough here */
 
102
        unsigned field_value_length;
 
103
        char *field_value;
 
104
} Argument_VcField;
 
105
 
 
106
typedef struct {
 
107
        char *value;
 
108
} Argument_Filename;
 
109
 
 
110
typedef struct {
 
111
        unsigned num_entries;
 
112
        unsigned *entries;
 
113
} Argument_BlockNumber;
 
114
 
 
115
typedef struct {
 
116
        FLAC__MetadataType type;
 
117
        char application_id[4]; /* only relevant if type == FLAC__STREAM_METADATA_TYPE_APPLICATION */
 
118
        FLAC__bool filter_application_by_id;
 
119
} Argument_BlockTypeEntry;
 
120
 
 
121
typedef struct {
 
122
        unsigned num_entries;
 
123
        Argument_BlockTypeEntry *entries;
 
124
} Argument_BlockType;
 
125
 
 
126
typedef struct {
 
127
        FLAC__bool is_binary;
 
128
} Argument_DataFormat;
 
129
 
 
130
typedef struct {
 
131
        char *file_name;
 
132
} Argument_FromFile;
 
133
 
 
134
typedef struct {
 
135
        char *specification;
 
136
} Argument_AddSeekpoint;
 
137
 
 
138
typedef struct {
 
139
        char *filename;
 
140
        Argument_AddSeekpoint *add_seekpoint_link;
 
141
} Argument_ImportCuesheetFrom;
 
142
 
 
143
typedef struct {
 
144
        unsigned length;
 
145
} Argument_AddPadding;
 
146
 
 
147
typedef struct {
 
148
        OperationType type;
 
149
        union {
 
150
                Argument_StreaminfoMD5 streaminfo_md5;
 
151
                Argument_StreaminfoUInt32 streaminfo_uint32;
 
152
                Argument_StreaminfoUInt64 streaminfo_uint64;
 
153
                Argument_VcFieldName vc_field_name;
 
154
                Argument_VcField vc_field;
 
155
                Argument_Filename filename;
 
156
                Argument_ImportCuesheetFrom import_cuesheet_from;
 
157
                Argument_AddSeekpoint add_seekpoint;
 
158
                Argument_AddPadding add_padding;
 
159
        } argument;
 
160
} Operation;
 
161
 
 
162
typedef struct {
 
163
        ArgumentType type;
 
164
        union {
 
165
                Argument_BlockNumber block_number;
 
166
                Argument_BlockType block_type;
 
167
                Argument_DataFormat data_format;
 
168
                Argument_FromFile from_file;
 
169
        } value;
 
170
} Argument;
 
171
 
 
172
typedef struct {
 
173
        FLAC__bool preserve_modtime;
 
174
        FLAC__bool prefix_with_filename;
 
175
        FLAC__bool utf8_convert;
 
176
        FLAC__bool use_padding;
 
177
        FLAC__bool cued_seekpoints;
 
178
        FLAC__bool show_long_help;
 
179
        FLAC__bool show_version;
 
180
        FLAC__bool application_data_format_is_hexdump;
 
181
        struct {
 
182
                Operation *operations;
 
183
                unsigned num_operations;
 
184
                unsigned capacity;
 
185
        } ops;
 
186
        struct {
 
187
                struct {
 
188
                        unsigned num_shorthand_ops;
 
189
                        unsigned num_major_ops;
 
190
                        FLAC__bool has_block_type;
 
191
                        FLAC__bool has_except_block_type;
 
192
                } checks;
 
193
                Argument *arguments;
 
194
                unsigned num_arguments;
 
195
                unsigned capacity;
 
196
        } args;
 
197
        unsigned num_files;
 
198
        char **filenames;
 
199
} CommandLineOptions;
 
200
 
 
201
void init_options(CommandLineOptions *options);
 
202
FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options);
 
203
void free_options(CommandLineOptions *options);
 
204
 
 
205
#endif