diff --git a/ChangeLog.txt b/ChangeLog.txt index aba0924..eb7e4d4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -42,8 +42,8 @@ Minor changes - support of compile time linking for distro packaging, uses -DLINKALL option -Version 1.4 (beta) -================== +Version 1.4 28/12/13 +==================== Features - native support of dsd playback to dop capable dac or via conversion to pcm and resampling @@ -55,3 +55,12 @@ - fix problem with libmpg123 playback not playing to end of track - add ablity for player name change to be stored locally in a file (to emulate hardware where name is stored on player) +Version 1.5 12/1/14 +=================== + +Minor changes +- add configurable delay for switch between pcm and dop +- allow visexport to work with jivelite running as any user +- bug fixes for dsf playback, for status progress on windows using wdm-ks output, and to avoid 100% cpu +- change some logging levels for slimproto to aid readablity + diff --git a/LICENSE.txt b/LICENSE.txt index cbf3eb1..8bb3cc5 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Squeezelite - lightweight headless squeezebox emulator -(c) Adrian Smith 2012, 2013, triode1@btinternet.com +(c) Adrian Smith 2012-2014, triode1@btinternet.com Released under GPLv3 license: diff --git a/buffer.c b/buffer.c index 9b3c06a..814b012 100644 --- a/buffer.c +++ b/buffer.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/decode.c b/decode.c index 4707f83..316085d 100644 --- a/decode.c +++ b/decode.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/dop.c b/dop.c index fbc77f9..580dd38 100644 --- a/dop.c +++ b/dop.c @@ -81,9 +81,10 @@ } } -void dop_init(bool enable) { +void dop_init(bool enable, unsigned delay) { LOCK_O; output.has_dop = enable; + output.dop_delay = delay; UNLOCK_O; } diff --git a/dsd.c b/dsd.c index b2f3c7b..fad957e 100644 --- a/dsd.c +++ b/dsd.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -215,8 +215,8 @@ unsigned bytes_per_frame = dop ? 2 : 1; if (bytes < d->block_size * d->channels) { - LOG_WARN("stream too short"); - return DECODE_ERROR; + LOG_INFO("stream too short"); // this can occur when scanning the track + return DECODE_COMPLETE; } IF_PROCESS( @@ -249,9 +249,15 @@ frames = min(bytes, d->sample_bytes) / bytes_per_frame; if (frames == 0) { - // /2 for dop should never result in 0 as header len is always even - LOG_WARN("frames got to zero"); - return DECODE_ERROR; + if (dop && d->sample_bytes == 1 && bytes >= 2) { + // 1 byte left add a byte of silence and play + *(iptrl + 1) = *(iptrr + 1) = 0x69; + frames = 1; + } else { + // should not get here due to wrapping m/2 for dop should never result in 0 as header len is always even + LOG_INFO("frames got to zero"); + return DECODE_COMPLETE; + } } frames = min(frames, out); diff --git a/faad.c b/faad.c index 84d558e..7a2fb72 100644 --- a/faad.c +++ b/faad.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/ffmpeg.c b/ffmpeg.c index 87b88be..bc63381 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/mad.c b/mad.c index 255bbd8..e355134 100644 --- a/mad.c +++ b/mad.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/main.c b/main.c index a69e26a..a91add5 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #include -#define TITLE "Squeezelite " VERSION ", Copyright 2012, 2013 Adrian Smith." +#define TITLE "Squeezelite " VERSION ", Copyright 2012-2014 Adrian Smith." static void usage(const char *argv0) { printf(TITLE " See -t for license terms\n" @@ -68,7 +68,7 @@ " \t\t\t phase_response = 0-100 (0 = minimum / 50 = linear / 100 = maximum)\n" #endif #if DSD - " -D\t\t\tOutput device supports DSD over PCM (DoP)\n" + " -D [delay]\t\tOutput device supports DSD over PCM (DoP), delay = optional delay switching between PCM and DoP in ms\n" #endif #if VISEXPORT " -v \t\t\tVisulizer support\n" @@ -169,6 +169,7 @@ #endif #if DSD bool dop = false; + unsigned dop_delay = 0; #endif #if VISEXPORT bool visexport = false; @@ -331,6 +332,9 @@ #if DSD case 'D': dop = true; + if (optind < argc && argv[optind] && argv[optind][0] != '-') { + dop_delay = atoi(argv[optind++]); + } break; #endif #if VISEXPORT @@ -350,6 +354,12 @@ break; } } + + // warn if command line includes something which isn't parsed + if (optind < argc) { + usage(argv[0]); + exit(0); + } signal(SIGINT, sighandler); signal(SIGTERM, sighandler); @@ -406,7 +416,7 @@ } #if DSD - dop_init(dop); + dop_init(dop, dop_delay); #endif #if VISEXPORT diff --git a/mpg.c b/mpg.c index 774b566..9e1010c 100644 --- a/mpg.c +++ b/mpg.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/output.c b/output.c index cbf4aa7..775e90e 100644 --- a/output.c +++ b/output.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,16 +119,33 @@ if (output.track_start && !silence) { if (output.track_start == outputbuf->readp) { + frames -= size; + IF_DSD( + if (output.dop != output.next_dop) { + if (output.dop_delay) { + // add silence delay in two halves, before and after track start and pcm-dop change + if (!output.dop_delay_active) { + output.pause_frames = output.current_sample_rate * output.dop_delay / 2000; + output.dop_delay_active = true; // first delay - don't process track start + break; + } else { + output.pause_frames = output.next_sample_rate * output.dop_delay / 2000; + output.dop_delay_active = false; // second delay - process track start + } + output.state = OUTPUT_PAUSE_FRAMES; + } + } + output.dop = output.next_dop; + ) LOG_INFO("track start sample rate: %u replay_gain: %u", output.next_sample_rate, output.next_replay_gain); output.frames_played = 0; output.track_started = true; output.current_sample_rate = output.next_sample_rate; - IF_DSD( output.dop = output.next_dop; ) if (!output.fade == FADE_ACTIVE || !output.fade_mode == FADE_CROSSFADE) { output.current_replay_gain = output.next_replay_gain; } output.track_start = NULL; - continue; + break; } else if (output.track_start > outputbuf->readp) { // reduce cont_frames so we find the next track start at beginning of next chunk cont_frames = min(cont_frames, (output.track_start - outputbuf->readp) / BYTES_PER_FRAME); @@ -224,9 +241,8 @@ wrote = output.write_cb(out_frames, silence, gainL, gainR, cross_gain_in, cross_gain_out, &cross_ptr); - if (wrote < 0) { - LOG_WARN("error in write cb"); - frames -= out_frames; + if (wrote <= 0) { + frames -= size; break; } else { out_frames = (frames_t)wrote; @@ -397,6 +413,7 @@ if (output.error_opening) { output.current_sample_rate = output.default_sample_rate; } + IF_DSD( output.dop_delay_active = false; ) } output.frames_played = 0; UNLOCK; diff --git a/output_alsa.c b/output_alsa.c index 65ab64f..bdb26ff 100644 --- a/output_alsa.c +++ b/output_alsa.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -532,6 +532,7 @@ continue; } LOG_INFO("start error: %s", snd_strerror(err)); + usleep(10000); } } else { start = false; @@ -579,6 +580,12 @@ // EPIPE indicates underrun - attempt to recover UNLOCK; continue; + } else if (err == -EIO) { + // EIO can occur with non existant pulse server + UNLOCK; + LOG_SDEBUG("snd_pcm_delay returns: EIO - sleeping"); + usleep(100000); + continue; } else { LOG_DEBUG("snd_pcm_delay returns: %d", err); } @@ -588,9 +595,15 @@ } // process frames - _output_frames(avail); + frames_t wrote = _output_frames(avail); UNLOCK; + + // some output devices such as alsa null refuse any data, avoid spinning + if (!wrote) { + LOG_SDEBUG("wrote 0 - sleeping"); + usleep(10000); + } } return 0; diff --git a/output_pa.c b/output_pa.c index df049af..46e1cc8 100644 --- a/output_pa.c +++ b/output_pa.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,13 +58,15 @@ LOG_WARN("error initialising port audio: %s", Pa_GetErrorText(err)); return; } - + printf("Output devices:\n"); for (i = 0; i < Pa_GetDeviceCount(); ++i) { - printf(" %i - %s [%s]\n", i, Pa_GetDeviceInfo(i)->name, Pa_GetHostApiInfo(Pa_GetDeviceInfo(i)->hostApi)->name); + if (Pa_GetDeviceInfo(i)->maxOutputChannels) { + printf(" %i - %s [%s]\n", i, Pa_GetDeviceInfo(i)->name, Pa_GetHostApiInfo(Pa_GetDeviceInfo(i)->hostApi)->name); + } } printf("\n"); - + if ((err = Pa_Terminate()) != paNoError) { LOG_WARN("error closing port audio: %s", Pa_GetErrorText(err)); } @@ -328,13 +330,22 @@ static int pa_callback(const void *pa_input, void *pa_output, unsigned long pa_frames_wanted, const PaStreamCallbackTimeInfo *time_info, PaStreamCallbackFlags statusFlags, void *userData) { int ret; + double stream_time; frames_t frames; optr = (u8_t *)pa_output; LOCK; - output.device_frames = (unsigned)((time_info->outputBufferDacTime - Pa_GetStreamTime(pa.stream)) * output.current_sample_rate); + stream_time = Pa_GetStreamTime(pa.stream); + + if (time_info->outputBufferDacTime > stream_time) { + // workaround for wdm-ks which can return outputBufferDacTime with a different epoch + output.device_frames = (unsigned)((time_info->outputBufferDacTime - stream_time) * output.current_sample_rate); + } else { + output.device_frames = 0; + } + output.updated = gettime_ms(); frames = _output_frames(pa_frames_wanted); diff --git a/output_pack.c b/output_pack.c index 744cc8d..ed7845c 100644 --- a/output_pack.c +++ b/output_pack.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/output_stdout.c b/output_stdout.c index 4be963b..e72a927 100644 --- a/output_stdout.c +++ b/output_stdout.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/output_vis.c b/output_vis.c index 7e0967a..2c616e8 100644 --- a/output_vis.c +++ b/output_vis.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ #if VISEXPORT +#include #include #include @@ -113,6 +114,8 @@ sprintf(vis_shm_path, "/squeezelite-%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + mode_t old_mask = umask(000); // allow any user to read our shm when created + vis_fd = shm_open(vis_shm_path, O_CREAT | O_RDWR, 0666); if (vis_fd != -1) { if (ftruncate(vis_fd, sizeof(struct vis_t)) == 0) { @@ -134,6 +137,8 @@ LOG_WARN("unable to open visualizer shared memory"); vis_mmap = NULL; } + + umask(old_mask); } #endif // VISEXPORT diff --git a/pcm.c b/pcm.c index 1ea070b..c59ea5b 100644 --- a/pcm.c +++ b/pcm.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/process.c b/process.c index 907f804..67ca3c2 100644 --- a/process.c +++ b/process.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/resample.c b/resample.c index 3290dc9..2f6fc11 100644 --- a/resample.c +++ b/resample.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/slimproto.c b/slimproto.c index d0c570c..143bdb6 100644 --- a/slimproto.c +++ b/slimproto.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -116,7 +116,7 @@ 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]); - LOG_DEBUG("cap: %s%s%s", base_cap, fixed_cap, var_cap); + LOG_INFO("cap: %s%s%s", base_cap, fixed_cap, var_cap); send_packet((u8_t *)&pkt, sizeof(pkt)); send_packet((u8_t *)base_cap, strlen(base_cap)); @@ -132,7 +132,12 @@ if (status.current_sample_rate && status.frames_played && status.frames_played > status.device_frames) { ms_played = (u32_t)(((u64_t)(status.frames_played - status.device_frames) * (u64_t)1000) / (u64_t)status.current_sample_rate); if (now > status.updated) ms_played += (now - status.updated); + LOG_SDEBUG("ms_played: %u (frames_played: %u device_frames: %u)", ms_played, status.frames_played, status.device_frames); + } else if (status.frames_played && now > status.stream_start) { + ms_played = now - status.stream_start; + LOG_SDEBUG("ms_played: %u using elapsed time (frames_played: %u device_frames: %u)", ms_played, status.frames_played, status.device_frames); } else { + LOG_SDEBUG("ms_played: 0"); ms_played = 0; } @@ -156,10 +161,10 @@ pkt.server_timestamp = server_timestamp; // keep this is server format - don't unpack/pack // error_code; - LOG_INFO("STAT: %s", event); + LOG_DEBUG("STAT: %s", event); if (loglevel == lSDEBUG) { - LOG_SDEBUG("received bytesL: %u streambuf: %u outputbuf: %u calc elapsed: %u real elapsed: %u (diff: %u) device: %u delay: %d", + LOG_SDEBUG("received bytesL: %u streambuf: %u outputbuf: %u calc elapsed: %u real elapsed: %u (diff: %d) device: %u delay: %d", (u32_t)status.stream_bytes, status.stream_full, status.output_full, ms_played, now - status.stream_start, ms_played - now + status.stream_start, status.device_frames * 1000 / status.current_sample_rate, now - status.updated); } @@ -175,7 +180,7 @@ pkt.length = htonl(sizeof(pkt) - 8); pkt.reason = disconnect & 0xFF; - LOG_INFO("DSCO: %d", disconnect); + LOG_DEBUG("DSCO: %d", disconnect); send_packet((u8_t *)&pkt, sizeof(pkt)); } @@ -187,7 +192,7 @@ memcpy(&pkt_header.opcode, "RESP", 4); pkt_header.length = htonl(sizeof(pkt_header) + len - 8); - LOG_INFO("RESP"); + LOG_DEBUG("RESP"); send_packet((u8_t *)&pkt_header, sizeof(pkt_header)); send_packet((u8_t *)header, len); @@ -200,7 +205,7 @@ memcpy(&pkt_header.opcode, "META", 4); pkt_header.length = htonl(sizeof(pkt_header) + len - 8); - LOG_INFO("META"); + LOG_DEBUG("META"); send_packet((u8_t *)&pkt_header, sizeof(pkt_header)); send_packet((u8_t *)meta, len); @@ -215,7 +220,7 @@ pkt_header.id = 0; // id 0 is playername S:P:Squeezebox2 pkt_header.length = htonl(sizeof(pkt_header) + strlen(name) + 1 - 8); - LOG_INFO("set playername: %s", name); + LOG_DEBUG("set playername: %s", name); send_packet((u8_t *)&pkt_header, sizeof(pkt_header)); send_packet((u8_t *)name, strlen(name) + 1); @@ -224,7 +229,7 @@ static void process_strm(u8_t *pkt, int len) { struct strm_packet *strm = (struct strm_packet *)pkt; - LOG_INFO("strm command %c", strm->command); + LOG_DEBUG("strm command %c", strm->command); switch(strm->command) { case 't': @@ -255,7 +260,7 @@ output.state = interval ? OUTPUT_PAUSE_FRAMES : OUTPUT_STOPPED; UNLOCK_O; if (!interval) sendSTAT("STMp", 0); - LOG_INFO("pause interval: %u", interval); + LOG_DEBUG("pause interval: %u", interval); } break; case 'a': @@ -265,7 +270,7 @@ output.skip_frames = interval * status.current_sample_rate / 1000; output.state = OUTPUT_SKIP_FRAMES; UNLOCK_O; - LOG_INFO("skip ahead interval: %u", interval); + LOG_DEBUG("skip ahead interval: %u", interval); } break; case 'u': @@ -278,7 +283,7 @@ LOCK_D; decode.state = DECODE_RUNNING; UNLOCK_D; - LOG_INFO("unpause at: %u now: %u", jiffies, gettime_ms()); + LOG_DEBUG("unpause at: %u now: %u", jiffies, gettime_ms()); sendSTAT("STMr", 0); } break; @@ -290,9 +295,9 @@ u16_t port = strm->server_port; // keep in network byte order if (ip == 0) ip = slimproto_ip; - LOG_INFO("strm s autostart: %c transition period: %u transition type: %u codec: %c", - strm->autostart, strm->transition_period, strm->transition_type - '0', strm->format); - + LOG_DEBUG("strm s autostart: %c transition period: %u transition type: %u codec: %c", + strm->autostart, strm->transition_period, strm->transition_type - '0', strm->format); + autostart = strm->autostart - '0'; sendSTAT("STMf", 0); if (header_len > MAX_HEADER -1) { @@ -303,7 +308,7 @@ codec_open(strm->format, strm->pcm_sample_size, strm->pcm_sample_rate, strm->pcm_channels, strm->pcm_endianness); } else if (autostart >= 2) { // extension to slimproto to allow server to detect codec from response header and send back in codc message - LOG_INFO("streaming unknown codec"); + LOG_DEBUG("streaming unknown codec"); } else { LOG_WARN("unknown codec requires autostart >= 2"); break; @@ -322,12 +327,12 @@ output.next_replay_gain = unpackN(&strm->replay_gain); output.fade_mode = strm->transition_type - '0'; output.fade_secs = strm->transition_period; - LOG_INFO("set fade mode: %u", output.fade_mode); + LOG_DEBUG("set fade mode: %u", output.fade_mode); UNLOCK_O; } break; default: - LOG_INFO("unhandled strm %c", strm->command); + LOG_WARN("unhandled strm %c", strm->command); break; } } @@ -336,7 +341,7 @@ struct cont_packet *cont = (struct cont_packet *)pkt; cont->metaint = unpackN(&cont->metaint); - LOG_INFO("cont metaint: %u loop: %u", cont->metaint, cont->loop); + LOG_DEBUG("cont metaint: %u loop: %u", cont->metaint, cont->loop); if (autostart > 1) { autostart -= 2; @@ -353,14 +358,14 @@ static void process_codc(u8_t *pkt, int len) { struct codc_packet *codc = (struct codc_packet *)pkt; - LOG_INFO("codc: %c", codc->format); + LOG_DEBUG("codc: %c", codc->format); codec_open(codc->format, codc->pcm_sample_size, codc->pcm_sample_rate, codc->pcm_channels, codc->pcm_endianness); } static void process_aude(u8_t *pkt, int len) { struct aude_packet *aude = (struct aude_packet *)pkt; - LOG_INFO("enable spdif: %d dac: %d", aude->enable_spdif, aude->enable_dac); + LOG_DEBUG("enable spdif: %d dac: %d", aude->enable_spdif, aude->enable_dac); LOCK_O; if (!aude->enable_spdif && output.state != OUTPUT_OFF) { @@ -377,7 +382,7 @@ audg->gainL = unpackN(&audg->gainL); audg->gainR = unpackN(&audg->gainR); - LOG_INFO("audg gainL: %u gainR: %u adjust: %u", audg->gainL, audg->gainR, audg->adjust); + LOG_DEBUG("audg gainL: %u gainR: %u adjust: %u", audg->gainL, audg->gainR, audg->adjust); LOCK_O; output.gainL = audg->adjust ? audg->gainL : FIXED_ONE; @@ -461,11 +466,11 @@ while (h->handler && strncmp((char *)pack, h->opcode, 4)) { h++; } if (h->handler) { - LOG_INFO("%s", h->opcode); + LOG_DEBUG("%s", h->opcode); h->handler(pack, len); } else { pack[4] = '\0'; - LOG_INFO("unhandled %s", (char *)pack); + LOG_WARN("unhandled %s", (char *)pack); } } @@ -750,7 +755,12 @@ if (!fgets(player_name, PLAYER_NAME_LEN, fp)) { player_name[PLAYER_NAME_LEN] = '\0'; } else { - LOG_INFO("retrived name %s from %s", player_name, name_file); + // strip any \n from fgets response + int len = strlen(player_name); + if (len > 0 && player_name[len - 1] == '\n') { + player_name[len - 1] = '\0'; + } + LOG_INFO("retrieved name %s from %s", player_name, name_file); } fclose(fp); } diff --git a/slimproto.h b/slimproto.h index 7133dff..77f197d 100644 --- a/slimproto.h +++ b/slimproto.h @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/squeezelite.h b/squeezelite.h index 92f6fd5..0d94b40 100644 --- a/squeezelite.h +++ b/squeezelite.h @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ // make may define: PORTAUDIO, SELFPIPE, RESAMPLE, VISEXPORT, DSD, LINKALL to influence build -#define VERSION "v1.4" +#define VERSION "v1.5" // build detection #if defined(linux) @@ -528,6 +528,8 @@ bool next_dop; // set in decode thread bool dop; bool has_dop; // set in dop_init - output device supports dop + unsigned dop_delay; // set in dop_init - delay in ms switching to/from dop + bool dop_delay_active; #endif }; @@ -581,7 +583,7 @@ bool is_flac_dop(u32_t *lptr, u32_t *rptr, frames_t frames); void update_dop_marker(u32_t *ptr, frames_t frames); void dop_silence_frames(u32_t *ptr, frames_t frames); -void dop_init(bool enable); +void dop_init(bool enable, unsigned delay); #endif // codecs diff --git a/stream.c b/stream.c index fe97c78..8c4fd67 100644 --- a/stream.c +++ b/stream.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/utils.c b/utils.c index 45a3e76..af5d3f0 100644 --- a/utils.c +++ b/utils.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/vorbis.c b/vorbis.c index d739aca..e062ac4 100644 --- a/vorbis.c +++ b/vorbis.c @@ -1,7 +1,7 @@ /* * Squeezelite - lightweight headless squeezebox emulator * - * (c) Adrian Smith 2012, 2013, triode1@btinternet.com + * (c) Adrian Smith 2012-2014, triode1@btinternet.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by