mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.3k stars 574 forks source link

send DACP-ID and Active-Remote headers in metadata and iTunes DACP address #86

Closed roblan closed 9 years ago

roblan commented 9 years ago

It would be awesome if there would be DACP-ID and Active-Remote headers in shairport-sync's metadata.

Those headers would be very useful in creating 'remote' for AirPlay source. As described in: http://www.sugrsugr.com/index.php/airplay-prev-next/

Even more awesome would be if there would be iTunes DACP address (and port) in metadata as well (this seems to be a little more complicated) but I could manage without it ;)

joerg-krause commented 9 years ago

+1. Nice feature indeed.

Unfortunately, some parts of the DACP client are copied from other sources without any licence information (eg avahi). And I would replace calling curl with system() by using libcurl.

As I started working on this I would like to help with the implementation.

mikebrady commented 9 years ago

Nice idea. I think I could get that stuff out as metadata. Sometime next week...

mikebrady commented 9 years ago

Getting the port is going to be a bit complicated; getting the other stuff should be straightforward (famous last words, I know...).

roblan commented 9 years ago

I will be supper happy having only Active-Remote and DACP-ID. Getting them should be fairly easy, cause they are present in debug messages already :) iTunes DACP address (with port) in the other hand seems to be a little more complicated, cause it requires avahi lookup, which probably I would have to make either way (to know if it is "full" DACP or AirPlay stripped version), so maybe there is no point?

It would force also a slightly change in returned metadata format I think, because one iTunes DACP can have two addresses (IPv4 and IPv6).

If I were You I wouldn't bother with address and port ;)

mikebrady commented 9 years ago

Hi there. I've just added that stuff in the whaale branch. I'll pull it to the development branch in the next few days and delete the branch. Let me know what you think.

roblan commented 9 years ago

I've checked it yesterday and it seems to work fine :) But I haven't seen a shairport-sync snam metadata... But maybe it's an issue of my metadata parser.

mikebrady commented 9 years ago

Good. I'll check the snam thing too. Could easily have messed it up. [Update] Yep, I didn't include the code, duh. I'll include it later today.

mikebrady commented 9 years ago

I've pushed another update. The semantics of snam have changed a bit.

When a play session is initiated by a source, it attempts to reserve the player by sending an "ANNOUNCE" packet. Typically, a source device name and/or a source "user agent" is sent as part of the packet. The "user agent" is usually the name of the sending application along with some more information. If metadata is enabled, the source name, if provided, is emitted as a metadata item with the type ssnc and code snam and similarly the user agent, if provided, is sent with the type ssnc and code snua. The metadata is emitted at the time the play session is initiated, whereas previously the sndr item was delayed.

The metadata item sndr is no longer sent in metadata. It's been replaced by snam and snua.

roblan commented 9 years ago

Does iTunes 12.1.2 sends snam? When I connect using iPhone there is snam in metadata, but iTunes gives me only snua?

mikebrady commented 9 years ago

Yep, that's been my experience too...