]> granicus.if.org Git - handbrake/commitdiff
WinGui: Stripping out a lot of legacy abstraction code for the scan service.
authorsr55 <sr55.hb@outlook.com>
Fri, 6 Mar 2015 22:36:10 +0000 (22:36 +0000)
committersr55 <sr55.hb@outlook.com>
Fri, 6 Mar 2015 22:36:10 +0000 (22:36 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6971 b64f7644-9d1e-0410-96f1-a4d463321fa5

18 files changed:
win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
win/CS/HandBrake.ApplicationServices/Interop/Factories/ScanFactory.cs [deleted file]
win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs
win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs
win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs
win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs
win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs
win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/AudioTrack.cs [deleted file]
win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Chapter.cs [deleted file]
win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/InputType.cs [deleted file]
win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Subtitle.cs [deleted file]
win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/SubtitleSource.cs [deleted file]
win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Title.cs [deleted file]
win/CS/HandBrake.ApplicationServices/Interop/Model/SourceVideoInfo.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs

index bc2f23f27fd80ce3348b9575ff0f307411b88a81..91228fdaed65b9d63df71ed4fefa7a2c3224b94b 100644 (file)
     <Compile Include="Interop\Json\Encode\Video.cs" />\r
     <Compile Include="Interop\Factories\AnamorphicFactory.cs" />\r
     <Compile Include="Services\Encode\Factories\EncodeFactory.cs" />\r
-    <Compile Include="Interop\Factories\ScanFactory.cs" />\r
     <Compile Include="Interop\Json\Scan\AudioList.cs" />\r
     <Compile Include="Interop\Json\Scan\ChapterList.cs" />\r
     <Compile Include="Interop\Json\Scan\Color.cs" />\r
     <Compile Include="Interop\Model\Language.cs" />\r
     <Compile Include="Interop\Model\Preview\PreviewSettings.cs" />\r
     <Compile Include="Interop\Model\RangeLimits.cs" />\r
-    <Compile Include="Interop\Model\Scan\AudioTrack.cs" />\r
-    <Compile Include="Interop\Model\Scan\Chapter.cs" />\r
-    <Compile Include="Interop\Model\Scan\InputType.cs" />\r
-    <Compile Include="Interop\Model\Scan\Subtitle.cs" />\r
-    <Compile Include="Interop\Model\Scan\SubtitleSource.cs" />\r
-    <Compile Include="Interop\Model\Scan\Title.cs" />\r
     <Compile Include="Interop\Model\Size.cs" />\r
     <Compile Include="Interop\Model\SourceVideoInfo.cs" />\r
     <Compile Include="Interop\Model\VideoQualityLimits.cs" />\r
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Factories/ScanFactory.cs b/win/CS/HandBrake.ApplicationServices/Interop/Factories/ScanFactory.cs
deleted file mode 100644 (file)
index e2ac0f3..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="ScanFactory.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   The scan factory.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Factories\r
-{\r
-    using System;\r
-    using System.Collections.Generic;\r
-\r
-    using HandBrake.ApplicationServices.Interop.Json.Scan;\r
-    using HandBrake.ApplicationServices.Interop.Model;\r
-    using HandBrake.ApplicationServices.Interop.Model.Scan;\r
-\r
-    /// <summary>\r
-    /// This factory takes the JSON objects deserialized from libhb for the scan information\r
-    /// and converts them into the internal Title objects.\r
-    /// </summary>\r
-    internal class ScanFactory\r
-    {\r
-        /// <summary>\r
-        /// The create title set.\r
-        /// </summary>\r
-        /// <param name="scan">\r
-        /// The scan.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The <see cref="IEnumerable"/>.\r
-        /// </returns>\r
-        internal static IEnumerable<Title> CreateTitleSet(JsonScanObject scan)\r
-        {\r
-            List<Title> titles = new List<Title>();\r
-\r
-            if (scan != null)\r
-            {\r
-                foreach (TitleList item in scan.TitleList)\r
-                {\r
-                    Title title = CreateTitle(item);\r
-\r
-                    if (title.TitleNumber == scan.MainFeature)\r
-                    {\r
-                        title.IsMainFeature = true;\r
-                    }\r
-\r
-                    titles.Add(title);\r
-                }\r
-            }\r
-\r
-            return titles;\r
-        }\r
-\r
-        /// <summary>\r
-        /// The create title.\r
-        /// </summary>\r
-        /// <param name="title">\r
-        /// The title.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The <see cref="Title"/>.\r
-        /// </returns>\r
-        private static Title CreateTitle(TitleList title)\r
-        {\r
-            Title newTitle = new Title\r
-            {\r
-                TitleNumber = title.Index,\r
-                Playlist = title.Playlist,\r
-                Resolution = new Size(title.Geometry.Width, title.Geometry.Height),\r
-                ParVal = new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den), \r
-                Duration = new TimeSpan(title.Duration.Hours, title.Duration.Minutes, title.Duration.Seconds),\r
-                AutoCropDimensions = new Cropping\r
-                {\r
-                    Top = title.Crop[0],\r
-                    Bottom = title.Crop[1],\r
-                    Left = title.Crop[2],\r
-                    Right = title.Crop[3]\r
-                },\r
-                AngleCount = title.AngleCount,\r
-                VideoCodecName = title.VideoCodec,\r
-                Framerate = ((double)title.FrameRate.Num) / title.FrameRate.Den,\r
-                FramerateNumerator = title.FrameRate.Num,\r
-                FramerateDenominator = title.FrameRate.Den,\r
-                Path = title.Path\r
-            };\r
-\r
-            switch (title.Type)\r
-            {\r
-                case 2:\r
-                    newTitle.InputType = InputType.Stream;\r
-                    break;\r
-                case 0:\r
-                    newTitle.InputType = InputType.Dvd;\r
-                    break;\r
-                case 1:\r
-                    newTitle.InputType = InputType.Bluray;\r
-                    break;\r
-                      case 3:\r
-                    newTitle.InputType = InputType.FFStream;\r
-                    break;\r
-            }\r
-\r
-            foreach (Subtitle subtitleTrack in CreateSubtitleTracks(title.SubtitleList))\r
-            {\r
-                newTitle.Subtitles.Add(subtitleTrack);\r
-            }\r
-\r
-            foreach (AudioTrack audioTrack in CreateAudioTracks(title.AudioList))\r
-            {\r
-                newTitle.AudioTracks.Add(audioTrack);\r
-            }\r
-\r
-            foreach (Chapter chapter in CreateChapters(title.ChapterList))\r
-            {\r
-                newTitle.Chapters.Add(chapter);\r
-            }\r
-  \r
-            return newTitle;\r
-        }\r
-\r
-        /// <summary>\r
-        /// The create subtitle tracks.\r
-        /// </summary>\r
-        /// <param name="subtitles">\r
-        /// The subtitles.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The <see cref="IEnumerable"/>.\r
-        /// </returns>\r
-        private static IEnumerable<Subtitle> CreateSubtitleTracks(IEnumerable<SubtitleList> subtitles)\r
-        {\r
-            List<Subtitle> subtiles = new List<Subtitle>();\r
-\r
-            int currentSubtitleTrack = 1;\r
-            foreach (SubtitleList subtitle in subtitles)\r
-            {\r
-                Subtitle newSubtitle = new Subtitle\r
-                {\r
-                    TrackNumber = currentSubtitleTrack,\r
-                    Language = subtitle.Language,\r
-                    LanguageCode = subtitle.LanguageCode,\r
-                    SubtitleSourceInt = subtitle.Source,\r
-                    SubtitleSource = (SubtitleSource)subtitle.Source  // TODO Check correct\r
-                };\r
-\r
-                subtiles.Add(newSubtitle);\r
-\r
-                currentSubtitleTrack++;\r
-            }\r
-\r
-            return subtiles;\r
-        }\r
-\r
-        /// <summary>\r
-        /// The create audio tracks.\r
-        /// </summary>\r
-        /// <param name="audioTracks">\r
-        /// The audio tracks.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The <see cref="IEnumerable"/>.\r
-        /// </returns>\r
-        private static IEnumerable<AudioTrack> CreateAudioTracks(IEnumerable<AudioList> audioTracks)\r
-        {\r
-            List<AudioTrack> tracks = new List<AudioTrack>();\r
-\r
-            int currentAudioTrack = 1;\r
-            foreach (AudioList track in audioTracks)\r
-            {\r
-                AudioTrack newAudio = new AudioTrack\r
-                {\r
-                    TrackNumber = currentAudioTrack,\r
-                    CodecId = Convert.ToUInt32(track.Codec),\r
-                    Language = track.Language,\r
-                    LanguageCode = track.LanguageCode,\r
-                    Description = track.Description,\r
-                    ChannelLayout = (ulong)track.ChannelLayout,\r
-                    SampleRate = track.SampleRate,\r
-                    Bitrate = track.BitRate\r
-                };\r
-\r
-                tracks.Add(newAudio);\r
-\r
-                currentAudioTrack++;\r
-            }\r
-            return tracks;\r
-        }\r
-\r
-        /// <summary>\r
-        /// The create chapters.\r
-        /// </summary>\r
-        /// <param name="chapters">\r
-        /// The chapters.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The <see cref="IEnumerable"/>.\r
-        /// </returns>\r
-        private static IEnumerable<Chapter> CreateChapters(IEnumerable<ChapterList> chapters)\r
-        {\r
-            List<Chapter> tracks = new List<Chapter>();\r
-\r
-            int currentTrack = 1;\r
-            foreach (ChapterList chapter in chapters)\r
-            {\r
-                Chapter newChapter = new Chapter\r
-                {\r
-                    Name = chapter.Name,\r
-                    ChapterNumber = currentTrack,\r
-                    Duration = new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds)\r
-                };\r
-\r
-                tracks.Add(newChapter);\r
-                currentTrack++;\r
-            }\r
-\r
-            return tracks;\r
-        }\r
-    }\r
-}\r
index 35d278a4addbc251b33c695ebba017f4d5f9b36e..714de654732781533b37e03207fcc7fb38756585 100644 (file)
@@ -1,5 +1,5 @@
 // --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="Encoders.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// <copyright file="HandBrakeEncoderHelpers.cs" company="HandBrake Project (http://handbrake.fr)">\r
 //   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
 // </copyright>\r
 // <summary>\r
@@ -17,7 +17,6 @@ namespace HandBrake.ApplicationServices.Interop
     using HandBrake.ApplicationServices.Interop.Helpers;\r
     using HandBrake.ApplicationServices.Interop.Model;\r
     using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
-    using HandBrake.ApplicationServices.Interop.Model.Scan;\r
 \r
     /// <summary>\r
     /// The encoders.\r
@@ -263,8 +262,8 @@ namespace HandBrake.ApplicationServices.Interop
         /// <summary>\r
         /// Determines if the given encoder is compatible with the given track.\r
         /// </summary>\r
-        /// <param name="track">\r
-        /// The audio track to examine.\r
+        /// <param name="codecId">\r
+        /// The codec Id.\r
         /// </param>\r
         /// <param name="encoder">\r
         /// The encoder to examine.\r
@@ -275,9 +274,9 @@ namespace HandBrake.ApplicationServices.Interop
         /// <remarks>\r
         /// Only works with passthrough encoders.\r
         /// </remarks>\r
-        public static bool AudioEncoderIsCompatible(AudioTrack track, HBAudioEncoder encoder)\r
+        public static bool AudioEncoderIsCompatible(int codecId, HBAudioEncoder encoder)\r
         {\r
-            return (track.CodecId & encoder.Id) > 0;\r
+            return (codecId & encoder.Id) > 0;\r
         }\r
 \r
         /// <summary>\r
@@ -317,8 +316,8 @@ namespace HandBrake.ApplicationServices.Interop
         /// <summary>\r
         /// Determines if DRC can be applied to the given track with the given encoder.\r
         /// </summary>\r
-        /// <param name="track">\r
-        /// The track to apply DRC to.\r
+        /// <param name="trackNumber">\r
+        /// The track Number.\r
         /// </param>\r
         /// <param name="encoder">\r
         /// The encoder to use for DRC.\r
@@ -329,9 +328,9 @@ namespace HandBrake.ApplicationServices.Interop
         /// <returns>\r
         /// True if DRC can be applied to the track with the given encoder.\r
         /// </returns>\r
-        public static bool CanApplyDrc(AudioTrack track, HBAudioEncoder encoder, int title)\r
+        public static bool CanApplyDrc(int trackNumber, HBAudioEncoder encoder, int title)\r
         {\r
-            return HBFunctions.hb_audio_can_apply_drc2(HandBrakeInstanceManager.LastScanHandle, title, track.TrackNumber, encoder.Id) > 0;\r
+            return HBFunctions.hb_audio_can_apply_drc2(HandBrakeInstanceManager.LastScanHandle, title, trackNumber, encoder.Id) > 0;\r
         }\r
 \r
         /// <summary>\r
index 3da06d58d84bd7a1bcd5d276cef6093eadcbcbd7..719119cc085f855b9b04921eb59adab669104a4a 100644 (file)
@@ -32,11 +32,11 @@ namespace HandBrake.ApplicationServices.Interop
     using HandBrake.ApplicationServices.Interop.Model;\r
     using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
     using HandBrake.ApplicationServices.Interop.Model.Preview;\r
-    using HandBrake.ApplicationServices.Interop.Model.Scan;\r
 \r
     using Newtonsoft.Json;\r
 \r
     using Geometry = HandBrake.ApplicationServices.Interop.Json.Anamorphic.Geometry;\r
+    using Size = HandBrake.ApplicationServices.Interop.Model.Size;\r
 \r
     /// <summary>\r
     /// A wrapper for a HandBrake instance.\r
@@ -71,7 +71,7 @@ namespace HandBrake.ApplicationServices.Interop
         /// <summary>\r
         /// The list of titles on this instance.\r
         /// </summary>\r
-        private List<Title> titles;\r
+        private JsonScanObject titles;\r
 \r
         /// <summary>\r
         /// The index of the default title.\r
@@ -125,7 +125,7 @@ namespace HandBrake.ApplicationServices.Interop
         /// <summary>\r
         /// Gets the list of titles on this instance.\r
         /// </summary>\r
-        public List<Title> Titles\r
+        public JsonScanObject Titles\r
         {\r
             get\r
             {\r
@@ -247,7 +247,7 @@ namespace HandBrake.ApplicationServices.Interop
         [HandleProcessCorruptedStateExceptions]\r
         public BitmapImage GetPreview(PreviewSettings job, int previewNumber)\r
         {\r
-            Title title = this.Titles.FirstOrDefault(t => t.TitleNumber == job.Title);\r
+            TitleList title = this.Titles.TitleList.FirstOrDefault(t => t.Index == job.Title);\r
             Validate.NotNull(title, "GetPreview: Title should not have been null. This is probably a bug.");\r
 \r
             // Creat the Expected Output Geometry details for libhb.\r
@@ -265,13 +265,13 @@ namespace HandBrake.ApplicationServices.Interop
                     height = job.Height ?? 0, \r
                     width = job.Width ?? 0, \r
                     par = job.Anamorphic != Anamorphic.Custom\r
-                        ? new hb_rational_t { den = title.ParVal.Height, num = title.ParVal.Width }\r
+                        ? new hb_rational_t { den = title.Geometry.PAR.Den, num = title.Geometry.PAR.Num }\r
                         : new hb_rational_t { den = job.PixelAspectY, num = job.PixelAspectX }\r
                 }\r
             };\r
 \r
             // Sanatise the input.\r
-            Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, new SourceVideoInfo(title.FramerateNumerator, title.FramerateDenominator, title.Resolution, title.ParVal), AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH); // TODO this keep isn't right.\r
+            Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, new SourceVideoInfo(null, null, new Size(title.Geometry.Width, title.Geometry.Height), new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den)), AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH); // TODO this keep isn't right.\r
             int width = resultGeometry.Width * resultGeometry.PAR.Num / resultGeometry.PAR.Den;\r
             int height = resultGeometry.Height;\r
             uiGeometry.geometry.height = resultGeometry.Height; // Prased the height now.\r
@@ -344,11 +344,8 @@ namespace HandBrake.ApplicationServices.Interop
         /// <param name="encodeObject">\r
         /// The encode Object.\r
         /// </param>\r
-        /// <param name="title">\r
-        /// The title.\r
-        /// </param>\r
         [HandleProcessCorruptedStateExceptions]\r
-        public void StartEncode(JsonEncodeObject encodeObject, Title title)\r
+        public void StartEncode(JsonEncodeObject encodeObject)\r
         {\r
             JsonSerializerSettings settings = new JsonSerializerSettings\r
             {\r
@@ -479,21 +476,10 @@ namespace HandBrake.ApplicationServices.Interop
             }\r
             else if (state != null && state.State == NativeConstants.HB_STATE_SCANDONE)\r
             {\r
-                this.titles = new List<Title>();\r
-\r
                 var jsonMsg = HBFunctions.hb_get_title_set_json(this.hbHandle);\r
-\r
                 string scanJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg);\r
-\r
-                JsonScanObject scanObject = JsonConvert.DeserializeObject<JsonScanObject>(scanJson);\r
-\r
-                foreach (Title title in ScanFactory.CreateTitleSet(scanObject))\r
-                { \r
-                    // Set the Main Title.\r
-                    this.featureTitle = title.IsMainFeature ? title.TitleNumber : 0;\r
-\r
-                    this.titles.Add(title);\r
-                }\r
+                this.titles = JsonConvert.DeserializeObject<JsonScanObject>(scanJson);\r
+                this.featureTitle = this.titles.MainFeature;\r
 \r
                 this.scanPollTimer.Stop();\r
 \r
index 138eed367ee735ee32c6236f77ab32745e021eab..577fbf0e65ea31053a0df40cf175f5d0daab56e4 100644 (file)
@@ -16,9 +16,6 @@ namespace HandBrake.ApplicationServices.Interop
 \r
     using HandBrake.ApplicationServices.Interop.EventArgs;\r
     using HandBrake.ApplicationServices.Interop.HbLib;\r
-    using HandBrake.ApplicationServices.Interop.Model;\r
-    using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
-    using HandBrake.ApplicationServices.Interop.Model.Scan;\r
 \r
     /// <summary>\r
     /// HandBrake Interop Utilities\r
index 48be6bc4040da60824016402d8bbc449d6c553a8..8230e66207356501b2fa8bd8d760420ff353d082 100644 (file)
 namespace HandBrake.ApplicationServices.Interop.Interfaces\r
 {\r
     using System;\r
-    using System.Collections.Generic;\r
     using System.Windows.Media.Imaging;\r
 \r
     using HandBrake.ApplicationServices.Interop.EventArgs;\r
     using HandBrake.ApplicationServices.Interop.Json.Encode;\r
-    using HandBrake.ApplicationServices.Interop.Model;\r
+    using HandBrake.ApplicationServices.Interop.Json.Scan;\r
     using HandBrake.ApplicationServices.Interop.Model.Preview;\r
-    using HandBrake.ApplicationServices.Interop.Model.Scan;\r
 \r
     /// <summary>\r
     /// The Interface for HandBrakeInstance\r
@@ -58,7 +56,7 @@ namespace HandBrake.ApplicationServices.Interop.Interfaces
         /// <summary>\r
         /// Gets the list of titles on this instance.\r
         /// </summary>\r
-        List<Title> Titles { get; }\r
+        JsonScanObject Titles { get; }\r
 \r
         #endregion\r
 \r
@@ -67,7 +65,9 @@ namespace HandBrake.ApplicationServices.Interop.Interfaces
         /// <summary>\r
         /// Initializes this instance.\r
         /// </summary>\r
-        /// <param name="verbosity">The code for the logging verbosity to use.</param>\r
+        /// <param name="verbosity">\r
+        /// The code for the logging verbosity to use.\r
+        /// </param>\r
         void Initialize(int verbosity);\r
 \r
         /// <summary>\r
@@ -108,10 +108,7 @@ namespace HandBrake.ApplicationServices.Interop.Interfaces
         /// <param name="jobToStart">\r
         /// The job to start.\r
         /// </param>\r
-        /// <param name="title">\r
-        /// The title.\r
-        /// </param>\r
-        void StartEncode(JsonEncodeObject jobToStart, Title title);\r
+        void StartEncode(JsonEncodeObject jobToStart);\r
 \r
         /// <summary>\r
         /// Starts a scan of the given path.\r
index bfe647ab8858ab8195d9499c9b9868a89082159f..2eca81fc6d437fcc5a93410c53aaa40844808f90 100644 (file)
@@ -15,12 +15,12 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
     internal class PAR\r
     {\r
         /// <summary>\r
-        /// Gets or sets the height.\r
+        /// Gets or sets the width.\r
         /// </summary>\r
         public int Num { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets the width.\r
+        /// Gets or sets the height.\r
         /// </summary>\r
         public int Den { get; set; }\r
     }\r
index b31dd4e05e17ce80d46b0a9d90498f7599489be3..f6668eb24ea183a030cea647b32076225dd67f31 100644 (file)
@@ -93,7 +93,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Scan
 \r
         /// <summary>\r
         /// Gets or sets the type.\r
-        ///  HB_DVD_TYPE, HB_BD_TYPE, HB_STREAM_TYPE, HB_FF_STREAM_TYPE\r
+        ///  HB_DVD_TYPE = 0, HB_BD_TYPE, HB_STREAM_TYPE, HB_FF_STREAM_TYPE\r
         /// </summary>\r
         public int Type { get; set; }\r
 \r
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/AudioTrack.cs
deleted file mode 100644 (file)
index 527b3c4..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="AudioTrack.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   An object represending an AudioTrack associated with a Title, in a DVD\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Scan\r
-{\r
-    /// <summary>\r
-    /// An object represending an AudioTrack associated with a Title, in a DVD\r
-    /// </summary>\r
-    public class AudioTrack\r
-    {\r
-        /// <summary>\r
-        /// Gets or sets the track number of this Audio Track\r
-        /// </summary>\r
-        public int TrackNumber { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the audio codec ID for this track.\r
-        /// </summary>\r
-        public uint CodecId { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the language (if detected) of this Audio Track\r
-        /// </summary>\r
-        public string Language { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the language code for this audio track.\r
-        /// </summary>\r
-        public string LanguageCode { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the description for this audio track.\r
-        /// </summary>\r
-        public string Description { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the channel layout of this Audio Track.\r
-        /// </summary>\r
-        public ulong ChannelLayout { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the frequency (in Hz) of this Audio Track\r
-        /// </summary>\r
-        public int SampleRate { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the bitrate (in bits/sec) of this Audio Track.\r
-        /// </summary>\r
-        public int Bitrate { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets the display string for this audio track.\r
-        /// </summary>\r
-        public string Display\r
-        {\r
-            get\r
-            {\r
-                return this.GetDisplayString(true);\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets the display string for this audio track (not including track number)\r
-        /// </summary>\r
-        public string NoTrackDisplay\r
-        {\r
-            get\r
-            {\r
-                return this.GetDisplayString(false);\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Override of the ToString method to make this object easier to use in the UI\r
-        /// </summary>\r
-        /// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>\r
-        public override string ToString()\r
-        {\r
-            return this.GetDisplayString(true);\r
-        }\r
-\r
-        /// <summary>\r
-        /// The get display string.\r
-        /// </summary>\r
-        /// <param name="includeTrackNumber">\r
-        /// The include track number.\r
-        /// </param>\r
-        /// <returns>\r
-        /// The <see cref="string"/>.\r
-        /// </returns>\r
-        private string GetDisplayString(bool includeTrackNumber)\r
-        {\r
-            if (includeTrackNumber)\r
-            {\r
-                return this.TrackNumber + " " + this.Description;\r
-            }\r
-            \r
-            return this.Description;\r
-        }\r
-    }\r
-}
\ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Chapter.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Chapter.cs
deleted file mode 100644 (file)
index 7209060..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="Chapter.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   An object representing a Chapter aosciated with a Title, in a DVD\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Scan\r
-{\r
-    using System;\r
-    using System.Globalization;\r
-\r
-    /// <summary>\r
-    /// An object representing a Chapter aosciated with a Title, in a DVD\r
-    /// </summary>\r
-    public class Chapter\r
-    {\r
-        /// <summary>\r
-        /// Gets or sets the name.\r
-        /// </summary>\r
-        public string Name { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the number of this Chapter, in regards to its parent Title\r
-        /// </summary>\r
-        public int ChapterNumber { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the duration of this chapter.\r
-        /// </summary>\r
-        public TimeSpan Duration { get; set; }\r
-\r
-        /// <summary>\r
-        /// Override of the ToString method to make this object easier to use in the UI\r
-        /// </summary>\r
-        /// <returns>A string formatted as: {chapter #}</returns>\r
-        public override string ToString()\r
-        {\r
-            return this.ChapterNumber.ToString(CultureInfo.InvariantCulture);\r
-        }\r
-    }\r
-}
\ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/InputType.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/InputType.cs
deleted file mode 100644 (file)
index 4366d5a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="InputType.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   Defines the InputType type.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Scan\r
-{\r
-    using System.ComponentModel.DataAnnotations;\r
-\r
-    /// <summary>\r
-    /// The input type.\r
-    /// </summary>\r
-    public enum InputType\r
-    {\r
-        [Display(Name = "File")]\r
-        Stream,\r
-\r
-        [Display(Name = "DVD")]\r
-        Dvd,\r
-\r
-        [Display(Name = "Blu-ray")]\r
-        Bluray,\r
-\r
-        [Display(Name = "File")]\r
-        FFStream\r
-    }\r
-}\r
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Subtitle.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Subtitle.cs
deleted file mode 100644 (file)
index 6f8a5b0..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="Subtitle.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   An object that represents a subtitle associated with a Title, in a DVD\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Scan\r
-{\r
-    using HandBrake.ApplicationServices.Interop.HbLib;\r
-\r
-    /// <summary>\r
-    /// An object that represents a subtitle associated with a Title, in a DVD\r
-    /// </summary>\r
-    public class Subtitle\r
-    {\r
-        /// <summary>\r
-        /// Gets or sets the track number of this Subtitle\r
-        /// </summary>\r
-        public int TrackNumber { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the language (if detected) of this Subtitle\r
-        /// </summary>\r
-        public string Language { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the Langauage Code.\r
-        /// </summary>\r
-        public string LanguageCode { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the subtitle source.\r
-        /// </summary>\r
-        public SubtitleSource SubtitleSource { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the subtitle source raw integer.\r
-        /// </summary>\r
-        public int SubtitleSourceInt { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets a value indicating whether the "forced only" flag can be set on this subtitle.\r
-        /// </summary>\r
-        public bool CanSetForcedOnly\r
-        {\r
-            get\r
-            {\r
-                return HBFunctions.hb_subtitle_can_force(this.SubtitleSourceInt) > 0;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets a value indicating whether this subtitle can be burned into the picture.\r
-        /// </summary>\r
-        public bool CanBurn\r
-        {\r
-            get\r
-            {\r
-                return HBFunctions.hb_subtitle_can_burn(this.SubtitleSourceInt) > 0;\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns true if the subtitle can be passed through using the given muxer.\r
-        /// </summary>\r
-        /// <param name="muxer">The muxer ID.</param>\r
-        /// <returns>True if the subtitle can be passed through.</returns>\r
-        public bool CanPass(int muxer)\r
-        {\r
-            return HBFunctions.hb_subtitle_can_pass(this.SubtitleSourceInt, muxer) > 0;\r
-        }\r
-\r
-        /// <summary>\r
-        /// Override of the ToString method to make this object easier to use in the UI\r
-        /// </summary>\r
-        /// <returns>A string formatted as: {track #} {language}</returns>\r
-        public override string ToString()\r
-        {\r
-            return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.SubtitleSource);\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets the display.\r
-        /// </summary>\r
-        public string Display\r
-        {\r
-            get\r
-            {\r
-                return this.ToString();\r
-            }\r
-        }\r
-    }\r
-}
\ No newline at end of file
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/SubtitleSource.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/SubtitleSource.cs
deleted file mode 100644 (file)
index d51ff4e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="SubtitleSource.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   Defines the SubtitleSource type.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Scan\r
-{\r
-    /// <summary>\r
-    /// The subtitle source.\r
-    /// </summary>\r
-    public enum SubtitleSource\r
-    {\r
-        VobSub,\r
-        SRT,\r
-        CC608,\r
-        CC708,\r
-        UTF8,\r
-        TX3G,\r
-        SSA,\r
-        PGS\r
-    }\r
-}\r
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Title.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Title.cs
deleted file mode 100644 (file)
index 37013ac..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="Title.cs" company="HandBrake Project (http://handbrake.fr)">\r
-//   This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-//   An object that represents a single Title of a DVD\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Scan\r
-{\r
-    using System;\r
-    using System.Collections.Generic;\r
-\r
-    using HandBrake.ApplicationServices.Interop.Model;\r
-\r
-    /// <summary>\r
-    /// An object that represents a single Title of a DVD\r
-    /// </summary>\r
-    public class Title\r
-    {\r
-        /// <summary>\r
-        /// The audio tracks.\r
-        /// </summary>\r
-        private readonly List<AudioTrack> audioTracks;\r
-\r
-        /// <summary>\r
-        /// The chapters.\r
-        /// </summary>\r
-        private readonly List<Chapter> chapters;\r
-\r
-        /// <summary>\r
-        /// The subtitles.\r
-        /// </summary>\r
-        private readonly List<Subtitle> subtitles;\r
-        \r
-        /// <summary>\r
-        /// Initializes a new instance of the Title class.\r
-        /// </summary>\r
-        public Title()\r
-        {\r
-            this.audioTracks = new List<AudioTrack>();\r
-            this.chapters = new List<Chapter>();\r
-            this.subtitles = new List<Subtitle>();\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the input type of this title.\r
-        /// </summary>\r
-        public InputType InputType { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets a collection of chapters in this Title\r
-        /// </summary>\r
-        public List<Chapter> Chapters\r
-        {\r
-            get { return this.chapters; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets a collection of audio tracks associated with this Title\r
-        /// </summary>\r
-        public List<AudioTrack> AudioTracks\r
-        {\r
-            get { return this.audioTracks; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets a collection of subtitles associated with this Title\r
-        /// </summary>\r
-        public List<Subtitle> Subtitles\r
-        {\r
-            get { return this.subtitles; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the track number of this Title (1-based).\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 duration of this title.\r
-        /// </summary>\r
-        public TimeSpan Duration { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the resolution (width/height) of this Title\r
-        /// </summary>\r
-        public Size Resolution { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the number of angles on the title.\r
-        /// </summary>\r
-        public int AngleCount { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the pixel aspect ratio.\r
-        /// </summary>\r
-        public Size ParVal { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the automatically detected crop region for this Title.\r
-        /// </summary>\r
-        public Cropping AutoCropDimensions { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the name of the video codec for this title.\r
-        /// </summary>\r
-        public string VideoCodecName { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the video frame rate for this title.\r
-        /// </summary>\r
-        public double Framerate { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the video frame rate numerator.\r
-        /// </summary>\r
-        public int FramerateNumerator { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the video frame rate denominator.\r
-        /// </summary>\r
-        public int FramerateDenominator { get; set; }\r
-\r
-        /// <summary>\r
-        /// Gets the total number of frames in this title.\r
-        /// </summary>\r
-        public int Frames\r
-        {\r
-            get\r
-            {\r
-                return (int)Math.Ceiling(this.Duration.TotalSeconds * this.Framerate);\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets the path.\r
-        /// </summary>\r
-        public string Path { get; set; }\r
-\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 #}[ {playlist source}] (00:00:00)</returns>\r
-        public override string ToString()\r
-        {\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
-        /// Gets the display string for this title.\r
-        /// </summary>\r
-        public string Display\r
-        {\r
-            get\r
-            {\r
-                return this.ToString();\r
-            }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether is main feature.\r
-        /// </summary>\r
-        public bool IsMainFeature { get; set; }\r
-    }\r
-}
\ No newline at end of file
index 65ed3002b6b3b57d6da0375484b5896dbd1516d3..0c634018990151cea33d5ef6aa269ca145095e0d 100644 (file)
@@ -29,7 +29,7 @@ namespace HandBrake.ApplicationServices.Interop.Model
         /// <param name="parVal">\r
         /// The par val.\r
         /// </param>\r
-        public SourceVideoInfo(int framerateNumerator, int framerateDenominator, Size resolution, Size parVal)\r
+        public SourceVideoInfo(int? framerateNumerator, int? framerateDenominator, Size resolution, Size parVal)\r
         {\r
             this.FramerateNumerator = framerateNumerator;\r
             this.FramerateDenominator = framerateDenominator;\r
@@ -40,12 +40,12 @@ namespace HandBrake.ApplicationServices.Interop.Model
         /// <summary>\r
         /// Gets the framerate numerator.\r
         /// </summary>\r
-        public int FramerateNumerator { get; private set; }\r
+        public int? FramerateNumerator { get; private set; }\r
 \r
         /// <summary>\r
         /// Gets the framerate denominator.\r
         /// </summary>\r
-        public int FramerateDenominator { get; private set; }\r
+        public int? FramerateDenominator { get; private set; }\r
 \r
         /// <summary>\r
         /// Gets or sets the resolution (width/height) of this Title\r
index 64011826a77619e73691b06a67e4fccb9cd05f47..81f619b7194d5aab509dc5775daf4ac41c0cad82 100644 (file)
@@ -471,8 +471,8 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories
             else\r
             {\r
                 // cfr or pfr flag with no rate specified implies use the title rate.\r
-                num = title.FramerateNumerator;\r
-                den = title.FramerateDenominator;\r
+                num = title.FramerateNumerator ?? 0;\r
+                den = title.FramerateDenominator ?? 0;\r
             }\r
 \r
             string framerateString = string.Format("{0}:{1}:{2}", fm, num, den); // filter_cfr, filter_vrate.num, filter_vrate.den\r
index 4fc5e3a523430d924fc058ac6d2e3f028cd11133..0f2113ca15a8fa95dbaa797a769759ae03a2871f 100644 (file)
@@ -132,7 +132,7 @@ namespace HandBrake.ApplicationServices.Services.Encode
                 this.instance.ScanCompleted += delegate\r
                 {\r
                     // Process into internal structures.\r
-                    this.scannedSource = new Source { Titles = LibScan.ConvertTitles(this.instance.Titles, this.instance.FeatureTitle) }; // TODO work around the bad Internal API.\r
+                    this.scannedSource = new Source { Titles = LibScan.ConvertTitles(this.instance.Titles) }; // TODO work around the bad Internal API.\r
                     this.ScanCompleted(job, this.instance);\r
                 };\r
 \r
@@ -218,19 +218,11 @@ namespace HandBrake.ApplicationServices.Services.Encode
                     throw new Exception("Unable to get title for encoding. Encode Failed.");\r
                 }\r
 \r
-                Interop.Model.Scan.Title scannedTitle = new Interop.Model.Scan.Title\r
-                                                            {\r
-                                                                Resolution = new Size(title.Resolution.Width, title.Resolution.Height), \r
-                                                                ParVal = new Size(title.ParVal.Width, title.ParVal.Height), \r
-                                                                FramerateDenominator = title.FramerateDenominator, \r
-                                                                FramerateNumerator = title.FramerateNumerator, \r
-                                                            };\r
-\r
                 ServiceLogMessage("Starting Encode ...");\r
 \r
                 // Get an EncodeJob object for the Interop Library\r
                 SourceVideoInfo videoInfo = new SourceVideoInfo(title.FramerateNumerator, title.FramerateDenominator, title.Resolution, title.ParVal);\r
-                instance.StartEncode(EncodeFactory.Create(job.Task, videoInfo, job.Configuration), scannedTitle);\r
+                instance.StartEncode(EncodeFactory.Create(job.Task, videoInfo, job.Configuration));\r
 \r
                 // Fire the Encode Started Event\r
                 this.InvokeEncodeStarted(System.EventArgs.Empty);\r
index 903497200885a8979b66e40f485496395a3c7b77..09e2df18a870f818e9c508f14d1ebfe16566edd3 100644 (file)
@@ -24,10 +24,11 @@ namespace HandBrake.ApplicationServices.Services.Scan
     using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.ApplicationServices.Interop;\r
     using HandBrake.ApplicationServices.Interop.EventArgs;\r
+    using HandBrake.ApplicationServices.Interop.HbLib;\r
     using HandBrake.ApplicationServices.Interop.Interfaces;\r
+    using HandBrake.ApplicationServices.Interop.Json.Scan;\r
     using HandBrake.ApplicationServices.Interop.Model;\r
     using HandBrake.ApplicationServices.Interop.Model.Preview;\r
-    using HandBrake.ApplicationServices.Interop.Model.Scan;\r
 \r
     using Chapter = HandBrake.ApplicationServices.Services.Scan.Model.Chapter;\r
     using ScanProgressEventArgs = HandBrake.ApplicationServices.Interop.EventArgs.ScanProgressEventArgs;\r
@@ -371,7 +372,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
             // Process into internal structures.\r
             if (this.instance != null && this.instance.Titles != null)\r
             {\r
-                this.SouceData = new Source { Titles = ConvertTitles(this.instance.Titles, this.instance.FeatureTitle), ScanPath = path };\r
+                this.SouceData = new Source { Titles = ConvertTitles(this.instance.Titles), ScanPath = path };\r
             }\r
 \r
             this.IsScanning = false;\r
@@ -451,71 +452,87 @@ namespace HandBrake.ApplicationServices.Services.Scan
         /// <returns>\r
         /// The convert titles.\r
         /// </returns>\r
-        internal static List<Title> ConvertTitles(IEnumerable<Interop.Model.Scan.Title> titles, int featureTitle)\r
+        internal static List<Title> ConvertTitles(JsonScanObject titles)\r
         {\r
             List<Title> titleList = new List<Title>();\r
-            foreach (Interop.Model.Scan.Title title in titles)\r
+            foreach (TitleList title in titles.TitleList)\r
             {\r
                 Title converted = new Title\r
                     {\r
-                        TitleNumber = title.TitleNumber,\r
-                        Duration = title.Duration,\r
-                        Resolution = new Size(title.Resolution.Width, title.Resolution.Height),\r
+                        TitleNumber = title.Index,\r
+                        Duration = new TimeSpan(0, title.Duration.Hours, title.Duration.Minutes, title.Duration.Seconds),\r
+                        Resolution = new Size(title.Geometry.Width, title.Geometry.Height),\r
                         AngleCount = title.AngleCount,\r
-                        ParVal = new Size(title.ParVal.Width, title.ParVal.Height),\r
-                        AutoCropDimensions = title.AutoCropDimensions,\r
-                        Fps = title.Framerate,\r
+                        ParVal = new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den),\r
+                        AutoCropDimensions = new Cropping\r
+                        {\r
+                            Top = title.Crop[0],\r
+                            Bottom = title.Crop[1],\r
+                            Left = title.Crop[2],\r
+                            Right = title.Crop[3]\r
+                        },\r
+                        Fps = ((double)title.FrameRate.Num) / title.FrameRate.Den,\r
                         SourceName = title.Path,\r
-                        MainTitle = title.TitleNumber == featureTitle,\r
-                        Playlist = title.InputType == InputType.Bluray ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,\r
-                        FramerateNumerator = title.FramerateNumerator,\r
-                        FramerateDenominator = title.FramerateDenominator\r
+                        MainTitle = titles.MainFeature == title.Index,\r
+                        Playlist = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,\r
+                        FramerateNumerator = title.FrameRate.Num,\r
+                        FramerateDenominator = title.FrameRate.Den\r
                     };\r
 \r
-                foreach (Interop.Model.Scan.Chapter chapter in title.Chapters)\r
+                int currentTrack = 1;\r
+                foreach (ChapterList chapter in title.ChapterList)\r
                 {\r
                     string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty;\r
-                    converted.Chapters.Add(new Chapter(chapter.ChapterNumber, chapterName, chapter.Duration));\r
+                    converted.Chapters.Add(new Chapter(currentTrack, chapterName, new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds)));\r
+                    currentTrack++;\r
                 }\r
 \r
-                foreach (AudioTrack track in title.AudioTracks)\r
+                int currentAudioTrack = 1;\r
+                foreach (AudioList track in title.AudioList)\r
                 {\r
-                    converted.AudioTracks.Add(new Audio(track.TrackNumber, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.Bitrate));\r
+                    converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate));\r
+                    currentAudioTrack++;\r
                 }\r
 \r
-                foreach (Interop.Model.Scan.Subtitle track in title.Subtitles)\r
+                int currentSubtitleTrack = 1;\r
+                foreach (SubtitleList track in title.SubtitleList)\r
                 {\r
                     SubtitleType convertedType = new SubtitleType();\r
 \r
-                    switch (track.SubtitleSource)\r
+                    switch (track.Source)\r
                     {\r
-                        case SubtitleSource.VobSub:\r
+                        case 0:\r
                             convertedType = SubtitleType.VobSub;\r
                             break;\r
-                        case SubtitleSource.UTF8:\r
+                        case 4:\r
                             convertedType = SubtitleType.UTF8Sub;\r
                             break;\r
-                        case SubtitleSource.TX3G:\r
+                        case 5:\r
                             convertedType = SubtitleType.TX3G;\r
                             break;\r
-                        case SubtitleSource.SSA:\r
+                        case 6:\r
                             convertedType = SubtitleType.SSA;\r
                             break;\r
-                        case SubtitleSource.SRT:\r
+                        case 1:\r
                             convertedType = SubtitleType.SRT;\r
                             break;\r
-                        case SubtitleSource.CC608:\r
+                        case 2:\r
                             convertedType = SubtitleType.CC;\r
                             break;\r
-                        case SubtitleSource.CC708:\r
+                        case 3:\r
                             convertedType = SubtitleType.CC;\r
                             break;\r
-                        case SubtitleSource.PGS:\r
+                        case 7:\r
                             convertedType = SubtitleType.PGS;\r
                             break;\r
                     }\r
 \r
-                    converted.Subtitles.Add(new Subtitle(track.SubtitleSourceInt, track.TrackNumber, track.Language, track.LanguageCode, convertedType, track.CanBurn, track.CanSetForcedOnly));\r
+\r
+                    bool canBurn = HBFunctions.hb_subtitle_can_burn(track.Source) > 0;\r
+                    bool canSetForcedOnly = HBFunctions.hb_subtitle_can_force(track.Source) > 0;\r
+\r
+                    converted.Subtitles.Add(new Subtitle(track.Source, currentSubtitleTrack, track.Language, track.LanguageCode, convertedType, canBurn, canSetForcedOnly));\r
+                    currentSubtitleTrack++;\r
                 }\r
 \r
                 titleList.Add(converted);\r