UPnP DLNA support in Elisa

It has been a long time since I have written about Elisa. In the meantime, I have been busy working on Elisa and also some other personal side projects. I plan to write about them later.

One area, Elisa is not fulfilling my needs is the support for UPnP DLNA. I am working actively on that but this is a lot of work and my plan is to probably release a preview of it in the next release to get feedback on it.

What is UPnP/DLNA ?

That is a way to connect different devices on your home network to share, play and control multimedia content.

One of the typical use case is to have some content stored on a NAS and use your smartphone to play it on some smart speakers.

This specification is important to me for the following reasons:

  • This is an ISO standard and is currently documented and anybody can implement support for it (as far as I understand) ;
  • This is supported on at least some widely used smart speakers (like some my family have) ;
  • This allows easy and seamless usage without requiring any configuration ;
  • This is one of the best existing solution and has wide support in existing OS and music players.

Current Status in Elisa

I have started some years ago a library written using Qt and leveraging the excellent KDSOAP library from KDAB . It is implementing both parts of UPnP:

  • The SSDP discovery protocol. It is based on HTTP, UDP and multi cast. This part of the library is partially covered by automated tests and should be mostly ready ;
  • The UPnP SOAP based communications (allow to browse music in remote servers, control a remote player, …). This part is mostly working but not enough documented nor covered by automated tests. It is developed in parallel with the matching code in Elisa.

I plan to continue working on this library to tidy it up, improve the documentation and write automated tests.

The main reason I started writing my own code is that the existing libraries I tested would require writing C code to generate XML trees using malloc and free. I am not feeling confident doing that. The other reason is that the amount of code I had to write is minimal due to using an existing SOAP library. At the moment, the main challenge is writing automated tests to stabilize the current code.

In Elisa, there is code using that library that integrates discovery of music servers. One can browse them and enqueue individual tracks for local play in Elisa.

This integration work has needed quite some re-engineering of existing code. I have used this opportunity to apply the lessons I have learned during the last years working on it. Quite clearly, this was sorely needed.

This led me to understand that re-engineering as soon as you understand what needs to be improved is much better than waiting and doing it later. Quite clearly, the features being worked by me during the past months have been hard to integrate because the code was not ready for it. The situations will soon be much better.

Next steps

The next steps is to finish a first usable state . I hope to be able to get this merged on the next stable release of Elisa. This first release will be done to get feedback on the stability of the code. I have seen exiting UPnP media servers return broken answers. I still need to find workarounds for those bugs. I suspect I will need to add a few of them.

I want to move the UPnP library through review by KDE developers to be able to make a proper release. Until that review, I will have to make beta releases. Without those beta releases, it will be hard for people to package this code and to distribute it to users.

This should also enable Elisa to interact with remote devices. That should help to integrate the support for more device types like ChromeCast for example.

Feedback is very much welcome on this work