using System;
namespace MediaBrowser.Dlna.PlayTo.Configuration
{
public class TranscodeSettings
{
///
/// Gets or sets the container.
///
///
/// The container.
///
public string Container { get; set; }
///
/// Gets or sets the target container.
///
///
/// The target container.
///
public string TargetContainer { get; set; }
///
/// The default transcoding settings
///
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;
}
///
/// Gets the profile settings.
///
/// The device properties.
/// The TranscodeSettings for the device
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();
}
}
}