Codebase list squeezelite / 1965bf4
check for id32 tag at start of mp3, needed for localfile access case only fix typos Adrian Smith 10 years ago
4 changed file(s) with 41 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
6161 - add configurable delay for switch between pcm and dop
6262 - allow visexport to work with jivelite running as any user
6363 - bug fixes for dsf playback, for status progress on windows using wdm-ks output, and to avoid 100% cpu
64 - change some logging levels for slimproto to aid readablity
64 - change some logging levels for slimproto to aid readability
6565
3333 struct mad_synth synth;
3434 enum mad_error last_error;
3535 // for lame gapless processing
36 bool checkgapless;
36 int checktags;
37 u32_t consume;
3738 u32_t skip;
3839 u64_t samples;
3940 u32_t padding;
9697 return (s32_t)(sample >> (MAD_F_FRACBITS + 1 - 24)) << 8;
9798 }
9899
100 // check for id3.2 tag at start of file - http://id3.org/id3v2.4.0-structure, return length
101 static unsigned _check_id3_tag(size_t bytes) {
102 u8_t *ptr = streambuf->readp;
103 u32_t size = 0;
104
105 if (bytes > 10 && *ptr == 'I' && *(ptr+1) == 'D' && *(ptr+2) == '3') {
106 // size is encoded as syncsafe integer, add 10 if footer present
107 if (*(ptr+6) < 0x80 && *(ptr+7) < 0x80 && *(ptr+8) < 0x80 && *(ptr+9) < 0x80) {
108 size = 10 + (*(ptr+6) << 21) + (*(ptr+7) << 14) + (*(ptr+8) << 7) + *(ptr+9) + ((*(ptr+5) & 0x10) ? 10 : 0);
109 LOG_DEBUG("id3.2 tag len: %u", size);
110 }
111 }
112
113 return size;
114 }
115
99116 // check for lame gapless params, don't advance streambuf
100117 static void _check_lame_header(size_t bytes) {
101118 u8_t *ptr = streambuf->readp;
149166 LOCK_S;
150167 bytes = min(_buf_used(streambuf), _buf_cont_read(streambuf));
151168
152 if (m->checkgapless) {
153 m->checkgapless = false;
154 if (!stream.meta_interval) {
155 _check_lame_header(bytes);
169 if (m->checktags) {
170 if (m->checktags == 1) {
171 m->consume = _check_id3_tag(bytes);
172 m->checktags = 2;
173 }
174 if (m->consume) {
175 u32_t consume = min(m->consume, bytes);
176 LOG_DEBUG("consume: %u of %u", consume, m->consume);
177 _buf_inc_readp(streambuf, consume);
178 m->consume -= consume;
179 UNLOCK_S;
180 return DECODE_RUNNING;
181 }
182 if (m->checktags == 2) {
183 if (!stream.meta_interval) {
184 _check_lame_header(bytes);
185 }
186 m->checktags = 0;
156187 }
157188 }
158189
304335 if (!m->readbuf) {
305336 m->readbuf = malloc(READBUF_SIZE + MAD_BUFFER_GUARD);
306337 }
307 m->checkgapless = true;
338 m->checktags = 1;
339 m->consume = 0;
308340 m->skip = MAD_DELAY;
309341 m->samples = 0;
310342 m->readbuf_len = 0;
5151 " -f <logfile>\t\tWrite debug to logfile\n"
5252 " -m <mac addr>\t\tSet mac address, format: ab:cd:ef:12:34:56\n"
5353 " -n <name>\t\tSet the player name\n"
54 " -N <filename>\t\tStore player name in filename to allow server defined name changes to be shared between servers (not suppored with -n)\n"
54 " -N <filename>\t\tStore player name in filename to allow server defined name changes to be shared between servers (not supported with -n)\n"
5555 #if ALSA
5656 " -p <priority>\t\tSet real time priority of output thread (1-99)\n"
5757 #endif
1919
2020 // make may define: PORTAUDIO, SELFPIPE, RESAMPLE, VISEXPORT, DSD, LINKALL to influence build
2121
22 #define VERSION "v1.5"
22 #define VERSION "v1.6-dev"
2323
2424 // build detection
2525 #if defined(linux)