Ejemplo n.º 1
0
        public string GetContentDirectoryXml(IDictionary <string, string> headers)
        {
            var profile = _dlna.GetProfile(headers) ??
                          _dlna.GetDefaultProfile();

            return(new ContentDirectoryXmlBuilder(profile).GetXml());
        }
Ejemplo n.º 2
0
        public ActionResult <DeviceProfile> GetProfile([FromRoute, Required] string profileId)
        {
            var profile = _dlnaManager.GetProfile(profileId);

            if (profile == null)
            {
                return(NotFound());
            }

            return(profile);
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public Task <ControlResponse> ProcessControlRequestAsync(ControlRequest request)
        {
            var profile = _dlna.GetProfile(request.Headers) ??
                          _dlna.GetDefaultProfile();

            return(new ControlHandler(_config, _logger, profile).ProcessControlRequestAsync(request));
        }
Ejemplo n.º 4
0
        private PlaylistItem CreatePlaylistItem(BaseItem item, long startPostionTicks, string serverAddress)
        {
            var deviceInfo = _device.Properties;

            var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
                          _dlnaManager.GetDefaultProfile();

            var mediaSources = item is Audio || item is Video
                ? _dtoService.GetMediaSources(item)
                : new List <MediaSourceInfo>();

            var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId);

            playlistItem.StreamInfo.StartPositionTicks = startPostionTicks;

            playlistItem.StreamUrl = playlistItem.StreamInfo.ToUrl(serverAddress);

            var itemXml =
                new DidlBuilder(profile, _imageProcessor, serverAddress, _dtoService).GetItemDidl(item, _session.DeviceId,
                                                                                                  new Filter());

            playlistItem.Didl = itemXml;

            return(playlistItem);
        }
Ejemplo n.º 5
0
        public ControlResponse ProcessControlRequest(ControlRequest request)
        {
            var profile = _dlna.GetProfile(request.Headers) ??
                          _dlna.GetDefaultProfile();

            var    serverAddress = request.RequestedUrl.Substring(0, request.RequestedUrl.IndexOf("/dlna", StringComparison.OrdinalIgnoreCase));
            string accessToken   = null;

            var user = GetUser(profile);

            return(new ControlHandler(
                       Logger,
                       _libraryManager,
                       profile,
                       serverAddress,
                       accessToken,
                       _imageProcessor,
                       _userDataManager,
                       user,
                       SystemUpdateId,
                       _config,
                       _localization,
                       _channelManager)
                   .ProcessControlRequest(request));
        }
Ejemplo n.º 6
0
        public ControlResponse ProcessControlRequest(ControlRequest request)
        {
            var profile = _dlna.GetProfile(request.Headers) ??
                          _dlna.GetDefaultProfile();

            return(new ControlHandler(_logger, profile, _config).ProcessControlRequest(request));
        }
Ejemplo n.º 7
0
        public Task <ControlResponse> ProcessControlRequestAsync(ControlRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var profile = _dlna.GetProfile(request.Headers) ?? _dlna.GetDefaultProfile();

            var serverAddress = request.RequestedUrl.Substring(0, request.RequestedUrl.IndexOf("/dlna", StringComparison.OrdinalIgnoreCase));

            var user = GetUser(profile);

            return(new ControlHandler(
                       Logger,
                       _libraryManager,
                       profile,
                       serverAddress,
                       null,
                       _imageProcessor,
                       _userDataManager,
                       user,
                       SystemUpdateId,
                       _config,
                       _localization,
                       _mediaSourceManager,
                       _userViewManager,
                       _mediaEncoder,
                       _tvSeriesManager)
                   .ProcessControlRequestAsync(request));
        }
Ejemplo n.º 8
0
        public ControlResponse ProcessControlRequest(ControlRequest request)
        {
            var profile = _dlna.GetProfile(request.Headers) ??
                          _dlna.GetDefaultProfile();

            var serverAddress = request.RequestedUrl.Substring(0, request.RequestedUrl.IndexOf("/dlna", StringComparison.OrdinalIgnoreCase));

            var user = GetUser(profile);

            return(new ControlHandler(
                       Logger,
                       _libraryManager,
                       profile,
                       serverAddress,
                       null,
                       _imageProcessor,
                       _userDataManager,
                       user,
                       SystemUpdateId,
                       _config,
                       _localization,
                       _mediaSourceManager,
                       _userViewManager,
                       _mediaEncoder,
                       XmlReaderSettingsFactory,
                       _tvSeriesManager)
                   .ProcessControlRequest(request));
        }
Ejemplo n.º 9
0
        public ControlResponse ProcessControlRequest(ControlRequest request)
        {
            var profile = _dlna.GetProfile(request.Headers) ??
                          _dlna.GetDefaultProfile();

            return(new ControlHandler(_config, _logger, XmlReaderSettingsFactory, profile).ProcessControlRequest(request));
        }
Ejemplo n.º 10
0
        private PlaylistItem CreatePlaylistItem(BaseItem item, User user, long startPostionTicks, string mediaSourceId, int?audioStreamIndex, int?subtitleStreamIndex)
        {
            var deviceInfo = _device.Properties;

            var profile = _dlnaManager.GetProfile(deviceInfo.ToDeviceIdentification()) ??
                          _dlnaManager.GetDefaultProfile();

            var hasMediaSources = item as IHasMediaSources;
            var mediaSources    = hasMediaSources != null
                ? (_mediaSourceManager.GetStaticMediaSources(hasMediaSources, true, user)).ToList()
                : new List <MediaSourceInfo>();

            var playlistItem = GetPlaylistItem(item, mediaSources, profile, _session.DeviceId, mediaSourceId, audioStreamIndex, subtitleStreamIndex);

            playlistItem.StreamInfo.StartPositionTicks = startPostionTicks;

            playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);

            var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager)
                          .GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);

            playlistItem.Didl = itemXml;

            return(playlistItem);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Creates a new DlnaSessionController.
        /// and logs the session in SessionManager
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns></returns>
        private async Task CreateController(Uri uri, IPAddress localIp)
        {
            var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger).ConfigureAwait(false);

            if (device != null && device.RendererCommands != null)
            {
                var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null)
                                  .ConfigureAwait(false);

                var controller = sessionInfo.SessionController as PlayToController;

                if (controller == null)
                {
                    var serverAddress = GetServerAddress(localIp);

                    sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
                                                                                      _sessionManager,
                                                                                      _itemRepository,
                                                                                      _libraryManager,
                                                                                      _logger,
                                                                                      _dlnaManager,
                                                                                      _userManager,
                                                                                      _dtoService,
                                                                                      _imageProcessor,
                                                                                      _ssdpHandler,
                                                                                      serverAddress);

                    controller.Init(device);

                    var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
                                  _dlnaManager.GetDefaultProfile();

                    _sessionManager.ReportCapabilities(sessionInfo.Id, new SessionCapabilities
                    {
                        PlayableMediaTypes = profile.GetSupportedMediaTypes(),

                        SupportedCommands = new List <string>
                        {
                            GeneralCommandType.VolumeDown.ToString(),
                            GeneralCommandType.VolumeUp.ToString(),
                            GeneralCommandType.Mute.ToString(),
                            GeneralCommandType.Unmute.ToString(),
                            GeneralCommandType.ToggleMute.ToString(),
                            GeneralCommandType.SetVolume.ToString()
                        },

                        SupportsMediaControl = true
                    });

                    _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
                }
            }
        }
Ejemplo n.º 12
0
        private async Task AddDevice(UpnpDeviceInfo info, string location, CancellationToken cancellationToken)
        {
            var uri = info.Location;

            _logger.LogDebug("Attempting to create PlayToController from location {0}", location);

            _logger.LogDebug("Logging session activity from location {0}", location);
            if (info.Headers.TryGetValue("USN", out string uuid))
            {
                uuid = GetUuid(uuid);
            }
            else
            {
                uuid = location.GetMD5().ToString("N", CultureInfo.InvariantCulture);
            }

            var sessionInfo = _sessionManager.LogSessionActivity("DLNA", _appHost.ApplicationVersionString, uuid, null, uri.OriginalString, null);

            var controller = sessionInfo.SessionControllers.OfType <PlayToController>().FirstOrDefault();

            if (controller == null)
            {
                var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _logger, cancellationToken).ConfigureAwait(false);

                string deviceName = device.Properties.Name;

                _sessionManager.UpdateDeviceName(sessionInfo.Id, deviceName);

                string serverAddress;
                if (info.LocalIpAddress == null || info.LocalIpAddress.Equals(IPAddress.Any) || info.LocalIpAddress.Equals(IPAddress.IPv6Any))
                {
                    serverAddress = await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    serverAddress = _appHost.GetLocalApiUrl(info.LocalIpAddress);
                }

                controller = new PlayToController(
                    sessionInfo,
                    _sessionManager,
                    _libraryManager,
                    _logger,
                    _dlnaManager,
                    _userManager,
                    _imageProcessor,
                    serverAddress,
                    null,
                    _deviceDiscovery,
                    _userDataManager,
                    _localization,
                    _mediaSourceManager,
                    _config,
                    _mediaEncoder);

                sessionInfo.AddController(controller);

                controller.Init(device);

                var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
                              _dlnaManager.GetDefaultProfile();

                _sessionManager.ReportCapabilities(sessionInfo.Id, new ClientCapabilities
                {
                    PlayableMediaTypes = profile.GetSupportedMediaTypes(),

                    SupportedCommands = new[]
                    {
                        GeneralCommandType.VolumeDown.ToString(),
                        GeneralCommandType.VolumeUp.ToString(),
                        GeneralCommandType.Mute.ToString(),
                        GeneralCommandType.Unmute.ToString(),
                        GeneralCommandType.ToggleMute.ToString(),
                        GeneralCommandType.SetVolume.ToString(),
                        GeneralCommandType.SetAudioStreamIndex.ToString(),
                        GeneralCommandType.SetSubtitleStreamIndex.ToString(),
                        GeneralCommandType.PlayMediaSource.ToString()
                    },

                    SupportsMediaControl = true
                });

                _logger.LogInformation("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
            }
        }
Ejemplo n.º 13
0
        private static void ApplyDeviceProfileSettings(StreamState state, IDlnaManager dlnaManager, IDeviceManager deviceManager, HttpRequest request, string?deviceProfileId, bool? @static)
        {
            if (!string.IsNullOrWhiteSpace(deviceProfileId))
            {
                state.DeviceProfile = dlnaManager.GetProfile(deviceProfileId);

                if (state.DeviceProfile == null)
                {
                    var caps = deviceManager.GetCapabilities(deviceProfileId);
                    state.DeviceProfile = caps == null?dlnaManager.GetProfile(request.Headers) : caps.DeviceProfile;
                }
            }

            var profile = state.DeviceProfile;

            if (profile == null)
            {
                // Don't use settings from the default profile.
                // Only use a specific profile if it was requested.
                return;
            }

            var audioCodec = state.ActualOutputAudioCodec;
            var videoCodec = state.ActualOutputVideoCodec;

            var mediaProfile = !state.IsVideoRequest
                ? profile.GetAudioMediaProfile(state.OutputContainer, audioCodec, state.OutputAudioChannels, state.OutputAudioBitrate, state.OutputAudioSampleRate, state.OutputAudioBitDepth)
                : profile.GetVideoMediaProfile(
                state.OutputContainer,
                audioCodec,
                videoCodec,
                state.OutputWidth,
                state.OutputHeight,
                state.TargetVideoBitDepth,
                state.OutputVideoBitrate,
                state.TargetVideoProfile,
                state.TargetVideoLevel,
                state.TargetFramerate,
                state.TargetPacketLength,
                state.TargetTimestamp,
                state.IsTargetAnamorphic,
                state.IsTargetInterlaced,
                state.TargetRefFrames,
                state.TargetVideoStreamCount,
                state.TargetAudioStreamCount,
                state.TargetVideoCodecTag,
                state.IsTargetAVC);

            if (mediaProfile != null)
            {
                state.MimeType = mediaProfile.MimeType;
            }

            if (!(@static.HasValue && @static.Value))
            {
                var transcodingProfile = !state.IsVideoRequest ? profile.GetAudioTranscodingProfile(state.OutputContainer, audioCodec) : profile.GetVideoTranscodingProfile(state.OutputContainer, audioCodec, videoCodec);

                if (transcodingProfile != null)
                {
                    state.EstimateContentLength = transcodingProfile.EstimateContentLength;
                    // state.EnableMpegtsM2TsMode = transcodingProfile.EnableMpegtsM2TsMode;
                    state.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;

                    if (state.VideoRequest != null)
                    {
                        state.VideoRequest.CopyTimestamps            = transcodingProfile.CopyTimestamps;
                        state.VideoRequest.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
                    }
                }
            }
        }
Ejemplo n.º 14
0
        async void _deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e)
        {
            string usn;

            if (!e.Headers.TryGetValue("USN", out usn))
            {
                usn = string.Empty;
            }

            string nt;

            if (!e.Headers.TryGetValue("NT", out nt))
            {
                nt = string.Empty;
            }

            string location;

            if (!e.Headers.TryGetValue("Location", out location))
            {
                location = string.Empty;
            }

            // It has to report that it's a media renderer
            if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1 &&
                nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1)
            {
                return;
            }

            if (_sessionManager.Sessions.Any(i => usn.IndexOf(i.DeviceId, StringComparison.OrdinalIgnoreCase) != -1))
            {
                return;
            }

            try
            {
                lock (_nonRendererUrls)
                {
                    if ((DateTime.UtcNow - _lastRendererClear).TotalMinutes >= 10)
                    {
                        _nonRendererUrls.Clear();
                        _lastRendererClear = DateTime.UtcNow;
                    }

                    if (_nonRendererUrls.Contains(location, StringComparer.OrdinalIgnoreCase))
                    {
                        return;
                    }
                }

                var uri    = new Uri(location);
                var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger).ConfigureAwait(false);

                if (device.RendererCommands == null)
                {
                    lock (_nonRendererUrls)
                    {
                        _nonRendererUrls.Add(location);
                        return;
                    }
                }

                var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null)
                                  .ConfigureAwait(false);

                var controller = sessionInfo.SessionController as PlayToController;

                if (controller == null)
                {
                    var    serverAddress = GetServerAddress(e.LocalEndPoint.Address);
                    string accessToken   = null;

                    sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
                                                                                      _sessionManager,
                                                                                      _libraryManager,
                                                                                      _logger,
                                                                                      _dlnaManager,
                                                                                      _userManager,
                                                                                      _imageProcessor,
                                                                                      serverAddress,
                                                                                      accessToken,
                                                                                      _deviceDiscovery,
                                                                                      _userDataManager,
                                                                                      _localization,
                                                                                      _mediaSourceManager,
                                                                                      _config);

                    controller.Init(device);

                    var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
                                  _dlnaManager.GetDefaultProfile();

                    _sessionManager.ReportCapabilities(sessionInfo.Id, new ClientCapabilities
                    {
                        PlayableMediaTypes = profile.GetSupportedMediaTypes(),

                        SupportedCommands = new List <string>
                        {
                            GeneralCommandType.VolumeDown.ToString(),
                            GeneralCommandType.VolumeUp.ToString(),
                            GeneralCommandType.Mute.ToString(),
                            GeneralCommandType.Unmute.ToString(),
                            GeneralCommandType.ToggleMute.ToString(),
                            GeneralCommandType.SetVolume.ToString(),
                            GeneralCommandType.SetAudioStreamIndex.ToString(),
                            GeneralCommandType.SetSubtitleStreamIndex.ToString()
                        },

                        SupportsMediaControl = true
                    });

                    _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error creating PlayTo device.", ex);
            }
        }
Ejemplo n.º 15
0
 public object Get(GetProfile request)
 {
     return(_dlnaManager.GetProfile(request.Id));
 }
Ejemplo n.º 16
0
        async void _deviceDiscovery_DeviceDiscovered(object sender, GenericEventArgs <UpnpDeviceInfo> e)
        {
            if (_disposed)
            {
                return;
            }

            var info = e.Argument;

            string usn;

            if (!info.Headers.TryGetValue("USN", out usn))
            {
                usn = string.Empty;
            }

            string nt;

            if (!info.Headers.TryGetValue("NT", out nt))
            {
                nt = string.Empty;
            }

            string location = info.Location.ToString();

            // It has to report that it's a media renderer
            if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1 &&
                nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1)
            {
                return;
            }

            if (_sessionManager.Sessions.Any(i => usn.IndexOf(i.DeviceId, StringComparison.OrdinalIgnoreCase) != -1))
            {
                return;
            }

            try
            {
                lock (_nonRendererUrls)
                {
                    if ((DateTime.UtcNow - _lastRendererClear).TotalMinutes >= 10)
                    {
                        _nonRendererUrls.Clear();
                        _lastRendererClear = DateTime.UtcNow;
                    }

                    if (_nonRendererUrls.Contains(location, StringComparer.OrdinalIgnoreCase))
                    {
                        return;
                    }
                }

                var uri = info.Location;
                _logger.Debug("Attempting to create PlayToController from location {0}", location);
                var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger, _timerFactory).ConfigureAwait(false);

                if (device.RendererCommands == null)
                {
                    lock (_nonRendererUrls)
                    {
                        _nonRendererUrls.Add(location);
                        return;
                    }
                }

                if (_disposed)
                {
                    return;
                }

                _logger.Debug("Logging session activity from location {0}", location);
                var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null)
                                  .ConfigureAwait(false);

                var controller = sessionInfo.SessionController as PlayToController;

                if (controller == null)
                {
                    if (_disposed)
                    {
                        return;
                    }

                    string serverAddress;
                    if (info.LocalIpAddress == null || info.LocalIpAddress.Equals(IpAddressInfo.Any) || info.LocalIpAddress.Equals(IpAddressInfo.IPv6Loopback))
                    {
                        serverAddress = await GetServerAddress(null).ConfigureAwait(false);
                    }
                    else
                    {
                        serverAddress = await GetServerAddress(info.LocalIpAddress).ConfigureAwait(false);
                    }

                    string accessToken = null;

                    sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
                                                                                      _sessionManager,
                                                                                      _libraryManager,
                                                                                      _logger,
                                                                                      _dlnaManager,
                                                                                      _userManager,
                                                                                      _imageProcessor,
                                                                                      serverAddress,
                                                                                      accessToken,
                                                                                      _deviceDiscovery,
                                                                                      _userDataManager,
                                                                                      _localization,
                                                                                      _mediaSourceManager,
                                                                                      _config,
                                                                                      _mediaEncoder);

                    controller.Init(device);

                    var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
                                  _dlnaManager.GetDefaultProfile();

                    _sessionManager.ReportCapabilities(sessionInfo.Id, new ClientCapabilities
                    {
                        PlayableMediaTypes = profile.GetSupportedMediaTypes(),

                        SupportedCommands = new string[]
                        {
                            GeneralCommandType.VolumeDown.ToString(),
                            GeneralCommandType.VolumeUp.ToString(),
                            GeneralCommandType.Mute.ToString(),
                            GeneralCommandType.Unmute.ToString(),
                            GeneralCommandType.ToggleMute.ToString(),
                            GeneralCommandType.SetVolume.ToString(),
                            GeneralCommandType.SetAudioStreamIndex.ToString(),
                            GeneralCommandType.SetSubtitleStreamIndex.ToString()
                        },

                        SupportsMediaControl = true,

                        // xbox one creates a new uuid everytime it restarts
                        SupportsPersistentIdentifier = (device.Properties.ModelName ?? string.Empty).IndexOf("xbox", StringComparison.OrdinalIgnoreCase) == -1
                    });

                    _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
                }
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error creating PlayTo device.", ex);

                lock (_nonRendererUrls)
                {
                    _nonRendererUrls.Add(location);
                }
            }
        }
Ejemplo n.º 17
0
        public object Get(GetProfile request)
        {
            var result = _dlnaManager.GetProfile(request.Id);

            return(ToOptimizedResult(result));
        }
Ejemplo n.º 18
0
        private async Task AddDevice(UpnpDeviceInfo info, string location, CancellationToken cancellationToken)
        {
            var uri = info.Location;

            _logger.Debug("Attempting to create PlayToController from location {0}", location);
            var device = await Device.CreateuPnpDeviceAsync(uri, _httpClient, _config, _logger, _timerFactory, cancellationToken).ConfigureAwait(false);

            _logger.Debug("Logging session activity from location {0}", location);
            var sessionInfo = await _sessionManager.LogSessionActivity(device.Properties.ClientType, _appHost.ApplicationVersion.ToString(), device.Properties.UUID, device.Properties.Name, uri.OriginalString, null).ConfigureAwait(false);

            var controller = sessionInfo.SessionController as PlayToController;

            if (controller == null)
            {
                string serverAddress;
                if (info.LocalIpAddress == null || info.LocalIpAddress.Equals(IpAddressInfo.Any) || info.LocalIpAddress.Equals(IpAddressInfo.IPv6Any))
                {
                    serverAddress = await _appHost.GetLocalApiUrl(cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    serverAddress = _appHost.GetLocalApiUrl(info.LocalIpAddress);
                }

                string accessToken = null;

                sessionInfo.SessionController = controller = new PlayToController(sessionInfo,
                                                                                  _sessionManager,
                                                                                  _libraryManager,
                                                                                  _logger,
                                                                                  _dlnaManager,
                                                                                  _userManager,
                                                                                  _imageProcessor,
                                                                                  serverAddress,
                                                                                  accessToken,
                                                                                  _deviceDiscovery,
                                                                                  _userDataManager,
                                                                                  _localization,
                                                                                  _mediaSourceManager,
                                                                                  _config,
                                                                                  _mediaEncoder);

                controller.Init(device);

                var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
                              _dlnaManager.GetDefaultProfile();

                _sessionManager.ReportCapabilities(sessionInfo.Id, new ClientCapabilities
                {
                    PlayableMediaTypes = profile.GetSupportedMediaTypes(),

                    SupportedCommands = new string[]
                    {
                        GeneralCommandType.VolumeDown.ToString(),
                        GeneralCommandType.VolumeUp.ToString(),
                        GeneralCommandType.Mute.ToString(),
                        GeneralCommandType.Unmute.ToString(),
                        GeneralCommandType.ToggleMute.ToString(),
                        GeneralCommandType.SetVolume.ToString(),
                        GeneralCommandType.SetAudioStreamIndex.ToString(),
                        GeneralCommandType.SetSubtitleStreamIndex.ToString()
                    },

                    SupportsMediaControl = true,

                    // xbox one creates a new uuid everytime it restarts
                    SupportsPersistentIdentifier = (device.Properties.ModelName ?? string.Empty).IndexOf("xbox", StringComparison.OrdinalIgnoreCase) == -1
                });

                _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
            }
        }