From 99aa2bf7c9bfa34d1bf822d70da22243fbbdd344 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 3 May 2015 17:29:45 +0000 Subject: [PATCH] WinGui: Fix Line Endings and (StyleCop)Warnings git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7152 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Interop/Factories/AnamorphicFactory.cs | 20 +- .../Interop/HandBrakeUtils.cs | 98 ++-- .../Interop/Json/Encode/SubtitleTrack.cs | 11 +- .../Interop/Json/Scan/SourceAudioTrack.cs | 11 +- .../Interop/Json/Scan/SourceChapter.cs | 11 +- .../Interop/Model/BitrateLimits.cs | 4 +- .../Interop/Model/Preview/PreviewSettings.cs | 131 ++++-- .../Encode/Factories/EncodeFactory.cs | 440 +++++++++--------- .../Services/Encode/LibEncode.cs | 1 - .../Services/Scan/LibScan.cs | 73 ++- .../Utilities/Converters.cs | 3 - .../Utilities/Execute.cs | 21 +- .../Utilities/ExtensionMethods.cs | 24 +- .../Utilities/GeneralUtilities.cs | 5 - .../Utilities/PropertyChangedBase.cs | 3 +- .../HandBrakeWPF/Controls/StatusPanel.xaml.cs | 1 - win/CS/HandBrakeWPF/Helpers/PictureSize.cs | 2 +- .../Presets/Factories/PlistFactory.cs | 3 - .../Presets/Factories/PlistPresetFactory.cs | 1 - .../Services/Presets/PresetService.cs | 5 + .../ViewModels/StaticPreviewViewModel.cs | 37 +- .../ViewModels/SubtitlesViewModel.cs | 1 - .../HandBrakeWPF/ViewModels/VideoViewModel.cs | 2 - win/CS/HandBrakeWPF/Views/ShellView.xaml.cs | 1 - 24 files changed, 486 insertions(+), 423 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Factories/AnamorphicFactory.cs b/win/CS/HandBrake.ApplicationServices/Interop/Factories/AnamorphicFactory.cs index 741723329..5c49c5073 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Factories/AnamorphicFactory.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Factories/AnamorphicFactory.cs @@ -64,14 +64,16 @@ namespace HandBrake.ApplicationServices.Interop.Factories DestSettings = new DestSettings { AnamorphicMode = (int)job.Anamorphic, - Geometry = { - Width = job.Width ?? 0, Height = job.Height ?? 0, - PAR = new PAR - { - Num = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : job.PixelAspectX, - Den = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : job.PixelAspectY, - } - }, + Geometry = + { + Width = job.Width ?? 0, + Height = job.Height ?? 0, + PAR = new PAR + { + 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.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right }, Modulus = job.Modulus ?? 16, @@ -98,7 +100,7 @@ namespace HandBrake.ApplicationServices.Interop.Factories /// /// The preview settings. /// Information on the title to consider. - /// + /// Geometry Information public static Geometry CreateGeometry(PreviewSettings settings, SourceVideoInfo title) { int settingMode = settings.KeepDisplayAspect ? 0x04 : 0; diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs index aad5df21c..ccbaee4c1 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs @@ -20,18 +20,18 @@ namespace HandBrake.ApplicationServices.Interop using HandBrake.ApplicationServices.Interop.Json.Shared; using HandBrake.ApplicationServices.Services.Logging; using HandBrake.ApplicationServices.Services.Logging.Model; - - using Newtonsoft.Json; - - /// - /// HandBrake Interop Utilities - /// - public static class HandBrakeUtils - { - /// - /// The callback for log messages from HandBrake. - /// - private static LoggingCallback loggingCallback; + + using Newtonsoft.Json; + + /// + /// HandBrake Interop Utilities + /// + public static class HandBrakeUtils + { + /// + /// The callback for log messages from HandBrake. + /// + private static LoggingCallback loggingCallback; /// /// The callback for error messages from HandBrake. @@ -223,12 +223,12 @@ namespace HandBrake.ApplicationServices.Interop public static bool IsH264LevelValid(string level, int width, int height, int fpsNumerator, int fpsDenominator, bool interlaced, bool fakeInterlaced) { return HBFunctions.hb_check_h264_level( - level, - width, - height, - fpsNumerator, - fpsDenominator, - interlaced ? 1 : 0, + level, + width, + height, + fpsNumerator, + fpsDenominator, + interlaced ? 1 : 0, fakeInterlaced ? 1 : 0) == 0; } @@ -260,12 +260,12 @@ namespace HandBrake.ApplicationServices.Interop /// The full x264 options string from the given inputs. /// public static string CreateX264OptionsString( - string preset, - IList tunes, - string extraOptions, - string profile, - string level, - int width, + string preset, + IList tunes, + string extraOptions, + string profile, + string level, + int width, int height) { if (width <= 0) @@ -279,35 +279,35 @@ namespace HandBrake.ApplicationServices.Interop } IntPtr ptr = HBFunctions.hb_x264_param_unparse( - preset, - string.Join(",", tunes), - extraOptions, - profile, - level, - width, + preset, + string.Join(",", tunes), + extraOptions, + profile, + level, + width, height); string x264Settings = Marshal.PtrToStringAnsi(ptr); - return x264Settings; - } - - /// - /// Gets the final size and PAR of the video, given anamorphic inputs. - /// - /// Anamorphic inputs. - /// The final size and PAR of the video. - public static Geometry GetAnamorphicSize(AnamorphicGeometry anamorphicGeometry) - { - string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); - LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug)); - IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode)); - string result = Marshal.PtrToStringAnsi(json); - return JsonConvert.DeserializeObject(result); - } - - /// - /// Sends the message logged event to any registered listeners. + return x264Settings; + } + + /// + /// Gets the final size and PAR of the video, given anamorphic inputs. + /// + /// Anamorphic inputs. + /// The final size and PAR of the video. + public static Geometry GetAnamorphicSize(AnamorphicGeometry anamorphicGeometry) + { + string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); + LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug)); + IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode)); + string result = Marshal.PtrToStringAnsi(json); + return JsonConvert.DeserializeObject(result); + } + + /// + /// Sends the message logged event to any registered listeners. /// /// /// The message to send. diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleTrack.cs index 3a8aedec7..af4ece97e 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleTrack.cs @@ -1,7 +1,10 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// Represents a subtitle track to encode. +// // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.ApplicationServices.Interop.Json.Encode diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceAudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceAudioTrack.cs index 091f9a4f8..b26baea0e 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceAudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceAudioTrack.cs @@ -1,7 +1,10 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// An audio track from the source video. +// // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.ApplicationServices.Interop.Json.Scan diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceChapter.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceChapter.cs index fce479ff1..fb0d84955 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceChapter.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SourceChapter.cs @@ -1,7 +1,10 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The a chapter from a video source. +// // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.ApplicationServices.Interop.Json.Scan diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/BitrateLimits.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/BitrateLimits.cs index a748fc99e..62ff64200 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/BitrateLimits.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/BitrateLimits.cs @@ -15,12 +15,12 @@ namespace HandBrake.ApplicationServices.Interop.Model public class BitrateLimits { /// - /// The inclusive lower limit for the bitrate. + /// Gets or sets the inclusive lower limit for the bitrate. /// public int Low { get; set; } /// - /// The inclusive upper limit for the bitrate. + /// Gets or sets the inclusive upper limit for the bitrate. /// public int High { get; set; } } diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs index af1a166ce..bcc7f2714 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Preview/PreviewSettings.cs @@ -6,52 +6,85 @@ // The preview settings. // // -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.ApplicationServices.Interop.Model.Preview -{ - using HandBrake.ApplicationServices.Interop.Model.Encoding; - using HandBrake.ApplicationServices.Services.Encode.Model; - - /// - /// The preview settings. - /// - public class PreviewSettings - { - /// - /// Initializes a new instance of the class. - /// - public PreviewSettings() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The task. - public PreviewSettings(EncodeTask task) - { - } - - public Cropping Cropping { get; set; } - - public int MaxWidth { get; set; } - - public int MaxHeight { get; set; } - - public bool KeepDisplayAspect { get; set; } - - public int TitleNumber { get; set; } - - public Anamorphic Anamorphic { get; set; } - - public int? Modulus { get; set; } - - public int Width { get; set; } - - public int Height { get; set; } - - public int PixelAspectX { get; set; } - - public int PixelAspectY { get; set; } - } -} + +namespace HandBrake.ApplicationServices.Interop.Model.Preview +{ + using HandBrake.ApplicationServices.Interop.Model.Encoding; + using HandBrake.ApplicationServices.Services.Encode.Model; + + /// + /// The preview settings. + /// + public class PreviewSettings + { + /// + /// Initializes a new instance of the class. + /// + public PreviewSettings() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The task. + public PreviewSettings(EncodeTask task) + { + } + + /// + /// Gets or sets the cropping. + /// + public Cropping Cropping { 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 a value indicating whether keep display aspect. + /// + public bool KeepDisplayAspect { get; set; } + + /// + /// Gets or sets the title number. + /// + public int TitleNumber { get; set; } + + /// + /// Gets or sets the anamorphic. + /// + public Anamorphic Anamorphic { get; set; } + + /// + /// Gets or sets the modulus. + /// + public int? Modulus { get; set; } + + /// + /// Gets or sets the width. + /// + public int Width { get; set; } + + /// + /// Gets or sets the height. + /// + public int Height { 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; } + } +} diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs index 54b80b28c..8554c843b 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs @@ -14,24 +14,24 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories using System.Linq; using System.Runtime.InteropServices; - using HandBrake.ApplicationServices.Interop; - using HandBrake.ApplicationServices.Interop.HbLib; - using HandBrake.ApplicationServices.Interop.Helpers; - using HandBrake.ApplicationServices.Interop.Json; - using HandBrake.ApplicationServices.Interop.Json.Anamorphic; - using HandBrake.ApplicationServices.Interop.Json.Encode; - using HandBrake.ApplicationServices.Interop.Json.Shared; - using HandBrake.ApplicationServices.Interop.Model.Encoding; + using HandBrake.ApplicationServices.Interop; + using HandBrake.ApplicationServices.Interop.HbLib; + using HandBrake.ApplicationServices.Interop.Helpers; + using HandBrake.ApplicationServices.Interop.Json; + using HandBrake.ApplicationServices.Interop.Json.Anamorphic; + using HandBrake.ApplicationServices.Interop.Json.Encode; + using HandBrake.ApplicationServices.Interop.Json.Shared; + using HandBrake.ApplicationServices.Interop.Model.Encoding; using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services.Encode.Model; - using HandBrake.ApplicationServices.Services.Encode.Model.Models; - using HandBrake.ApplicationServices.Utilities; - - using AudioTrack = HandBrake.ApplicationServices.Services.Encode.Model.Models.AudioTrack; - using Subtitle = HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles; - - /// - /// This factory takes the internal EncodeJob object and turns it into a set of JSON models + using HandBrake.ApplicationServices.Services.Encode.Model.Models; + using HandBrake.ApplicationServices.Utilities; + + using AudioTrack = HandBrake.ApplicationServices.Services.Encode.Model.Models.AudioTrack; + using Subtitle = HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles; + + /// + /// This factory takes the internal EncodeJob object and turns it into a set of JSON models /// that can be deserialized by libhb. /// internal class EncodeFactory @@ -51,23 +51,23 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories /// /// The configuration. /// - /// - /// The . - /// - internal static JsonEncodeObject Create(EncodeTask job, HBConfiguration configuration) - { - JsonEncodeObject encode = new JsonEncodeObject - { - SequenceID = 0, - Audio = CreateAudio(job), - Destination = CreateDestination(job), - Filters = CreateFilters(job), - PAR = CreatePAR(job), - Metadata = CreateMetadata(job), - Source = CreateSource(job, configuration), - Subtitle = CreateSubtitle(job), - Video = CreateVideo(job, configuration) - }; + /// + /// The . + /// + internal static JsonEncodeObject Create(EncodeTask job, HBConfiguration configuration) + { + JsonEncodeObject encode = new JsonEncodeObject + { + SequenceID = 0, + Audio = CreateAudio(job), + Destination = CreateDestination(job), + Filters = CreateFilters(job), + PAR = CreatePAR(job), + Metadata = CreateMetadata(job), + Source = CreateSource(job, configuration), + Subtitle = CreateSubtitle(job), + Video = CreateVideo(job, configuration) + }; return encode; } @@ -88,36 +88,36 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories { Range range = new Range(); switch (job.PointToPointMode) - { - case PointToPointMode.Chapters: - range.Type = "chapter"; - range.Start = job.StartPoint; - range.End = job.EndPoint; - break; - case PointToPointMode.Seconds: - range.Type = "time"; - range.Start = job.StartPoint * 90000; - range.End = (job.EndPoint - job.StartPoint) * 90000; - break; - case PointToPointMode.Frames: - range.Type = "frame"; - range.Start = job.StartPoint; - range.End = job.EndPoint; - break; - case PointToPointMode.Preview: - range.Type = "preview"; - range.Start = job.PreviewEncodeStartAt; - range.SeekPoints = configuration.PreviewScanCount; - range.End = job.PreviewEncodeDuration * 90000; - break; - } - - Source source = new Source - { - Title = job.Title, - Range = range, - Angle = job.Angle, - Path = job.Source, + { + case PointToPointMode.Chapters: + range.Type = "chapter"; + range.Start = job.StartPoint; + range.End = job.EndPoint; + break; + case PointToPointMode.Seconds: + range.Type = "time"; + range.Start = job.StartPoint * 90000; + range.End = (job.EndPoint - job.StartPoint) * 90000; + break; + case PointToPointMode.Frames: + range.Type = "frame"; + range.Start = job.StartPoint; + range.End = job.EndPoint; + break; + case PointToPointMode.Preview: + range.Type = "preview"; + range.Start = job.PreviewEncodeStartAt; + range.SeekPoints = configuration.PreviewScanCount; + range.End = job.PreviewEncodeDuration * 90000; + break; + } + + Source source = new Source + { + Title = job.Title, + Range = range, + Angle = job.Angle, + Path = job.Source, }; return source; } @@ -132,28 +132,28 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories /// The . /// private static Destination CreateDestination(EncodeTask job) - { - Destination destination = new Destination - { - File = job.Destination, - Mp4Options = new Mp4Options - { - IpodAtom = job.IPod5GSupport, - Mp4Optimize = job.OptimizeMP4 - }, - ChapterMarkers = job.IncludeChapterMarkers, - Mux = HBFunctions.hb_container_get_from_name(job.OutputFormat == OutputFormat.Mp4 ? "av_mp4" : "av_mkv"), // TODO tidy up. - ChapterList = new List() - }; - - if (job.IncludeChapterMarkers) - { - foreach (ChapterMarker item in job.ChapterNames) - { - Chapter chapter = new Chapter { Name = item.ChapterName }; - destination.ChapterList.Add(chapter); - } - } + { + Destination destination = new Destination + { + File = job.Destination, + Mp4Options = new Mp4Options + { + IpodAtom = job.IPod5GSupport, + Mp4Optimize = job.OptimizeMP4 + }, + ChapterMarkers = job.IncludeChapterMarkers, + Mux = HBFunctions.hb_container_get_from_name(job.OutputFormat == OutputFormat.Mp4 ? "av_mp4" : "av_mkv"), // TODO tidy up. + ChapterList = new List() + }; + + if (job.IncludeChapterMarkers) + { + foreach (ChapterMarker item in job.ChapterNames) + { + Chapter chapter = new Chapter { Name = item.ChapterName }; + destination.ChapterList.Add(chapter); + } + } return destination; } @@ -178,28 +178,28 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories /// /// The job. /// - /// - /// The . - /// - private static Subtitle CreateSubtitle(EncodeTask job) - { - Subtitles subtitle = new Subtitles - { - Search = - new SubtitleSearch - { - Enable = false, - Default = false, - Burn = false, - Forced = false - }, - SubtitleList = new List() - }; - - foreach (HandBrake.ApplicationServices.Services.Encode.Model.Models.SubtitleTrack item in job.SubtitleTracks) - { - if (!item.IsSrtSubtitle) - { + /// + /// The . + /// + private static Subtitle CreateSubtitle(EncodeTask job) + { + Subtitles subtitle = new Subtitles + { + Search = + new SubtitleSearch + { + Enable = false, + Default = false, + Burn = false, + Forced = false + }, + SubtitleList = new List() + }; + + foreach (HandBrake.ApplicationServices.Services.Encode.Model.Models.SubtitleTrack item in job.SubtitleTracks) + { + if (!item.IsSrtSubtitle) + { // Handle Foreign Audio Search if (item.SourceTrack.TrackNumber == 0) { @@ -207,27 +207,27 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories subtitle.Search.Burn = item.Burned; subtitle.Search.Default = item.Default; subtitle.Search.Forced = item.Forced; - } - else - { - HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack - { - Burn = item.Burned, - Default = item.Default, - Forced = item.Forced, - ID = item.SourceTrack.TrackNumber, - Track = (item.SourceTrack.TrackNumber - 1) - }; - - subtitle.SubtitleList.Add(track); - } - } - else - { - HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack - { - Track = -1, // Indicates SRT - Default = item.Default, + } + else + { + HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack + { + Burn = item.Burned, + Default = item.Default, + Forced = item.Forced, + ID = item.SourceTrack.TrackNumber, + Track = (item.SourceTrack.TrackNumber - 1) + }; + + subtitle.SubtitleList.Add(track); + } + } + else + { + HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack + { + Track = -1, // Indicates SRT + Default = item.Default, Offset = item.SrtOffset, Burn = item.Burned, SRT = @@ -237,13 +237,13 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories Codeset = item.SrtCharCode, Language = item.SrtLang } - }; - - subtitle.SubtitleList.Add(track); - } - } - - return subtitle; + }; + + subtitle.SubtitleList.Add(track); + } + } + + return subtitle; } /// @@ -315,64 +315,64 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories /// The . /// private static Audio CreateAudio(EncodeTask job) - { - Audio audio = new Audio(); - - List copyMaskList = new List(); - if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMaskList.Add(NativeConstants.HB_ACODEC_AAC_PASS); - if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_AC3_PASS); - if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_DCA_HD_PASS); + { + Audio audio = new Audio(); + + List copyMaskList = new List(); + if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMaskList.Add(NativeConstants.HB_ACODEC_AAC_PASS); + if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_AC3_PASS); + if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_DCA_HD_PASS); if (job.AllowedPassthruOptions.AudioAllowDTSPass) copyMaskList.Add(NativeConstants.HB_ACODEC_DCA_PASS); if (job.AllowedPassthruOptions.AudioAllowEAC3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_EAC3_PASS); - if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMaskList.Add(NativeConstants.HB_ACODEC_FLAC_PASS); - if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_MP3_PASS); - if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_TRUEHD_PASS); - audio.CopyMask = copyMaskList.ToArray(); - - HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback)); - audio.FallbackEncoder = audioEncoder.Id; - - audio.AudioList = new List(); - foreach (AudioTrack item in job.AudioTracks) - { - HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(ApplicationServices.Utilities.Converters.GetCliAudioEncoder(item.Encoder)); - Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder); - - HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown)); - Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown)); - - HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack audioTrack = new HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack - { - Track = (item.Track.HasValue ? item.Track.Value : 0) - 1, - DRC = item.DRC, - Encoder = encoder.Id, - Gain = item.Gain, - Mixdown = mixdown.Id, - NormalizeMixLevel = false, - Samplerate = GetSampleRateRaw(item.SampleRate), - Name = item.TrackName, + if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMaskList.Add(NativeConstants.HB_ACODEC_FLAC_PASS); + if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_MP3_PASS); + if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_TRUEHD_PASS); + audio.CopyMask = copyMaskList.ToArray(); + + HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback)); + audio.FallbackEncoder = audioEncoder.Id; + + audio.AudioList = new List(); + foreach (AudioTrack item in job.AudioTracks) + { + HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(ApplicationServices.Utilities.Converters.GetCliAudioEncoder(item.Encoder)); + Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder); + + HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown)); + Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown)); + + HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack audioTrack = new HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack + { + Track = (item.Track.HasValue ? item.Track.Value : 0) - 1, + DRC = item.DRC, + Encoder = encoder.Id, + Gain = item.Gain, + Mixdown = mixdown.Id, + NormalizeMixLevel = false, + Samplerate = GetSampleRateRaw(item.SampleRate), + Name = item.TrackName, }; if (!item.IsPassthru) { // TODO Impiment Quality and Compression. We only support bitrate right now. - //if (item.EncodeRateType == AudioEncodeRateType.Quality) - //{ + // if (item.EncodeRateType == AudioEncodeRateType.Quality) + // { // audioTrack.Quality = item.Quality; - //} + // } - //if (item.EncodeRateType == AudioEncodeRateType.Compression) - //{ + // if (item.EncodeRateType == AudioEncodeRateType.Compression) + // { // audioTrack.CompressionLevel = item.Compression; - //} - - //if (item.EncodeRateType == AudioEncodeRateType.Bitrate) - // { - audioTrack.Bitrate = item.Bitrate; - // } - } - - audio.AudioList.Add(audioTrack); + // } + + // if (item.EncodeRateType == AudioEncodeRateType.Bitrate) + // { + audioTrack.Bitrate = item.Bitrate; + // } + } + + audio.AudioList.Add(audioTrack); } return audio; @@ -406,17 +406,17 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories /// /// The job. /// - /// - /// The . - /// - private static Filters CreateFilters(EncodeTask job) - { - Filters filter = new Filters - { - FilterList = new List(), - Grayscale = job.Grayscale - }; - + /// + /// The . + /// + private static Filters CreateFilters(EncodeTask job) + { + Filters filter = new Filters + { + FilterList = new List(), + Grayscale = job.Grayscale + }; + // Detelecine if (job.Detelecine != Detelecine.Off) { @@ -521,21 +521,21 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories filter.FilterList.Add(filterItem); } - // CropScale Filter - Filter cropScale = new Filter - { - ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE, - Settings = - string.Format( - "{0}:{1}:{2}:{3}:{4}:{5}", - job.Width, - job.Height, - job.Cropping.Top, - job.Cropping.Bottom, - job.Cropping.Left, - job.Cropping.Right) - }; - filter.FilterList.Add(cropScale); + // CropScale Filter + Filter cropScale = new Filter + { + ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE, + Settings = + string.Format( + "{0}:{1}:{2}:{3}:{4}:{5}", + job.Width, + job.Height, + job.Cropping.Top, + job.Cropping.Bottom, + job.Cropping.Left, + job.Cropping.Right) + }; + filter.FilterList.Add(cropScale); // Rotate /* TODO NOT SUPPORTED YET. */ @@ -547,17 +547,17 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories /// The create meta data. /// /// - /// The job. - /// - /// - /// The . - /// - private static Metadata CreateMetadata(EncodeTask job) - { - Metadata metaData = new Metadata(); - - /* TODO NOT SUPPORTED YET. */ - return metaData; + /// The job. + /// + /// + /// The . + /// + private static Metadata CreateMetadata(EncodeTask job) + { + Metadata metaData = new Metadata(); + + /* TODO NOT SUPPORTED YET. */ + return metaData; } } } diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs index a0718262d..6ad5875cf 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs @@ -164,7 +164,6 @@ namespace HandBrake.ApplicationServices.Services.Encode } } - #region HandBrakeInstance Event Handlers. /// diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs index 5eab75520..b67513826 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs @@ -102,13 +102,13 @@ namespace HandBrake.ApplicationServices.Services.Scan #region Events - /// - /// Scan has Started - /// - public event EventHandler ScanStarted; - - /// - /// Scan has completed + /// + /// Scan has Started + /// + public event EventHandler ScanStarted; + + /// + /// Scan has completed /// public event ScanCompletedStatus ScanCompleted; @@ -318,14 +318,14 @@ namespace HandBrake.ApplicationServices.Services.Scan HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled); - this.ServiceLogMessage("Starting Scan ..."); - this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0); - - if (this.ScanStarted != null) - this.ScanStarted(this, System.EventArgs.Empty); - } - catch (Exception exc) - { + this.ServiceLogMessage("Starting Scan ..."); + this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0); + + if (this.ScanStarted != null) + this.ScanStarted(this, System.EventArgs.Empty); + } + catch (Exception exc) + { this.ServiceLogMessage("Scan Failed ..." + Environment.NewLine + exc); this.Stop(); @@ -488,28 +488,28 @@ namespace HandBrake.ApplicationServices.Services.Scan Playlist = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null, FramerateNumerator = title.FrameRate.Num, FramerateDenominator = title.FrameRate.Den - }; - - int currentTrack = 1; - foreach (SourceChapter chapter in title.ChapterList) - { - string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty; - converted.Chapters.Add(new Chapter(currentTrack, chapterName, new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds))); + }; + + int currentTrack = 1; + foreach (SourceChapter chapter in title.ChapterList) + { + string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty; + converted.Chapters.Add(new Chapter(currentTrack, chapterName, new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds))); currentTrack++; - } - - int currentAudioTrack = 1; - foreach (SourceAudioTrack track in title.AudioList) - { - converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate)); - currentAudioTrack++; - } - - int currentSubtitleTrack = 1; - foreach (SourceSubtitleTrack track in title.SubtitleList) - { - SubtitleType convertedType = new SubtitleType(); - + } + + int currentAudioTrack = 1; + foreach (SourceAudioTrack track in title.AudioList) + { + converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate)); + currentAudioTrack++; + } + + int currentSubtitleTrack = 1; + foreach (SourceSubtitleTrack track in title.SubtitleList) + { + SubtitleType convertedType = new SubtitleType(); + switch (track.Source) { case 0: @@ -538,7 +538,6 @@ namespace HandBrake.ApplicationServices.Services.Scan break; } - bool canBurn = HBFunctions.hb_subtitle_can_burn(track.Source) > 0; bool canSetForcedOnly = HBFunctions.hb_subtitle_can_force(track.Source) > 0; diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs index d681106e0..3e61b35d8 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs @@ -154,8 +154,6 @@ namespace HandBrake.ApplicationServices.Utilities } } - - /// /// Get the GUI equiv to a GUI audio encoder string /// @@ -232,7 +230,6 @@ namespace HandBrake.ApplicationServices.Utilities #region Video - /// /// Get the Video Encoder for a given string /// diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/Execute.cs b/win/CS/HandBrake.ApplicationServices/Utilities/Execute.cs index 7f5889891..c98140977 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/Execute.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/Execute.cs @@ -27,7 +27,7 @@ namespace HandBrake.ApplicationServices.Utilities private static bool? inDesignMode; /// - /// Indicates whether or not the framework is in design-time mode. + /// Gets a value indicating whether or not the framework is in design-time mode. /// public static bool InDesignMode { @@ -72,6 +72,12 @@ namespace HandBrake.ApplicationServices.Utilities Execute.dispatcher = (Dispatcher)null; } + /// + /// The validate dispatcher. + /// + /// + /// Not initialized with dispatcher. + /// private static void ValidateDispatcher() { if (Execute.dispatcher == null) @@ -91,7 +97,12 @@ namespace HandBrake.ApplicationServices.Utilities /// /// Executes the action on the UI thread asynchronously. /// - /// The action to execute. + /// + /// The action to execute. + /// + /// + /// The . + /// public static Task OnUIThreadAsync(this System.Action action) { Execute.ValidateDispatcher(); @@ -112,6 +123,12 @@ namespace HandBrake.ApplicationServices.Utilities return (Task)taskSource.Task; } + /// + /// The check access. + /// + /// + /// The . + /// private static bool CheckAccess() { if (Execute.dispatcher != null) diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs b/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs index 53db9e23f..9966002c7 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/ExtensionMethods.cs @@ -1,20 +1,31 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The extension methods. +// +// -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.ApplicationServices.Utilities { using System.Linq.Expressions; using System.Reflection; + /// + /// The extension methods. + /// public static class ExtensionMethods { /// /// Converts an expression into a . /// - /// The expression to convert. - /// The member info. + /// + /// The expression to convert. + /// + /// + /// The member info. + /// public static MemberInfo GetMemberInfo(this Expression expression) { var lambda = (LambdaExpression)expression; @@ -30,6 +41,5 @@ namespace HandBrake.ApplicationServices.Utilities return memberExpression.Member; } - } } diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs index 2e8e3f05f..f92332c61 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs @@ -29,11 +29,6 @@ namespace HandBrake.ApplicationServices.Utilities /// private static readonly string LogDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs"; - /// - /// The is lib hb present. - /// - private static bool? isLibHbPresent; - #endregion #region Properties diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs b/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs index b5de5dd22..071243621 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/PropertyChangedBase.cs @@ -27,7 +27,7 @@ namespace HandBrake.ApplicationServices.Utilities private bool isNotifying; /// - /// Enables/Disables property change notification. + /// Gets or sets a value indicating whether the Enables/Disables property change notification. /// [Browsable(false)] public bool IsNotifying @@ -48,6 +48,7 @@ namespace HandBrake.ApplicationServices.Utilities public event PropertyChangedEventHandler PropertyChanged = (param0, param1) => { }; /// + /// Initializes a new instance of the class. /// Creates an instance of . /// public PropertyChangedBase() diff --git a/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs b/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs index 404e2981b..90afe8e33 100644 --- a/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs +++ b/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs @@ -104,7 +104,6 @@ namespace HandBrakeWPF.Controls /// private static void OnCancelActionSet(DependencyObject d, DependencyPropertyChangedEventArgs e) { - } /// diff --git a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs index b14695922..12a994914 100644 --- a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs +++ b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs @@ -186,7 +186,7 @@ namespace HandBrakeWPF.Helpers maxHeight = job.MaxHeight, mode = (int)(hb_anamorphic_mode_t)job.AnamorphicMode, modulus = job.Modulus.HasValue ? job.Modulus.Value : 16, - geometry = new hb_geometry_s { height = job.Height, width = job.Width, par = job.AnamorphicMode != Anamorphic.Custom ? new hb_rational_t { den = title.ParH, num = title.ParW } : new hb_rational_t { den = job.ParH, num = job.ParW }} + geometry = new hb_geometry_s { height = job.Height, width = job.Width, par = job.AnamorphicMode != Anamorphic.Custom ? new hb_rational_t { den = title.ParH, num = title.ParW } : new hb_rational_t { den = job.ParH, num = job.ParW }} }; hb_geometry_s sourceGeometry = new hb_geometry_s diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs index 804f77b19..eb38c62ad 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs @@ -148,7 +148,6 @@ namespace HandBrakeWPF.Services.Presets.Factories AddEncodeElement(xmlWriter, "Mp4iPodCompatible", "integer", parsed.IPod5GSupport ? "1" : "0"); AddEncodeElement(xmlWriter, "PictureAutoCrop", "integer", "1"); - // Filters AddEncodeElement(xmlWriter, "PictureDeblock", "integer", parsed.Deblock.ToString()); @@ -158,7 +157,6 @@ namespace HandBrakeWPF.Services.Presets.Factories AddEncodeElement(xmlWriter, "PictureDeinterlaceCustom", "string", parsed.Deinterlace == Deinterlace.Custom ? parsed.CustomDeinterlace : string.Empty); AddEncodeElement(xmlWriter, "PictureDeinterlace", "integer", ((int)parsed.Deinterlace).ToString()); - AddEncodeElement(xmlWriter, "PictureDenoiseFilter", "string", parsed.Denoise.ToString().ToLower()); AddEncodeElement(xmlWriter, "PictureDenoiseCustom", "string", parsed.DenoisePreset == DenoisePreset.Custom ? parsed.CustomDenoise : string.Empty); AddEncodeElement(xmlWriter, "PictureDenoisePreset", "string", parsed.DenoisePreset.ToString().ToLower()); @@ -212,7 +210,6 @@ namespace HandBrakeWPF.Services.Presets.Factories AddEncodeElement(xmlWriter, "VideoOptionExtra", "string", parsed.ExtraAdvancedArguments); AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0"); - int videoQualityType = 0; if (parsed.VideoBitrate != null) videoQualityType = 1; else if (parsed.Quality != null) videoQualityType = 2; diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs index a8b0f43a3..d58e111eb 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs @@ -279,7 +279,6 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.Task.AdvancedEncoderOptions = kvp.Value; break; - // Preset Information case "PresetBuildNumber": preset.Version = kvp.Value; diff --git a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs index c0355a3bf..b7be8bfdc 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/PresetService.cs @@ -12,6 +12,7 @@ namespace HandBrakeWPF.Services.Presets using System; using System.Collections.Generic; using System.Collections.ObjectModel; + using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; @@ -318,6 +319,7 @@ namespace HandBrakeWPF.Services.Presets catch (Exception exc) { // Do Nothing. + Debug.WriteLine(exc); } } } @@ -446,6 +448,7 @@ namespace HandBrakeWPF.Services.Presets catch (Exception exc) { // Do Nothing. + Debug.WriteLine(exc); } } } @@ -478,6 +481,7 @@ namespace HandBrakeWPF.Services.Presets catch (Exception exc) { // Do Nothing + Debug.WriteLine(exc); } } @@ -500,6 +504,7 @@ namespace HandBrakeWPF.Services.Presets catch (Exception exc) { createBackup = true; + Debug.WriteLine(exc); } } diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 7e6cc2525..768c127d6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -19,19 +19,17 @@ namespace HandBrakeWPF.ViewModels using System.Windows; using System.Windows.Media.Imaging; - using HandBrake.ApplicationServices.Model; + using HandBrake.ApplicationServices.Interop.Model.Encoding; + using HandBrake.ApplicationServices.Services.Encode; using HandBrake.ApplicationServices.Services.Encode.EventArgs; using HandBrake.ApplicationServices.Services.Encode.Interfaces; using HandBrake.ApplicationServices.Services.Encode.Model; using HandBrake.ApplicationServices.Services.Encode.Model.Models; using HandBrake.ApplicationServices.Services.Scan.Interfaces; using HandBrake.ApplicationServices.Services.Scan.Model; - using HandBrake.ApplicationServices.Interop.Model.Encoding; - using HandBrake.ApplicationServices.Services.Encode; using HandBrakeWPF.Factories; using HandBrakeWPF.Properties; - using HandBrakeWPF.Services; using HandBrakeWPF.Services.Interfaces; using HandBrakeWPF.Services.Queue.Model; using HandBrakeWPF.ViewModels.Interfaces; @@ -126,15 +124,19 @@ namespace HandBrakeWPF.ViewModels /// /// The user Setting Service. /// - public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService) + /// + /// The error Service. + /// + public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService, IErrorService errorService) { this.scanService = scanService; this.selectedPreviewImage = 1; - this.Title = Properties.Resources.Preview; + this.Title = Resources.Preview; this.PreviewNotAvailable = true; // Live Preview this.userSettingService = userSettingService; + this.errorService = errorService; this.encodeService = new LibEncode(); // Preview needs a seperate instance rather than the shared singleton. This could maybe do with being refactored at some point this.Title = "Preview"; @@ -410,7 +412,7 @@ namespace HandBrakeWPF.ViewModels this.Task = task; this.UpdatePreviewFrame(); this.DisplayName = "Picture Preview"; - this.Title = Properties.Resources.Preview; + this.Title = Resources.Preview; this.ScannedSource = scannedSource; } @@ -446,6 +448,7 @@ namespace HandBrakeWPF.ViewModels catch (Exception exc) { PreviewNotAvailable = true; + Debug.WriteLine(exc); } if (image != null) @@ -470,13 +473,13 @@ namespace HandBrakeWPF.ViewModels if (ea.NewSize.Width > workArea.Width) { this.Width = (int)Math.Round(workArea.Width, 0) - 20; - this.Title = Properties.Resources.Preview_Scaled; + this.Title = Resources.Preview_Scaled; } if (ea.NewSize.Height > workArea.Height) { this.Height = (int)Math.Round(workArea.Height, 0) - 20; - this.Title = Properties.Resources.Preview_Scaled; + this.Title = Resources.Preview_Scaled; } } #endregion @@ -514,21 +517,21 @@ namespace HandBrakeWPF.ViewModels catch (Exception) { this.IsEncoding = false; - this.errorService.ShowMessageBox("Unable to delete previous preview file. You may need to restart the application.", + this.errorService.ShowMessageBox("Unable to delete previous preview file. You may need to restart the application.", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); } if (this.Task == null || string.IsNullOrEmpty(Task.Source)) { - this.errorService.ShowMessageBox("You must first scan a source and setup your encode before creating a preview.", + this.errorService.ShowMessageBox("You must first scan a source and setup your encode before creating a preview.", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); return; } EncodeTask encodeTask = new EncodeTask(this.Task) { - PreviewEncodeDuration = this.Duration, - PreviewEncodeStartAt = this.SelectedPreviewImage, + PreviewEncodeDuration = this.Duration, + PreviewEncodeStartAt = this.SelectedPreviewImage, PointToPointMode = PointToPointMode.Preview }; @@ -561,6 +564,7 @@ namespace HandBrakeWPF.ViewModels #endregion #region Private Methods + /// /// Play the Encoded file /// @@ -600,7 +604,7 @@ namespace HandBrakeWPF.ViewModels } else { - this.errorService.ShowMessageBox("Unable to detect VLC Player. \nPlease make sure VLC is installed and the directory specified in HandBrake's options is correct. (See: \"Tools Menu > Options > Picture Tab\")", + this.errorService.ShowMessageBox("Unable to detect VLC Player. \nPlease make sure VLC is installed and the directory specified in HandBrake's options is correct. (See: \"Tools Menu > Options > Picture Tab\")", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Warning); } } @@ -614,7 +618,7 @@ namespace HandBrakeWPF.ViewModels } else { - this.errorService.ShowMessageBox("Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.", + this.errorService.ShowMessageBox("Unable to find the preview file. Either the file was deleted or the encode failed. Check the activity log for details.", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Warning); } } @@ -631,7 +635,7 @@ namespace HandBrakeWPF.ViewModels // Make sure we are not already encoding and if we are then display an error. if (encodeService.IsEncoding) { - this.errorService.ShowMessageBox("Handbrake is already encoding a video! Only one file can be encoded at any one time.", + this.errorService.ShowMessageBox("Handbrake is already encoding a video! Only one file can be encoded at any one time.", Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); return; } @@ -645,6 +649,7 @@ namespace HandBrakeWPF.ViewModels #endregion #region Event Handlers + /// /// Handle Encode Progress Events /// diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 33aa86be1..14c6a9899 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -667,7 +667,6 @@ namespace HandBrakeWPF.ViewModels SourceTrack = source, }; - // Burn-in Behaviours if (this.SubtitleBehaviours.SelectedBurnInBehaviour == SubtitleBurnInBehaviourModes.ForeignAudio || this.SubtitleBehaviours.SelectedBurnInBehaviour == SubtitleBurnInBehaviourModes.ForeignAudioPreferred) diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 6d72d0590..47cc4f6a3 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -1220,7 +1220,6 @@ namespace HandBrakeWPF.ViewModels this.VideoLevel = VideoLevel.Auto; } - // Setup Presets. this.VideoPresets.Clear(); if (encoder.Presets != null) @@ -1247,7 +1246,6 @@ namespace HandBrakeWPF.ViewModels // Update the Quality Slider. Make sure the bounds are up to date with the users settings. this.SetQualitySliderBounds(); - // Update control display this.UseAdvancedTab = selectedEncoder != VideoEncoder.QuickSync && this.UseAdvancedTab; this.DisplayOptimiseOptions = this.SelectedVideoEncoder == VideoEncoder.X264 || this.SelectedVideoEncoder == VideoEncoder.X265 || this.SelectedVideoEncoder == VideoEncoder.QuickSync; diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs index 7f8be26ab..fc5a141b9 100644 --- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs @@ -73,7 +73,6 @@ namespace HandBrakeWPF.Views this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift))); // Garbage Colleciton this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F1, ModifierKeys.None)), new KeyGesture(Key.F1, ModifierKeys.None))); // Help - // Enable Windows 7 Taskbar progress indication. if (this.TaskbarItemInfo == null) { -- 2.40.0