/// <returns>An image with the requested preview.</returns>\r
public BitmapImage GetPreview(EncodeJob job, int previewNumber)\r
{\r
- IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, job.Title);\r
+ IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(job.Title));\r
var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);\r
\r
List<IntPtr> allocatedMemory = this.ApplyJob(ref nativeJob, job);\r
EncodingProfile profile = job.EncodingProfile;\r
this.currentJob = job;\r
\r
- IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, job.Title);\r
+ IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(job.Title));\r
var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);\r
\r
this.encodeAllocatedMemory = this.ApplyJob(ref nativeJob, job, preview, previewNumber, previewSeconds, overallSelectedLengthSeconds);\r
return;\r
}\r
\r
- IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, job.Title);\r
+ IntPtr nativeJobPtr = HBFunctions.hb_job_init_by_index(this.hbHandle, this.GetTitleIndex(title));\r
var nativeJob = InteropUtilities.ReadStructure<hb_job_s>(nativeJobPtr);\r
\r
List<IntPtr> allocatedMemory = this.ApplyJob(ref nativeJob, job);\r
}\r
\r
/// <summary>\r
- /// Gets the title, given the 1-based index.\r
+ /// Gets the title, given the 1-based title number.\r
/// </summary>\r
- /// <param name="titleIndex">The index of the title (1-based).</param>\r
+ /// <param name="titleNumber">The number of the title (1-based).</param>\r
/// <returns>The requested Title.</returns>\r
- private Title GetTitle(int titleIndex)\r
+ private Title GetTitle(int titleNumber)\r
+ {\r
+ return this.Titles.SingleOrDefault(title => title.TitleNumber == titleNumber);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the 1-based title index of the given title.\r
+ /// </summary>\r
+ /// <param name="titleNumber">The 1-based title title number.</param>\r
+ /// <returns>The 1-based title index.</returns>\r
+ private int GetTitleIndex(int titleNumber)\r
+ {\r
+ Title title = this.GetTitle(titleNumber);\r
+ return this.GetTitleIndex(title);\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the 1-based title index of the given title.\r
+ /// </summary>\r
+ /// <param name="title">The title to look up</param>\r
+ /// <returns>The 1-based title index of the given title.</returns>\r
+ private int GetTitleIndex(Title title)\r
{\r
- return this.Titles.SingleOrDefault(title => title.TitleNumber == titleIndex);\r
+ return this.Titles.IndexOf(title) + 1;\r
}\r
\r
/// <summary>\r
var newTitle = new Title\r
{\r
TitleNumber = title.index,\r
+ Playlist = title.playlist,\r
Resolution = new Size(title.width, title.height),\r
ParVal = new Size(title.pixel_aspect_width, title.pixel_aspect_height),\r
Duration = TimeSpan.FromSeconds(title.duration / 90000),\r
/// </summary>\r
public int TitleNumber { get; set; }\r
\r
+ /// <summary>\r
+ /// Gets or sets the playlist number this title came from.\r
+ /// </summary>\r
+ public int Playlist { get; set; }\r
+\r
/// <summary>\r
/// Gets or sets the length in time of this Title\r
/// </summary>\r
/// <summary>\r
/// Override of the ToString method to provide an easy way to use this object in the UI\r
/// </summary>\r
- /// <returns>A string representing this track in the format: {title #} (00:00:00)</returns>\r
+ /// <returns>A string representing this track in the format: {title #}[ {playlist source}] (00:00:00)</returns>\r
public override string ToString()\r
{\r
- return string.Format("{0} ({1:00}:{2:00}:{3:00})", this.TitleNumber, this.Duration.Hours,\r
- this.Duration.Minutes, this.Duration.Seconds);\r
+ string playlistPortion = string.Empty;\r
+ if (this.InputType == InputType.Bluray)\r
+ {\r
+ playlistPortion = string.Format(" {0:d5}.MPLS", this.Playlist);\r
+ }\r
+\r
+ return string.Format(\r
+ "{0}{1} ({2:00}:{3:00}:{4:00})", \r
+ this.TitleNumber, \r
+ playlistPortion,\r
+ this.Duration.Hours,\r
+ this.Duration.Minutes, \r
+ this.Duration.Seconds);\r
}\r
\r
/// <summary>\r