diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-26 21:44:00 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-02-26 21:44:00 -0500 |
| commit | dfb491fcc54cf6f32fb212d8493e83f541d05c89 (patch) | |
| tree | a5c7e6b38c00060b2c601ec2d0a34acc7adc2a07 /MediaBrowser.Dlna/PlayTo/Configuration/TranscodeSetting.cs | |
| parent | ec131ba0dc25b29ca522cf4555bfad29ad501406 (diff) | |
import remaining dlna classes
Diffstat (limited to 'MediaBrowser.Dlna/PlayTo/Configuration/TranscodeSetting.cs')
| -rw-r--r-- | MediaBrowser.Dlna/PlayTo/Configuration/TranscodeSetting.cs | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/MediaBrowser.Dlna/PlayTo/Configuration/TranscodeSetting.cs b/MediaBrowser.Dlna/PlayTo/Configuration/TranscodeSetting.cs new file mode 100644 index 000000000..f5cceaaaa --- /dev/null +++ b/MediaBrowser.Dlna/PlayTo/Configuration/TranscodeSetting.cs @@ -0,0 +1,76 @@ +using System; + +namespace MediaBrowser.Dlna.PlayTo.Configuration +{ + public class TranscodeSettings + { + /// <summary> + /// Gets or sets the container. + /// </summary> + /// <value> + /// The container. + /// </value> + public string Container { get; set; } + + /// <summary> + /// Gets or sets the target container. + /// </summary> + /// <value> + /// The target container. + /// </value> + public string TargetContainer { get; set; } + + /// <summary> + /// The default transcoding settings + /// </summary> + private static readonly TranscodeSettings[] DefaultTranscodingSettings = + { + new TranscodeSettings { Container = "mkv", TargetContainer = "ts" }, + new TranscodeSettings { Container = "flac", TargetContainer = "mp3" }, + new TranscodeSettings { Container = "m4a", TargetContainer = "mp3" } + }; + + public static TranscodeSettings[] GetDefaultTranscodingSettings() + { + return DefaultTranscodingSettings; + } + + /// <summary> + /// Gets the profile settings. + /// </summary> + /// <param name="deviceProperties">The device properties.</param> + /// <returns>The TranscodeSettings for the device</returns> + public static TranscodeSettings[] GetProfileSettings(DeviceProperties deviceProperties) + { + foreach (var profile in PlayToConfiguration.Profiles) + { + if (!string.IsNullOrEmpty(profile.FriendlyName)) + { + if (!string.Equals(deviceProperties.Name, profile.FriendlyName, StringComparison.OrdinalIgnoreCase)) + continue; + } + + if (!string.IsNullOrEmpty(profile.ModelNumber)) + { + if (!string.Equals(deviceProperties.ModelNumber, profile.ModelNumber, StringComparison.OrdinalIgnoreCase)) + continue; + } + + if (!string.IsNullOrEmpty(profile.ModelName)) + { + if (!string.Equals(deviceProperties.ModelName, profile.ModelName, StringComparison.OrdinalIgnoreCase)) + continue; + } + + deviceProperties.DisplayName = profile.Name; + deviceProperties.ClientType = profile.ClientType; + return profile.TranscodeSettings; + + } + + // Since we don't have alot of info about different devices we go down the safe + // route abd use the default transcoding settings if no profile exist + return GetDefaultTranscodingSettings(); + } + } +} |
