using System.Linq;\r
using System.Runtime.InteropServices;\r
using System.Text;\r
+ using System.Windows.Media;\r
using System.Windows.Media.Imaging;\r
\r
using HandBrake.Interop.EventArgs;\r
}\r
}\r
\r
+ // Rotate\r
+ if (profile.FlipHorizontal || profile.FlipVertical || profile.Rotation != PictureRotation.None)\r
+ {\r
+ bool rotate90 = false;\r
+ bool flipHorizontal = profile.FlipHorizontal;\r
+ bool flipVertical = profile.FlipVertical;\r
+\r
+ switch (profile.Rotation)\r
+ {\r
+ case PictureRotation.Clockwise90:\r
+ rotate90 = true;\r
+ break;\r
+ case PictureRotation.Clockwise180:\r
+ flipHorizontal = !flipHorizontal;\r
+ flipVertical = !flipVertical;\r
+ break;\r
+ case PictureRotation.Clockwise270:\r
+ rotate90 = true;\r
+ flipHorizontal = !flipHorizontal;\r
+ flipVertical = !flipVertical;\r
+ break;\r
+ }\r
+\r
+ int rotateSetting = 0;\r
+ if (flipVertical)\r
+ {\r
+ rotateSetting |= 1;\r
+ }\r
+\r
+ if (flipHorizontal)\r
+ {\r
+ rotateSetting |= 2;\r
+ }\r
+\r
+ if (rotate90)\r
+ {\r
+ rotateSetting |= 4;\r
+ }\r
+\r
+ this.AddFilter(filterList, (int)hb_filter_ids.HB_FILTER_ROTATE, rotateSetting.ToString(CultureInfo.InvariantCulture), allocatedMemory);\r
+ }\r
+\r
// Construct final filter list\r
nativeJob.list_filter = this.ConvertFilterListToNative(filterList, allocatedMemory).Ptr;\r
\r
<Compile Include="HbLib\NativeConstants.cs" />\r
<Compile Include="Interfaces\IHandBrakeInstance.cs" />\r
<Compile Include="Helpers\InteropUtilities.cs" />\r
+ <Compile Include="Model\Encoding\PictureRotation.cs" />\r
<Compile Include="Model\Encoding\x265\x265Preset.cs" />\r
<Compile Include="Model\Encoding\x265\x265Profile.cs" />\r
<Compile Include="Model\Encoding\x265\x265Tune.cs" />\r
/// Gets or sets the modulus.\r
/// </summary>\r
public int Modulus { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets the rotation.\r
+ /// </summary>\r
+ public PictureRotation Rotation { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether the picture should be flipped horizontally.\r
+ /// </summary>\r
+ public bool FlipHorizontal { get; set; }\r
+\r
+ /// <summary>\r
+ /// Gets or sets a value indicating whether the picture should be flipped vertically.\r
+ /// </summary>\r
+ public bool FlipVertical { get; set; }\r
#endregion\r
\r
#region Filters\r
public int Deblock { get; set; }\r
\r
/// <summary>\r
- /// Gets or sets a value indicating whether grayscale.\r
+ /// Gets or sets a value indicating whether the grayscale filter will be applied.\r
/// </summary>\r
public bool Grayscale { get; set; }\r
#endregion\r
PixelAspectX = this.PixelAspectX,\r
PixelAspectY = this.PixelAspectY,\r
Modulus = this.Modulus,\r
+ Rotation = this.Rotation,\r
+ FlipHorizontal = this.FlipHorizontal,\r
+ FlipVertical = this.FlipVertical,\r
\r
Deinterlace = this.Deinterlace,\r
CustomDeinterlace = this.CustomDeinterlace,\r
--- /dev/null
+// --------------------------------------------------------------------------------------------------------------------\r
+// <copyright file="Rotation.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
+// </copyright>\r
+// --------------------------------------------------------------------------------------------------------------------\r
+\r
+namespace HandBrake.Interop.Model.Encoding\r
+{\r
+ /// <summary>\r
+ /// Possible picture rotations.\r
+ /// </summary>\r
+ public enum PictureRotation\r
+ {\r
+ None = 0,\r
+ Clockwise90,\r
+ Clockwise180,\r
+ Clockwise270\r
+ }\r
+}\r