diff options
author | sr55 <[email protected]> | 2014-12-18 21:30:24 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2014-12-18 21:30:24 +0000 |
commit | aee0ccc0e4d624f88c0d7f3effda3a8a085def74 (patch) | |
tree | 8770df03472655675facf0c8cd5e62c72c1c2f06 | |
parent | 6dac5a9af13ffee95a448cdbe9d1971fb35d3266 (diff) |
WinGui: Update the libhb scan code to work with the updated API. See rev6602 for API changes.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6608 b64f7644-9d1e-0410-96f1-a4d463321fa5
9 files changed, 27 insertions, 58 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs index e50d5ac1b..6311c79e3 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs @@ -476,7 +476,7 @@ namespace HandBrake.ApplicationServices.Services.Scan TitleNumber = title.TitleNumber,
Duration = title.Duration,
Resolution = new Size(title.Resolution.Width, title.Resolution.Height),
- AspectRatio = title.AspectRatio,
+ AspectRatio = (decimal)title.AspectRatio,
AngleCount = title.AngleCount,
ParVal = new Size(title.ParVal.Width, title.ParVal.Height),
AutoCropDimensions = title.AutoCropDimensions,
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs index ad6b291d1..2757fe093 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs @@ -72,7 +72,7 @@ namespace HandBrake.ApplicationServices.Services.Scan.Model /// <summary>
/// Gets or sets the aspect ratio of this Title
/// </summary>
- public double AspectRatio { get; set; }
+ public decimal AspectRatio { get; set; }
/// <summary>
/// Gets or sets AngleCount.
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index 1bc9445f3..b2d20af0a 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -1166,8 +1166,8 @@ namespace HandBrake.Interop {
// CFR with "Same as Source". Use the title rate
nativeJob.cfr = 1;
- nativeJob.vrate = originalTitle.rate;
- nativeJob.vrate_base = originalTitle.rate_base;
+ nativeJob.vrate = originalTitle.vrate.num;
+ nativeJob.vrate_base = originalTitle.vrate.den;
}
else
{
@@ -1860,8 +1860,8 @@ namespace HandBrake.Interop {
TitleNumber = title.index,
Playlist = title.playlist,
- Resolution = new Size(title.width, title.height),
- ParVal = new Size(title.pixel_aspect_width, title.pixel_aspect_height),
+ Resolution = new Size(title.geometry.width, title.geometry.height),
+ ParVal = new Size(title.geometry.par.num, title.geometry.par.den),
Duration = Converters.Converters.PtsToTimeSpan(title.duration),
DurationPts = title.duration,
AutoCropDimensions = new Cropping
@@ -1871,12 +1871,12 @@ namespace HandBrake.Interop Left = title.crop[2],
Right = title.crop[3]
},
- AspectRatio = title.aspect,
+ AspectRatio = Math.Round((decimal)title.container_dar.num / title.container_dar.den, 2),
AngleCount = title.angle_count,
VideoCodecName = title.video_codec_name,
- Framerate = ((double)title.rate) / title.rate_base,
- FramerateNumerator = title.rate,
- FramerateDenominator = title.rate_base,
+ Framerate = ((double)title.vrate.num) / title.vrate.den,
+ FramerateNumerator = title.vrate.num,
+ FramerateDenominator = title.vrate.den,
Path = Encoding.UTF8.GetString(title.path).TrimEnd('\0')
};
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs index 449d7f023..243632ba9 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs @@ -115,7 +115,7 @@ namespace HandBrake.Interop.HbLib public static extern void hb_set_anamorphic_size(ref hb_job_s job, ref int output_width, ref int output_height, ref int output_par_width, ref int output_par_height);
[DllImport("hb.dll", EntryPoint = "hb_set_anamorphic_size2", CallingConvention = CallingConvention.Cdecl)]
- public static extern void hb_set_anamorphic_size2(ref hb_geometry_s sourceGeometry, ref hb_ui_geometry_s uiGeometry, ref hb_geometry_s result);
+ public static extern void hb_set_anamorphic_size2(ref hb_geometry_s sourceGeometry, ref hb_geometry_settings_s uiGeometry, ref hb_geometry_s result);
/// Return Type: int
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs index c6bc59fb3..7814fb27b 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs @@ -60,9 +60,9 @@ namespace HandBrake.Interop.HbLib /// int
public int bitrate;
- public float quality;
+ public double quality;
- public float compression_level;
+ public double compression_level;
/// double
public double dynamic_range_compression;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_geometry.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_geometry.cs index 6a0001ff7..857b9eca0 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_geometry.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_geometry.cs @@ -38,7 +38,7 @@ namespace HandBrake.Interop.HbLib /// The hb_ui_geometry_s.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
- public struct hb_ui_geometry_s
+ public struct hb_geometry_settings_s
{
/// <summary>
/// Anamorphic mode, see job struct anamorphic
@@ -67,16 +67,6 @@ namespace HandBrake.Interop.HbLib public int[] crop;
/// <summary>
- /// destination storage width
- /// </summary>
- public int width;
-
- /// <summary>
- /// destination storage height
- /// </summary>
- public int height;
-
- /// <summary>
/// max destination storage width
/// </summary>
public int maxWidth;
@@ -89,12 +79,7 @@ namespace HandBrake.Interop.HbLib /// <summary>
/// Pixel aspect used in custom anamorphic
/// </summary>
- public hb_rational_t par;
-
- /// <summary>
- /// Display aspect used in custom anamorphic
- /// </summary>
- public hb_rational_t dar;
+ public hb_geometry_s geometry;
}
/// <summary>
@@ -104,12 +89,12 @@ namespace HandBrake.Interop.HbLib public struct hb_rational_t
{
/// <summary>
- /// The num.
+ /// The num. W
/// </summary>
public int num;
/// <summary>
- /// The den.
+ /// The den. H
/// </summary>
public int den;
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs index a3152c4be..3e43ac2a6 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs @@ -69,35 +69,20 @@ namespace HandBrake.Interop.HbLib /// uint64_t->unsigned int
public ulong duration;
- /// double
- public double aspect;
-
- /// double
- public double container_aspect;
-
public int has_resolution_change;
- /// int
- public int width;
-
- /// int
- public int height;
+ public hb_geometry_s geometry;
- /// int
- public int pixel_aspect_width;
+ public hb_rational_t dar;
- /// int
- public int pixel_aspect_height;
+ public hb_rational_t container_dar;
public int color_prim;
public int color_transfer;
public int color_matrix;
/// int
- public int rate;
-
- /// int
- public int rate_base;
+ public hb_rational_t vrate;
/// int[4]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I4)]
@@ -179,7 +164,9 @@ namespace HandBrake.Interop.HbLib {
HB_DVD_DEMUXER = 0,
- HB_MPEG_DEMUXER,
+ HB_TS_DEMUXER,
+
+ HB_PS_DEMUXER,
HB_NULL_DEMUXER,
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs index d722404bd..6137199d8 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs @@ -101,7 +101,7 @@ namespace HandBrake.Interop.SourceData /// <summary>
/// Gets or sets the aspect ratio of this Title
/// </summary>
- public double AspectRatio { get; set; }
+ public decimal AspectRatio { get; set; }
/// <summary>
/// Gets or sets the number of angles on the title.
diff --git a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs index f790c5a15..f7dc3aeac 100644 --- a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs +++ b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs @@ -184,19 +184,16 @@ namespace HandBrakeWPF.Helpers int settingMode = (int)setting + (job.KeepDisplayAspect ? 0x04 : 0);
- hb_ui_geometry_s uiGeometry = new hb_ui_geometry_s
+ hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s
{
crop = new[] { job.Crop.Top, job.Crop.Bottom, job.Crop.Left, job.Crop.Right },
- dar = new hb_rational_t { den = 0, num = 0 },
- height = job.Height,
itu_par = 0,
keep = settingMode,
maxWidth = job.MaxWidth,
maxHeight = job.MaxHeight,
mode = (int)(hb_anamorphic_mode_t)job.AnamorphicMode,
modulus = job.Modulus.HasValue ? job.Modulus.Value : 16,
- 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 },
- width = job.Width,
+ 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
|