Subversion Repositories shark

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * mpg123 defines
3
 * used source: musicout.h from mpegaudio package
4
 */
5
 
6
#include        <stdio.h>
31 pj 7
#include        <stdlib.h>
2 pj 8
#include        <string.h>
9
#include        <signal.h>
10
#include        <math.h>
11
 
12
#include        <unistd.h>
13
 
14
#ifdef OS2
15
#include <float.h>
16
#endif
17
 
18
 
19
#define MPG123_REMOTE
20
#define SHUFFLESUPPORT
21
#ifdef HPUX
22
#define random rand
23
#define srandom srand
24
#endif
25
 
26
#define FRONTEND_SAJBER 1
27
#define FRONTEND_TK3PLAY 2
28
 
29
 
30
#ifdef SGI
31
#include <audio.h>
32
#endif
33
 
34
#include "xfermem.h"
35
 
36
#ifdef SUNOS
37
#define memmove(dst,src,size) bcopy(src,dst,size)
38
#endif
39
 
40
#ifdef REAL_IS_FLOAT
41
#  define real float
42
#elif defined(REAL_IS_LONG_DOUBLE)
43
#  define real long double
44
#else
45
#  define real double
46
#endif
47
 
48
#ifdef __GNUC__
49
#define INLINE inline
50
#else
51
#define INLINE
52
#endif
53
 
54
#if defined(LINUX) || defined(__FreeBSD__)
55
#define VOXWARE
56
#endif
57
 
58
#include "audio.h"
59
 
60
/* AUDIOBUFSIZE = n*64 with n=1,2,3 ...  */
61
#define         AUDIOBUFSIZE            16384
62
 
63
#define         FALSE                   0
64
#define         TRUE                    1
65
 
66
#define         MAX_NAME_SIZE           81
67
#define         SBLIMIT                 32
68
#define         SCALE_BLOCK             12
69
#define         SSLIMIT                 18
70
 
71
#define         MPG_MD_STEREO           0
72
#define         MPG_MD_JOINT_STEREO     1
73
#define         MPG_MD_DUAL_CHANNEL     2
74
#define         MPG_MD_MONO             3
75
 
76
#define MAXOUTBURST 32768
77
 
78
 
79
struct al_table
80
{
81
  short bits;
82
  short d;
83
};
84
 
85
struct frame {
86
    struct al_table *alloc;
87
    int (*synth)(real *,int,unsigned char *);
88
    int (*synth_mono)(real *,unsigned char *);
89
    int stereo;
90
    int jsbound;
91
    int single;
92
    int II_sblimit;
93
    int lsf;
94
    int mpeg25;
95
    int down_sample;
96
    int header_change;
97
    int block_size;
98
    int lay;
99
    int (*do_layer)(struct frame *fr,int,struct audio_info_struct *);
100
    int error_protection;
101
    int bitrate_index;
102
    int sampling_frequency;
103
    int padding;
104
    int extension;
105
    int mode;
106
    int mode_ext;
107
    int copyright;
108
    int original;
109
    int emphasis;
110
};
111
 
112
extern int outmode;  
113
extern int tryresync;
114
extern int quiet;
115
extern int halfspeed;
116
extern int usebuffer;
117
extern int buffer_fd[2];
118
extern txfermem *buffermem;
119
extern char *prgName, *prgVersion;
120
 
121
#ifndef OS2
122
extern void buffer_loop(struct audio_info_struct *ai, sigset_t *oldsigset);
123
#endif
124
 
125
/* ------ Declarations from "httpget.c" ------ */
126
 
127
extern char *proxyurl;
128
extern unsigned long proxyip;
129
extern FILE *http_open (char *url);
130
 
131
/* ------ Declarations from "common.c" ------ */
132
 
133
extern void audio_flush(int, struct audio_info_struct *);
134
extern void (*catchsignal(int signum, void(*handler)()))();
135
 
136
extern void print_header(struct frame *);
137
extern void print_header_compact(struct frame *);
138
 
139
extern char *strndup(const char *src, int num);
140
extern int split_dir_file(const char *path, char **dname, char **fname);
141
 
142
extern unsigned int   get1bit(void);
143
extern unsigned int   getbits(int);
144
extern unsigned int   getbits_fast(int);
145
 
146
extern void set_pointer(long);
147
 
148
extern unsigned char *pcm_sample;
149
extern int pcm_point;
150
extern int audiobufsize;
151
 
152
#ifdef VARMODESUPPORT
153
extern int varmode;
154
extern int playlimit;
155
#endif
156
 
157
struct III_sideinfo
158
{
159
  unsigned main_data_begin;
160
  unsigned private_bits;
161
  struct {
162
    struct gr_info_s {
163
      int scfsi;
164
      unsigned part2_3_length;
165
      unsigned big_values;
166
      unsigned scalefac_compress;
167
      unsigned block_type;
168
      unsigned mixed_block_flag;
169
      unsigned table_select[3];
170
      unsigned subblock_gain[3];
171
      unsigned maxband[3];
172
      unsigned maxbandl;
173
      unsigned maxb;
174
      unsigned region1start;
175
      unsigned region2start;
176
      unsigned preflag;
177
      unsigned scalefac_scale;
178
      unsigned count1table_select;
179
      real *full_gain[3];
180
      real *pow2gain;
181
    } gr[2];
182
  } ch[2];
183
};
184
 
185
extern void open_stream(char *,int fd);
186
extern void close_stream(void);
187
extern long tell_stream(void);
188
extern void read_frame_init (void);
189
extern int read_frame(struct frame *fr);
190
extern int back_frame(struct frame *fr,int num);
191
extern void play_frame(int init,struct frame *fr);
192
extern int do_layer3(struct frame *fr,int,struct audio_info_struct *);
193
extern int do_layer2(struct frame *fr,int,struct audio_info_struct *);
194
extern int do_layer1(struct frame *fr,int,struct audio_info_struct *);
195
extern int synth_1to1 (real *,int,unsigned char *);
196
extern int synth_1to1_8bit (real *,int,unsigned char *);
197
extern int synth_2to1 (real *,int,unsigned char *);
198
extern int synth_2to1_8bit (real *,int,unsigned char *);
199
extern int synth_4to1 (real *,int,unsigned char *);
200
extern int synth_4to1_8bit (real *,int,unsigned char *);
201
extern int synth_1to1_mono (real *,unsigned char *);
202
extern int synth_1to1_8bit_mono (real *,unsigned char *);
203
extern int synth_2to1_mono (real *,unsigned char *);
204
extern int synth_2to1_8bit_mono (real *,unsigned char *);
205
extern int synth_4to1_mono (real *,unsigned char *);
206
extern int synth_4to1_8bit_mono (real *,unsigned char *);
207
extern void rewindNbits(int bits);
208
extern int  hsstell(void);
209
extern void set_pointer(long);
210
extern void huffman_decoder(int ,int *);
211
extern void huffman_count1(int,int *);
212
 
213
extern void init_layer3(int);
214
extern void init_layer2(void);
215
extern void make_decode_tables(long scale);
216
extern void make_conv16to8_table(int);
217
extern void dct64(real *,real *,real *);
218
 
219
extern void control_sajber(struct frame *fr);
220
extern void control_tk3play(struct frame *fr);
221
 
222
extern unsigned char *conv16to8;
223
extern long freqs[7];
224
extern real muls[27][64];
225
extern real decwin[512+32];
226
extern real *pnts[5];
227
 
228