115 | 115 |
|
116 | 116 |
LOG_INFO("mac: %02x:%02x:%02x:%02x:%02x:%02x", pkt.mac[0], pkt.mac[1], pkt.mac[2], pkt.mac[3], pkt.mac[4], pkt.mac[5]);
|
117 | 117 |
|
118 | |
LOG_DEBUG("cap: %s%s%s", base_cap, fixed_cap, var_cap);
|
|
118 |
LOG_INFO("cap: %s%s%s", base_cap, fixed_cap, var_cap);
|
119 | 119 |
|
120 | 120 |
send_packet((u8_t *)&pkt, sizeof(pkt));
|
121 | 121 |
send_packet((u8_t *)base_cap, strlen(base_cap));
|
|
160 | 160 |
pkt.server_timestamp = server_timestamp; // keep this is server format - don't unpack/pack
|
161 | 161 |
// error_code;
|
162 | 162 |
|
163 | |
LOG_INFO("STAT: %s", event);
|
|
163 |
LOG_DEBUG("STAT: %s", event);
|
164 | 164 |
|
165 | 165 |
if (loglevel == lSDEBUG) {
|
166 | 166 |
LOG_SDEBUG("received bytesL: %u streambuf: %u outputbuf: %u calc elapsed: %u real elapsed: %u (diff: %d) device: %u delay: %d",
|
|
179 | 179 |
pkt.length = htonl(sizeof(pkt) - 8);
|
180 | 180 |
pkt.reason = disconnect & 0xFF;
|
181 | 181 |
|
182 | |
LOG_INFO("DSCO: %d", disconnect);
|
|
182 |
LOG_DEBUG("DSCO: %d", disconnect);
|
183 | 183 |
|
184 | 184 |
send_packet((u8_t *)&pkt, sizeof(pkt));
|
185 | 185 |
}
|
|
191 | 191 |
memcpy(&pkt_header.opcode, "RESP", 4);
|
192 | 192 |
pkt_header.length = htonl(sizeof(pkt_header) + len - 8);
|
193 | 193 |
|
194 | |
LOG_INFO("RESP");
|
|
194 |
LOG_DEBUG("RESP");
|
195 | 195 |
|
196 | 196 |
send_packet((u8_t *)&pkt_header, sizeof(pkt_header));
|
197 | 197 |
send_packet((u8_t *)header, len);
|
|
204 | 204 |
memcpy(&pkt_header.opcode, "META", 4);
|
205 | 205 |
pkt_header.length = htonl(sizeof(pkt_header) + len - 8);
|
206 | 206 |
|
207 | |
LOG_INFO("META");
|
|
207 |
LOG_DEBUG("META");
|
208 | 208 |
|
209 | 209 |
send_packet((u8_t *)&pkt_header, sizeof(pkt_header));
|
210 | 210 |
send_packet((u8_t *)meta, len);
|
|
219 | 219 |
pkt_header.id = 0; // id 0 is playername S:P:Squeezebox2
|
220 | 220 |
pkt_header.length = htonl(sizeof(pkt_header) + strlen(name) + 1 - 8);
|
221 | 221 |
|
222 | |
LOG_INFO("set playername: %s", name);
|
|
222 |
LOG_DEBUG("set playername: %s", name);
|
223 | 223 |
|
224 | 224 |
send_packet((u8_t *)&pkt_header, sizeof(pkt_header));
|
225 | 225 |
send_packet((u8_t *)name, strlen(name) + 1);
|
|
228 | 228 |
static void process_strm(u8_t *pkt, int len) {
|
229 | 229 |
struct strm_packet *strm = (struct strm_packet *)pkt;
|
230 | 230 |
|
231 | |
LOG_INFO("strm command %c", strm->command);
|
|
231 |
LOG_DEBUG("strm command %c", strm->command);
|
232 | 232 |
|
233 | 233 |
switch(strm->command) {
|
234 | 234 |
case 't':
|
|
259 | 259 |
output.state = interval ? OUTPUT_PAUSE_FRAMES : OUTPUT_STOPPED;
|
260 | 260 |
UNLOCK_O;
|
261 | 261 |
if (!interval) sendSTAT("STMp", 0);
|
262 | |
LOG_INFO("pause interval: %u", interval);
|
|
262 |
LOG_DEBUG("pause interval: %u", interval);
|
263 | 263 |
}
|
264 | 264 |
break;
|
265 | 265 |
case 'a':
|
|
269 | 269 |
output.skip_frames = interval * status.current_sample_rate / 1000;
|
270 | 270 |
output.state = OUTPUT_SKIP_FRAMES;
|
271 | 271 |
UNLOCK_O;
|
272 | |
LOG_INFO("skip ahead interval: %u", interval);
|
|
272 |
LOG_DEBUG("skip ahead interval: %u", interval);
|
273 | 273 |
}
|
274 | 274 |
break;
|
275 | 275 |
case 'u':
|
|
282 | 282 |
LOCK_D;
|
283 | 283 |
decode.state = DECODE_RUNNING;
|
284 | 284 |
UNLOCK_D;
|
285 | |
LOG_INFO("unpause at: %u now: %u", jiffies, gettime_ms());
|
|
285 |
LOG_DEBUG("unpause at: %u now: %u", jiffies, gettime_ms());
|
286 | 286 |
sendSTAT("STMr", 0);
|
287 | 287 |
}
|
288 | 288 |
break;
|
|
294 | 294 |
u16_t port = strm->server_port; // keep in network byte order
|
295 | 295 |
if (ip == 0) ip = slimproto_ip;
|
296 | 296 |
|
297 | |
LOG_INFO("strm s autostart: %c transition period: %u transition type: %u codec: %c",
|
298 | |
strm->autostart, strm->transition_period, strm->transition_type - '0', strm->format);
|
299 | |
|
|
297 |
LOG_DEBUG("strm s autostart: %c transition period: %u transition type: %u codec: %c",
|
|
298 |
strm->autostart, strm->transition_period, strm->transition_type - '0', strm->format);
|
|
299 |
|
300 | 300 |
autostart = strm->autostart - '0';
|
301 | 301 |
sendSTAT("STMf", 0);
|
302 | 302 |
if (header_len > MAX_HEADER -1) {
|
|
307 | 307 |
codec_open(strm->format, strm->pcm_sample_size, strm->pcm_sample_rate, strm->pcm_channels, strm->pcm_endianness);
|
308 | 308 |
} else if (autostart >= 2) {
|
309 | 309 |
// extension to slimproto to allow server to detect codec from response header and send back in codc message
|
310 | |
LOG_INFO("streaming unknown codec");
|
|
310 |
LOG_DEBUG("streaming unknown codec");
|
311 | 311 |
} else {
|
312 | 312 |
LOG_WARN("unknown codec requires autostart >= 2");
|
313 | 313 |
break;
|
|
326 | 326 |
output.next_replay_gain = unpackN(&strm->replay_gain);
|
327 | 327 |
output.fade_mode = strm->transition_type - '0';
|
328 | 328 |
output.fade_secs = strm->transition_period;
|
329 | |
LOG_INFO("set fade mode: %u", output.fade_mode);
|
|
329 |
LOG_DEBUG("set fade mode: %u", output.fade_mode);
|
330 | 330 |
UNLOCK_O;
|
331 | 331 |
}
|
332 | 332 |
break;
|
333 | 333 |
default:
|
334 | |
LOG_INFO("unhandled strm %c", strm->command);
|
|
334 |
LOG_WARN("unhandled strm %c", strm->command);
|
335 | 335 |
break;
|
336 | 336 |
}
|
337 | 337 |
}
|
|
340 | 340 |
struct cont_packet *cont = (struct cont_packet *)pkt;
|
341 | 341 |
cont->metaint = unpackN(&cont->metaint);
|
342 | 342 |
|
343 | |
LOG_INFO("cont metaint: %u loop: %u", cont->metaint, cont->loop);
|
|
343 |
LOG_DEBUG("cont metaint: %u loop: %u", cont->metaint, cont->loop);
|
344 | 344 |
|
345 | 345 |
if (autostart > 1) {
|
346 | 346 |
autostart -= 2;
|
|
357 | 357 |
static void process_codc(u8_t *pkt, int len) {
|
358 | 358 |
struct codc_packet *codc = (struct codc_packet *)pkt;
|
359 | 359 |
|
360 | |
LOG_INFO("codc: %c", codc->format);
|
|
360 |
LOG_DEBUG("codc: %c", codc->format);
|
361 | 361 |
codec_open(codc->format, codc->pcm_sample_size, codc->pcm_sample_rate, codc->pcm_channels, codc->pcm_endianness);
|
362 | 362 |
}
|
363 | 363 |
|
364 | 364 |
static void process_aude(u8_t *pkt, int len) {
|
365 | 365 |
struct aude_packet *aude = (struct aude_packet *)pkt;
|
366 | 366 |
|
367 | |
LOG_INFO("enable spdif: %d dac: %d", aude->enable_spdif, aude->enable_dac);
|
|
367 |
LOG_DEBUG("enable spdif: %d dac: %d", aude->enable_spdif, aude->enable_dac);
|
368 | 368 |
|
369 | 369 |
LOCK_O;
|
370 | 370 |
if (!aude->enable_spdif && output.state != OUTPUT_OFF) {
|
|
381 | 381 |
audg->gainL = unpackN(&audg->gainL);
|
382 | 382 |
audg->gainR = unpackN(&audg->gainR);
|
383 | 383 |
|
384 | |
LOG_INFO("audg gainL: %u gainR: %u adjust: %u", audg->gainL, audg->gainR, audg->adjust);
|
|
384 |
LOG_DEBUG("audg gainL: %u gainR: %u adjust: %u", audg->gainL, audg->gainR, audg->adjust);
|
385 | 385 |
|
386 | 386 |
LOCK_O;
|
387 | 387 |
output.gainL = audg->adjust ? audg->gainL : FIXED_ONE;
|
|
465 | 465 |
while (h->handler && strncmp((char *)pack, h->opcode, 4)) { h++; }
|
466 | 466 |
|
467 | 467 |
if (h->handler) {
|
468 | |
LOG_INFO("%s", h->opcode);
|
|
468 |
LOG_DEBUG("%s", h->opcode);
|
469 | 469 |
h->handler(pack, len);
|
470 | 470 |
} else {
|
471 | 471 |
pack[4] = '\0';
|
472 | |
LOG_INFO("unhandled %s", (char *)pack);
|
|
472 |
LOG_WARN("unhandled %s", (char *)pack);
|
473 | 473 |
}
|
474 | 474 |
}
|
475 | 475 |
|
|
754 | 754 |
if (!fgets(player_name, PLAYER_NAME_LEN, fp)) {
|
755 | 755 |
player_name[PLAYER_NAME_LEN] = '\0';
|
756 | 756 |
} else {
|
757 | |
LOG_INFO("retrived name %s from %s", player_name, name_file);
|
|
757 |
// strip any \n from fgets response
|
|
758 |
int len = strlen(player_name);
|
|
759 |
if (len > 0 && player_name[len - 1] == '\n') {
|
|
760 |
player_name[len - 1] = '\0';
|
|
761 |
}
|
|
762 |
LOG_INFO("retrieved name %s from %s", player_name, name_file);
|
758 | 763 |
}
|
759 | 764 |
fclose(fp);
|
760 | 765 |
}
|