diff options
Diffstat (limited to 'win/CS/HandBrake.Interop')
4 files changed, 82 insertions, 1 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index e97343852..bfd0c44de 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -16,6 +16,7 @@ namespace HandBrake.Interop using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
+ using System.Windows.Media;
using System.Windows.Media.Imaging;
using HandBrake.Interop.EventArgs;
@@ -1502,6 +1503,48 @@ namespace HandBrake.Interop }
}
+ // Rotate
+ if (profile.FlipHorizontal || profile.FlipVertical || profile.Rotation != PictureRotation.None)
+ {
+ bool rotate90 = false;
+ bool flipHorizontal = profile.FlipHorizontal;
+ bool flipVertical = profile.FlipVertical;
+
+ switch (profile.Rotation)
+ {
+ case PictureRotation.Clockwise90:
+ rotate90 = true;
+ break;
+ case PictureRotation.Clockwise180:
+ flipHorizontal = !flipHorizontal;
+ flipVertical = !flipVertical;
+ break;
+ case PictureRotation.Clockwise270:
+ rotate90 = true;
+ flipHorizontal = !flipHorizontal;
+ flipVertical = !flipVertical;
+ break;
+ }
+
+ int rotateSetting = 0;
+ if (flipVertical)
+ {
+ rotateSetting |= 1;
+ }
+
+ if (flipHorizontal)
+ {
+ rotateSetting |= 2;
+ }
+
+ if (rotate90)
+ {
+ rotateSetting |= 4;
+ }
+
+ this.AddFilter(filterList, (int)hb_filter_ids.HB_FILTER_ROTATE, rotateSetting.ToString(CultureInfo.InvariantCulture), allocatedMemory);
+ }
+
// Construct final filter list
nativeJob.list_filter = this.ConvertFilterListToNative(filterList, allocatedMemory).Ptr;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index bb4bd48cf..d86da1833 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -151,6 +151,7 @@ <Compile Include="HbLib\NativeConstants.cs" />
<Compile Include="Interfaces\IHandBrakeInstance.cs" />
<Compile Include="Helpers\InteropUtilities.cs" />
+ <Compile Include="Model\Encoding\PictureRotation.cs" />
<Compile Include="Model\Encoding\x265\x265Preset.cs" />
<Compile Include="Model\Encoding\x265\x265Profile.cs" />
<Compile Include="Model\Encoding\x265\x265Tune.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs index 257c324d7..2dea5624b 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs @@ -130,6 +130,21 @@ namespace HandBrake.Interop.Model.Encoding /// Gets or sets the modulus.
/// </summary>
public int Modulus { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rotation.
+ /// </summary>
+ public PictureRotation Rotation { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the picture should be flipped horizontally.
+ /// </summary>
+ public bool FlipHorizontal { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the picture should be flipped vertically.
+ /// </summary>
+ public bool FlipVertical { get; set; }
#endregion
#region Filters
@@ -180,7 +195,7 @@ namespace HandBrake.Interop.Model.Encoding public int Deblock { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether grayscale.
+ /// Gets or sets a value indicating whether the grayscale filter will be applied.
/// </summary>
public bool Grayscale { get; set; }
#endregion
@@ -307,6 +322,9 @@ namespace HandBrake.Interop.Model.Encoding PixelAspectX = this.PixelAspectX,
PixelAspectY = this.PixelAspectY,
Modulus = this.Modulus,
+ Rotation = this.Rotation,
+ FlipHorizontal = this.FlipHorizontal,
+ FlipVertical = this.FlipVertical,
Deinterlace = this.Deinterlace,
CustomDeinterlace = this.CustomDeinterlace,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/PictureRotation.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/PictureRotation.cs new file mode 100644 index 000000000..0476b1673 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/PictureRotation.cs @@ -0,0 +1,19 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Rotation.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model.Encoding
+{
+ /// <summary>
+ /// Possible picture rotations.
+ /// </summary>
+ public enum PictureRotation
+ {
+ None = 0,
+ Clockwise90,
+ Clockwise180,
+ Clockwise270
+ }
+}
|