philippe44 / AirConnect

Use AirPlay to stream to UPnP/Sonos & Chromecast devices
Other
3.46k stars 217 forks source link

CCA only has audio: Local meta data and command line transport control? #166

Closed OneBobone closed 5 years ago

OneBobone commented 5 years ago

Hello! Very nice project that you are developing. Congratulations! I am trying to integrate Airconnect to an older WHA system: Nuvo Grand Concerto. CCA has been very useful for this. I am also using HomeSeer and a CCA plugin.

Not sure what is supposed to work, but I cannot get get NEXT and PREVIOUS to work nor basic metadata to the CCA (as seen on GH). Only Audio and PAUSE/STOP.

If this could work, it would obviously be great but, I am actually looking for:

Is this possible? I am running on Windows 7 but could run on Cygwin as well.

Thanks,

Bob

philippe44 commented 5 years ago

Hi - Next and Previous can only come from the AirPlay controller, so you would have to detect it and send commands to it. The raopcore.c gives you a good idea on how to detect active-remote and submit commands to these (look at the general raop/dmcp on the internet as well).

Understand that AirPlay is virtually an audio pipe with an OutofBand control to send volume commands & metadata info (RTSP). Once playback has started, everything is just a looong track and whenever metadata changes, AirPlay controller sends that update OoB using RTSP.

Unfortunately, CC devices do not work that way, they want each track to be an individual URL (if you want metadata to be displayed) and there is no OoB control. So to some extend, AirPlay is a webradio to the CC and unfortunately CC does not even accept shoutcast in-band metadata update for mp3/aac, so there is no way to update it

Having each metadata & artwork update piped by AirConnect and having AirConnect offer a command line interface to notify back the AirPlay controller is a lot of work that is really out the scope of what I'm doing. I'm not even sure that you could do anything with these from a CC point of view. I assume this is more for the WHA needs, right?

OneBobone commented 5 years ago

Yes, you are perfectly right, the CCA would just be a DAC in sense, but that is a valuable starting point. As some metadata is visible in the logs, I was assuming that album art was also passing through the airconnect engine? With your knowhow, do you think that it is possible to use raopcore.c with Windows to control Airplay? (I forgot to mention that “volume” control works.)

philippe44 commented 5 years ago

The album art is passed as a data blob (not an an URL), I just discard it currently. It's done in handle_rtsp(), and should be added to a SET_PARAMETER subsection. The headers will tell you the format and the body will contain the artwork. You can control the AirPlay controller, I already do that to send play, pause, stop and volume when I detect something happened on the CCA side, I forward to the AirPlay master. It's done in raop_notify(). You could use the same method to send commands like next and prev to the AirPlay controller

OneBobone commented 5 years ago

Hello Phillipe, Thank you very much for your kind input. All of what you write sounds quite promissing! I may however have given you the wrong impression of my skills. I am not a C++ programmer and Linux abilities are quite limited.

Do you not need to have a session unique token or similar to control Airplay on an iDevice? My need is to get this to work on Windows. I have also tried to get Shairport-Sync to work, but there the control problems had to do with dbus compatibilty with Cygwin, according to the friendly developer.

How would you suggest that I proceed?

Many thanks, Bob

philippe44 commented 5 years ago

Hi Bob - Unfortunately, these modifications require C-level programming and if you are not familiar with that, it's going to be impossible. You would need, in the C program, to create a namedpipe a send metadata (including image) to it, a bit like shairport-sync does. You would also need to find a way to get input from another pipe, maybe stdin to direct command to the player, adn this is probably the most difficult one. I would even not do that from AirConnect, I would in fact use external applications to detect the remote and connect with it.

OneBobone commented 5 years ago

You would also need to find a way to get input from another pipe, maybe stdin to direct command to the player, and this is probably the most difficult one. I would even not do that from AirConnect, I would in fact use external applications to detect the remote and connect with it.

Thank you! My thinking was that since you already manage to command the Airplay controller from Airconnect, that it might be possible to access those commands by exposing them in some way? This would be valuable when control from e.g. CCAs is not (directly) possible. What other project would you have in mind that could work alongside with Airconnect? It would have to be in the same airplay session, right?

philippe44 commented 5 years ago

I don't have in mind a specific project, but you don't need to use the same airplay session, you just need to detect controller and send them commands. What you describe is absolutely possible, I just cannot put that on my todo list currently

OneBobone commented 5 years ago

I don't have in mind a specific project, but you don't need to use the same airplay session, you just need to detect controller and send them commands. What you describe is absolutely possible, I just cannot put that on my todo list currently

Ok, fair enough. I respect that. Just to be sure, by controller you mean e.g. a typical iPhone?

philippe44 commented 5 years ago

yes