<Compile Include="Interop\Model\BitrateLimits.cs" />\r
<Compile Include="Interop\Model\Cropping.cs" />\r
<Compile Include="Interop\Model\Encoding\Anamorphic.cs" />\r
- <Compile Include="Interop\Model\Encoding\AudioEncoder.cs" />\r
+ <Compile Include="Services\Encode\Model\Models\AudioEncoder.cs" />\r
<Compile Include="Interop\Model\Encoding\Container.cs" />\r
<Compile Include="Interop\Model\Encoding\Decomb.cs" />\r
<Compile Include="Interop\Model\Encoding\Deinterlace.cs" />\r
<Compile Include="Services\Encode\Factories\VideoPresetFactory.cs" />\r
<Compile Include="Services\Encode\Factories\VideoLevelFactory.cs" />\r
<Compile Include="Services\Encode\Factories\VideoTuneFactory.cs" />\r
+ <Compile Include="Services\Encode\Model\Models\AudioEncoderRateType.cs" />\r
<Compile Include="Services\Encode\Model\Models\DenoisePreset.cs" />\r
<Compile Include="Services\Encode\Model\Models\DenoiseTune.cs" />\r
<Compile Include="Model\HBConfiguration.cs" />\r
\r
namespace HandBrake.ApplicationServices.Interop\r
{\r
- using System;\r
using System.Collections.Generic;\r
using System.Linq;\r
\r
\r
/// <summary>\r
/// List of HandBrake containers.\r
- /// </summary>\r
+ /// </summary> \r
private static List<HBContainer> containers;\r
\r
/// <summary>\r
/// <summary>\r
/// Returns true if the subtitle source type can be set to forced only.\r
/// </summary>\r
- /// <param name="source">The subtitle source type (SSA, VobSub, etc)</param>\r
- /// <returns>True if the subtitle source type can be set to forced only.</returns>\r
+ /// <param name="source">\r
+ /// The subtitle source type (SSA, VobSub, etc)\r
+ /// </param>\r
+ /// <returns>\r
+ /// True if the subtitle source type can be set to forced only.\r
+ /// </returns>\r
public static bool SubtitleCanSetForcedOnly(int source)\r
{\r
return HBFunctions.hb_subtitle_can_force(source) > 0;\r
/// <summary>\r
/// Returns true if the subtitle source type can be burned in.\r
/// </summary>\r
- /// <param name="source">The subtitle source type (SSA, VobSub, etc)</param>\r
- /// <returns>True if the subtitle source type can be burned in.</returns>\r
+ /// <param name="source">\r
+ /// The subtitle source type (SSA, VobSub, etc)\r
+ /// </param>\r
+ /// <returns>\r
+ /// True if the subtitle source type can be burned in.\r
+ /// </returns>\r
public static bool SubtitleCanBurn(int source)\r
{\r
return HBFunctions.hb_subtitle_can_burn(source) > 0;\r
/// <summary>\r
/// Returns true if the subtitle type can be passed through using the given muxer.\r
/// </summary>\r
- /// <param name="subtitleSourceType">The subtitle source type (SSA, VobSub, etc)</param>\r
- /// <param name="muxer">The ID of the muxer.</param>\r
- /// <returns>True if the subtitle type can be passed through with the given muxer.</returns>\r
+ /// <param name="subtitleSourceType">\r
+ /// The subtitle source type (SSA, VobSub, etc)\r
+ /// </param>\r
+ /// <param name="muxer">\r
+ /// The ID of the muxer.\r
+ /// </param>\r
+ /// <returns>\r
+ /// True if the subtitle type can be passed through with the given muxer.\r
+ /// </returns>\r
public static bool SubtitleCanPassthrough(int subtitleSourceType, int muxer)\r
{\r
return HBFunctions.hb_subtitle_can_pass(subtitleSourceType, muxer) > 0;\r
/// <summary>\r
/// Gets the subtitle source type's name.\r
/// </summary>\r
- /// <param name="source">The subtitle source type (SSA, VobSub, etc).</param>\r
- /// <returns>The name of the subtitle source.</returns>\r
+ /// <param name="source">\r
+ /// The subtitle source type (SSA, VobSub, etc).\r
+ /// </param>\r
+ /// <returns>\r
+ /// The name of the subtitle source.\r
+ /// </returns>\r
public static string GetSubtitleSourceName(int source)\r
{\r
switch ((hb_subtitle_s_subsource)source)\r
\r
return new VideoQualityLimits\r
{\r
- Low = low,\r
- High = high,\r
- Granularity = granularity,\r
+ Low = low, \r
+ High = high, \r
+ Granularity = granularity, \r
Ascending = direction == 0\r
};\r
}\r
/// <returns>\r
/// Limits on the audio quality for the given encoder.\r
/// </returns>\r
- internal static RangeLimits GetAudioQualityLimits(int encoderId)\r
+ public static RangeLimits GetAudioQualityLimits(int encoderId)\r
{\r
float low = 0, high = 0, granularity = 0;\r
int direction = 0;\r
\r
return new RangeLimits\r
{\r
- Low = low,\r
- High = high,\r
- Granularity = granularity,\r
+ Low = low, \r
+ High = high, \r
+ Granularity = granularity, \r
Ascending = direction == 0\r
};\r
}\r
/// <returns>\r
/// Limits on the audio compression for the given encoder.\r
/// </returns>\r
- internal static RangeLimits GetAudioCompressionLimits(int encoderId)\r
+ public static RangeLimits GetAudioCompressionLimits(int encoderId)\r
{\r
float low = 0, high = 0, granularity = 0;\r
int direction = 0;\r
\r
return new RangeLimits\r
{\r
- Low = low,\r
- High = high,\r
- Granularity = granularity,\r
+ Low = low, \r
+ High = high, \r
+ Granularity = granularity, \r
Ascending = direction == 0\r
};\r
}\r
+\r
+ /// <summary>\r
+ /// The get default quality.\r
+ /// </summary>\r
+ /// <param name="encoder">\r
+ /// The encoder.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="double"/>.\r
+ /// </returns>\r
+ public static double GetDefaultQuality(HBAudioEncoder encoder)\r
+ {\r
+ return HBFunctions.hb_audio_quality_get_default((uint)encoder.Id);\r
+ }\r
+\r
+ /// <summary>\r
+ /// The get default audio compression.\r
+ /// </summary>\r
+ /// <param name="encoder">\r
+ /// The encoder.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="double"/>.\r
+ /// </returns>\r
+ public static double GetDefaultAudioCompression(HBAudioEncoder encoder)\r
+ {\r
+ return HBFunctions.hb_audio_compression_get_default((uint)encoder.Id);\r
+ }\r
}\r
}\r
[DllImport("hb.dll", EntryPoint = "hb_image_close", CallingConvention = CallingConvention.Cdecl)]\r
public static extern IntPtr hb_image_close(IntPtr image);\r
\r
-\r
/* JSON API */\r
\r
// char * hb_get_title_set_json(hb_handle_t * h);\r
{\r
using System;\r
using System.Collections.Generic;\r
+ using System.Globalization;\r
using System.Linq;\r
using System.Runtime.InteropServices;\r
\r
HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(EnumHelper<Mixdown>.GetShortName(item.MixDown));\r
Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + item.MixDown);\r
\r
+ HBRate sampleRate = HandBrakeEncoderHelpers.AudioSampleRates.FirstOrDefault(s => s.Name == item.SampleRate.ToString(CultureInfo.InvariantCulture));\r
+\r
HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack audioTrack = new HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack\r
{\r
Track = (item.Track.HasValue ? item.Track.Value : 0) - 1,\r
Gain = item.Gain,\r
Mixdown = mixdown.Id,\r
NormalizeMixLevel = false,\r
- Samplerate = GetSampleRateRaw(item.SampleRate),\r
+ Samplerate = sampleRate != null ? sampleRate.Rate : 0,\r
Name = item.TrackName,\r
};\r
\r
if (!item.IsPassthru)\r
{\r
- // TODO Impiment Quality and Compression. We only support bitrate right now.\r
- // if (item.EncodeRateType == AudioEncodeRateType.Quality)\r
- // {\r
- // audioTrack.Quality = item.Quality;\r
- // }\r
-\r
- // if (item.EncodeRateType == AudioEncodeRateType.Compression)\r
- // {\r
- // audioTrack.CompressionLevel = item.Compression;\r
- // }\r
-\r
- // if (item.EncodeRateType == AudioEncodeRateType.Bitrate)\r
- // {\r
- audioTrack.Bitrate = item.Bitrate;\r
- // }\r
+ if (item.EncoderRateType == AudioEncoderRateType.Quality)\r
+ {\r
+ audioTrack.Quality = item.Quality;\r
+ }\r
+\r
+ if (item.EncoderRateType == AudioEncoderRateType.Bitrate)\r
+ {\r
+ audioTrack.Bitrate = item.Bitrate;\r
+ }\r
}\r
\r
audio.AudioList.Add(audioTrack);\r
return audio;\r
}\r
\r
- /// <summary>\r
- /// The get sample rate raw.\r
- /// </summary>\r
- /// <param name="rate">\r
- /// The rate.\r
- /// </param>\r
- /// <returns>\r
- /// The <see cref="int"/>.\r
- /// </returns>\r
- private static int GetSampleRateRaw(double rate)\r
- {\r
- if (rate == 22.05)\r
- return 22050;\r
- else if (rate == 24)\r
- return 24000;\r
- else if (rate == 44.1)\r
- return 32000;\r
- else if (rate == 48)\r
- return 48000;\r
- else return 48000;\r
- }\r
-\r
/// <summary>\r
/// The create filter.\r
/// </summary>\r
// </summary>\r
// --------------------------------------------------------------------------------------------------------------------\r
\r
-namespace HandBrake.ApplicationServices.Interop.Model.Encoding\r
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models\r
{\r
using System.ComponentModel.DataAnnotations;\r
\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="AudioEncoderRateType.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+// The audio encoder rate type.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.ApplicationServices.Services.Encode.Model.Models\r
+{\r
+ using System.ComponentModel.DataAnnotations;\r
+\r
+ /// <summary>\r
+ /// The audio encoder rate type.\r
+ /// </summary>\r
+ public enum AudioEncoderRateType\r
+ {\r
+ /// <summary>\r
+ /// The bitrate.\r
+ /// </summary>\r
+ [Display(Name = "Bitrate: ")]\r
+ Bitrate, \r
+\r
+ /// <summary>\r
+ /// The quality.\r
+ /// </summary>\r
+ [Display(Name = "Quality: ")]\r
+ Quality, \r
+ }\r
+}\r
using System.ComponentModel;\r
using System.Globalization;\r
using System.Linq;\r
+ using System.Runtime.CompilerServices;\r
\r
using HandBrake.ApplicationServices.Interop;\r
using HandBrake.ApplicationServices.Interop.Model;\r
private Audio scannedTrack;\r
private bool isDefault;\r
private IEnumerable<int> bitrates;\r
+ private IEnumerable<double> encoderQualityValues;\r
+ private AudioEncoderRateType encoderRateType;\r
+ private double? quality;\r
\r
/// <summary>\r
/// Initializes a new instance of the <see cref = "AudioTrack" /> class.\r
this.TrackName = string.Empty;\r
\r
// Setup Backing Properties\r
- this.SetupBitrateLimits();\r
+ this.EncoderRateType = AudioEncoderRateType.Bitrate;\r
+ this.SetupLimits();\r
}\r
\r
/// <summary>\r
this.scannedTrack = track.ScannedTrack ?? new Audio();\r
}\r
this.TrackName = track.TrackName;\r
+ this.Quality = track.Quality;\r
\r
// Setup Backing Properties\r
- this.SetupBitrateLimits();\r
+ this.encoderRateType = track.EncoderRateType;\r
+ this.SetupLimits();\r
}\r
\r
#region Track Properties\r
\r
- /// <summary>\r
- /// Gets or sets Audio Bitrate\r
- /// </summary>\r
- public int Bitrate\r
- {\r
- get\r
- {\r
- return this.bitrate;\r
- }\r
-\r
- set\r
- {\r
- this.bitrate = value;\r
- this.NotifyOfPropertyChange(() => this.Bitrate);\r
- }\r
- }\r
- \r
-\r
/// <summary>\r
/// Gets or sets Dynamic Range Compression\r
/// </summary>\r
{\r
this.mixDown = value;\r
this.NotifyOfPropertyChange(() => this.MixDown);\r
- this.SetupBitrateLimits();\r
+ this.SetupLimits();\r
this.NotifyOfPropertyChange(() => this.TrackReference);\r
}\r
}\r
this.encoder = value;\r
this.NotifyOfPropertyChange(() => this.Encoder);\r
this.NotifyOfPropertyChange(() => this.IsPassthru);\r
- this.NotifyOfPropertyChange(() => this.CannotSetBitrate);\r
- this.SetupBitrateLimits();\r
+ this.NotifyOfPropertyChange(() => this.IsBitrateVisible);\r
+ this.NotifyOfPropertyChange(() => this.IsQualityVisible);\r
+ this.NotifyOfPropertyChange(() => this.IsRateTypeVisible);\r
+ this.SetupLimits();\r
this.NotifyOfPropertyChange(() => this.TrackReference);\r
+\r
+ // Refresh the available encoder rate types.\r
+ this.NotifyOfPropertyChange(() => this.AudioEncoderRateTypes);\r
+ if (!this.AudioEncoderRateTypes.Contains(this.EncoderRateType))\r
+ {\r
+ this.EncoderRateType = AudioEncoderRateType.Bitrate; // Default to bitrate.\r
+ }\r
}\r
}\r
\r
{\r
this.sampleRate = value;\r
this.NotifyOfPropertyChange(() => this.SampleRate);\r
- this.SetupBitrateLimits();\r
+ this.SetupLimits();\r
this.NotifyOfPropertyChange(() => this.TrackReference);\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Gets or sets the encoder rate type.\r
+ /// </summary>\r
+ public AudioEncoderRateType EncoderRateType\r
+ {\r
+ get\r
+ {\r
+ return this.encoderRateType;\r
+ }\r
+\r
+ set\r
+ {\r
+ this.encoderRateType = value;\r
+ this.SetupLimits();\r
+ this.NotifyOfPropertyChange(() => this.EncoderRateType);\r
+ this.NotifyOfPropertyChange(() => this.IsBitrateVisible);\r
+ this.NotifyOfPropertyChange(() => this.IsQualityVisible);\r
+\r
+ if (!this.Quality.HasValue)\r
+ {\r
+ HBAudioEncoder hbAudioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.Encoder));\r
+ this.Quality = HandBrakeEncoderHelpers.GetDefaultQuality(hbAudioEncoder);\r
+ }\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Audio Bitrate\r
+ /// </summary>\r
+ public int Bitrate\r
+ {\r
+ get\r
+ {\r
+ return this.bitrate;\r
+ }\r
+\r
+ set\r
+ {\r
+ this.bitrate = value;\r
+ this.NotifyOfPropertyChange(() => this.Bitrate);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets or sets Audio quality\r
+ /// </summary>\r
+ public double? Quality\r
+ {\r
+ get\r
+ {\r
+ return this.quality;\r
+ }\r
+\r
+ set\r
+ {\r
+ this.quality = value;\r
+ this.NotifyOfPropertyChange(() => this.quality);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets or sets the track name.\r
+ /// </summary>\r
+ public string TrackName { get; set; }\r
#endregion\r
\r
/// <summary>\r
/// Gets AudioEncoderDisplayValue.\r
/// </summary>\r
+ [JsonIgnore]\r
public string AudioEncoderDisplayValue\r
{\r
get\r
/// <summary>\r
/// Gets AudioMixdownDisplayValue.\r
/// </summary>\r
+ [JsonIgnore]\r
public string AudioMixdownDisplayValue\r
{\r
get\r
/// <summary>\r
/// Gets the The UI display value for bit rate\r
/// </summary>\r
+ [JsonIgnore]\r
public string BitRateDisplayValue\r
{\r
get\r
\r
return this.Bitrate.ToString();\r
}\r
- } \r
+ }\r
\r
/// <summary>\r
/// Gets or sets a value indicating whether is default.\r
/// TODO - Can this be removed? May have been added as a quick fix for a styling quirk.\r
/// </summary>\r
+ [JsonIgnore]\r
public bool IsDefault\r
{\r
get\r
/// <summary>\r
/// Gets or sets the The UI display value for sample rate\r
/// </summary>\r
+ [JsonIgnore]\r
public string SampleRateDisplayValue\r
{\r
get\r
/// <summary>\r
/// Gets the Audio Track Name\r
/// </summary>\r
+ [JsonIgnore]\r
public int? Track\r
{\r
get\r
/// <summary>\r
/// Gets a value indicating whether IsPassthru.\r
/// </summary>\r
+ [JsonIgnore]\r
public bool IsPassthru\r
{\r
get\r
/// <summary>\r
/// Gets the bitrates.\r
/// </summary>\r
+ [JsonIgnore]\r
public IEnumerable<int> Bitrates\r
{\r
get\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Gets the quality compression values.\r
+ /// </summary>\r
+ [JsonIgnore]\r
+ public IEnumerable<double> EncoderQualityValues\r
+ {\r
+ get\r
+ {\r
+ return this.encoderQualityValues;\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the audio encoder rate types.\r
+ /// </summary>\r
+ [JsonIgnore]\r
+ public IEnumerable<AudioEncoderRateType> AudioEncoderRateTypes\r
+ {\r
+ get\r
+ {\r
+ IList<AudioEncoderRateType> types = EnumHelper<AudioEncoderRateType>.GetEnumList().ToList();\r
+ HBAudioEncoder hbaenc = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.Encoder));\r
+ if (hbaenc == null || !hbaenc.SupportsQuality)\r
+ {\r
+ types.Remove(AudioEncoderRateType.Quality);\r
+ }\r
+\r
+ return types;\r
+ }\r
+ }\r
+\r
/// <summary>\r
/// Gets a value indicating whether can set bitrate.\r
/// </summary>\r
- public bool CannotSetBitrate\r
+ [JsonIgnore]\r
+ public bool IsBitrateVisible\r
+ {\r
+ get\r
+ {\r
+ if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)\r
+ {\r
+ return false;\r
+ }\r
+\r
+ return Equals(this.EncoderRateType, AudioEncoderRateType.Bitrate);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets a value indicating whether is quality visible.\r
+ /// </summary>\r
+ [JsonIgnore]\r
+ public bool IsQualityVisible\r
{\r
get\r
{\r
- return this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24;\r
+ if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)\r
+ {\r
+ return false;\r
+ }\r
+\r
+ return Equals(this.EncoderRateType, AudioEncoderRateType.Quality);\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets a value indicating whether is rate type visible.\r
+ /// </summary>\r
+ [JsonIgnore]\r
+ public bool IsRateTypeVisible\r
+ {\r
+ get\r
+ {\r
+ if (this.IsPassthru || this.Encoder == AudioEncoder.ffflac || this.Encoder == AudioEncoder.ffflac24)\r
+ {\r
+ return false;\r
+ }\r
+\r
+ return true;\r
}\r
}\r
\r
/// <summary>\r
/// Gets a value indicating whether IsLossless.\r
/// </summary>\r
+ [JsonIgnore]\r
public bool IsLossless\r
{\r
get\r
get { return this; }\r
}\r
\r
+ #region Handler Methods\r
+\r
/// <summary>\r
- /// Gets or sets the track name.\r
+ /// The setup limits.\r
/// </summary>\r
- public string TrackName { get; set; }\r
+ private void SetupLimits()\r
+ {\r
+ this.SetupBitrateLimits();\r
+ this.SetupQualityCompressionLimits();\r
+ }\r
\r
/// <summary>\r
/// The calculate bitrate limits.\r
this.Bitrate = HandBrakeEncoderHelpers.GetDefaultBitrate(hbaenc, rate != null ? rate.Rate : 48000, mixdown);\r
}\r
}\r
+\r
+ /// <summary>\r
+ /// The setup quality compression limits.\r
+ /// </summary>\r
+ private void SetupQualityCompressionLimits()\r
+ {\r
+ HBAudioEncoder hbAudioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(this.Encoder));\r
+ if (hbAudioEncoder.SupportsQuality)\r
+ {\r
+ RangeLimits limits = null;\r
+\r
+ if (hbAudioEncoder.SupportsQuality)\r
+ {\r
+ limits = hbAudioEncoder.QualityLimits;\r
+ }\r
+\r
+ if (limits != null)\r
+ {\r
+ double value = limits.Ascending ? limits.Low : limits.High;\r
+ List<double> values = new List<double> { value };\r
+\r
+ if (limits.Ascending)\r
+ {\r
+ while (value < limits.High)\r
+ {\r
+ value += limits.Granularity;\r
+ values.Add(value);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ while (value > limits.Low)\r
+ {\r
+ value -= limits.Granularity;\r
+ values.Add(value);\r
+ }\r
+ }\r
+\r
+ this.encoderQualityValues = values;\r
+ }\r
+ else\r
+ {\r
+ this.encoderQualityValues = new List<double>();\r
+ }\r
+ }\r
+ else\r
+ {\r
+ this.encoderQualityValues = new List<double>();\r
+ }\r
+\r
+ // Default the audio quality value if it's out of range.\r
+ if (Equals(this.EncoderRateType, AudioEncoderRateType.Quality))\r
+ {\r
+ if (this.Quality.HasValue && !this.encoderQualityValues.Contains(this.Quality.Value))\r
+ {\r
+ this.Quality = HandBrakeEncoderHelpers.GetDefaultQuality(hbAudioEncoder);\r
+ }\r
+ }\r
+\r
+ this.NotifyOfPropertyChange(() => this.EncoderQualityValues);\r
+ }\r
+\r
+ #endregion\r
}\r
}
\ No newline at end of file
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="AudioRateTypeConverter.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// <summary>\r
+// The audio rate type converter.\r
+// </summary>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrakeWPF.Converters.Audio\r
+{\r
+ using System;\r
+ using System.Collections.Generic;\r
+ using System.Globalization;\r
+ using System.Windows.Data;\r
+\r
+ using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
+ using HandBrake.ApplicationServices.Utilities;\r
+\r
+ /// <summary>\r
+ /// The audio rate type converter.\r
+ /// </summary>\r
+ public class AudioRateTypeConverter : IValueConverter\r
+ {\r
+ /// <summary>\r
+ /// The convert.\r
+ /// </summary>\r
+ /// <param name="value">\r
+ /// The value.\r
+ /// </param>\r
+ /// <param name="targetType">\r
+ /// The target type.\r
+ /// </param>\r
+ /// <param name="parameter">\r
+ /// The parameter.\r
+ /// </param>\r
+ /// <param name="culture">\r
+ /// The culture.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="object"/>.\r
+ /// </returns>\r
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\r
+ {\r
+ var types = value as IEnumerable<AudioEncoderRateType>;\r
+ if (types != null)\r
+ {\r
+ List<string> rateTypes = new List<string>();\r
+ foreach (var item in types)\r
+ {\r
+ rateTypes.Add(EnumHelper<AudioEncoderRateType>.GetDisplay(item));\r
+ }\r
+\r
+ return rateTypes;\r
+ }\r
+\r
+\r
+ if (targetType == typeof(AudioEncoderRateType) || value.GetType() == typeof(AudioEncoderRateType))\r
+ {\r
+ return EnumHelper<AudioEncoderRateType>.GetDisplay((AudioEncoderRateType)value);\r
+ }\r
+\r
+ return null;\r
+ }\r
+\r
+ /// <summary>\r
+ /// The convert back.\r
+ /// </summary>\r
+ /// <param name="value">\r
+ /// The value.\r
+ /// </param>\r
+ /// <param name="targetType">\r
+ /// The target type.\r
+ /// </param>\r
+ /// <param name="parameter">\r
+ /// The parameter.\r
+ /// </param>\r
+ /// <param name="culture">\r
+ /// The culture.\r
+ /// </param>\r
+ /// <returns>\r
+ /// The <see cref="object"/>.\r
+ /// </returns>\r
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)\r
+ {\r
+ if (value == null)\r
+ {\r
+ return null;\r
+ }\r
+\r
+ return EnumHelper<AudioEncoderRateType>.GetValue(value.ToString());\r
+ }\r
+ }\r
+}\r
return EnumHelper<OutputFormat>.GetDisplay((OutputFormat)value);\r
}\r
\r
+ \r
return null;\r
}\r
\r
<Compile Include="Controls\AlertPanel.xaml.cs">\r
<DependentUpon>AlertPanel.xaml</DependentUpon>\r
</Compile>\r
+ <Compile Include="Converters\Audio\AudioRateTypeConverter.cs" />\r
<Compile Include="Converters\Audio\AudioTrackDefaultBehaviourConverter.cs" />\r
<Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />\r
<Compile Include="Converters\Filters\DenoisePresetConverter.cs" />\r
{\r
#region Private Variables\r
\r
- private static readonly int CurrentPresetVersion = 3;\r
+ private static readonly int CurrentPresetVersion = 4;\r
\r
/// <summary>\r
/// User Preset Default Catgory Name\r
<Audio:AudioEncoderConverter x:Key="audioEncoderConverter" />\r
<Audio:AudioBehaviourConverter x:Key="audioBehaviourConverter" />\r
<Audio:AudioTrackDefaultBehaviourConverter x:Key="audioTrackDefaultBehaviourConverter" />\r
+ <Audio:AudioRateTypeConverter x:Key="audioRateTypeConverter" />\r
</UserControl.Resources>\r
\r
<Grid>\r
<Image Grid.Column="0" Grid.Row="0"\r
Width="16"\r
Height="16"\r
- Margin="10,0,10,0"\r
+ Margin="8,0,8,0"\r
Source="Images/Movies.png" />\r
\r
<!-- Settings -->\r
</ComboBox.ItemsSource>\r
</ComboBox>\r
\r
- <TextBlock Grid.Column="4" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Bitrate}"\r
- Visibility="{Binding CannotSetBitrate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />\r
+ <ComboBox Grid.Column="4" Height="22" Width="65" HorizontalAlignment="Stretch"\r
+ ItemsSource="{Binding AudioEncoderRateTypes, Converter={StaticResource audioRateTypeConverter}}"\r
+ SelectedItem="{Binding EncoderRateType, Converter={StaticResource audioRateTypeConverter}}"\r
+ Visibility="{Binding IsRateTypeVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />\r
+\r
+ <ComboBox Grid.Column="5" Width="55" Height="22" Margin="5,0,5,0" ItemsSource="{Binding EncoderQualityValues}"\r
+ SelectedItem="{Binding Quality}"\r
+ Visibility="{Binding IsQualityVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />\r
+\r
<ComboBox Grid.Column="5" Width="55" Height="22" Margin="5,0,5,0" ItemsSource="{Binding Bitrates}"\r
SelectedItem="{Binding Bitrate}"\r
- Visibility="{Binding CannotSetBitrate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />\r
-\r
+ Visibility="{Binding IsBitrateVisible, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />\r
\r
<!-- Row 2 -->\r
<TextBlock Grid.Row="0" Grid.Column="6" VerticalAlignment="Center" FontWeight="Bold" Text="{x:Static Properties:ResourcesUI.AudioView_Mixdown}"\r
Visibility="{Binding IsPassthru, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />\r
\r
\r
-\r
- <ToggleButton Name="advancedOptionsToggle" VerticalAlignment="Center" Grid.Column="8" Grid.Row="0" Grid.ColumnSpan="2"\r
+ <ToggleButton Name="advancedOptionsToggle" VerticalAlignment="Center" Grid.Column="8" Grid.Row="0" Grid.ColumnSpan="2" Margin="5,0,0,0"\r
Padding="3,0" Height="22" HorizontalAlignment="Left" >\r
<ToggleButton.Style>\r
<Style TargetType="{x:Type ToggleButton}">\r
<Setter Property="Content" Value="Show"/>\r
+ <Setter Property="FontWeight" Value="Bold" />\r
<Style.Triggers>\r
<Trigger Property="IsChecked" Value="True">\r
- <Setter Property="Content" Value="Hide"/>\r
+ <Setter Property="Content" Value="˄"/>\r
</Trigger>\r
<Trigger Property="IsChecked" Value="False">\r
- <Setter Property="Content" Value="Show"/>\r
+ <Setter Property="Content" Value="˅" />\r
</Trigger>\r
</Style.Triggers>\r
</Style>\r