Exemplo n.º 1
0
        public SettingsWindow(TranscodeSettings settings)
        {
            InitializeComponent();

            this.settings    = settings ?? throw new ApplicationException("new SettingsWindow(): settings is null");
            this.DataContext = this.settings;
        }
Exemplo n.º 2
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)
        {
            if (!IsUriValid(uri))
            {
                return;
            }

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

            if (device != null && device.RendererCommands != null && !_sessionManager.Sessions.Any(s => string.Equals(s.DeviceId, device.Properties.UUID) && s.IsActive))
            {
                var transcodeProfiles = TranscodeSettings.GetProfileSettings(device.Properties);

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

                var controller = sessionInfo.SessionController as PlayToController;

                if (controller == null)
                {
                    sessionInfo.SessionController = controller = new PlayToController(sessionInfo, _sessionManager, _itemRepository, _libraryManager, _logger, _networkManager);
                }

                controller.Init(device, transcodeProfiles);

                _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
            }
        }
Exemplo n.º 3
0
        private static DlnaProfile[] GetDefaultProfiles()
        {
            var profile0 = new DlnaProfile
            {
                Name              = "Samsung TV (B Series) [Profile]",
                ClientType        = "DLNA",
                FriendlyName      = "^TV$",
                ModelNumber       = @"1\.0",
                ModelName         = "Samsung DTV DMR",
                TranscodeSettings = TranscodeSettings.GetDefaultTranscodingSettings()
            };

            var profile1 = new DlnaProfile
            {
                Name              = "Samsung TV (E/F-series) [Profile]",
                ClientType        = "DLNA",
                FriendlyName      = @"(^\[TV\][A-Z]{2}\d{2}(E|F)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung",
                ModelNumber       = @"(1\.0)|(AllShare1\.0)",
                TranscodeSettings = TranscodeSettings.GetDefaultTranscodingSettings()
            };

            var profile2 = new DlnaProfile
            {
                Name              = "Samsung TV (C/D-series) [Profile]",
                ClientType        = "DLNA",
                FriendlyName      = @"(^TV-\d{2}C\d{3}.*)|(^\[TV\][A-Z]{2}\d{2}(D)[A-Z]?\d{3,4}.*)|^\[TV\] Samsung",
                ModelNumber       = @"(1\.0)|(AllShare1\.0)",
                TranscodeSettings = TranscodeSettings.GetDefaultTranscodingSettings()
            };

            var profile3 = new DlnaProfile
            {
                Name              = "Xbox 360 [Profile]",
                ClientType        = "DLNA",
                ModelName         = "Xbox 360",
                TranscodeSettings = new[]
                {
                    new TranscodeSettings {
                        Container = "mkv", TargetContainer = "ts"
                    },
                    new TranscodeSettings {
                        Container = "flac", TargetContainer = "mp3"
                    },
                    new TranscodeSettings {
                        Container = "m4a", TargetContainer = "mp3"
                    }
                }
            };

            var profile4 = new DlnaProfile
            {
                Name              = "Xbox One [Profile]",
                ModelName         = "Xbox One",
                ClientType        = "DLNA",
                FriendlyName      = "Xbox-SystemOS",
                TranscodeSettings = new[]
                {
                    new TranscodeSettings {
                        Container = "mkv", TargetContainer = "ts"
                    },
                    new TranscodeSettings {
                        Container = "flac", TargetContainer = "mp3"
                    },
                    new TranscodeSettings {
                        Container = "m4a", TargetContainer = "mp3"
                    }
                }
            };

            var profile5 = new DlnaProfile
            {
                Name              = "Sony Bravia TV (2012)",
                ClientType        = "TV",
                FriendlyName      = @"BRAVIA KDL-\d{2}[A-Z]X\d5(\d|G).*",
                TranscodeSettings = TranscodeSettings.GetDefaultTranscodingSettings()
            };

            //WDTV does not need any transcoding of the formats we support statically
            var profile6 = new DlnaProfile
            {
                Name              = "WDTV Live [Profile]",
                ClientType        = "DLNA",
                ModelName         = "WD TV HD Live",
                TranscodeSettings = new TranscodeSettings[] { }
            };

            var profile7 = new DlnaProfile
            {
                //Linksys DMA2100us does not need any transcoding of the formats we support statically
                Name              = "Linksys DMA2100 [Profile]",
                ClientType        = "DLNA",
                ModelName         = "DMA2100us",
                TranscodeSettings = new TranscodeSettings[] { }
            };

            return(new[]
            {
                profile0,
                profile1,
                profile2,
                profile3,
                profile4,
                profile5,
                profile6,
                profile7
            });
        }