Skip to content

UPnP Server module implementation

Alaric Senat requested to merge asenat/vlc:upnp_server into master

This MR follows discussions about implementation that can be found here:

These changes implement a fully functional UPNP server exposing the medialibrary content on the network.

Version 3

The recent changes on the medialibrary introduced a way to whitelist media in a generic manner to all the network interface. The UPnP server now only list media that have been explicitly marked as public by the user. This mitigates a lot of the privacy issues talked earlier. To be clear, this merge request is only the start of the usage of the public media sharing, I plan to port this medialibrary capability to at least the HTTP interface. The MR does not provide a way to mark media as public/private, this will be done later.

Additionally, I tried to lighten up the merge request:

  • The transcoding output of the server will be submitted in a subsequent MR
  • The Unit tests will also be for a subsequent merge request as I'm introducing a small C++ helper that I would like to make available across all the codebase
  • The commits have been cleaned up, and re-arranged
  • The submitted code has been reformatted and cleaned up and updated to C++17 capabilities.

Original Description

Extracted from the former commit message:

This is the first implementation of a vlc upnp server module.
  The module behave as an interface, it works in pair with the
  medialibrary API to expose most of its content.
  Here is a list of the server main features:
    - Very straightforward to deploy, you start vlc with `-I upnp` and it
      simply exposes the medialibrary on the local network.
    - The server automatically exposes downscaled versions of your videos
    - While the DLNA spec is far from being fully supported, a lot of DLNA
      clients are supported.
    - DLNA's "time based seeking" during transcoding is supported.
    - Special transcoding profiles depending on client's user-agent are
      suported, for the moment only the PLAYSTATION3 has differents
      profiles hardcoded in the source code but it should be extensible to
      other specific clients eventually using config files.
  The module is split into different parts, here's a quick overview:
    - upnp_server.cpp: The core of the module, all the interactions with
      libupnp are done here, this file brings all the module parts
    - cds/*: The "ContentDirectory Service", represents and implements the
      server file hierarchy, in our case, it mostly reflect the
      medialibrary content.
    - sout.cpp: The access out upnp server submodule internals. Used in
      media transcoding to make the connection between the vlc transcode
      pipeline output and the upnp HTTP callbacks.
    - xml_wrapper: Wrap the xmli library with modern c++ code to fit the
      codebase better.
    - test/*: Unit tests
  The upnp_server module is based on Hamza Parnica's great proof of
Edited by Alaric Senat

Merge request reports