UPnP / DLNA Media Server for MediaPortal 2 (2 Viewers)

McGoober

Retired Team Member
  • Premium Supporter
  • August 13, 2006
    122
    105
    Cambridge, UK
    Home Country
    United Kingdom United Kingdom
    I've been building a plugin for MediaPortal 2 Server to allow UPNP/DLNA devices to access media from the media library.

    Background: A while ago I used to use windows mediacenter. No matter how hard I tried it just wouldn't stay stable. So I went out and bought an Internet telly with DLNA to replace it. Now I needed a DLNA media server to serve all my digital content. I tried Serviio but that did a terrible job. So I set out on a quest to find some open software that I could modify for my own purposes. MediaPortal 2 was perfect since it already had a UPnP implementation.

    I'm going to share my development progress on this thread. Comments are of course welcome at anytime.

    After a few months of initial development, I managed to get my MediaPortal 2 Server plugin to serve up an MP3 to my iPhone (MediaConnect App). The MP3 was the main theme to Skyrim (a great game by the way). Later I was getting some of my photo library displayed.
    However there is still a long way to go, so stay tuned.

    Edits by morpheus_xx:

    The development continued and we created new test snapshots of this plugin!

    2014-11-26:
    Edits by MrTechno:

    Latest version of the code - https://github.com/MediaPortal/MediaPortal-2/tree/FEAT_DLNA_v2

    2015-03-08:
     
    Last edited by a moderator:

    McGoober

    Retired Team Member
  • Premium Supporter
  • August 13, 2006
    122
    105
    Cambridge, UK
    Home Country
    United Kingdom United Kingdom
    Re: Plugin: UPnP / DLNA Media Server

    Had another coding session tonight. Found a rather bad performance issue when browsing so I probably need to repost the plugin. I also ran the UPnP developer tools device validator which found a load of problems. However there is good news, I may have found the problem with the ResourceAccessModule. It's to do with mime types. After a quick hacky change I got a mp4 video to play on my iPhone woot!
     

    McGoober

    Retired Team Member
  • Premium Supporter
  • August 13, 2006
    122
    105
    Cambridge, UK
    Home Country
    United Kingdom United Kingdom
    Re: Plugin: UPnP / DLNA Media Server

    I've uploaded a new version of the plugin (v1.01). Let me know how things are going with it, I love to hear a story me... Good or Bad ;)
     

    bighick

    Portal Pro
    July 6, 2009
    72
    8
    Home Country
    United States of America United States of America
    Re: Plugin: UPnP / DLNA Media Server

    Will this also transcode? IE: let my ps3 play MKV's?
     

    McGoober

    Retired Team Member
  • Premium Supporter
  • August 13, 2006
    122
    105
    Cambridge, UK
    Home Country
    United Kingdom United Kingdom
    Re: Plugin: UPnP / DLNA Media Server

    Hey bighick, Yes that is the eventual idea. But right now, no. At the moment the Plugin will let UPnP controllers browse the contents of your shares from the media library and will serve up the file content but not transcode it. My goal as described above is to get it to work with my Sony Bravia telly which will have similar media restrictions to your PS3 (i.e requires transcoding) . So stay tuned :)
     

    McGoober

    Retired Team Member
  • Premium Supporter
  • August 13, 2006
    122
    105
    Cambridge, UK
    Home Country
    United Kingdom United Kingdom
    Re: Plugin: UPnP / DLNA Media Server

    I've been doing some debugging on my TV to figure out why it won't accept any URL's from mediaportal. It seems like it's all down to some DLNA specifics, but without the spec it's really hard.... However, last night I have managed to find them. Woot!. After a quick scan I came to the conclusion that I was going to need (I kinda knew this anyway) to have my own HTTP resource access code. This means taking some of the ResourceAccessModule code and modifying it with my own with changes specific for DLNA. Mine also differs in that it will be taking a media item guid rather than a resource path, which means I can resolve the request to a database item and get the extra metadata DLNA is going to need. Last night it was starting to work (thanks to the mediaportal guys for making plugins hook almost anything) and I was able to serve up an MP3 (Skyrim again) to my phone. My next challenge is to remotely interrupt my wife's TV watching of an evening with full Skyrim rendition :) oh the joy of UPnP pranking.
     

    MJGraf

    Retired Team Member
  • Premium Supporter
  • January 13, 2006
    2,478
    1,385
    Re: Plugin: UPnP / DLNA Media Server

    Hi McGoober,

    first of all, I wanted to say thank you so much for taking this challenge! DLNA is a killer feature, that will make MP2 even more THE media app!

    What I discovered with a very short test is first of all that the binaries in the first post do not work anymore with the current dev-branch. The reason is that the name "PictureAspect" was changed to "ItemAspect. It has to be changed twice in the code. After that, the source code above compiles against the current dev-branch - only showing some warnings.

    Unfortunately, I don't have much time atm to really test this plugin in detail, but I will definitely come back with a full bug report with logs. Nevertheless some first observations:
    I used my iPad with the mediaConnect app.
    MP2-Server is shown as DLNA device.
    I can browse my shares, but it seems as if the directory name of the share is displayed instead of the share name (the directory in my case is "Tagged", while the name I gave this share is "Music". However, "Tagged" is displayed in mediaConnect after I select "Shares".
    When browsing a large collection like my music collection, it gets really slow - but I think you already mentioned this above.
    When I try to open a Picture, I get the error "Resource Unavailable; The resource for 'xyz' is currently unavailable.
    When I browse my music collection, it works if I only browse directories with other sub-directories in it. As soon as I select a directory in which actual music files in it, I get the error "UPnP Error: Action Failed. Error code = 501"

    Nevertheless, for the short development time of this plugin, the result is already amazing. As mentioned, I'll provide proper bug reports as soon as I find the time.

    In the meantime - please keep up this excellent work!

    Michael
     

    McGoober

    Retired Team Member
  • Premium Supporter
  • August 13, 2006
    122
    105
    Cambridge, UK
    Home Country
    United Kingdom United Kingdom
    Re: Plugin: UPnP / DLNA Media Server

    Hey MJGraf, thanks for the comments, keep em coming.

    I happened to name my shares the same as my folders, whoops, I'll get that sorted.
    As for the error code 501, I'll need the exception that's in the logs to figure out what went on there. You should find a file in ...

    C:\ProgramData\Team MediaPortal\MP2-Server\Log\Server.log

    At least that's where mine is :)
    I've been working on the DLNA compatibility, which is rather slow going. Lots of extra code to support the rather specific encoding handshaking. Still I reckon I'll get a new version out tonight, that will be a step closer.

    New plugin uploaded (1.02).

    Fix for PictureAspect code change.
    Added own resource access http module.
    Really bad implementation of protocolInfo (will get better I promise)

    MediaConnect will now play an MPEG file, an MP3 and an MP4 avi.
     

    Users who are viewing this thread

    Top Bottom