From 3971869f634466f832c3ec33e0e9b1779058156f Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 18 Jan 2015 18:02:25 +0000 Subject: WinGui: Remove the EncodingProfile object as it doesn't make sense in the context of the app. Small fix to updated preview window. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6767 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Utilities/InteropModelCreator.cs | 119 +++-- .../HandBrakeInterop/HandBrakeInstance.cs | 20 +- .../HandBrakeInterop/HandBrakeInterop.csproj | 1 - .../HandBrakeInterop/HandBrakeUtils.cs | 6 +- .../Json/Factories/AnamorphicFactory.cs | 22 +- .../Json/Factories/EncodeFactory.cs | 92 ++-- .../HandBrakeInterop/Model/EncodeJob.cs | 552 ++++++++++++++++----- .../Model/Encoding/EncodingProfile.cs | 381 -------------- .../ViewModels/StaticPreviewViewModel.cs | 10 +- 9 files changed, 566 insertions(+), 637 deletions(-) delete mode 100644 win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs index 2c3f013ff..2ffc766b5 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs @@ -11,9 +11,7 @@ namespace HandBrake.ApplicationServices.Utilities { using System; using System.Collections.Generic; - using System.Diagnostics; using System.Linq; - using System.Windows.Media.Animation; using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services.Encode.Model; @@ -25,7 +23,6 @@ namespace HandBrake.ApplicationServices.Utilities /// /// A Utility Class to Convert a - /// TODO remove this class and replace a new factory to convert the EncodeTask object. This will remove a layer of abstraction. /// public class InteropModelCreator { @@ -68,15 +65,12 @@ namespace HandBrake.ApplicationServices.Utilities // Which will be converted to this EncodeJob Model. EncodeJob job = new EncodeJob(); - EncodingProfile profile = new EncodingProfile(); - job.EncodingProfile = profile; // Audio Settings - profile.AudioEncodings = new List(); + job.AudioEncodings = new List(); job.ChosenAudioTracks = new List(); foreach (AudioTrack track in work.AudioTracks) { - AudioEncoding newTrack = new AudioEncoding { Bitrate = track.Bitrate, @@ -87,11 +81,11 @@ namespace HandBrake.ApplicationServices.Utilities Mixdown = Converters.GetCliMixDown(track.MixDown), SampleRateRaw = GetSampleRateRaw(track.SampleRate), EncodeRateType = AudioEncodeRateType.Bitrate, - Name = track.TrackName, + Name = track.TrackName, IsPassthru = track.IsPassthru }; - profile.AudioEncodings.Add(newTrack); + job.AudioEncodings.Add(newTrack); if (track.Track != null) { job.ChosenAudioTracks.Add(track.Track.Value); @@ -144,111 +138,110 @@ namespace HandBrake.ApplicationServices.Utilities } job.Angle = work.Angle; - job.EncodingProfile = profile; // Output Settings - profile.IPod5GSupport = work.IPod5GSupport; - profile.Optimize = work.OptimizeMP4; + job.IPod5GSupport = work.IPod5GSupport; + job.Optimize = work.OptimizeMP4; switch (work.OutputFormat) { case OutputFormat.Mp4: - profile.ContainerName = "av_mp4"; // TODO make part of enum. + job.ContainerName = "av_mp4"; // TODO make part of enum. break; case OutputFormat.Mkv: - profile.ContainerName = "av_mkv"; // TODO make part of enum. + job.ContainerName = "av_mkv"; // TODO make part of enum. break; } // Picture Settings - profile.Anamorphic = work.Anamorphic; - profile.Cropping = new Cropping { Top = work.Cropping.Top, Bottom = work.Cropping.Bottom, Left = work.Cropping.Left, Right = work.Cropping.Right }; - profile.CroppingType = CroppingType.Custom; // TODO deal with this better - profile.DisplayWidth = work.DisplayWidth.HasValue ? int.Parse(Math.Round(work.DisplayWidth.Value, 0).ToString()) : 0; - profile.PixelAspectX = work.PixelAspectX; - profile.PixelAspectY = work.PixelAspectY; - profile.Height = work.Height.HasValue ? work.Height.Value : 0; - profile.KeepDisplayAspect = work.KeepDisplayAspect; - profile.MaxHeight = work.MaxHeight.HasValue ? work.MaxHeight.Value : 0; - profile.MaxWidth = work.MaxWidth.HasValue ? work.MaxWidth.Value : 0; - profile.Modulus = work.Modulus.HasValue ? work.Modulus.Value : 16; - profile.UseDisplayWidth = true; - profile.Width = work.Width.HasValue ? work.Width.Value : 0; + job.Anamorphic = work.Anamorphic; + job.Cropping = new Cropping { Top = work.Cropping.Top, Bottom = work.Cropping.Bottom, Left = work.Cropping.Left, Right = work.Cropping.Right }; + job.CroppingType = CroppingType.Custom; // TODO deal with this better + job.DisplayWidth = work.DisplayWidth.HasValue ? int.Parse(Math.Round(work.DisplayWidth.Value, 0).ToString()) : 0; + job.PixelAspectX = work.PixelAspectX; + job.PixelAspectY = work.PixelAspectY; + job.Height = work.Height.HasValue ? work.Height.Value : 0; + job.KeepDisplayAspect = work.KeepDisplayAspect; + job.MaxHeight = work.MaxHeight.HasValue ? work.MaxHeight.Value : 0; + job.MaxWidth = work.MaxWidth.HasValue ? work.MaxWidth.Value : 0; + job.Modulus = work.Modulus.HasValue ? work.Modulus.Value : 16; + job.UseDisplayWidth = true; + job.Width = work.Width.HasValue ? work.Width.Value : 0; // Filter Settings - profile.CustomDecomb = work.CustomDecomb; - profile.CustomDeinterlace = work.CustomDeinterlace; - profile.CustomDenoise = work.CustomDenoise; - profile.DenoisePreset = work.DenoisePreset.ToString().ToLower().Replace(" ", string.Empty); - profile.DenoiseTune = work.DenoiseTune.ToString().ToLower().Replace(" ", string.Empty); - profile.CustomDetelecine = work.CustomDetelecine; + job.CustomDecomb = work.CustomDecomb; + job.CustomDeinterlace = work.CustomDeinterlace; + job.CustomDenoise = work.CustomDenoise; + job.DenoisePreset = work.DenoisePreset.ToString().ToLower().Replace(" ", string.Empty); + job.DenoiseTune = work.DenoiseTune.ToString().ToLower().Replace(" ", string.Empty); + job.CustomDetelecine = work.CustomDetelecine; if (work.Deblock > 4) { - profile.Deblock = work.Deblock; + job.Deblock = work.Deblock; } - profile.Decomb = work.Decomb; - profile.Deinterlace = work.Deinterlace; - profile.Denoise = work.Denoise; - profile.Detelecine = work.Detelecine; - profile.Grayscale = work.Grayscale; + job.Decomb = work.Decomb; + job.Deinterlace = work.Deinterlace; + job.Denoise = work.Denoise; + job.Detelecine = work.Detelecine; + job.Grayscale = work.Grayscale; // Video Settings - profile.Framerate = work.Framerate.HasValue ? work.Framerate.Value : 0; - profile.ConstantFramerate = work.FramerateMode == FramerateMode.CFR; - profile.PeakFramerate = work.FramerateMode == FramerateMode.PFR; - profile.Quality = work.Quality.HasValue ? work.Quality.Value : 0; - profile.VideoBitrate = work.VideoBitrate.HasValue ? work.VideoBitrate.Value : 0; - profile.VideoEncodeRateType = work.VideoEncodeRateType; - profile.VideoEncoder = Converters.GetVideoEncoder(work.VideoEncoder); - profile.TwoPass = work.TwoPass; - profile.TurboFirstPass = work.TurboFirstPass; + job.Framerate = work.Framerate.HasValue ? work.Framerate.Value : 0; + job.ConstantFramerate = work.FramerateMode == FramerateMode.CFR; + job.PeakFramerate = work.FramerateMode == FramerateMode.PFR; + job.Quality = work.Quality.HasValue ? work.Quality.Value : 0; + job.VideoBitrate = work.VideoBitrate.HasValue ? work.VideoBitrate.Value : 0; + job.VideoEncodeRateType = work.VideoEncodeRateType; + job.VideoEncoder = Converters.GetVideoEncoder(work.VideoEncoder); + job.TwoPass = work.TwoPass; + job.TurboFirstPass = work.TurboFirstPass; if (work.VideoEncoder == VideoEncoder.X264) { - profile.VideoPreset = work.X264Preset.ToString().ToLower().Replace(" ", string.Empty); - profile.VideoTunes = new List(); + job.VideoPreset = work.X264Preset.ToString().ToLower().Replace(" ", string.Empty); + job.VideoTunes = new List(); if (work.X264Tune != x264Tune.None) { - profile.VideoTunes.Add(work.X264Tune.ToString().ToLower().Replace(" ", string.Empty)); + job.VideoTunes.Add(work.X264Tune.ToString().ToLower().Replace(" ", string.Empty)); } if (work.FastDecode) { - profile.VideoTunes.Add("fastdecode"); + job.VideoTunes.Add("fastdecode"); } - profile.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); // TODO change these away from strings. - profile.VideoLevel = work.H264Level; + job.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); // TODO change these away from strings. + job.VideoLevel = work.H264Level; } else if (work.VideoEncoder == VideoEncoder.X265) { - profile.VideoPreset = work.X265Preset.ToString().ToLower().Replace(" ", string.Empty); + job.VideoPreset = work.X265Preset.ToString().ToLower().Replace(" ", string.Empty); if (work.H265Profile != x265Profile.None) { - profile.VideoProfile = work.H265Profile.ToString().ToLower().Replace(" ", string.Empty); + job.VideoProfile = work.H265Profile.ToString().ToLower().Replace(" ", string.Empty); } - profile.VideoTunes = new List(); + job.VideoTunes = new List(); if (work.X265Tune != x265Tune.None) { - profile.VideoTunes.Add(work.X265Tune.ToString().ToLower().Replace(" ", string.Empty)); + job.VideoTunes.Add(work.X265Tune.ToString().ToLower().Replace(" ", string.Empty)); } } else if (work.VideoEncoder == VideoEncoder.QuickSync) { - profile.VideoPreset = work.QsvPreset.ToString().ToLower().Replace(" ", string.Empty); - profile.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); - profile.VideoLevel = work.H264Level; + job.VideoPreset = work.QsvPreset.ToString().ToLower().Replace(" ", string.Empty); + job.VideoProfile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); + job.VideoLevel = work.H264Level; } // Chapter Markers - profile.IncludeChapterMarkers = work.IncludeChapterMarkers; + job.IncludeChapterMarkers = work.IncludeChapterMarkers; job.CustomChapterNames = work.ChapterNames.Select(item => item.ChapterName).ToList(); job.UseDefaultChapterNames = work.IncludeChapterMarkers; // Advanced Settings - profile.VideoOptions = work.ShowAdvancedTab ? work.AdvancedEncoderOptions : work.ExtraAdvancedArguments; + job.VideoOptions = work.ShowAdvancedTab ? work.AdvancedEncoderOptions : work.ExtraAdvancedArguments; // Subtitles job.Subtitles = new Subtitles { SourceSubtitles = new List(), SrtSubtitles = new List() }; diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index a36e672ca..4d9b6791b 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -292,20 +292,20 @@ namespace HandBrake.Interop // Creat the Expected Output Geometry details for libhb. hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s { - crop = new[] { job.EncodingProfile.Cropping.Top, job.EncodingProfile.Cropping.Bottom, job.EncodingProfile.Cropping.Left, job.EncodingProfile.Cropping.Right }, + crop = new[] { job.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right }, itu_par = 0, - keep = (int)AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH + (job.EncodingProfile.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width? - maxWidth = job.EncodingProfile.MaxWidth, - maxHeight = job.EncodingProfile.MaxHeight, - mode = (int)(hb_anamorphic_mode_t)job.EncodingProfile.Anamorphic, - modulus = job.EncodingProfile.Modulus, + keep = (int)AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH + (job.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width? + maxWidth = job.MaxWidth, + maxHeight = job.MaxHeight, + mode = (int)(hb_anamorphic_mode_t)job.Anamorphic, + modulus = job.Modulus, geometry = new hb_geometry_s { - height = job.EncodingProfile.Height, - width = job.EncodingProfile.Width, - par = job.EncodingProfile.Anamorphic != Anamorphic.Custom + height = job.Height, + width = job.Width, + par = job.Anamorphic != Anamorphic.Custom ? new hb_rational_t { den = title.ParVal.Height, num = title.ParVal.Width } - : new hb_rational_t { den = job.EncodingProfile.PixelAspectY, num = job.EncodingProfile.PixelAspectX } + : new hb_rational_t { den = job.PixelAspectY, num = job.PixelAspectX } } }; diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index f153d2dca..52939e219 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -241,7 +241,6 @@ - diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs index abb67a074..1d7042ab3 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs @@ -456,7 +456,7 @@ namespace HandBrake.Interop { long availableBytes = ((long)sizeMB) * 1024 * 1024; - EncodingProfile profile = job.EncodingProfile; + EncodeJob profile = job; double lengthSeconds = overallSelectedLengthSeconds > 0 ? overallSelectedLengthSeconds : GetJobLengthSeconds(job, title); lengthSeconds += 1.5; @@ -509,7 +509,7 @@ namespace HandBrake.Interop { long totalBytes = 0; - EncodingProfile profile = job.EncodingProfile; + EncodeJob profile = job; double lengthSeconds = GetJobLengthSeconds(job, title); lengthSeconds += 1.5; @@ -579,7 +579,7 @@ namespace HandBrake.Interop { var list = new List>(); - foreach (AudioEncoding encoding in job.EncodingProfile.AudioEncodings) + foreach (AudioEncoding encoding in job.AudioEncodings) { if (encoding.InputNumber == 0) { diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs index 97809c348..1fd16ec5e 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs @@ -53,7 +53,7 @@ namespace HandBrake.Interop.Json.Factories /// public static Geometry CreateGeometry(EncodeJob job, Title title, KeepSetting keepWidthOrHeight) // Todo remove the need for these objects. Should use simpler objects. { - int settingMode = (int)keepWidthOrHeight + (job.EncodingProfile.KeepDisplayAspect ? 0x04 : 0); + int settingMode = (int)keepWidthOrHeight + (job.KeepDisplayAspect ? 0x04 : 0); // Sanatise the Geometry First. AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry @@ -66,27 +66,27 @@ namespace HandBrake.Interop.Json.Factories }, DestSettings = new DestSettings { - AnamorphicMode = (int)job.EncodingProfile.Anamorphic, + AnamorphicMode = (int)job.Anamorphic, Geometry = { - Width = job.EncodingProfile.Width, Height = job.EncodingProfile.Height, + Width = job.Width, Height = job.Height, PAR = new PAR { - Num = job.EncodingProfile.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : job.EncodingProfile.PixelAspectX, - Den = job.EncodingProfile.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : job.EncodingProfile.PixelAspectY, + Num = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : job.PixelAspectX, + Den = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : job.PixelAspectY, } }, Keep = settingMode, - Crop = new List { job.EncodingProfile.Cropping.Top, job.EncodingProfile.Cropping.Bottom, job.EncodingProfile.Cropping.Left, job.EncodingProfile.Cropping.Right }, - Modulus = job.EncodingProfile.Modulus, - MaxWidth = job.EncodingProfile.MaxWidth, - MaxHeight = job.EncodingProfile.MaxHeight, + Crop = new List { job.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right }, + Modulus = job.Modulus, + MaxWidth = job.MaxWidth, + MaxHeight = job.MaxHeight, ItuPAR = false } }; - if (job.EncodingProfile.Anamorphic == Anamorphic.Custom) + if (job.Anamorphic == Anamorphic.Custom) { - anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = job.EncodingProfile.PixelAspectX, Den = job.EncodingProfile.PixelAspectY }; + anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = job.PixelAspectX, Den = job.PixelAspectY }; } else { diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs index 51b29533f..327e5ce9f 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs @@ -126,11 +126,11 @@ namespace HandBrake.Interop.Json.Factories File = job.OutputPath, Mp4Options = new Mp4Options { - IpodAtom = job.EncodingProfile.IPod5GSupport, - Mp4Optimize = job.EncodingProfile.Optimize + IpodAtom = job.IPod5GSupport, + Mp4Optimize = job.Optimize }, - ChapterMarkers = job.EncodingProfile.IncludeChapterMarkers, - Mux = HBFunctions.hb_container_get_from_name(job.EncodingProfile.ContainerName), + ChapterMarkers = job.IncludeChapterMarkers, + Mux = HBFunctions.hb_container_get_from_name(job.ContainerName), ChapterList = new List() }; @@ -241,23 +241,23 @@ namespace HandBrake.Interop.Json.Factories { Video video = new Video(); - HBVideoEncoder videoEncoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(e => e.ShortName == job.EncodingProfile.VideoEncoder); - Validate.NotNull(videoEncoder, "Video encoder " + job.EncodingProfile.VideoEncoder + " not recognized."); + HBVideoEncoder videoEncoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(e => e.ShortName == job.VideoEncoder); + Validate.NotNull(videoEncoder, "Video encoder " + job.VideoEncoder + " not recognized."); if (videoEncoder != null) { video.Codec = videoEncoder.Id; } - video.TwoPass = job.EncodingProfile.TwoPass; - video.Turbo = job.EncodingProfile.TurboFirstPass; - video.Level = job.EncodingProfile.VideoLevel; - video.Options = job.EncodingProfile.VideoOptions; - video.Preset = job.EncodingProfile.VideoPreset; - video.Profile = job.EncodingProfile.VideoProfile; - video.Quality = job.EncodingProfile.Quality; - if (job.EncodingProfile.VideoTunes != null && job.EncodingProfile.VideoTunes.Count > 0) + video.TwoPass = job.TwoPass; + video.Turbo = job.TurboFirstPass; + video.Level = job.VideoLevel; + video.Options = job.VideoOptions; + video.Preset = job.VideoPreset; + video.Profile = job.VideoProfile; + video.Quality = job.Quality; + if (job.VideoTunes != null && job.VideoTunes.Count > 0) { - video.Tune = string.Join(",", job.EncodingProfile.VideoTunes); + video.Tune = string.Join(",", job.VideoTunes); } return video; @@ -276,10 +276,10 @@ namespace HandBrake.Interop.Json.Factories { Audio audio = new Audio(); - if (!string.IsNullOrEmpty(job.EncodingProfile.AudioEncoderFallback)) + if (!string.IsNullOrEmpty(job.AudioEncoderFallback)) { - HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(job.EncodingProfile.AudioEncoderFallback); - Validate.NotNull(audioEncoder, "Unrecognized fallback audio encoder: " + job.EncodingProfile.AudioEncoderFallback); + HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(job.AudioEncoderFallback); + Validate.NotNull(audioEncoder, "Unrecognized fallback audio encoder: " + job.AudioEncoderFallback); audio.FallbackEncoder = audioEncoder.Id; } @@ -287,7 +287,7 @@ namespace HandBrake.Interop.Json.Factories audio.AudioList = new List(); int numTracks = 0; - foreach (AudioEncoding item in job.EncodingProfile.AudioEncodings) + foreach (AudioEncoding item in job.AudioEncodings) { HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(item.Encoder); Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder); @@ -348,31 +348,31 @@ namespace HandBrake.Interop.Json.Factories Filter filter = new Filter { FilterList = new List(), - Grayscale = job.EncodingProfile.Grayscale + Grayscale = job.Grayscale }; // Detelecine - if (job.EncodingProfile.Detelecine != Detelecine.Off) + if (job.Detelecine != Detelecine.Off) { - FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DETELECINE, Settings = job.EncodingProfile.CustomDetelecine }; + FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DETELECINE, Settings = job.CustomDetelecine }; filter.FilterList.Add(filterItem); } // Decomb - if (job.EncodingProfile.Decomb != Decomb.Off) + if (job.Decomb != Decomb.Off) { string options; - if (job.EncodingProfile.Decomb == Decomb.Fast) + if (job.Decomb == Decomb.Fast) { options = "7:2:6:9:1:80"; } - else if (job.EncodingProfile.Decomb == Decomb.Bob) + else if (job.Decomb == Decomb.Bob) { options = "455"; } else { - options = job.EncodingProfile.CustomDecomb; + options = job.CustomDecomb; } FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DECOMB, Settings = options }; @@ -380,28 +380,28 @@ namespace HandBrake.Interop.Json.Factories } // Deinterlace - if (job.EncodingProfile.Deinterlace != Deinterlace.Off) + if (job.Deinterlace != Deinterlace.Off) { string options; - if (job.EncodingProfile.Deinterlace == Deinterlace.Fast) + if (job.Deinterlace == Deinterlace.Fast) { options = "0"; } - else if (job.EncodingProfile.Deinterlace == Deinterlace.Slow) + else if (job.Deinterlace == Deinterlace.Slow) { options = "1"; } - else if (job.EncodingProfile.Deinterlace == Deinterlace.Slower) + else if (job.Deinterlace == Deinterlace.Slower) { options = "3"; } - else if (job.EncodingProfile.Deinterlace == Deinterlace.Bob) + else if (job.Deinterlace == Deinterlace.Bob) { options = "15"; } else { - options = job.EncodingProfile.CustomDeinterlace; + options = job.CustomDeinterlace; } FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEINTERLACE, Settings = options }; @@ -409,8 +409,8 @@ namespace HandBrake.Interop.Json.Factories } // VFR / CFR - int fm = job.EncodingProfile.ConstantFramerate ? 1 : job.EncodingProfile.PeakFramerate ? 2 : 0; - IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(job.EncodingProfile.Framerate.ToString(CultureInfo.InvariantCulture)); + int fm = job.ConstantFramerate ? 1 : job.PeakFramerate ? 2 : 0; + IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(job.Framerate.ToString(CultureInfo.InvariantCulture)); int vrate = HBFunctions.hb_video_framerate_get_from_name(frameratePrt); int num; @@ -433,28 +433,28 @@ namespace HandBrake.Interop.Json.Factories filter.FilterList.Add(framerateShaper); // Deblock - if (job.EncodingProfile.Deblock >= 5) + if (job.Deblock >= 5) { - FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEBLOCK, Settings = job.EncodingProfile.Deblock.ToString() }; + FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEBLOCK, Settings = job.Deblock.ToString() }; filter.FilterList.Add(filterItem); } // Denoise - if (job.EncodingProfile.Denoise != Denoise.Off) + if (job.Denoise != Denoise.Off) { - hb_filter_ids id = job.EncodingProfile.Denoise == Denoise.hqdn3d + hb_filter_ids id = job.Denoise == Denoise.hqdn3d ? hb_filter_ids.HB_FILTER_HQDN3D : hb_filter_ids.HB_FILTER_NLMEANS; string settings; - if (job.EncodingProfile.Denoise == Denoise.hqdn3d - && !string.IsNullOrEmpty(job.EncodingProfile.CustomDenoise)) + if (job.Denoise == Denoise.hqdn3d + && !string.IsNullOrEmpty(job.CustomDenoise)) { - settings = job.EncodingProfile.CustomDenoise; + settings = job.CustomDenoise; } else { - IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings((int)id, job.EncodingProfile.DenoisePreset, job.EncodingProfile.DenoiseTune); + IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings((int)id, job.DenoisePreset, job.DenoiseTune); settings = Marshal.PtrToStringAnsi(settingsPtr); } @@ -472,10 +472,10 @@ namespace HandBrake.Interop.Json.Factories "{0}:{1}:{2}:{3}:{4}:{5}", resultGeometry.Width, resultGeometry.Height, - job.EncodingProfile.Cropping.Top, - job.EncodingProfile.Cropping.Bottom, - job.EncodingProfile.Cropping.Left, - job.EncodingProfile.Cropping.Right) + job.Cropping.Top, + job.Cropping.Bottom, + job.Cropping.Left, + job.Cropping.Right) }; filter.FilterList.Add(cropScale); diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs index cd54342a7..ce7209948 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs @@ -9,147 +9,416 @@ namespace HandBrake.Interop.Model { - using System; - using System.Collections.Generic; - using System.Xml.Serialization; + using System.Collections.Generic; - using HandBrake.Interop.Model.Encoding; + using HandBrake.Interop.Model.Encoding; - /// + /// /// The encode job. /// public class EncodeJob { - #region Properties + /// + /// Initializes a new instance of the class. + /// + public EncodeJob() + { + this.Cropping = new Cropping(); + } - /// - /// Gets or sets the angle to encode. 0 for default, 1+ for specified angle. - /// - public int Angle { get; set; } + #region Source - /// - /// Gets or sets the chapter end. - /// - public int ChapterEnd { get; set; } + /// + /// Gets or sets the source path. + /// + public string SourcePath { get; set; } - /// - /// Gets or sets the chapter start. - /// - public int ChapterStart { get; set; } + /// + /// Gets or sets the 1-based index of the title to encode. + /// + public int Title { get; set; } - /// - /// Gets or sets the list of chosen audio tracks (1-based) - /// - public List ChosenAudioTracks { get; set; } + /// + /// Gets or sets the range type. + /// + public VideoRangeType RangeType { get; set; } - /// - /// Gets or sets the custom chapter names. - /// - public List CustomChapterNames { get; set; } + /// + /// Gets or sets the seek points. + /// This is the number of preview points. + /// + public int SeekPoints { get; set; } - /// - /// Gets or sets the encoding profile. - /// - public EncodingProfile EncodingProfile { get; set; } + /// + /// Gets or sets the start at preview. + /// + public int StartAtPreview { get; set; } - /// - /// Gets or sets the frames end. - /// - public int FramesEnd { get; set; } + /// + /// Gets or sets the seconds end. + /// + public int SecondsEnd { get; set; } - /// - /// Gets or sets the frames start. - /// - public int FramesStart { get; set; } + /// + /// Gets or sets the seconds start. + /// + public double SecondsStart { get; set; } - /// - /// Gets or sets the length. The length of video to encode. - /// - [XmlIgnore] - public TimeSpan Length { get; set; } + /// + /// Gets or sets the angle to encode. 0 for default, 1+ for specified angle. + /// + public int Angle { get; set; } - /// - /// Gets or sets the output path. - /// - public string OutputPath { get; set; } + /// + /// Gets or sets the chapter end. + /// + public int ChapterEnd { get; set; } - /// - /// Gets or sets the range type. - /// - public VideoRangeType RangeType { get; set; } + /// + /// Gets or sets the chapter start. + /// + public int ChapterStart { get; set; } - /// - /// Gets or sets the seek points. - /// This is the number of preview points. - /// - public int SeekPoints { get; set; } + /// + /// Gets or sets the frames end. + /// + public int FramesEnd { get; set; } - /// - /// Gets or sets the start at preview. - /// - public int StartAtPreview { get; set; } + /// + /// Gets or sets the frames start. + /// + public int FramesStart { get; set; } - /// - /// Gets or sets the seconds end. - /// - public int SecondsEnd { get; set; } + /// + /// Gets or sets the source type. + /// + public SourceType SourceType { get; set; } - /// - /// Gets or sets the seconds start. - /// - public double SecondsStart { get; set; } + #endregion - /// - /// Gets or sets the source path. - /// - public string SourcePath { get; set; } + #region Destination and Output Settings - /// - /// Gets or sets the source type. - /// - public SourceType SourceType { get; set; } + /// + /// Gets or sets the output path. + /// + public string OutputPath { get; set; } - /// - /// Gets or sets the subtitles. - /// - public Subtitles Subtitles { get; set; } + /// + /// Gets or sets the container name. + /// + public string ContainerName { get; set; } - /// - /// Gets or sets the 1-based index of the title to encode. - /// - public int Title { get; set; } + /// + /// Gets or sets the preferred extension. + /// + public OutputExtension PreferredExtension { get; set; } - /// - /// Gets or sets a value indicating whether use default chapter names. - /// - public bool UseDefaultChapterNames { get; set; } + /// + /// Gets or sets a value indicating whether include chapter markers. + /// + public bool IncludeChapterMarkers { get; set; } - /// - /// Gets or sets a value indicating whether to use DXVA hardware decoding. - /// - public bool DxvaDecoding { get; set; } + /// + /// Gets or sets a value indicating whether optimize. + /// + public bool Optimize { get; set; } - /// - /// Gets or sets the xml length. - /// - [XmlElement("Length")] - public string XmlLength - { - get - { - return this.Length.ToString(); - } - set - { - this.Length = TimeSpan.Parse(value); - } - } + /// + /// Gets or sets a value indicating whether i pod 5 g support. + /// + public bool IPod5GSupport { get; set; } + #endregion - #endregion + #region Picture Settings + + /// + /// Gets or sets the width. + /// + public int Width { get; set; } + + /// + /// Gets or sets the height. + /// + public int Height { get; set; } + + /// + /// Gets or sets the max width. + /// + public int MaxWidth { get; set; } + + /// + /// Gets or sets the max height. + /// + public int MaxHeight { get; set; } + + /// + /// Gets or sets the scale method. + /// + public ScaleMethod ScaleMethod { get; set; } + + /// + /// Gets or sets the cropping type. + /// + public CroppingType CroppingType { get; set; } + + /// + /// Gets or sets the cropping. + /// + public Cropping Cropping { get; set; } + + /// + /// Gets or sets the anamorphic. + /// + public Anamorphic Anamorphic { get; set; } + + /// + /// Gets or sets a value indicating whether use display width. + /// + public bool UseDisplayWidth { get; set; } + + /// + /// Gets or sets the display width. + /// + public int DisplayWidth { get; set; } + + /// + /// Gets or sets a value indicating whether keep display aspect. + /// + public bool KeepDisplayAspect { get; set; } + + /// + /// Gets or sets the pixel aspect x. + /// + public int PixelAspectX { get; set; } + + /// + /// Gets or sets the pixel aspect y. + /// + public int PixelAspectY { get; set; } + + /// + /// Gets or sets the modulus. + /// + public int Modulus { get; set; } + + /// + /// Gets or sets the rotation. + /// + public PictureRotation Rotation { get; set; } + + /// + /// Gets or sets a value indicating whether the picture should be flipped horizontally. + /// + public bool FlipHorizontal { get; set; } + + /// + /// Gets or sets a value indicating whether the picture should be flipped vertically. + /// + public bool FlipVertical { get; set; } + #endregion + + #region Filters - #region Public Methods + /// + /// Gets or sets the deinterlace. + /// + public Deinterlace Deinterlace { get; set; } - /// + /// + /// Gets or sets the custom deinterlace. + /// + public string CustomDeinterlace { get; set; } + + /// + /// Gets or sets the decomb. + /// + public Decomb Decomb { get; set; } + + /// + /// Gets or sets the custom decomb. + /// + public string CustomDecomb { get; set; } + + /// + /// Gets or sets the detelecine. + /// + public Detelecine Detelecine { get; set; } + + /// + /// Gets or sets the custom detelecine. + /// + public string CustomDetelecine { get; set; } + + /// + /// Gets or sets the denoise. + /// + public Denoise Denoise { get; set; } + + /// + /// Gets or sets the denoise preset name. + /// + public string DenoisePreset { get; set; } + + /// + /// Gets or sets the denoise tune name. + /// + public string DenoiseTune { get; set; } + + /// + /// Gets or sets a value indicating whether we should use the provided + /// custom denoise string or we should use the preset and tune. + /// + public bool UseCustomDenoise { get; set; } + + /// + /// Gets or sets the custom denoise. + /// + public string CustomDenoise { get; set; } + + /// + /// Gets or sets the deblock. + /// + public int Deblock { get; set; } + + /// + /// Gets or sets a value indicating whether the grayscale filter will be applied. + /// + public bool Grayscale { get; set; } + #endregion + + #region Video + + /// + /// Gets or sets the video encoder. + /// + public string VideoEncoder { get; set; } + + /// + /// Gets or sets the video encoder options. + /// + public string VideoOptions { get; set; } + + /// + /// Gets or sets the video encoder profile name. + /// + public string VideoProfile { get; set; } + + /// + /// Gets or sets the video encoder preset name. + /// + public string VideoPreset { get; set; } + + /// + /// Gets or sets the video encoder tunes. + /// + public List VideoTunes { get; set; } + + /// + /// Gets or sets the video encoder level. + /// + public string VideoLevel { get; set; } + + /// + /// Gets or sets a value indicating whether to use QSV decoding. + /// + public bool QsvDecode { get; set; } + + /// + /// Gets or sets the video encode rate type. + /// + public VideoEncodeRateType VideoEncodeRateType { get; set; } + + /// + /// Gets or sets the quality. + /// + public double Quality { get; set; } + + /// + /// Gets or sets the target size. + /// + public int TargetSize { get; set; } + + /// + /// Gets or sets the video bitrate. + /// + public int VideoBitrate { get; set; } + + /// + /// Gets or sets a value indicating whether two pass. + /// + public bool TwoPass { get; set; } + + /// + /// Gets or sets a value indicating whether turbo first pass. + /// + public bool TurboFirstPass { get; set; } + + /// + /// Gets or sets the framerate. + /// + public double Framerate { get; set; } + + /// + /// Gets or sets a value indicating whether constant framerate. + /// + public bool ConstantFramerate { get; set; } + + /// + /// Gets or sets a value indicating whether peak framerate. + /// + public bool PeakFramerate { get; set; } + #endregion + + #region Audio + + /// + /// Gets or sets the audio encodings. + /// + public List AudioEncodings { get; set; } + + /// + /// Gets or sets the list of chosen audio tracks (1-based) + /// + public List ChosenAudioTracks { get; set; } + + /// + /// Gets or sets the audio encoder fallback. + /// + public string AudioEncoderFallback { get; set; } + #endregion + + #region Chapter Markers + + /// + /// Gets or sets a value indicating whether use default chapter names. + /// + public bool UseDefaultChapterNames { get; set; } + + /// + /// Gets or sets the custom chapter names. + /// + public List CustomChapterNames { get; set; } + #endregion + + #region Subtitles + + /// + /// Gets or sets the subtitles. + /// + public Subtitles Subtitles { get; set; } + #endregion + + #region Additional Args + + /// + /// Gets or sets a value indicating whether to use DXVA hardware decoding. + /// + public bool DxvaDecoding { get; set; } + #endregion + + #region Public Methods + + /// /// The clone. /// /// @@ -172,11 +441,66 @@ namespace HandBrake.Interop.Model FramesEnd = this.FramesEnd, ChosenAudioTracks = new List(this.ChosenAudioTracks), Subtitles = this.Subtitles, - UseDefaultChapterNames = this.UseDefaultChapterNames, - DxvaDecoding = this.DxvaDecoding, + UseDefaultChapterNames = this.UseDefaultChapterNames, + DxvaDecoding = this.DxvaDecoding, OutputPath = this.OutputPath, - EncodingProfile = this.EncodingProfile, - Length = this.Length + + ContainerName = this.ContainerName, + PreferredExtension = this.PreferredExtension, + IncludeChapterMarkers = this.IncludeChapterMarkers, + Optimize = this.Optimize, + IPod5GSupport = this.IPod5GSupport, + + Width = this.Width, + Height = this.Height, + MaxWidth = this.MaxWidth, + MaxHeight = this.MaxHeight, + ScaleMethod = this.ScaleMethod, + CroppingType = this.CroppingType, + Cropping = this.Cropping.Clone(), + Anamorphic = this.Anamorphic, + UseDisplayWidth = this.UseDisplayWidth, + DisplayWidth = this.DisplayWidth, + KeepDisplayAspect = this.KeepDisplayAspect, + PixelAspectX = this.PixelAspectX, + PixelAspectY = this.PixelAspectY, + Modulus = this.Modulus, + Rotation = this.Rotation, + FlipHorizontal = this.FlipHorizontal, + FlipVertical = this.FlipVertical, + + Deinterlace = this.Deinterlace, + CustomDeinterlace = this.CustomDeinterlace, + Decomb = this.Decomb, + CustomDecomb = this.CustomDecomb, + Detelecine = this.Detelecine, + CustomDetelecine = this.CustomDetelecine, + Denoise = this.Denoise, + DenoisePreset = this.DenoisePreset, + DenoiseTune = this.DenoiseTune, + UseCustomDenoise = this.UseCustomDenoise, + CustomDenoise = this.CustomDenoise, + Deblock = this.Deblock, + Grayscale = this.Grayscale, + + VideoEncoder = this.VideoEncoder, + VideoOptions = this.VideoOptions, + VideoProfile = this.VideoProfile, + VideoPreset = this.VideoPreset, + VideoTunes = this.VideoTunes, + VideoLevel = this.VideoLevel, + QsvDecode = this.QsvDecode, + VideoEncodeRateType = this.VideoEncodeRateType, + Quality = this.Quality, + TargetSize = this.TargetSize, + VideoBitrate = this.VideoBitrate, + TwoPass = this.TwoPass, + TurboFirstPass = this.TurboFirstPass, + Framerate = this.Framerate, + ConstantFramerate = this.ConstantFramerate, + + AudioEncodings = new List(this.AudioEncodings), + AudioEncoderFallback = this.AudioEncoderFallback }; return clone; diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs deleted file mode 100644 index 581b9364a..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs +++ /dev/null @@ -1,381 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// -// -// Defines the EncodingProfile type. -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Model.Encoding -{ - using System.Collections.Generic; - - using HandBrake.Interop.Model; - - /// - /// The encoding profile. - /// - public class EncodingProfile - { - /// - /// Initializes a new instance of the class. - /// - public EncodingProfile() - { - this.Cropping = new Cropping(); - } - - #region Destination and Output Settings - - /// - /// Gets or sets the container name. - /// - public string ContainerName { get; set; } - - /// - /// Gets or sets the preferred extension. - /// - public OutputExtension PreferredExtension { get; set; } - - /// - /// Gets or sets a value indicating whether include chapter markers. - /// - public bool IncludeChapterMarkers { get; set; } - - /// - /// Gets or sets a value indicating whether optimize. - /// - public bool Optimize { get; set; } - - /// - /// Gets or sets a value indicating whether i pod 5 g support. - /// - public bool IPod5GSupport { get; set; } - #endregion - - #region Picture Settings - - /// - /// Gets or sets the width. - /// - public int Width { get; set; } - - /// - /// Gets or sets the height. - /// - public int Height { get; set; } - - /// - /// Gets or sets the max width. - /// - public int MaxWidth { get; set; } - - /// - /// Gets or sets the max height. - /// - public int MaxHeight { get; set; } - - /// - /// Gets or sets the scale method. - /// - public ScaleMethod ScaleMethod { get; set; } - - /// - /// Gets or sets the cropping type. - /// - public CroppingType CroppingType { get; set; } - - /// - /// Gets or sets the cropping. - /// - public Cropping Cropping { get; set; } - - /// - /// Gets or sets the anamorphic. - /// - public Anamorphic Anamorphic { get; set; } - - /// - /// Gets or sets a value indicating whether use display width. - /// - public bool UseDisplayWidth { get; set; } - - /// - /// Gets or sets the display width. - /// - public int DisplayWidth { get; set; } - - /// - /// Gets or sets a value indicating whether keep display aspect. - /// - public bool KeepDisplayAspect { get; set; } - - /// - /// Gets or sets the pixel aspect x. - /// - public int PixelAspectX { get; set; } - - /// - /// Gets or sets the pixel aspect y. - /// - public int PixelAspectY { get; set; } - - /// - /// Gets or sets the modulus. - /// - public int Modulus { get; set; } - - /// - /// Gets or sets the rotation. - /// - public PictureRotation Rotation { get; set; } - - /// - /// Gets or sets a value indicating whether the picture should be flipped horizontally. - /// - public bool FlipHorizontal { get; set; } - - /// - /// Gets or sets a value indicating whether the picture should be flipped vertically. - /// - public bool FlipVertical { get; set; } - #endregion - - #region Filters - - /// - /// Gets or sets the deinterlace. - /// - public Deinterlace Deinterlace { get; set; } - - /// - /// Gets or sets the custom deinterlace. - /// - public string CustomDeinterlace { get; set; } - - /// - /// Gets or sets the decomb. - /// - public Decomb Decomb { get; set; } - - /// - /// Gets or sets the custom decomb. - /// - public string CustomDecomb { get; set; } - - /// - /// Gets or sets the detelecine. - /// - public Detelecine Detelecine { get; set; } - - /// - /// Gets or sets the custom detelecine. - /// - public string CustomDetelecine { get; set; } - - /// - /// Gets or sets the denoise. - /// - public Denoise Denoise { get; set; } - - /// - /// Gets or sets the denoise preset name. - /// - public string DenoisePreset { get; set; } - - /// - /// Gets or sets the denoise tune name. - /// - public string DenoiseTune { get; set; } - - /// - /// Gets or sets a value indicating whether we should use the provided - /// custom denoise string or we should use the preset and tune. - /// - public bool UseCustomDenoise { get; set; } - - /// - /// Gets or sets the custom denoise. - /// - public string CustomDenoise { get; set; } - - /// - /// Gets or sets the deblock. - /// - public int Deblock { get; set; } - - /// - /// Gets or sets a value indicating whether the grayscale filter will be applied. - /// - public bool Grayscale { get; set; } - #endregion - - #region Video - - /// - /// Gets or sets the video encoder. - /// - public string VideoEncoder { get; set; } - - /// - /// Gets or sets the video encoder options. - /// - public string VideoOptions { get; set; } - - /// - /// Gets or sets the video encoder profile name. - /// - public string VideoProfile { get; set; } - - /// - /// Gets or sets the video encoder preset name. - /// - public string VideoPreset { get; set; } - - /// - /// Gets or sets the video encoder tunes. - /// - public List VideoTunes { get; set; } - - /// - /// Gets or sets the video encoder level. - /// - public string VideoLevel { get; set; } - - /// - /// Gets or sets a value indicating whether to use QSV decoding. - /// - public bool QsvDecode { get; set; } - - /// - /// Gets or sets the video encode rate type. - /// - public VideoEncodeRateType VideoEncodeRateType { get; set; } - - /// - /// Gets or sets the quality. - /// - public double Quality { get; set; } - - /// - /// Gets or sets the target size. - /// - public int TargetSize { get; set; } - - /// - /// Gets or sets the video bitrate. - /// - public int VideoBitrate { get; set; } - - /// - /// Gets or sets a value indicating whether two pass. - /// - public bool TwoPass { get; set; } - - /// - /// Gets or sets a value indicating whether turbo first pass. - /// - public bool TurboFirstPass { get; set; } - - /// - /// Gets or sets the framerate. - /// - public double Framerate { get; set; } - - /// - /// Gets or sets a value indicating whether constant framerate. - /// - public bool ConstantFramerate { get; set; } - - /// - /// Gets or sets a value indicating whether peak framerate. - /// - public bool PeakFramerate { get; set; } - #endregion - - #region Audio - - /// - /// Gets or sets the audio encodings. - /// - public List AudioEncodings { get; set; } - - /// - /// Gets or sets the audio encoder fallback. - /// - public string AudioEncoderFallback { get; set; } - #endregion - - /// - /// The clone. - /// - /// - /// The . - /// - public EncodingProfile Clone() - { - var profile = new EncodingProfile - { - ContainerName = this.ContainerName, - PreferredExtension = this.PreferredExtension, - IncludeChapterMarkers = this.IncludeChapterMarkers, - Optimize = this.Optimize, - IPod5GSupport = this.IPod5GSupport, - - Width = this.Width, - Height = this.Height, - MaxWidth = this.MaxWidth, - MaxHeight = this.MaxHeight, - ScaleMethod = this.ScaleMethod, - CroppingType = this.CroppingType, - Cropping = this.Cropping.Clone(), - Anamorphic = this.Anamorphic, - UseDisplayWidth = this.UseDisplayWidth, - DisplayWidth = this.DisplayWidth, - KeepDisplayAspect = this.KeepDisplayAspect, - PixelAspectX = this.PixelAspectX, - PixelAspectY = this.PixelAspectY, - Modulus = this.Modulus, - Rotation = this.Rotation, - FlipHorizontal = this.FlipHorizontal, - FlipVertical = this.FlipVertical, - - Deinterlace = this.Deinterlace, - CustomDeinterlace = this.CustomDeinterlace, - Decomb = this.Decomb, - CustomDecomb = this.CustomDecomb, - Detelecine = this.Detelecine, - CustomDetelecine = this.CustomDetelecine, - Denoise = this.Denoise, - DenoisePreset = this.DenoisePreset, - DenoiseTune = this.DenoiseTune, - UseCustomDenoise = this.UseCustomDenoise, - CustomDenoise = this.CustomDenoise, - Deblock = this.Deblock, - Grayscale = this.Grayscale, - - VideoEncoder = this.VideoEncoder, - VideoOptions = this.VideoOptions, - VideoProfile = this.VideoProfile, - VideoPreset = this.VideoPreset, - VideoTunes = this.VideoTunes, - VideoLevel = this.VideoLevel, - QsvDecode = this.QsvDecode, - VideoEncodeRateType = this.VideoEncodeRateType, - Quality = this.Quality, - TargetSize = this.TargetSize, - VideoBitrate = this.VideoBitrate, - TwoPass = this.TwoPass, - TurboFirstPass = this.TurboFirstPass, - Framerate = this.Framerate, - ConstantFramerate = this.ConstantFramerate, - - AudioEncodings = new List(this.AudioEncodings), - AudioEncoderFallback = this.AudioEncoderFallback - }; - - return profile; - } - } -} diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 77cd826db..d360ab0ea 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -138,7 +138,6 @@ namespace HandBrakeWPF.ViewModels this.Title = "Preview"; this.Percentage = "0.00%"; this.PercentageValue = 0; - this.StartAt = 1; this.Duration = 30; this.CanPlay = true; @@ -323,11 +322,6 @@ namespace HandBrakeWPF.ViewModels } } - /// - /// Gets or sets StartAt. - /// - public int StartAt { get; set; } - /// /// Gets StartPoints. /// @@ -523,7 +517,7 @@ namespace HandBrakeWPF.ViewModels EncodeTask encodeTask = new EncodeTask(this.Task) { PreviewDuration = this.Duration, - PreviewStartAt = this.StartAt, + PreviewStartAt = this.SelectedPreviewImage, PointToPointMode = PointToPointMode.Preview }; @@ -547,7 +541,7 @@ namespace HandBrakeWPF.ViewModels // Setup the encode task as a preview encode encodeTask.IsPreviewEncode = true; - encodeTask.PreviewEncodeStartAt = this.StartAt; + encodeTask.PreviewEncodeStartAt = this.SelectedPreviewImage; // TODO 0 and 1 mean the same. Need to fix this as it knocks the video out of sync with the still preview. encodeTask.PreviewEncodeDuration = this.Duration; QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create()); ThreadPool.QueueUserWorkItem(this.CreatePreview, task); -- cgit v1.2.3