diff --git a/Lib/HandBrake.Interop.dll b/Lib/HandBrake.Interop.dll index 1dbf16c4..a1149eb9 100644 Binary files a/Lib/HandBrake.Interop.dll and b/Lib/HandBrake.Interop.dll differ diff --git a/Lib/HandBrake.Interop.pdb b/Lib/HandBrake.Interop.pdb index 805b6ca2..978351a2 100644 Binary files a/Lib/HandBrake.Interop.pdb and b/Lib/HandBrake.Interop.pdb differ diff --git a/Lib/hb.dll b/Lib/hb.dll index ea324bf1..513e3ec2 100644 Binary files a/Lib/hb.dll and b/Lib/hb.dll differ diff --git a/VidCoder/Extensions/VCProfileExtensions.cs b/VidCoder/Extensions/VCProfileExtensions.cs deleted file mode 100644 index 416af14d..00000000 --- a/VidCoder/Extensions/VCProfileExtensions.cs +++ /dev/null @@ -1,34 +0,0 @@ -using HandBrake.Interop.Interop.Interfaces.Model.Picture; -using HandBrake.Interop.Interop.Interfaces.Model.Preview; -using HandBrake.Interop.Interop.Json.Scan; -using VidCoderCommon.Model; - -namespace VidCoder.Extensions -{ - public static class VCProfileExtensions - { - public static PreviewSettings CreatePreviewSettings(this VCProfile profile, SourceTitle title) - { - VCCropping cropping = JsonEncodeFactory.GetCropping(profile, title); - - var outputSize = JsonEncodeFactory.GetOutputSize(profile, title); - int width = outputSize.ScaleWidth; - int height = outputSize.ScaleHeight; - - return new PreviewSettings - { - Anamorphic = Anamorphic.None, - Cropping = cropping.GetHbCropping(), - Width = width, - Height = height, - MaxWidth = width, - MaxHeight = height, - KeepDisplayAspect = true, - Modulus = profile.Modulus, - PixelAspectX = 1, - PixelAspectY = 1, - TitleNumber = title.Index - }; - } - } -} diff --git a/VidCoder/Model/PreviewImageJob.cs b/VidCoder/Model/PreviewImageJob.cs index 3b6ba71c..06cf4c66 100644 --- a/VidCoder/Model/PreviewImageJob.cs +++ b/VidCoder/Model/PreviewImageJob.cs @@ -20,7 +20,7 @@ public class PreviewImageJob /// public object ImageFileSync { get; set; } - public VCProfile Profile { get; set; } + public VCJob Job { get; set; } public SourceTitle Title { get; set; } } diff --git a/VidCoder/Services/PreviewImageService.cs b/VidCoder/Services/PreviewImageService.cs index e638f7eb..b9a02608 100644 --- a/VidCoder/Services/PreviewImageService.cs +++ b/VidCoder/Services/PreviewImageService.cs @@ -12,6 +12,7 @@ using System.Windows.Media.Imaging; using DynamicData; using HandBrake.Interop.Interop; +using HandBrake.Interop.Interop.Json.Encode; using Microsoft.AnyContainer; using ReactiveUI; using VidCoder.Extensions; @@ -408,7 +409,7 @@ private void EnqueueWork(int previewNumber) UpdateVersion = updateVersion, ScanInstance = this.ScanInstance, PreviewIndex = previewNumber, - Profile = this.job.EncodingProfile, + Job = this.job, Title = this.mainViewModel.SelectedTitle.Title, ImageFileSync = this.imageFileSync[previewNumber] }); @@ -475,16 +476,24 @@ private void ProcessPreviewImageWork(object state) } if (imageSource == null && !imageJob.ScanInstance.IsDisposed) - { - // Make a HandBrake call to get the image - imageSource = BitmapUtilities.ConvertToBitmapImage(BitmapUtilities.ConvertByteArrayToBitmap(imageJob.ScanInstance.GetPreview(imageJob.Profile.CreatePreviewSettings(imageJob.Title), imageJob.PreviewIndex, imageJob.Profile.DeinterlaceType != VCDeinterlace.Off))); + { + // Create the JsonEncodeObject + JsonEncodeFactory factory = new JsonEncodeFactory(new StubLogger()); + + JsonEncodeObject jsonEncodeObject = factory.CreateJsonObject( + imageJob.Job, + imageJob.Title, + EncodingRes.DefaultChapterName); + + // Make a HandBrake call to get the image + imageSource = BitmapUtilities.ConvertToBitmapImage(BitmapUtilities.ConvertByteArrayToBitmap(imageJob.ScanInstance.GetPreview(jsonEncodeObject, imageJob.PreviewIndex))); - // Transform the image as per rotation and reflection settings - VCProfile profile = imageJob.Profile; - if (profile.FlipHorizontal || profile.FlipVertical || profile.Rotation != VCPictureRotation.None) - { - imageSource = CreateTransformedBitmap(imageSource, profile); - } + //// Transform the image as per rotation and reflection settings + //VCProfile profile = imageJob.Job.EncodingProfile; + //if (profile.FlipHorizontal || profile.FlipVertical || profile.Rotation != VCPictureRotation.None) + //{ + // imageSource = CreateTransformedBitmap(imageSource, profile); + //} // Start saving the image file in the background and continue to process the queue. ThreadPool.QueueUserWorkItem(this.BackgroundFileSave, new SaveImageJob @@ -518,38 +527,6 @@ private void ProcessPreviewImageWork(object state) } } - private static TransformedBitmap CreateTransformedBitmap(BitmapSource source, VCProfile profile) - { - var transformedBitmap = new TransformedBitmap(); - transformedBitmap.BeginInit(); - transformedBitmap.Source = source; - var transformGroup = new TransformGroup(); - transformGroup.Children.Add(new ScaleTransform(profile.FlipHorizontal ? -1 : 1, profile.FlipVertical ? -1 : 1)); - transformGroup.Children.Add(new RotateTransform(ConvertRotationToDegrees(profile.Rotation))); - transformedBitmap.Transform = transformGroup; - transformedBitmap.EndInit(); - transformedBitmap.Freeze(); - - return transformedBitmap; - } - - private static double ConvertRotationToDegrees(VCPictureRotation rotation) - { - switch (rotation) - { - case VCPictureRotation.None: - return 0; - case VCPictureRotation.Clockwise90: - return 90; - case VCPictureRotation.Clockwise180: - return 180; - case VCPictureRotation.Clockwise270: - return 270; - } - - return 0; - } - private void BackgroundFileSave(object state) { var job = state as SaveImageJob; diff --git a/VidCoder/Utilities/PresetConverter.cs b/VidCoder/Utilities/PresetConverter.cs index bfa5b9bc..163bb5ab 100644 --- a/VidCoder/Utilities/PresetConverter.cs +++ b/VidCoder/Utilities/PresetConverter.cs @@ -33,7 +33,6 @@ public static Preset ConvertHandBrakePresetToVC(HBPreset hbPreset) profile.Width = hbPreset.PictureWidth ?? 0; profile.Height = hbPreset.PictureHeight ?? 0; profile.PaddingMode = VCPaddingMode.None; - profile.Modulus = hbPreset.PictureModulus; profile.Rotation = VCPictureRotation.None; profile.FlipHorizontal = false; profile.FlipVertical = false; diff --git a/VidCoder/View/Panels/SizingPanel.xaml b/VidCoder/View/Panels/SizingPanel.xaml index cf281599..17633c24 100644 --- a/VidCoder/View/Panels/SizingPanel.xaml +++ b/VidCoder/View/Panels/SizingPanel.xaml @@ -21,6 +21,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -471,9 +457,18 @@ private void RegisterProfileProperties() this.RegisterProfileProperty(nameof(this.CropBottom), this.RefreshOutputSize); this.RegisterProfileProperty(nameof(this.CropLeft), this.RefreshOutputSize); this.RegisterProfileProperty(nameof(this.CropRight), this.RefreshOutputSize); - this.RegisterProfileProperty(nameof(this.Rotation), this.RefreshOutputSize); - this.RegisterProfileProperty(nameof(this.FlipHorizontal), () => this.previewUpdateService.RefreshPreview()); - this.RegisterProfileProperty(nameof(this.FlipVertical), () => this.previewUpdateService.RefreshPreview()); + this.RegisterProfileProperty(nameof(this.Rotation), () => { + this.RefreshOutputSize(); + this.RefreshCropping(); + }); + this.RegisterProfileProperty(nameof(this.FlipHorizontal), () => { + this.previewUpdateService.RefreshPreview(); + this.RefreshCropping(); + }); + this.RegisterProfileProperty(nameof(this.FlipVertical), () => { + this.previewUpdateService.RefreshPreview(); + this.RefreshCropping(); + }); this.RegisterProfileProperty(nameof(this.SizingMode), () => { if (this.SizingMode == VCSizingMode.Manual) @@ -611,12 +606,6 @@ public string PadColor private ObservableAsPropertyHelper padColorEnabled; public bool PadColorEnabled => this.padColorEnabled.Value; - public int Modulus - { - get { return this.Profile.Modulus; } - set { this.UpdateProfileProperty(nameof(this.Profile.Modulus), value); } - } - public int PixelAspectX { get { return this.Profile.PixelAspectX; } @@ -704,6 +693,37 @@ public void RefreshOutputSize() this.previewUpdateService.RefreshPreview(); } + private void RefreshCropping() + { + if (this.CroppingType != VCCroppingType.Automatic) + { + return; + } + + bool oldAutoValue = this.AutomaticChange; + this.AutomaticChange = true; + + SourceTitleViewModel sourceTitle = this.MainViewModel.SelectedTitle; + if (sourceTitle == null) + { + this.CropTop = 0; + this.CropBottom = 0; + this.CropLeft = 0; + this.CropRight = 0; + } + else + { + VCCropping autoCropping = JsonEncodeFactory.GetAutomaticCropping(this.Rotation, this.FlipHorizontal, this.FlipVertical, this.MainViewModel.SelectedTitle.Title); + + this.CropTop = autoCropping.Top; + this.CropBottom = autoCropping.Bottom; + this.CropLeft = autoCropping.Left; + this.CropRight = autoCropping.Right; + } + + this.AutomaticChange = oldAutoValue; + } + private void EnsureResolutionPopulatedIfRequired() { if (!this.AllowEmptyResolution && (this.Width == 0 || this.Height == 0)) diff --git a/VidCoder/ViewModel/Panels/VideoFiltersPanelViewModel.cs b/VidCoder/ViewModel/Panels/VideoFiltersPanelViewModel.cs index 19dbeab3..05fe16ac 100644 --- a/VidCoder/ViewModel/Panels/VideoFiltersPanelViewModel.cs +++ b/VidCoder/ViewModel/Panels/VideoFiltersPanelViewModel.cs @@ -267,8 +267,13 @@ private void RegisterProfileProperties() { this.CustomDetelecine = GetDefaultCustomFilterString(hb_filter_ids.HB_FILTER_DETELECINE); } + + this.previewUpdateService.RefreshPreview(); + }); + this.RegisterProfileProperty(nameof(this.CustomDetelecine), () => + { + this.previewUpdateService.RefreshPreview(); }); - this.RegisterProfileProperty(nameof(this.CustomDetelecine)); this.RegisterProfileProperty(nameof(this.DeinterlaceType), () => { @@ -303,8 +308,13 @@ private void RegisterProfileProperties() this.CustomDeinterlace = GetDefaultCustomFilterString(GetDeinterlaceFilter(this.DeinterlaceType)); } + + this.previewUpdateService.RefreshPreview(); + }); + this.RegisterProfileProperty(nameof(this.CustomDeinterlace), () => + { + this.previewUpdateService.RefreshPreview(); }); - this.RegisterProfileProperty(nameof(this.CustomDeinterlace)); this.RegisterProfileProperty(nameof(this.CombDetect), () => { if (this.CombDetect == "custom" && string.IsNullOrWhiteSpace(this.CustomCombDetect)) @@ -312,7 +322,10 @@ private void RegisterProfileProperties() this.CustomCombDetect = GetDefaultCustomFilterString(hb_filter_ids.HB_FILTER_COMB_DETECT); } }); - this.RegisterProfileProperty(nameof(this.CustomCombDetect)); + this.RegisterProfileProperty(nameof(this.CustomCombDetect), () => + { + this.previewUpdateService.RefreshPreview(); + }); this.RegisterProfileProperty(nameof(this.DenoiseType), () => { @@ -393,7 +406,10 @@ private void RegisterProfileProperties() this.RegisterProfileProperty(nameof(this.SharpenTune)); this.RegisterProfileProperty(nameof(this.CustomSharpen)); this.RegisterProfileProperty(nameof(this.Deblock)); - this.RegisterProfileProperty(nameof(this.Grayscale)); + this.RegisterProfileProperty(nameof(this.Grayscale), () => + { + this.previewUpdateService.RefreshPreview(); + }); } public List DetelecineChoices { get; } diff --git a/VidCoder/ViewModel/QueueTitlesWindowViewModel.cs b/VidCoder/ViewModel/QueueTitlesWindowViewModel.cs index a195f990..62334d46 100644 --- a/VidCoder/ViewModel/QueueTitlesWindowViewModel.cs +++ b/VidCoder/ViewModel/QueueTitlesWindowViewModel.cs @@ -17,6 +17,7 @@ using VidCoderCommon.Extensions; using VidCoderCommon.Model; using ReactiveUI; +using HandBrake.Interop.Interop.Json.Encode; namespace VidCoder.ViewModel { @@ -77,15 +78,15 @@ public QueueTitlesWindowViewModel() SourceTitle title = this.SelectedTitles[0].Title; // Do preview - var previewProfile = - new VCProfile - { - Cropping = new VCCropping(), - VideoEncoder = "x264", - AudioEncodings = new List() - }; - - this.PreviewImage = BitmapUtilities.ConvertToBitmapImage(BitmapUtilities.ConvertByteArrayToBitmap(this.main.ScanInstance.GetPreview(previewProfile.CreatePreviewSettings(title), 2, deinterlace: false))); + VCJob job = this.main.EncodeJob; + JsonEncodeFactory factory = new JsonEncodeFactory(new StubLogger()); + + JsonEncodeObject jsonEncodeObject = factory.CreateJsonObject( + job, + title, + EncodingRes.DefaultChapterName); + + this.PreviewImage = BitmapUtilities.ConvertToBitmapImage(BitmapUtilities.ConvertByteArrayToBitmap(this.main.ScanInstance.GetPreview(jsonEncodeObject, 2))); this.RaisePropertyChanged(nameof(this.TitleText)); } }; diff --git a/VidCoderCommon.Tests/Model/JsonEncodeFactoryTests.cs b/VidCoderCommon.Tests/Model/JsonEncodeFactoryTests.cs index 74eb4b07..bf106d19 100644 --- a/VidCoderCommon.Tests/Model/JsonEncodeFactoryTests.cs +++ b/VidCoderCommon.Tests/Model/JsonEncodeFactoryTests.cs @@ -240,8 +240,8 @@ public void GetOutputSize_AnamorphicToAnamorphicRotate90() OutputSizeInfo outputSize = JsonEncodeFactory.GetOutputSize(profile, sourceTitle); // Assert - outputSize.ScaleWidth.ShouldBe(718); - outputSize.ScaleHeight.ShouldBe(276); + outputSize.ScaleWidth.ShouldBe(276); + outputSize.ScaleHeight.ShouldBe(718); outputSize.OutputWidth.ShouldBe(276); outputSize.OutputHeight.ShouldBe(718); outputSize.Par.Num.ShouldBe(9); @@ -299,8 +299,8 @@ public void GetOutputSize_AnamorphicToNonAnamorphicRotate270() OutputSizeInfo outputSize = JsonEncodeFactory.GetOutputSize(profile, sourceTitle); // Assert - outputSize.ScaleWidth.ShouldBe(718); - outputSize.ScaleHeight.ShouldBe(310); + outputSize.ScaleWidth.ShouldBe(310); + outputSize.ScaleHeight.ShouldBe(718); outputSize.OutputWidth.ShouldBe(310); outputSize.OutputHeight.ShouldBe(718); AssertNormalPar(outputSize); @@ -403,8 +403,8 @@ public void GetOutputSize_AnamorphicToAnamorphicRotatePad() OutputSizeInfo outputSize = JsonEncodeFactory.GetOutputSize(profile, sourceTitle); // Assert - outputSize.ScaleWidth.ShouldBe(500); - outputSize.ScaleHeight.ShouldBe(192); + outputSize.ScaleWidth.ShouldBe(192); + outputSize.ScaleHeight.ShouldBe(500); outputSize.OutputWidth.ShouldBe(500); outputSize.OutputHeight.ShouldBe(500); outputSize.Par.Num.ShouldBe(25875); @@ -440,8 +440,8 @@ public void GetOutputSize_AnamorphicToNonAnamorphicRotatePad() OutputSizeInfo outputSize = JsonEncodeFactory.GetOutputSize(profile, sourceTitle); // Assert - outputSize.ScaleWidth.ShouldBe(500); - outputSize.ScaleHeight.ShouldBe(216); + outputSize.ScaleWidth.ShouldBe(216); + outputSize.ScaleHeight.ShouldBe(500); outputSize.OutputWidth.ShouldBe(500); outputSize.OutputHeight.ShouldBe(500); AssertNormalPar(outputSize); @@ -552,8 +552,8 @@ public void GetOutputSize_NonAnamorphicToNonAnamorphicWithCroppingAndRotateAndPa OutputSizeInfo outputSize = JsonEncodeFactory.GetOutputSize(profile, sourceTitle); // Assert - outputSize.ScaleWidth.ShouldBe(1080); - outputSize.ScaleHeight.ShouldBe(448); + outputSize.ScaleWidth.ShouldBe(448); + outputSize.ScaleHeight.ShouldBe(1080); outputSize.OutputWidth.ShouldBe(1920); outputSize.OutputHeight.ShouldBe(1080); AssertNormalPar(outputSize); diff --git a/VidCoderCommon/Model/JsonEncodeFactory.cs b/VidCoderCommon/Model/JsonEncodeFactory.cs index f21bce9d..0dc81dec 100644 --- a/VidCoderCommon/Model/JsonEncodeFactory.cs +++ b/VidCoderCommon/Model/JsonEncodeFactory.cs @@ -1274,17 +1274,8 @@ public static OutputSizeInfo GetOutputSize(VCProfile profile, SourceTitle title) { if (profile.SizingMode == VCSizingMode.Manual) { - int manualOutputWidth, manualOutputHeight; - if (profile.Rotation == VCPictureRotation.Clockwise90 || profile.Rotation == VCPictureRotation.Clockwise270) - { - manualOutputWidth = profile.Height; - manualOutputHeight = profile.Width; - } - else - { - manualOutputWidth = profile.Width; - manualOutputHeight = profile.Height; - } + int manualOutputWidth = profile.Width; + int manualOutputHeight = profile.Height; manualOutputWidth += profile.Padding.Left + profile.Padding.Right; manualOutputHeight += profile.Padding.Top + profile.Padding.Bottom; @@ -1309,6 +1300,18 @@ public static OutputSizeInfo GetOutputSize(VCProfile profile, SourceTitle title) int sourceParWidth = title.Geometry.PAR.Num; int sourceParHeight = title.Geometry.PAR.Den; + // If we are rotating 90/270, swap the source picture width/height and PAR + if (profile.Rotation == VCPictureRotation.Clockwise90 || profile.Rotation == VCPictureRotation.Clockwise270) + { + int temp = sourceWidth; + sourceWidth = sourceHeight; + sourceHeight = temp; + + temp = sourceParWidth; + sourceParWidth = sourceParHeight; + sourceParHeight = temp; + } + VCCropping cropping = GetCropping(profile, title); int croppedSourceWidth = sourceWidth - cropping.Left - cropping.Right; int croppedSourceHeight = sourceHeight - cropping.Top - cropping.Bottom; @@ -1343,8 +1346,6 @@ public static OutputSizeInfo GetOutputSize(VCProfile profile, SourceTitle title) adjustedSourceAspect = sourceAspect * sourceParWidth / sourceParHeight; } - bool swapDimensionsFromRotation = profile.Rotation == VCPictureRotation.Clockwise90 || profile.Rotation == VCPictureRotation.Clockwise270; - // When using padding fill/width/height, the dimensions we are specifying are post-rotation. We need to adjust here to give the right values to the scale filter. int? maxPictureWidth = null, maxPictureHeight = null; switch (profile.PaddingMode) @@ -1352,8 +1353,8 @@ public static OutputSizeInfo GetOutputSize(VCProfile profile, SourceTitle title) case VCPaddingMode.Fill: case VCPaddingMode.Width: case VCPaddingMode.Height: - maxPictureWidth = swapDimensionsFromRotation ? profile.Height : profile.Width; - maxPictureHeight = swapDimensionsFromRotation ? profile.Width : profile.Height; + maxPictureWidth = profile.Width; + maxPictureHeight = profile.Height; break; case VCPaddingMode.Custom: case VCPaddingMode.None: @@ -1412,14 +1413,6 @@ public static OutputSizeInfo GetOutputSize(VCProfile profile, SourceTitle title) int scaleWidth = pictureOutputWidth; int scaleHeight = pictureOutputHeight; - // Rotation happens before padding. - if (swapDimensionsFromRotation) - { - int swapDimension = pictureOutputWidth; - pictureOutputWidth = pictureOutputHeight; - pictureOutputHeight = swapDimension; - } - int outputWidth, outputHeight; VCPadding padding; switch (profile.PaddingMode) @@ -1547,16 +1540,16 @@ public static OutputSizeInfo GetOutputSize(VCProfile profile, SourceTitle title) int totalVerticalPadding = padding.Top + padding.Bottom; bool hasHorizontalPadding = totalHorizontalPadding > 0; bool hasVerticalPadding = totalVerticalPadding > 0; - if (!hasHorizontalPadding && !swapDimensionsFromRotation || !hasVerticalPadding && swapDimensionsFromRotation) + if (!hasHorizontalPadding) { // The output dimensions at this point are after rotation, so we need to swap to get the pre-rotation sizing dimensions. - scaleWidth = swapDimensionsFromRotation ? roundedOutputHeight : roundedOutputWidth; + scaleWidth = roundedOutputWidth; } - if (!hasVerticalPadding && !swapDimensionsFromRotation || !hasHorizontalPadding && swapDimensionsFromRotation) + if (!hasVerticalPadding) { // The output dimensions at this point are after rotation, so we need to swap to get the pre-rotation sizing dimensions. - scaleHeight = swapDimensionsFromRotation ? roundedOutputWidth : roundedOutputHeight; + scaleHeight = roundedOutputHeight; } // Refresh the picture output size after adjustment @@ -1567,18 +1560,9 @@ public static OutputSizeInfo GetOutputSize(VCProfile profile, SourceTitle title) if (profile.UseAnamorphic) { // Calculate PAR from final picture size - if (swapDimensionsFromRotation) - { - outputPar = MathUtilities.CreatePar( - (long)croppedSourceHeight * sourceParHeight * pictureOutputHeight, - (long)croppedSourceWidth * sourceParWidth * pictureOutputWidth); - } - else - { - outputPar = MathUtilities.CreatePar( - (long)croppedSourceWidth * sourceParWidth * pictureOutputHeight, - (long)croppedSourceHeight * sourceParHeight * pictureOutputWidth); - } + outputPar = MathUtilities.CreatePar( + (long)croppedSourceWidth * sourceParWidth * pictureOutputHeight, + (long)croppedSourceHeight * sourceParHeight * pictureOutputWidth); } else { @@ -1638,8 +1622,7 @@ public static VCCropping GetCropping(VCProfile profile, SourceTitle title) switch (profile.CroppingType) { case VCCroppingType.Automatic: - var autoCrop = title.Crop; - return new VCCropping(autoCrop[0], autoCrop[1], autoCrop[2], autoCrop[3]); + return GetAutomaticCropping(profile.Rotation, profile.FlipHorizontal, profile.FlipVertical, title); case VCCroppingType.None: return new VCCropping(0, 0, 0, 0); case VCCroppingType.Custom: @@ -1648,5 +1631,60 @@ public static VCCropping GetCropping(VCProfile profile, SourceTitle title) throw new ArgumentOutOfRangeException(); } } + + public static VCCropping GetAutomaticCropping(VCPictureRotation rotation, bool flipHorizontal, bool flipVertical, SourceTitle title) + { + var autoCrop = title.Crop; + int top = autoCrop[0]; + int bottom = autoCrop[1]; + int left = autoCrop[2]; + int right = autoCrop[3]; + + int temp; + + if (flipHorizontal) + { + temp = left; + left = right; + right = temp; + } + + if (flipVertical) + { + temp = top; + top = bottom; + bottom = temp; + } + + switch (rotation) + { + case VCPictureRotation.Clockwise90: + temp = top; + top = left; + left = bottom; + bottom = right; + right = temp; + break; + case VCPictureRotation.Clockwise180: + temp = top; + top = bottom; + bottom = temp; + temp = left; + left = right; + right = temp; + break; + case VCPictureRotation.Clockwise270: + temp = top; + top = right; + right = bottom; + bottom = left; + left = temp; + break; + default: + break; + } + + return new VCCropping(top, bottom, left, right); + } } } diff --git a/VidCoderCommon/Model/OutputSizeInfo.cs b/VidCoderCommon/Model/OutputSizeInfo.cs index 2fbd9b43..07c978a2 100644 --- a/VidCoderCommon/Model/OutputSizeInfo.cs +++ b/VidCoderCommon/Model/OutputSizeInfo.cs @@ -10,12 +10,12 @@ namespace VidCoderCommon.Model public class OutputSizeInfo { /// - /// The width to scale to (before rotation). + /// The width to scale to (after rotation). /// public int ScaleWidth { get; set; } /// - /// The height to scale to (before rotation). + /// The height to scale to (after rotation). /// public int ScaleHeight { get; set; } @@ -34,7 +34,7 @@ public class OutputSizeInfo public VCPadding Padding { get; set; } /// - /// The post-rotation picture width. + /// The final picture width, post-rotation, scaling and not counting padding. /// public int PictureWidth { @@ -50,7 +50,7 @@ public int PictureWidth } /// - /// The post-rotation picture height. + /// The final picture height, post-rotation, scaling and not counting padding. /// public int PictureHeight { diff --git a/VidCoderCommon/Model/Preset/VCProfile.cs b/VidCoderCommon/Model/Preset/VCProfile.cs index eb1117f5..068478bb 100644 --- a/VidCoderCommon/Model/Preset/VCProfile.cs +++ b/VidCoderCommon/Model/Preset/VCProfile.cs @@ -69,8 +69,6 @@ public string PadColor public int PixelAspectY { get; set; } - public int Modulus { get; set; } - private VCPictureRotation rotation; public VCPictureRotation Rotation { diff --git a/build_interop.ps1 b/build_interop.ps1 index 43ed510a..2426f6dd 100644 --- a/build_interop.ps1 +++ b/build_interop.ps1 @@ -9,10 +9,11 @@ $HandBrakeFolder = "..\HandBrake\win\CS" $HandBrakeSolution = $HandBrakeFolder + "\HandBrake.sln" $HandBrakeInteropFolder = $HandBrakeFolder + "\HandBrake.Interop" $HandBrakeInteropProject = $HandBrakeInteropFolder + "\HandBrake.Interop.csproj" +$HandBrakeInteropBinFolder = $HandBrakeInteropFolder + "\bin\Any CPU\Release"; & $MsBuildExe $HandBrakeInteropProject /t:rebuild "/p:Configuration=Release;Platform=Any CPU"; ExitIfFailed -copy ($HandBrakeInteropFolder + "\bin\Release\HandBrake.Interop.dll") Lib -force -copy ($HandBrakeInteropFolder + "\bin\Release\HandBrake.Interop.pdb") Lib -force +copy ($HandBrakeInteropBinFolder + "\HandBrake.Interop.dll") Lib -force +copy ($HandBrakeInteropBinFolder + "\HandBrake.Interop.pdb") Lib -force "Files copied." WriteSuccess