1 /*
2 	mpg123: main code of the program (not of the decoder...)
3 
4 	copyright 1995-2020 by the mpg123 project - free software under the terms of the LGPL 2.1
5 	see COPYING and AUTHORS files in distribution or http://mpg123.org
6 	initially written by Michael Hipp
7 
8 	mpg123 defines
9 	used source: musicout.h from mpegaudio package
10 */
11 
12 #ifndef MPG123_H
13 #define MPG123_H
14 #include "config.h"
15 
16 /* everyone needs it */
17 #include "compat.h"
18 /* import DLL symbols on windows */
19 
20 #include "httpget.h"
21 #if WIN32
22 #include "win32_support.h"
23 #endif
24 
25 #if defined(WIN32) && defined(DYNAMIC_BUILD)
26 #define LINK_MPG123_DLL
27 #endif
28 #include "mpg123.h"
29 #define MPG123_REMOTE
30 #define REMOTE_BUFFER_SIZE 2048
31 //#define MAXOUTBURST 32768
32 
33 #ifdef __GNUC__
34 #define INLINE inline
35 #else
36 #define INLINE
37 #endif
38 
39 #include "local.h"
40 
41 #define VERBOSE_MAX 3
42 
43 extern char* binpath; /* argv[0], actually... */
44 extern int stdout_is_term;
45 extern int stderr_is_term;
46 
47 struct parameter
48 {
49 	int aggressive; /* renice to max. priority */
50 	int shuffle;	/* shuffle/random play */
51 	int remote;	/* remote operation */
52 	int remote_err;	/* remote operation to stderr */
53 	int quiet;	/* shut up! */
54 	int xterm_title;	/* Change xterm title to song names? */
55 	long usebuffer;	/* second level buffer size */
56 	int verbose;    /* verbose level */
57 	const char* output_module;	/* audio output module to use */
58 	const char* output_device;	/* audio output device to use */
59 	long  output_flags;	/* out123 flags */
60 #ifdef HAVE_TERMIOS
61 	int term_ctrl;
62 	int term_visual;
63 	/* Those are supposed to be single characters. */
64 	char* term_usr1;
65 	char* term_usr2;
66 #endif
67 	int checkrange;
68 	int force_reopen;
69 	long realtime;
70 #ifdef HAVE_WINDOWS_H
71 	int w32_priority;
72 #endif
73 	long listentry; /* possibility to choose playback of one entry in playlist (0: off, > 0 : select, < 0; just show list*/
74 	char* listname; /* name of playlist */
75 	int long_id3;
76 	char *cpu;
77 #ifdef FIFO
78 	char* fifo;
79 #endif
80 	long timeout; /* timeout for reading in seconds */
81 	long loop;    /* looping of tracks */
82 	int delay;
83 	int index;    /* index / scan through files before playback */
84 	/* parameters for mpg123 handle */
85 	int down_sample;
86 	long rva; /* (which) rva to do: 0: nothing, 1: radio/mix/track 2: album/audiophile */
87 	long halfspeed;
88 	long doublespeed;
89 	long start_frame;  /* frame offset to begin with */
90 	long frame_number; /* number of frames to decode */
91 	long outscale;
92 	long flags;
93 	long force_rate;
94 	int resample;
95 	int talk_icy;
96 	long resync_limit;
97 	int smooth;
98 	double pitch; /* <0 or >0, 0.05 for 5% speedup. */
99 	unsigned long appflags; /* various switches for mpg123 application */
100 	char *proxyurl;
101 	int keep_open; /* Whether to keep files open after end reached, for remote control mode, perhaps terminal control, too. */
102 	int force_utf8; /* Regardless of environment, always print out verbatim UTF for metadata. */
103 	long index_size; /* size of frame index */
104 	char *force_encoding;
105 	double preload; /* buffer preload size (fraction of full buffer) */
106 	long preframes;
107 	long gain; /* audio output gain, for selected outputs */
108 	char* streamdump;
109 	long icy_interval;
110 	const char* name; /* name for this player instance */
111 	double device_buffer; /* output device buffer */
112 };
113 
114 enum mpg123app_flags
115 {
116 	 MPG123APP_IGNORE_MIME = 0x01
117 	,MPG123APP_LYRICS = 0x02
118 	,MPG123APP_CONTINUE = 0x04
119 };
120 
121 /* shortcut to check application flags */
122 #define APPFLAG(a) (param.appflags & (a))
123 
124 extern char *equalfile;
125 extern off_t framenum;
126 extern struct httpdata htd;
127 
128 extern int intflag;
129 
130 #ifdef VARMODESUPPORT
131 extern int varmode;
132 extern int playlimit;
133 #endif
134 
135 /* why extern? */
136 extern int play_frame(void);
137 
138 extern int control_generic(mpg123_handle *fr);
139 
140 extern struct parameter param;
141 
142 /* avoid the SIGINT in terminal control */
143 void next_track(void);
144 void prev_track(void);
145 void next_dir(void);
146 void prev_dir(void);
147 int  open_track(char *fname);
148 void close_track(void);
149 void set_intflag(void);
150 
151 /* equalizer... success is 0, failure -1 */
152 int load_equalizer(mpg123_handle *mh);
153 
154 void continue_msg(const char *name);
155 
156 #endif
157