| 1 |
/* |
| 2 |
mpg123: main code of the program (not of the decoder...) |
| 3 |
|
| 4 |
copyright 1995-2026 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 |
|
| 15 |
#include "mpg123config.h" |
| 16 |
|
| 17 |
/* everyone needs it */ |
| 18 |
#include "compat/compat.h" |
| 19 |
/* import DLL symbols on windows */ |
| 20 |
|
| 21 |
#include "httpget.h" |
| 22 |
#ifdef _WIN32 |
| 23 |
#include "win32_support.h" |
| 24 |
#endif |
| 25 |
|
| 26 |
#include "streamdump.h" |
| 27 |
|
| 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 stdin_is_term; |
| 45 |
extern int stdout_is_term; |
| 46 |
extern int stderr_is_term; |
| 47 |
|
| 48 |
struct parameter |
| 49 |
{ |
| 50 |
int aggressive; /* renice to max. priority */ |
| 51 |
int shuffle; /* shuffle/random play */ |
| 52 |
int remote; /* remote operation */ |
| 53 |
int remote_err; /* remote operation to stderr */ |
| 54 |
int quiet; /* shut up! */ |
| 55 |
int xterm_title; /* Change xterm title to song names? */ |
| 56 |
long usebuffer; /* second level buffer size */ |
| 57 |
int verbose; /* verbose level */ |
| 58 |
const char* output_module; /* audio output module to use */ |
| 59 |
const char* output_device; /* audio output device to use */ |
| 60 |
long output_flags; /* out123 flags */ |
| 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 |
int checkrange; |
| 67 |
int force_reopen; |
| 68 |
long realtime; |
| 69 |
#ifdef HAVE_WINDOWS_H |
| 70 |
int w32_priority; |
| 71 |
#endif |
| 72 |
long listentry; /* possibility to choose playback of one entry in playlist (0: off, > 0 : select, < 0; just show list*/ |
| 73 |
char* listname; /* name of playlist */ |
| 74 |
int long_id3; |
| 75 |
char *cpu; |
| 76 |
#ifdef FIFO |
| 77 |
char* fifo; |
| 78 |
#endif |
| 79 |
long timeout; /* timeout for reading in seconds */ |
| 80 |
long loop; /* looping of tracks */ |
| 81 |
int delay; |
| 82 |
int index; /* index / scan through files before playback */ |
| 83 |
/* parameters for mpg123 handle */ |
| 84 |
int down_sample; |
| 85 |
long rva; /* (which) rva to do: 0: nothing, 1: radio/mix/track 2: album/audiophile */ |
| 86 |
long halfspeed; |
| 87 |
long doublespeed; |
| 88 |
long start_frame; /* frame offset to begin with */ |
| 89 |
long frame_number; /* number of frames to decode */ |
| 90 |
long outscale; |
| 91 |
long flags; |
| 92 |
long force_rate; |
| 93 |
int resample; |
| 94 |
int talk_icy; |
| 95 |
long resync_limit; |
| 96 |
int smooth; |
| 97 |
double pitch; /* <0 or >0, 0.05 for 5% speedup. */ |
| 98 |
double pauseloop; // terminal control 'pause' loop length |
| 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 |
#if defined(NETWORK) || defined(NET123) |
| 113 |
char *httpauth; /* HTTP auth data */ |
| 114 |
#endif |
| 115 |
#if defined(NET123) |
| 116 |
char *network_backend; |
| 117 |
#endif |
| 118 |
}; |
| 119 |
|
| 120 |
enum mpg123app_flags |
| 121 |
{ |
| 122 |
MPG123APP_IGNORE_MIME = 0x01 |
| 123 |
,MPG123APP_LYRICS = 0x02 |
| 124 |
,MPG123APP_CONTINUE = 0x04 |
| 125 |
}; |
| 126 |
|
| 127 |
/* shortcut to check application flags */ |
| 128 |
#define APPFLAG(a) (param.appflags & (a)) |
| 129 |
|
| 130 |
extern char *equalfile; |
| 131 |
extern off_t framenum; |
| 132 |
extern struct stream *filept; |
| 133 |
extern int intflag; |
| 134 |
|
| 135 |
#ifdef VARMODESUPPORT |
| 136 |
extern int varmode; |
| 137 |
extern int playlimit; |
| 138 |
#endif |
| 139 |
|
| 140 |
/* why extern? */ |
| 141 |
void play_prebuffer(void); |
| 142 |
extern int play_frame(void); |
| 143 |
|
| 144 |
extern int control_generic(mpg123_handle *fr); |
| 145 |
|
| 146 |
extern struct parameter param; |
| 147 |
|
| 148 |
/* avoid the SIGINT in terminal control */ |
| 149 |
void next_track(void); |
| 150 |
void prev_track(void); |
| 151 |
void next_dir(void); |
| 152 |
void prev_dir(void); |
| 153 |
int open_track(char *fname); |
| 154 |
void close_track(void); |
| 155 |
void set_intflag(void); |
| 156 |
|
| 157 |
/* equalizer... success is 0, failure -1 */ |
| 158 |
int load_equalizer(mpg123_handle *mh); |
| 159 |
|
| 160 |
void continue_msg(const char *name); |
| 161 |
|
| 162 |
#endif |