using HandBrake.ApplicationServices.Interop.Model;\r
using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
using HandBrake.ApplicationServices.Interop.Model.Preview;\r
- using HandBrake.ApplicationServices.Services.Encode.Model;\r
\r
/// <summary>\r
/// The anamorphic factory.\r
/// </summary>\r
public enum KeepSetting\r
{\r
- HB_KEEP_WIDTH = 0x01,\r
- HB_KEEP_HEIGHT = 0x02,\r
+ /// <summary>\r
+ /// The h b_ kee p_ width.\r
+ /// </summary>\r
+ HB_KEEP_WIDTH = 0x01, \r
+\r
+ /// <summary>\r
+ /// The h b_ kee p_ height.\r
+ /// </summary>\r
+ HB_KEEP_HEIGHT = 0x02, \r
+\r
+ /// <summary>\r
+ /// The h b_ kee p_ displa y_ aspect.\r
+ /// </summary>\r
HB_KEEP_DISPLAY_ASPECT = 0x04\r
}\r
\r
/// <summary>\r
- /// The create geometry.\r
+ /// Finds output geometry for the given preview settings and title.\r
/// </summary>\r
- /// <param name="job">\r
- /// The job.\r
+ /// <param name="settings">\r
+ /// The preview settings.\r
/// </param>\r
/// <param name="title">\r
- /// The current title.\r
- /// </param>\r
- /// <param name="keepWidthOrHeight">\r
- /// Keep Width or Height. (Not Display Aspect)\r
+ /// Information on the title to consider.\r
/// </param>\r
/// <returns>\r
- /// The <see cref="Geometry"/>.\r
+ /// Geometry Information\r
/// </returns>\r
- public static Geometry CreateGeometry(EncodeTask job, SourceVideoInfo title, KeepSetting keepWidthOrHeight) // Todo remove the need for these objects. Should use simpler objects.\r
- {\r
- int settingMode = (int)keepWidthOrHeight + (job.KeepDisplayAspect ? 0x04 : 0);\r
-\r
- // Sanitize the Geometry First.\r
- AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry\r
- {\r
- SourceGeometry = new Geometry\r
- {\r
- Width = title.Resolution.Width,\r
- Height = title.Resolution.Height,\r
- PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height }\r
- },\r
- DestSettings = new DestSettings\r
- {\r
- AnamorphicMode = (int)job.Anamorphic,\r
- Geometry =\r
- {\r
- Width = job.Width ?? 0,\r
- Height = job.Height ?? 0,\r
- PAR = new PAR\r
- {\r
- Num = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : job.PixelAspectX,\r
- Den = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : job.PixelAspectY,\r
- }\r
- },\r
- Keep = settingMode,\r
- Crop = new List<int> { job.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right },\r
- Modulus = job.Modulus ?? 16,\r
- MaxWidth = job.MaxWidth ?? 0,\r
- MaxHeight = job.MaxHeight ?? 0,\r
- ItuPAR = false\r
- }\r
- };\r
-\r
- if (job.Anamorphic == Anamorphic.Custom)\r
- {\r
- anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = job.PixelAspectX, Den = job.PixelAspectY };\r
- }\r
- else\r
- {\r
- anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height };\r
- }\r
-\r
- return HandBrakeUtils.GetAnamorphicSize(anamorphicGeometry);\r
- }\r
-\r
- /// <summary>\r
- /// Finds output geometry for the given preview settings and title.\r
- /// </summary>\r
- /// <param name="settings">The preview settings.</param>\r
- /// <param name="title">Information on the title to consider.</param>\r
- /// <returns>Geometry Information</returns>\r
public static Geometry CreateGeometry(PreviewSettings settings, SourceVideoInfo title)\r
{\r
int settingMode = settings.KeepDisplayAspect ? 0x04 : 0;\r
{\r
SourceGeometry = new Geometry\r
{\r
- Width = title.Resolution.Width,\r
- Height = title.Resolution.Height,\r
+ Width = title.Resolution.Width, \r
+ Height = title.Resolution.Height, \r
PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height }\r
- },\r
+ }, \r
DestSettings = new DestSettings\r
{\r
- AnamorphicMode = (int)settings.Anamorphic,\r
+ AnamorphicMode = (int)settings.Anamorphic, \r
Geometry =\r
{\r
- Width = settings.Width,\r
- Height = settings.Height,\r
+ Width = settings.Width, \r
+ Height = settings.Height, \r
PAR = new PAR\r
{\r
- Num = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : settings.PixelAspectX,\r
- Den = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : settings.PixelAspectY,\r
+ Num = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : settings.PixelAspectX, \r
+ Den = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : settings.PixelAspectY, \r
}\r
- },\r
- Keep = settingMode,\r
- Crop = new List<int> { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right },\r
- Modulus = settings.Modulus ?? 16,\r
- MaxWidth = settings.MaxWidth,\r
- MaxHeight = settings.MaxHeight,\r
+ }, \r
+ Keep = settingMode, \r
+ Crop = new List<int> { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right }, \r
+ Modulus = settings.Modulus ?? 16, \r
+ MaxWidth = settings.MaxWidth, \r
+ MaxHeight = settings.MaxHeight, \r
ItuPAR = false\r
}\r
};\r