Codebase list squeezelite / 1605d37
change logging levels for slimproto update changelog allow visexport to work with jivelite running as any user Adrian Smith 10 years ago
4 changed file(s) with 50 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
4141 Minor changes
4242 - support of compile time linking for distro packaging, uses -DLINKALL option
4343
44 Version 1.4 (beta)
45 ==================
44 Version 1.4 28/12/13
45 ====================
4646
4747 Features
4848 - native support of dsd playback to dop capable dac or via conversion to pcm and resampling
5454 - fix problem with libmpg123 playback not playing to end of track
5555 - add ablity for player name change to be stored locally in a file (to emulate hardware where name is stored on player)
5656
57 Version 1.5-dev
58 ===============
59
60 Minor changes
61 - add configurable delay for switch between pcm and dop
62 - allow visexport to work with jivelite running as any user
63 - bug fixes for dsf playback and for status progress on windows using wdm-ks output
64 - change some logging levels for slimproto to aid readablity
65
354354 }
355355 }
356356
357 // warn if command line includes something which isn't parsed
358 if (optind < argc) {
359 usage(argv[0]);
360 exit(0);
361 }
362
357363 signal(SIGINT, sighandler);
358364 signal(SIGTERM, sighandler);
359365 #if defined(SIGQUIT)
2323
2424 #if VISEXPORT
2525
26 #include <sys/stat.h>
2627 #include <sys/mman.h>
2728 #include <fcntl.h>
2829
112113
113114 sprintf(vis_shm_path, "/squeezelite-%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
114115
116 mode_t old_mask = umask(000); // allow any user to read our shm when created
117
115118 vis_fd = shm_open(vis_shm_path, O_CREAT | O_RDWR, 0666);
116119 if (vis_fd != -1) {
117120 if (ftruncate(vis_fd, sizeof(struct vis_t)) == 0) {
133136 LOG_WARN("unable to open visualizer shared memory");
134137 vis_mmap = NULL;
135138 }
139
140 umask(old_mask);
136141 }
137142
138143 #endif // VISEXPORT
115115
116116 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]);
117117
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);
119119
120120 send_packet((u8_t *)&pkt, sizeof(pkt));
121121 send_packet((u8_t *)base_cap, strlen(base_cap));
160160 pkt.server_timestamp = server_timestamp; // keep this is server format - don't unpack/pack
161161 // error_code;
162162
163 LOG_INFO("STAT: %s", event);
163 LOG_DEBUG("STAT: %s", event);
164164
165165 if (loglevel == lSDEBUG) {
166166 LOG_SDEBUG("received bytesL: %u streambuf: %u outputbuf: %u calc elapsed: %u real elapsed: %u (diff: %d) device: %u delay: %d",
179179 pkt.length = htonl(sizeof(pkt) - 8);
180180 pkt.reason = disconnect & 0xFF;
181181
182 LOG_INFO("DSCO: %d", disconnect);
182 LOG_DEBUG("DSCO: %d", disconnect);
183183
184184 send_packet((u8_t *)&pkt, sizeof(pkt));
185185 }
191191 memcpy(&pkt_header.opcode, "RESP", 4);
192192 pkt_header.length = htonl(sizeof(pkt_header) + len - 8);
193193
194 LOG_INFO("RESP");
194 LOG_DEBUG("RESP");
195195
196196 send_packet((u8_t *)&pkt_header, sizeof(pkt_header));
197197 send_packet((u8_t *)header, len);
204204 memcpy(&pkt_header.opcode, "META", 4);
205205 pkt_header.length = htonl(sizeof(pkt_header) + len - 8);
206206
207 LOG_INFO("META");
207 LOG_DEBUG("META");
208208
209209 send_packet((u8_t *)&pkt_header, sizeof(pkt_header));
210210 send_packet((u8_t *)meta, len);
219219 pkt_header.id = 0; // id 0 is playername S:P:Squeezebox2
220220 pkt_header.length = htonl(sizeof(pkt_header) + strlen(name) + 1 - 8);
221221
222 LOG_INFO("set playername: %s", name);
222 LOG_DEBUG("set playername: %s", name);
223223
224224 send_packet((u8_t *)&pkt_header, sizeof(pkt_header));
225225 send_packet((u8_t *)name, strlen(name) + 1);
228228 static void process_strm(u8_t *pkt, int len) {
229229 struct strm_packet *strm = (struct strm_packet *)pkt;
230230
231 LOG_INFO("strm command %c", strm->command);
231 LOG_DEBUG("strm command %c", strm->command);
232232
233233 switch(strm->command) {
234234 case 't':
259259 output.state = interval ? OUTPUT_PAUSE_FRAMES : OUTPUT_STOPPED;
260260 UNLOCK_O;
261261 if (!interval) sendSTAT("STMp", 0);
262 LOG_INFO("pause interval: %u", interval);
262 LOG_DEBUG("pause interval: %u", interval);
263263 }
264264 break;
265265 case 'a':
269269 output.skip_frames = interval * status.current_sample_rate / 1000;
270270 output.state = OUTPUT_SKIP_FRAMES;
271271 UNLOCK_O;
272 LOG_INFO("skip ahead interval: %u", interval);
272 LOG_DEBUG("skip ahead interval: %u", interval);
273273 }
274274 break;
275275 case 'u':
282282 LOCK_D;
283283 decode.state = DECODE_RUNNING;
284284 UNLOCK_D;
285 LOG_INFO("unpause at: %u now: %u", jiffies, gettime_ms());
285 LOG_DEBUG("unpause at: %u now: %u", jiffies, gettime_ms());
286286 sendSTAT("STMr", 0);
287287 }
288288 break;
294294 u16_t port = strm->server_port; // keep in network byte order
295295 if (ip == 0) ip = slimproto_ip;
296296
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
300300 autostart = strm->autostart - '0';
301301 sendSTAT("STMf", 0);
302302 if (header_len > MAX_HEADER -1) {
307307 codec_open(strm->format, strm->pcm_sample_size, strm->pcm_sample_rate, strm->pcm_channels, strm->pcm_endianness);
308308 } else if (autostart >= 2) {
309309 // 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");
311311 } else {
312312 LOG_WARN("unknown codec requires autostart >= 2");
313313 break;
326326 output.next_replay_gain = unpackN(&strm->replay_gain);
327327 output.fade_mode = strm->transition_type - '0';
328328 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);
330330 UNLOCK_O;
331331 }
332332 break;
333333 default:
334 LOG_INFO("unhandled strm %c", strm->command);
334 LOG_WARN("unhandled strm %c", strm->command);
335335 break;
336336 }
337337 }
340340 struct cont_packet *cont = (struct cont_packet *)pkt;
341341 cont->metaint = unpackN(&cont->metaint);
342342
343 LOG_INFO("cont metaint: %u loop: %u", cont->metaint, cont->loop);
343 LOG_DEBUG("cont metaint: %u loop: %u", cont->metaint, cont->loop);
344344
345345 if (autostart > 1) {
346346 autostart -= 2;
357357 static void process_codc(u8_t *pkt, int len) {
358358 struct codc_packet *codc = (struct codc_packet *)pkt;
359359
360 LOG_INFO("codc: %c", codc->format);
360 LOG_DEBUG("codc: %c", codc->format);
361361 codec_open(codc->format, codc->pcm_sample_size, codc->pcm_sample_rate, codc->pcm_channels, codc->pcm_endianness);
362362 }
363363
364364 static void process_aude(u8_t *pkt, int len) {
365365 struct aude_packet *aude = (struct aude_packet *)pkt;
366366
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);
368368
369369 LOCK_O;
370370 if (!aude->enable_spdif && output.state != OUTPUT_OFF) {
381381 audg->gainL = unpackN(&audg->gainL);
382382 audg->gainR = unpackN(&audg->gainR);
383383
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);
385385
386386 LOCK_O;
387387 output.gainL = audg->adjust ? audg->gainL : FIXED_ONE;
465465 while (h->handler && strncmp((char *)pack, h->opcode, 4)) { h++; }
466466
467467 if (h->handler) {
468 LOG_INFO("%s", h->opcode);
468 LOG_DEBUG("%s", h->opcode);
469469 h->handler(pack, len);
470470 } else {
471471 pack[4] = '\0';
472 LOG_INFO("unhandled %s", (char *)pack);
472 LOG_WARN("unhandled %s", (char *)pack);
473473 }
474474 }
475475
754754 if (!fgets(player_name, PLAYER_NAME_LEN, fp)) {
755755 player_name[PLAYER_NAME_LEN] = '\0';
756756 } 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);
758763 }
759764 fclose(fp);
760765 }