1 /*
2  *      Command line frontend program
3  *
4  *      Copyright (c) 1999 Mark Taylor
5  *                    2000 Takehiro TOMIANGA
6  *                    2010-2011 Robert Hegemann
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
24 #ifndef MAIN_H_INCLUDED
25 #define MAIN_H_INCLUDED
26 
27 #ifdef HAVE_LIMITS_H
28 # include <limits.h>
29 #endif
30 
31 #include "get_audio.h"
32 
33 #if defined(__cplusplus)
34 extern "C" {
35 #endif
36 
37 #ifndef PATH_MAX
38 #define PATH_MAX 1024
39 #endif
40 
41 
42 /* GLOBAL VARIABLES used by parse.c and main.c.
43    instantiated in parce.c.  ugly, ugly */
44 
45 typedef struct ReaderConfig
46 {
47     sound_file_format input_format;
48     int   swapbytes;                /* force byte swapping   default=0 */
49     int   swap_channel;             /* 0: no-op, 1: swaps input channels */
50     int   input_samplerate;
51     int   ignorewavlength;
52 } ReaderConfig;
53 
54 typedef struct WriterConfig
55 {
56     int   flush_write;
57 } WriterConfig;
58 
59 typedef struct UiConfig
60 {
61     int   silent;                   /* Verbosity */
62     int   brhist;
63     int   print_clipping_info;      /* print info whether waveform clips */
64     float update_interval;          /* to use Frank's time status display */
65 } UiConfig;
66 
67 typedef struct DecoderConfig
68 {
69     int   mp3_delay;                /* to adjust the number of samples truncated during decode */
70     int   mp3_delay_set;            /* user specified the value of the mp3 encoder delay to assume for decoding */
71     int   disable_wav_header;
72     mp3data_struct mp3input_data;
73 } DecoderConfig;
74 
75 typedef enum ByteOrder { ByteOrderLittleEndian, ByteOrderBigEndian } ByteOrder;
76 
77 typedef struct RawPCMConfig
78 {
79     int     in_bitwidth;
80     int     in_signed;
81     ByteOrder in_endian;
82 } RawPCMConfig;
83 
84 extern ReaderConfig global_reader;
85 extern WriterConfig global_writer;
86 extern UiConfig global_ui_config;
87 extern DecoderConfig global_decoder;
88 extern RawPCMConfig global_raw_pcm;
89 
90 
91 extern FILE* lame_fopen(char const* file, char const* mode);
92 extern char* utf8ToConsole8Bit(const char* str);
93 extern char* utf8ToLocal8Bit(const char* str);
94 extern unsigned short* utf8ToUtf16(char const* mbstr);
95 extern char* utf8ToLatin1(char const* str);
96 #ifdef _WIN32
97 extern wchar_t* utf8ToUnicode(char const* mbstr);
98 extern char *unicodeToUtf8(const wchar_t *wstr);
99 #endif
100 
101 extern void dosToLongFileName(char* filename);
102 extern void setProcessPriority(int priority);
103 
104 extern int lame_main(lame_t gf, int argc, char** argv);
105 extern char* lame_getenv(char const* var);
106 
107 #if defined(__cplusplus)
108 }
109 #endif
110 
111 #endif
112