UPnP / DLNA Media Server for MediaPortal 2 (1 Viewer)

henso

Development Group
  • Team MediaPortal
  • February 16, 2012
    2,341
    831
    Home Country
    Denmark Denmark
    What a mess... I told you I have no experience with UPnP.... ;)
    When I say device I mean the physical device like a TV, XBox, PS3 or whatever.

    3. In the MP2 server there's an interface called ILocalizedDeviceInformation which content is what is sent to the TV when it requests it from the MP2 server. I need to be able to send different ILocalizedDeviceInformation depending on which TV type is requesting the information. The method DvDevice:AddDeviceDescriptionsRecursive is responsible for sending the ILocalizedDeviceInformation information using the property _deviceInformation. So I need to be able to override _deviceInformation depending on what TV type is connecting.
    4. This is just something I read about, so what I think I need is being able to request the TV's ILocalizedDeviceInformation somehow. I believe this can be done by sending an M-SEARCH to the TV and waiting for it to respond. Is this possible with the current UPnP classes in MP2?
    5. The MP2 server is using an IResourceServer interface to to listen for file requests. The TV reads the content library info from the MP2 server over DLNA. Inside this info are HTTP links used to access the file (like http://MP2ServerIP:Port/GetDlnaResource/MediaItemGuid). The TV then downloads the file stream using this link which is established using a client (HTTP client) connection to the MP2 resource server (HTTP server). If the TV then stops playing the file it will disconnect this client from the MP2 resource server. So the streaming part has nothing to do with UPnP. The problem is that in the HTTP module used for streaming the file there is no indication that the TV is no longer connected and therefore it keeps streaming to a client that is no longer connected.
     

    Albert

    MP2 Developer
  • Premium Supporter
  • February 18, 2008
    1,297
    1,130
    46
    Freiburg im Breisgau, Germany
    Home Country
    Germany Germany
    3. Why do you think you need to use different instances of ILocalizedDeviceInformation? Actually, this data contains the information about a device. This data is normally always the same, independent from the client. The only thing which can be adapted is: The data can (and will) be sent in different languages for clients of different locales.
    4. For me, it sounds as if you want to something which is against the idea of UPnP/AV. The idea is that a client (=control point) connects to a server (=device), not vice versa. You should not need to know anything about your client (=the TV which requests data from your device). But if you really want to get to know which devices are present in the network, yes, you can do that with the UPnP lib. Take a look at MediaPortal\Tools\UPnPTools\UPnPDeviceSpy.
    5. Do I understand it correctly that you have already implemented code using the UPnP library to make your TV request media items via the MP2's ResourceAccessModule? Originally, that ResourceAccessModule wasn't written for transferring media items to DLNA devices, but now, as you say it - you're right, why not. But the problem that the TV just breaks the connection and the ResourceAccessModule doesn't notice that - that might be a problem with our HTTP server which is used by the MP2 resource server. Actually, the HTTP server should notice the connection break and raise an exception which should make the ResourceAccessModule stop sending the file... If I have time, I'll check if that works correctly.
     

    henso

    Development Group
  • Team MediaPortal
  • February 16, 2012
    2,341
    831
    Home Country
    Denmark Denmark
    3. Some TV manufacturer lock their TV's so they only work with their own DLNA server which have specific device information. So to support different TV's from different manufacturers the device information needs to be different for the same device. It is so to speak to cheat the TV into thinking it is connected to the manufacturer own DLNA server.
    4. Thanks, I will try to see if that helps me.
    5. I'm not using the default ResourceAccessModule but a created HttpModule called DlnaResourceAccessModule., But basically they are the same.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    3. Some TV manufacturer lock their TV's so they only work with their own DLNA server which have specific device information. So to support different TV's from different manufacturers the device information needs to be different for the same device. It is so to speak to cheat the TV into thinking it is connected to the manufacturer own DLNA server.

    oh, when will the manufacturers learn... locking down the devices aren't anything but just an annoyance to the end users.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    To solve point 3), I think the only solution is to let your plugin publish several devices, each for a specific manufacturer. All devices can use the same backend functions.

    It would be good that these device details could be added from some configuration instead of having to recompile the source code.
     

    henso

    Development Group
  • Team MediaPortal
  • February 16, 2012
    2,341
    831
    Home Country
    Denmark Denmark
    To solve point 3), I think the only solution is to let your plugin publish several devices, each for a specific manufacturer. All devices can use the same backend functions.

    I don't think that would be practical. Some of the physical devices are able to see all the published devices and there could be many if there is one per manufacturer.
    I propose a solution as follows (in DvDevice.cs):
    Code:
    public delegate void GetDeviceInfoForEndpointDlgt(EndpointConfiguration config, ref ILocalizedDeviceInformation deviceInfo);
    public class DvDevice : IDisposable
    {
      public GetDeviceInfoForEndpointDlgt DeviceInfoHook = null;
      ...
      internal void AddDeviceDescriptionsRecursive(XmlWriter writer, EndpointConfiguration config, CultureInfo culture)
      {
          ...
          GetDeviceInfoForEndpointDlgt dih = DeviceInfoHook;
          ILocalizedDeviceInformation deviceInformation = null;
          if (dih != null)
            dih(config, ref deviceInformation);
          if (deviceInformation == null)
          {
            deviceInformation = _deviceInformation;
          }
          ...
      }
      ...
    }

    I can then link device information to endpoint configuration and saved it a file. Next time the device is published this information is already loaded and then I can override the device information sent depending on endpoint configuration. Would this be possible? :unsure:

    It would be good that these device details could be added from some configuration instead of having to recompile the source code.

    The device information needed will of course be defined in a config file, so no recompiles should be needed. ;)
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I have some new idea for extending this plugin:

    With help of other devs I started the work on a native MP2-TV solution. This allows us to watch TV channels without the need of MP1-TvServer.

    We should extent this plugin to expose TV channels as "video items" and allow playback on remote devices. When such a "file" is requested, MP2-TV plugin tunes the channel and we can stream the content to the client.

    Do you think this is possible?
     

    henso

    Development Group
  • Team MediaPortal
  • February 16, 2012
    2,341
    831
    Home Country
    Denmark Denmark
    I kind of had the same idea and was going to test it with MP1 TV server at some point. To my current knowledge I believe it is possible, but I will know for sure once I get around to testing it.
     

    Valk

    Portal Pro
    February 25, 2006
    302
    108
    Home Country
    Australia Australia
    You shouldn't have an issue streaming live tv via upnp, when I developed StreamTV while I initially made it for a friend who wanted to stream via the web to a location without any TV signal I also wanted to stream to my now dead PS3.

    I had it going using MP1-TvServer > PS3 Media Server > PS3 successfully.

    If I remember right just report the content length as 0 and send away (if you can get the size of each frame and set the buffer accordingly it will stop any jitter).
     

    Users who are viewing this thread

    Top Bottom