diff options
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs | 35 | ||||
-rw-r--r-- | win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs | 16 |
2 files changed, 22 insertions, 29 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index b08facbd2..6c4e26ede 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -829,20 +829,13 @@ namespace HandBrake.Interop IntPtr titleSetPtr = HBFunctions.hb_get_title_set(this.hbHandle);
hb_title_set_s titleSet = InteropUtilities.ToStructureFromPtr<hb_title_set_s>(titleSetPtr);
this.originalTitles = titleSet.list_title.ToListFromHandBrakeList<hb_title_s>();
-
- foreach (hb_title_s title in this.originalTitles)
- {
- var newTitle = this.ConvertTitle(title);
-
- // Convert the Path to UTF-8.
- byte[] bytes = Encoding.Default.GetBytes(title.path);
- string utf8Str = Encoding.UTF8.GetString(bytes);
- newTitle.Path = utf8Str;
-
- this.titles.Add(newTitle);
- }
-
- if (this.originalTitles.Count > 0)
+ + foreach (hb_title_s title in this.originalTitles) + { + this.titles.Add(this.ConvertTitle(title)); + } + + if (this.originalTitles.Count > 0) {
this.featureTitle = titleSet.feature;
}
@@ -1881,13 +1874,13 @@ namespace HandBrake.Interop AspectRatio = title.aspect,
AngleCount = title.angle_count,
VideoCodecName = title.video_codec_name,
- Framerate = ((double)title.rate) / title.rate_base,
- FramerateNumerator = title.rate,
- FramerateDenominator = title.rate_base,
- Path = title.path
- };
-
- switch (title.type)
+ Framerate = ((double)title.rate) / title.rate_base, + FramerateNumerator = title.rate, + FramerateDenominator = title.rate_base, + Path = Encoding.UTF8.GetString(title.path).TrimEnd('\0') + }; + + switch (title.type) {
case hb_title_type_anon.HB_STREAM_TYPE:
newTitle.InputType = InputType.Stream;
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 d9a845081..a3152c4be 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs @@ -16,14 +16,14 @@ namespace HandBrake.Interop.HbLib /// Anonymous_990d28ea_6cf3_4fbc_8143_4df9513e9550
public hb_title_type_anon type;
- public uint reg_desc;
-
- /// char[1024]
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
- public string path;
-
- /// char[1024]
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
+ public uint reg_desc; + + /// char[1024] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] + public byte[] path; + + /// char[1024] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)] public string name;
/// int
|