summaryrefslogtreecommitdiffstats
path: root/win/CS
diff options
context:
space:
mode:
authorrandomengy <[email protected]>2012-12-02 22:40:37 +0000
committerrandomengy <[email protected]>2012-12-02 22:40:37 +0000
commit900b57a83dfa9a78c3f5a0673f052fff9ba6d302 (patch)
treec293345ef4b34417d591da89faee362165fe8dae /win/CS
parent37035605b849ada282844a936d106a9042d8a0b2 (diff)
Interop: Fixing title number/title index mixup. Adding Playlist to the Title object.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5088 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs36
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs2
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs4
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs22
4 files changed, 51 insertions, 13 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index a1263a4fb..a2bf8cef9 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -233,7 +233,7 @@ namespace HandBrake.Interop
/// <returns>An image with the requested preview.</returns>
public BitmapImage GetPreview(EncodeJob job, int previewNumber)
{
- IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, job.Title);
+ IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(job.Title));
var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);
List<IntPtr> allocatedMemory = this.ApplyJob(ref nativeJob, job);
@@ -402,7 +402,7 @@ namespace HandBrake.Interop
EncodingProfile profile = job.EncodingProfile;
this.currentJob = job;
- IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, job.Title);
+ IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(job.Title));
var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);
this.encodeAllocatedMemory = this.ApplyJob(ref nativeJob, job, preview, previewNumber, previewSeconds, overallSelectedLengthSeconds);
@@ -576,7 +576,7 @@ namespace HandBrake.Interop
return;
}
- IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, job.Title);
+ IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(title));
var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);
List<IntPtr> allocatedMemory = this.ApplyJob(ref nativeJob, job);
@@ -1540,13 +1540,34 @@ namespace HandBrake.Interop
}
/// <summary>
- /// Gets the title, given the 1-based index.
+ /// Gets the title, given the 1-based title number.
/// </summary>
- /// <param name="titleIndex">The index of the title (1-based).</param>
+ /// <param name="titleNumber">The number of the title (1-based).</param>
/// <returns>The requested Title.</returns>
- private Title GetTitle(int titleIndex)
+ private Title GetTitle(int titleNumber)
+ {
+ return this.Titles.SingleOrDefault(title => title.TitleNumber == titleNumber);
+ }
+
+ /// <summary>
+ /// Gets the 1-based title index of the given title.
+ /// </summary>
+ /// <param name="titleNumber">The 1-based title title number.</param>
+ /// <returns>The 1-based title index.</returns>
+ private int GetTitleIndex(int titleNumber)
+ {
+ Title title = this.GetTitle(titleNumber);
+ return this.GetTitleIndex(title);
+ }
+
+ /// <summary>
+ /// Gets the 1-based title index of the given title.
+ /// </summary>
+ /// <param name="title">The title to look up</param>
+ /// <returns>The 1-based title index of the given title.</returns>
+ private int GetTitleIndex(Title title)
{
- return this.Titles.SingleOrDefault(title => title.TitleNumber == titleIndex);
+ return this.Titles.IndexOf(title) + 1;
}
/// <summary>
@@ -1657,6 +1678,7 @@ namespace HandBrake.Interop
var newTitle = new Title
{
TitleNumber = title.index,
+ Playlist = title.playlist,
Resolution = new Size(title.width, title.height),
ParVal = new Size(title.pixel_aspect_width, title.pixel_aspect_height),
Duration = TimeSpan.FromSeconds(title.duration / 90000),
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 136c2df74..859719b79 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs
@@ -23,7 +23,7 @@ namespace HandBrake.Interop.HbLib
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
- public string dvd;
+ public string path;
/// char[1024]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs
index 523d7a8dd..3990704fe 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.33.0.0")]
-[assembly: AssemblyFileVersion("1.33.0.0")]
+[assembly: AssemblyVersion("1.35.0.0")]
+[assembly: AssemblyFileVersion("1.35.0.0")]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs
index 06b1acdef..344759c1d 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/Title.cs
@@ -68,6 +68,11 @@ namespace HandBrake.Interop.SourceData
public int TitleNumber { get; set; }
/// <summary>
+ /// Gets or sets the playlist number this title came from.
+ /// </summary>
+ public int Playlist { get; set; }
+
+ /// <summary>
/// Gets or sets the length in time of this Title
/// </summary>
public TimeSpan Duration { get; set; }
@@ -131,11 +136,22 @@ namespace HandBrake.Interop.SourceData
/// <summary>
/// Override of the ToString method to provide an easy way to use this object in the UI
/// </summary>
- /// <returns>A string representing this track in the format: {title #} (00:00:00)</returns>
+ /// <returns>A string representing this track in the format: {title #}[ {playlist source}] (00:00:00)</returns>
public override string ToString()
{
- return string.Format("{0} ({1:00}:{2:00}:{3:00})", this.TitleNumber, this.Duration.Hours,
- this.Duration.Minutes, this.Duration.Seconds);
+ string playlistPortion = string.Empty;
+ if (this.InputType == InputType.Bluray)
+ {
+ playlistPortion = string.Format(" {0:d5}.MPLS", this.Playlist);
+ }
+
+ return string.Format(
+ "{0}{1} ({2:00}:{3:00}:{4:00})",
+ this.TitleNumber,
+ playlistPortion,
+ this.Duration.Hours,
+ this.Duration.Minutes,
+ this.Duration.Seconds);
}
/// <summary>