// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The video options queue tooltip converter. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Converters.Video { using System; using System.Globalization; using System.Windows.Data; using HandBrake.Interop.Interop.Model.Encoding; using HandBrakeWPF.Utilities; using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask; /// /// The x 264 queue tooltip converter. /// public class VideoOptionsTooltipConverter : IValueConverter { /// /// Converts a value. /// /// /// A converted value. If the method returns null, the valid null value is used. /// /// /// The value produced by the binding source. /// /// /// The type of the binding target property. /// /// /// The converter parameter to use. /// /// /// The culture to use in the converter. /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { EncodeTask task = value as EncodeTask; if (task != null) { string rfqp = task.VideoEncoder == VideoEncoder.X264 || task.VideoEncoder == VideoEncoder.X264_10 || task.VideoEncoder == VideoEncoder.X265 || task.VideoEncoder == VideoEncoder.X265_10 || task.VideoEncoder == VideoEncoder.X265_12 ? "RF" : "QP"; string quality = task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality ? task.Quality + rfqp : task.VideoBitrate + " kbps"; string twoPass = null; if (task.VideoEncodeRateType == VideoEncodeRateType.AverageBitrate) { twoPass = task.TwoPass ? task.TurboFirstPass ? " (2-Pass with Turbo)" : " (2-Pass)" : string.Empty; } return string.Format("{0} - {1}{2}", EnumHelper.GetDisplay(task.VideoEncoder), quality, twoPass); } return "Unknown"; } /// /// Converts a value. /// /// /// A converted value. If the method returns null, the valid null value is used. /// /// /// The value that is produced by the binding target. /// /// /// The type to convert to. /// /// /// The converter parameter to use. /// /// /// The culture to use in the converter. /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }