mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.27k stars 573 forks source link

pipe output #108

Closed noelhibbard closed 9 years ago

noelhibbard commented 9 years ago

I cloned the latest dev branch and configured like this: ./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-systemv --with-pipe

And then when I use this command line it just sits there (Never says "startup") and I don't see it advertised: shairport-sync -a "Test" -o pipe -- /tmp/airpipe

Any ideas?

mikebrady commented 9 years ago

Yep – looks like a bug. If you do what you've just done and then do $cat /tmp/airpipe it will work. Sorry. Will look at it later.

noelhibbard commented 9 years ago

Oh thank god... I thought I was starting to loose my mind because at some point in testing I had it working. No doubt I read the pipe before looking for it on my iDevice. I think I can work around this for testing. Thanks for the very fast response.

mikebrady commented 9 years ago

Thanks. I must have made the same mistake myself. It might take a few days to fix...

mikebrady commented 9 years ago

I've push out an update – 2.3.10 – just now which, I think, fixes this problem. The changes have been fairly extensive, so I'd be grateful for any feedback.

noelhibbard commented 9 years ago

Thanks Mike, I will give it a shot over the next few days.

noelhibbard commented 9 years ago

I had a few minutes so I went ahead and gave it a spin. The bug is fixed and overall something is working different with pipe handling because now it seems to keep the pipe open. I am now able to pipe the output over the little sample script that comes with note_airtunes and it works perfect. I was able to pipe it fine before too but if I switched targets the pipe would close and then node_airtunes would close. Thanks again Mike! I think I finally have everything I need to build an AirPlay proxy that will output to multiple AirPlay targets.

mikebrady commented 9 years ago

Thanks for the feedback. You're right about the pipe staying open – that's a behaviour I explicitly included: so long as it has something reading from it, the pipe should stay open now until Shairport Sync terminates.

noelhibbard commented 9 years ago

Okay, one more request. Would it be possible to add another command line option to the pipe backend that sends silence to the pipe between track changes, pauses and seeks? I ask because I have managed to get LMS (SqueezeServer) to read the pipe but as soon as I pause, change tracks or seek it breaks the playback. When changing tracks, or seeking it looks like data stops flowing to the pipe for a bit. When pausing the data also stops flowing. If it could pad with silence I think LMS would be happy.

But so far I am able to AirPlay to LMS and then LMS can output to multiple rooms in sync. I can use the iPeg iOS app to select rooms and volume levels. It just breaks as soon as I use any transport controls on the AirPlay stream. I'm so close. :)

mikebrady commented 9 years ago

So, I've been thinking about this. It would be quite tricky, but probably possible, to add silence between pauses and track changes for the pipe (not for alsa). It would take a good deal of readjustment of the way Shairport Sync deals with initial synchronisation, among other things. However, even if it was done, would it be sufficient? As things stand, even if you don't use any controls, when a play session ends, data stops flowing five seconds later. The only way to avoid that would be to continue to send silence even after the session ended, in other words, forever. That doesn't seem right, does it?

noelhibbard commented 9 years ago

Yeah I suspected it wouldn't be a two line change. I did think about what you are saying though (sending silence between sessions) which is why I thought it would be best to make it an option to function this way rather than the default. Would it really be harmful to send silence 24/7 though? I know it doesn't sound ideal but not really harmful. Unless I am missing something.

mikebrady commented 9 years ago

Overall, as soon as a play session starts, one would have to introduce silence into every single gap, even between play sessions coming from different sources. For a kind of symmetry, one might as well starting sending silence into the pipe as soon as it's opened. It could be done, I'd say, with a bit of time and care, but it does seem a bit hacky to me, TBH. I'll give it some more thought.

mikebrady commented 9 years ago

Hi Noel. I've been thinking a bit about this, and I going to respectfully decline your request -- as I said before, it strikes me as being a hack -- a tacked-on feature to work around a problem with another piece of software, viz. LMS. Sorry to rain on your parade, but I don't think it would be the right approach.