]> granicus.if.org Git - handbrake/commitdiff
WinGui: Bug fixes to the libhb json encode factory and surrounding classes. Encoding...
authorsr55 <sr55.hb@outlook.com>
Fri, 2 Jan 2015 21:18:44 +0000 (21:18 +0000)
committersr55 <sr55.hb@outlook.com>
Fri, 2 Jan 2015 21:18:44 +0000 (21:18 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6681 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeService.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs
win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Interfaces/IHandBrakeInstance.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/AnamorphicFactory.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs

index 6a09e598543383fd0c72e82e5d5a5c7ee580a9fa..6a1a2d0fd86b20b3ba8065e37c3ea2ed29ac205b 100644 (file)
@@ -304,7 +304,10 @@ namespace HandBrake.ApplicationServices.Services.Encode
         /// <param name="encodeQueueTask">\r
         /// The encode QueueTask.\r
         /// </param>\r
-        protected void SetupLogging(QueueTask encodeQueueTask)\r
+        /// <param name="isLibhb">\r
+        /// Indicates if this is libhb that is encoding or not.\r
+        /// </param>\r
+        protected void SetupLogging(QueueTask encodeQueueTask, bool isLibhb)\r
         {\r
             this.ShutdownFileWriter();\r
             string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";\r
@@ -315,7 +318,12 @@ namespace HandBrake.ApplicationServices.Services.Encode
             {\r
                 string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task), encodeQueueTask.Configuration);\r
                 this.logBuffer = new StringBuilder();\r
-                this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));\r
+\r
+                if (!isLibhb)\r
+                {\r
+                    this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));\r
+                }\r
+\r
                 this.logBuffer.AppendLine();\r
 \r
                 // Clear the current Encode Logs)\r
index dad5b9597cbd411c993114029d33f3bf48278fa9..2c59d1410e9c0574f9b4b03a2665808f452843d2 100644 (file)
@@ -99,7 +99,7 @@ namespace HandBrake.ApplicationServices.Services.Encode
                 {\r
                     try\r
                     {\r
-                        this.SetupLogging(this.currentTask);\r
+                        this.SetupLogging(this.currentTask, false);\r
                     }\r
                     catch (Exception)\r
                     {\r
index 8a046e0af626284e22806012938783baff016386..6ae5d1f600e44981e319fab444def249f2b9674a 100644 (file)
@@ -11,18 +11,18 @@ namespace HandBrake.ApplicationServices.Services.Encode
 {\r
     using System;\r
     using System.Diagnostics;\r
+    using System.Linq;\r
 \r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Encode.Interfaces;\r
+    using HandBrake.ApplicationServices.Services.Scan;\r
+    using HandBrake.ApplicationServices.Services.Scan.Model;\r
     using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.Interop;\r
     using HandBrake.Interop.EventArgs;\r
     using HandBrake.Interop.Interfaces;\r
     using HandBrake.Interop.Model;\r
 \r
-    using EncodeCompletedEventArgs = HandBrake.ApplicationServices.Services.Encode.EventArgs.EncodeCompletedEventArgs;\r
-    using EncodeProgressEventArgs = HandBrake.ApplicationServices.Services.Encode.EventArgs.EncodeProgressEventArgs;\r
-\r
     /// <summary>\r
     /// LibHB Implementation of IEncode\r
     /// </summary>\r
@@ -55,6 +55,8 @@ namespace HandBrake.ApplicationServices.Services.Encode
         /// </summary>\r
         private QueueTask currentTask;\r
 \r
+        private Source scannedSource;\r
+\r
         #endregion\r
 \r
         /// <summary>\r
@@ -117,7 +119,7 @@ namespace HandBrake.ApplicationServices.Services.Encode
                 {\r
                     try\r
                     {\r
-                        this.SetupLogging(job);\r
+                        this.SetupLogging(job, true);\r
                     }\r
                     catch (Exception)\r
                     {\r
@@ -135,12 +137,14 @@ namespace HandBrake.ApplicationServices.Services.Encode
 \r
                 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.ScanCompleted(job, this.instance);\r
                     };\r
             }\r
             catch (Exception exc)\r
             {\r
-                this.InvokeEncodeCompleted(new EncodeCompletedEventArgs(false, exc, "An Error has occured.", this.currentTask.Task.Destination));\r
+                this.InvokeEncodeCompleted(new EventArgs.EncodeCompletedEventArgs(false, exc, "An Error has occured.", this.currentTask.Task.Destination));\r
             }\r
         }\r
 \r
@@ -207,7 +211,16 @@ namespace HandBrake.ApplicationServices.Services.Encode
             EncodeJob encodeJob = InteropModelCreator.GetEncodeJob(job);\r
 \r
             // Start the Encode\r
-            instance.StartEncode(encodeJob, job.Configuration.PreviewScanCount);\r
+            Title title = this.scannedSource.Titles.FirstOrDefault(t => t.TitleNumber == job.Task.Title);\r
+            if (title == null)\r
+            {\r
+                throw new Exception("Unable to get title for encoding. Encode Failed.");\r
+            }\r
+\r
+            Interop.Model.Scan.Title scannedTitle = new Interop.Model.Scan.Title { Resolution = new Size(title.Resolution.Width, title.Resolution.Height), ParVal = new Size(title.ParVal.Width, title.ParVal.Height) };\r
+            \r
+            // TODO fix this tempory hack to pass in the required title information into the factory.\r
+            instance.StartEncode(encodeJob, scannedTitle, job.Configuration.PreviewScanCount);\r
 \r
             // Fire the Encode Started Event\r
             this.InvokeEncodeStarted(System.EventArgs.Empty);\r
@@ -237,6 +250,7 @@ namespace HandBrake.ApplicationServices.Services.Encode
         }\r
 \r
         #region HandBrakeInstance Event Handlers.\r
+\r
         /// <summary>\r
         /// Log a message\r
         /// </summary>\r
@@ -286,16 +300,16 @@ namespace HandBrake.ApplicationServices.Services.Encode
         /// <param name="e">\r
         /// The Interop.EncodeProgressEventArgs.\r
         /// </param>\r
-        private void InstanceEncodeProgress(object sender, Interop.EventArgs.EncodeProgressEventArgs e)\r
+        private void InstanceEncodeProgress(object sender, EncodeProgressEventArgs e)\r
         {\r
-           EncodeProgressEventArgs args = new EncodeProgressEventArgs\r
+           EventArgs.EncodeProgressEventArgs args = new EventArgs.EncodeProgressEventArgs\r
             {\r
-                AverageFrameRate = e.AverageFrameRate,\r
-                CurrentFrameRate = e.CurrentFrameRate,\r
-                EstimatedTimeLeft = e.EstimatedTimeLeft,\r
-                PercentComplete = e.FractionComplete * 100,\r
-                Task = e.Pass,\r
-                ElapsedTime = DateTime.Now - this.startTime,\r
+                AverageFrameRate = e.AverageFrameRate, \r
+                CurrentFrameRate = e.CurrentFrameRate, \r
+                EstimatedTimeLeft = e.EstimatedTimeLeft, \r
+                PercentComplete = e.FractionComplete * 100, \r
+                Task = e.Pass, \r
+                ElapsedTime = DateTime.Now - this.startTime, \r
             };\r
 \r
             this.InvokeEncodeStatusChanged(args);\r
@@ -310,14 +324,14 @@ namespace HandBrake.ApplicationServices.Services.Encode
         /// <param name="e">\r
         /// The e.\r
         /// </param>\r
-        private void InstanceEncodeCompleted(object sender, Interop.EventArgs.EncodeCompletedEventArgs e)\r
+        private void InstanceEncodeCompleted(object sender, EncodeCompletedEventArgs e)\r
         {\r
             this.IsEncoding = false;\r
 \r
             this.InvokeEncodeCompleted(\r
                 e.Error\r
-                    ? new EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Task.Destination)\r
-                    : new EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Task.Destination));\r
+                    ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Task.Destination)\r
+                    : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Task.Destination));\r
 \r
             this.ShutdownFileWriter();\r
         }\r
index 3666ce869d087468d23697595ed72c193e72e908..d857e75f5d65dd814d1ddf6836a490b3967bd3b9 100644 (file)
@@ -469,7 +469,7 @@ namespace HandBrake.ApplicationServices.Services.Scan
         /// <returns>\r
         /// The convert titles.\r
         /// </returns>\r
-        private static List<Title> ConvertTitles(IEnumerable<Interop.Model.Scan.Title> titles, int featureTitle)\r
+        internal static List<Title> ConvertTitles(IEnumerable<Interop.Model.Scan.Title> titles, int featureTitle)\r
         {\r
             List<Title> titleList = new List<Title>();\r
             foreach (Interop.Model.Scan.Title title in titles)\r
index a8bf3db755c15de5788b4f0762c92ef8a12f5cc1..0ed007e53d1ddde027b823d851e4fabdcdac75c3 100644 (file)
@@ -445,28 +445,46 @@ namespace HandBrake.Interop
         /// <param name="jobToStart">\r
         /// The job to start.\r
         /// </param>\r
+        /// <param name="title">\r
+        /// The title.\r
+        /// </param>\r
         /// <param name="scanPreviewCount">\r
         /// The scan Preview Count.\r
         /// </param>\r
-        public void StartEncode(EncodeJob jobToStart, int scanPreviewCount)\r
+        public void StartEncode(EncodeJob jobToStart, Title title, int scanPreviewCount)\r
         {\r
-            this.StartEncode(jobToStart, false, 0, 0, 0, scanPreviewCount);\r
+            this.StartEncode(jobToStart, title, false, 0, 0, 0, scanPreviewCount);\r
         }\r
 \r
         /// <summary>\r
         /// Starts an encode with the given job.\r
         /// </summary>\r
-        /// <param name="job">The job to start.</param>\r
-        /// <param name="preview">The scan Preview Count.</param>\r
-        /// <param name="previewNumber">Preview Feature: Preview to encode</param>\r
-        /// <param name="previewSeconds">Number of seconds to encode for the preview</param>\r
-        /// <param name="overallSelectedLengthSeconds"></param>\r
-        /// <param name="scanPreviewCount">Number of previews</param>\r
-        public void StartEncode(EncodeJob job, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds, int scanPreviewCount)\r
+        /// <param name="job">\r
+        /// The job to start.\r
+        /// </param>\r
+        /// <param name="title">\r
+        /// The title.\r
+        /// </param>\r
+        /// <param name="preview">\r
+        /// The scan Preview Count.\r
+        /// </param>\r
+        /// <param name="previewNumber">\r
+        /// Preview Feature: Preview to encode\r
+        /// </param>\r
+        /// <param name="previewSeconds">\r
+        /// Number of seconds to encode for the preview\r
+        /// </param>\r
+        /// <param name="overallSelectedLengthSeconds">\r
+        /// The overall Selected Length Seconds.\r
+        /// </param>\r
+        /// <param name="scanPreviewCount">\r
+        /// Number of previews\r
+        /// </param>\r
+        public void StartEncode(EncodeJob job, Title title, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds, int scanPreviewCount)\r
         {\r
             this.previewCount = scanPreviewCount;\r
 \r
-            JsonEncodeObject encodeObject = EncodeFactory.Create(job, lastScan);\r
+            JsonEncodeObject encodeObject = EncodeFactory.Create(job, title);\r
 \r
             JsonSerializerSettings settings = new JsonSerializerSettings\r
             {\r
index 64c03cbef964934d9751acdd3ed95e3c6ea3269e..e6eeae943ed0c1541b62e4d92799c2ad4ff3f93b 100644 (file)
@@ -143,10 +143,13 @@ namespace HandBrake.Interop.Interfaces
         /// <param name="jobToStart">\r
         /// The job to start.\r
         /// </param>\r
+        /// <param name="title">\r
+        /// The title.\r
+        /// </param>\r
         /// <param name="scanPreviewCount">\r
         /// The scan Preview Count.\r
         /// </param>\r
-        void StartEncode(EncodeJob jobToStart, int scanPreviewCount);\r
+        void StartEncode(EncodeJob jobToStart, Title title, int scanPreviewCount);\r
 \r
         /// <summary>\r
         /// Starts an encode with the given job.\r
@@ -154,6 +157,9 @@ namespace HandBrake.Interop.Interfaces
         /// <param name="job">\r
         /// The job to start.\r
         /// </param>\r
+        /// <param name="title">\r
+        /// The title.\r
+        /// </param>\r
         /// <param name="preview">\r
         /// True if this is a preview encode.\r
         /// </param>\r
@@ -170,8 +176,7 @@ namespace HandBrake.Interop.Interfaces
         /// <param name="scanPreviewCount">\r
         /// The scan Preview Count.\r
         /// </param>\r
-        void StartEncode(\r
-            EncodeJob job, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds, int scanPreviewCount);\r
+        void StartEncode(EncodeJob job, Title title, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds, int scanPreviewCount);\r
 \r
         /// <summary>\r
         /// Starts scanning the given path.\r
index cb882c126a589ee30db88e5c08dbace818faf0cc..598fedac16b0c1c3cf42cbddc9d41945e6f17d9f 100644 (file)
@@ -21,6 +21,9 @@ namespace HandBrake.Interop.Json.Factories
 \r
     using Newtonsoft.Json;\r
 \r
+    /// <summary>\r
+    /// The anamorphic factory.\r
+    /// </summary>\r
     public class AnamorphicFactory\r
     {\r
         /// <summary>\r
index fd2274e3f36ac09c406684aaff485cb7e3eca4a7..0c074262da56c282a2d31b19d4f518d009ddbcb3 100644 (file)
@@ -18,17 +18,11 @@ namespace HandBrake.Interop.Json.Factories
     using HandBrake.Interop.Helpers;\r
     using HandBrake.Interop.Json.Anamorphic;\r
     using HandBrake.Interop.Json.Encode;\r
-    using HandBrake.Interop.Json.Scan;\r
     using HandBrake.Interop.Model;\r
     using HandBrake.Interop.Model.Encoding;\r
+    using HandBrake.Interop.Model.Scan;\r
 \r
-    using Newtonsoft.Json;\r
-\r
-    using AudioList = HandBrake.Interop.Json.Encode.AudioList;\r
-    using ChapterList = HandBrake.Interop.Json.Encode.ChapterList;\r
-    using MetaData = HandBrake.Interop.Json.Encode.MetaData;\r
-    using PAR = HandBrake.Interop.Json.Anamorphic.PAR;\r
-    using SubtitleList = HandBrake.Interop.Json.Encode.SubtitleList;\r
+    using Subtitle = HandBrake.Interop.Json.Encode.Subtitle;\r
 \r
     /// <summary>\r
     /// This factory takes the internal EncodeJob object and turns it into a set of JSON models\r
@@ -36,34 +30,30 @@ namespace HandBrake.Interop.Json.Factories
     /// </summary>\r
     internal class EncodeFactory\r
     {\r
-\r
-        /*\r
-         * <j45> maxWidth and maxHeight are frontend issues.  You pass those into hb_set_anamorphic_size when calculating geometry settings.  width and height are given to the CROP_SCALE filter.  No need for the frontend to set it in the job.  The job will get the final dimensions from the filter settings anyway.\r
-         * <j45> for example, both crop_scale and rotate filters modify job width and height settings\r
-         *\r
-         */\r
-\r
         /// <summary>\r
         /// The create.\r
         /// </summary>\r
         /// <param name="job">\r
         /// The encode job.\r
         /// </param>\r
+        /// <param name="title">\r
+        /// The title.\r
+        /// </param>\r
         /// <returns>\r
         /// The <see cref="JsonEncodeObject"/>.\r
         /// </returns>\r
-        internal static JsonEncodeObject Create(EncodeJob job, JsonScanObject scannedSource)\r
+        internal static JsonEncodeObject Create(EncodeJob job, Title title)\r
         {\r
             JsonEncodeObject encode = new JsonEncodeObject\r
                 {\r
-                    SequenceID = 0,\r
-                    Audio = CreateAudio(job),\r
-                    Destination = CreateDestination(job),\r
-                    Filter = CreateFilter(job),\r
-                    PAR = CreatePAR(job),\r
-                    MetaData = CreateMetaData(job),\r
-                    Source = CreateSource(job),\r
-                    Subtitle = CreateSubtitle(job),\r
+                    SequenceID = 0, \r
+                    Audio = CreateAudio(job), \r
+                    Destination = CreateDestination(job), \r
+                    Filter = CreateFilter(job, title), \r
+                    PAR = CreatePAR(job), \r
+                    MetaData = CreateMetaData(job), \r
+                    Source = CreateSource(job), \r
+                    Subtitle = CreateSubtitle(job), \r
                     Video = CreateVideo(job)\r
                 };\r
 \r
@@ -83,17 +73,17 @@ namespace HandBrake.Interop.Json.Factories
         {\r
             Source source = new Source\r
             {\r
-                Title = job.Title,\r
+                Title = job.Title, \r
                 Range =\r
                     new Range\r
                         {\r
-                            ChapterEnd = job.ChapterEnd,\r
-                            ChapterStart = job.ChapterStart,\r
-                            FrameToStart = job.FramesStart,\r
-                            FrameToStop = job.FramesEnd,\r
-                            PtsToStart = (int)(job.SecondsStart * 90000),\r
-                            PtsToStop = (int)((job.SecondsEnd - job.SecondsStart) * 90000),\r
-                        },\r
+                            ChapterEnd = job.ChapterEnd, \r
+                            ChapterStart = job.ChapterStart, \r
+                            FrameToStart = job.FramesStart, \r
+                            FrameToStop = job.FramesEnd, \r
+                            PtsToStart = (int)(job.SecondsStart * 90000), \r
+                            PtsToStop = (int)((job.SecondsEnd - job.SecondsStart) * 90000), \r
+                        }, \r
                 Angle = job.Angle\r
             };\r
             return source;\r
@@ -112,23 +102,24 @@ namespace HandBrake.Interop.Json.Factories
         {\r
             Destination destination = new Destination\r
             {\r
-                File = job.OutputPath,\r
-                Mp4Options =\r
-                    new Mp4Options\r
-                        {\r
-                            IpodAtom = job.EncodingProfile.IPod5GSupport,\r
-                           // LargeFileSize = job.EncodingProfile.LargeFile,\r
-                            Mp4Optimize = job.EncodingProfile.Optimize\r
-                        },\r
-                ChapterMarkers = job.EncodingProfile.IncludeChapterMarkers,\r
-                Mux = HBFunctions.hb_container_get_from_name(job.EncodingProfile.ContainerName),\r
+                File = job.OutputPath, \r
+                Mp4Options = new Mp4Options\r
+                                 {\r
+                                     IpodAtom = job.EncodingProfile.IPod5GSupport, \r
+                                     Mp4Optimize = job.EncodingProfile.Optimize\r
+                                 }, \r
+                ChapterMarkers = job.EncodingProfile.IncludeChapterMarkers, \r
+                Mux = HBFunctions.hb_container_get_from_name(job.EncodingProfile.ContainerName), \r
                 ChapterList = new List<ChapterList>()\r
             };\r
 \r
-            foreach (string item in job.CustomChapterNames)\r
+            if (!job.UseDefaultChapterNames)\r
             {\r
-                ChapterList chapter = new ChapterList { Name = item };\r
-                destination.ChapterList.Add(chapter);\r
+                foreach (string item in job.CustomChapterNames)\r
+                {\r
+                    ChapterList chapter = new ChapterList { Name = item };\r
+                    destination.ChapterList.Add(chapter);\r
+                }\r
             }\r
 \r
             return destination;\r
@@ -137,11 +128,15 @@ namespace HandBrake.Interop.Json.Factories
         /// <summary>\r
         /// Create the PAR object\r
         /// </summary>\r
-        /// <param name="job">The Job</param>\r
-        /// <returns>The produced PAR object.</returns>\r
+        /// <param name="job">\r
+        /// The Job\r
+        /// </param>\r
+        /// <returns>\r
+        /// The produced PAR object.\r
+        /// </returns>\r
         private static PAR CreatePAR(EncodeJob job)\r
         {\r
-            return new PAR {Num = job.EncodingProfile.PixelAspectX, Den = job.EncodingProfile.PixelAspectY} ;\r
+            return new PAR { Num = job.EncodingProfile.PixelAspectX, Den = job.EncodingProfile.PixelAspectY };\r
         }\r
 \r
         /// <summary>\r
@@ -151,7 +146,7 @@ namespace HandBrake.Interop.Json.Factories
         /// The job.\r
         /// </param>\r
         /// <returns>\r
-        /// The <see cref="Subtitle"/>.\r
+        /// The <see cref="Encode.Subtitle"/>.\r
         /// </returns>\r
         private static Subtitle CreateSubtitle(EncodeJob job)\r
         {\r
@@ -160,11 +155,11 @@ namespace HandBrake.Interop.Json.Factories
                     Search =\r
                         new Search\r
                             {\r
-                                Enable = false,\r
-                                Default = false,\r
-                                Burn = false,\r
+                                Enable = false, \r
+                                Default = false, \r
+                                Burn = false, \r
                                 Forced = false\r
-                            },\r
+                            }, \r
                     SubtitleList = new List<SubtitleList>()\r
                 };\r
 \r
@@ -172,10 +167,10 @@ namespace HandBrake.Interop.Json.Factories
             {\r
                 SubtitleList track = new SubtitleList\r
                     {\r
-                        Burn = item.BurnedIn,\r
-                        Default = item.Default,\r
-                        Force = item.Forced,\r
-                        ID = item.TrackNumber,\r
+                        Burn = item.BurnedIn, \r
+                        Default = item.Default, \r
+                        Force = item.Forced, \r
+                        ID = item.TrackNumber, \r
                         Track = item.TrackNumber\r
                     };\r
 \r
@@ -186,13 +181,13 @@ namespace HandBrake.Interop.Json.Factories
             {\r
                 SubtitleList track = new SubtitleList\r
                     {\r
-                        Default = item.Default,\r
-                        Offset = item.Offset,\r
+                        Default = item.Default, \r
+                        Offset = item.Offset, \r
                         SRT =\r
                             new SRT\r
                                 {\r
-                                    Filename = item.FileName,\r
-                                    Codeset = item.CharacterCode,\r
+                                    Filename = item.FileName, \r
+                                    Codeset = item.CharacterCode, \r
                                     Language = item.LanguageCode\r
                                 }\r
                     };\r
@@ -270,15 +265,15 @@ namespace HandBrake.Interop.Json.Factories
 \r
                 AudioList audioTrack = new AudioList\r
                     {\r
-                        Track = numTracks++,\r
-                        Bitrate = item.Bitrate,\r
-                        CompressionLevel = item.Compression,\r
-                        DRC = item.Drc,\r
-                        Encoder = encoder.Id,\r
-                        Gain = item.Gain,\r
-                        Mixdown = mixdown.Id,\r
-                        NormalizeMixLevel = false,\r
-                        Quality = item.Quality,\r
+                        Track = numTracks++, \r
+                        Bitrate = item.Bitrate, \r
+                        CompressionLevel = item.Compression, \r
+                        DRC = item.Drc, \r
+                        Encoder = encoder.Id, \r
+                        Gain = item.Gain, \r
+                        Mixdown = mixdown.Id, \r
+                        NormalizeMixLevel = false, \r
+                        Quality = item.Quality, \r
                         Samplerate = item.SampleRateRaw\r
                     };\r
 \r
@@ -289,19 +284,22 @@ namespace HandBrake.Interop.Json.Factories
         }\r
 \r
         /// <summary>\r
-        /// The create filter. TODO\r
+        /// The create filter.\r
         /// </summary>\r
         /// <param name="job">\r
         /// The job.\r
         /// </param>\r
+        /// <param name="title">\r
+        /// The title.\r
+        /// </param>\r
         /// <returns>\r
         /// The <see cref="Filter"/>.\r
         /// </returns>\r
-        private static Filter CreateFilter(EncodeJob job)\r
+        private static Filter CreateFilter(EncodeJob job, Title title)\r
         {\r
             Filter filter = new Filter\r
                             {\r
-                                FilterList = new List<FilterList>(),\r
+                                FilterList = new List<FilterList>(), \r
                                 Grayscale = job.EncodingProfile.Grayscale\r
                             };\r
 \r
@@ -315,7 +313,7 @@ namespace HandBrake.Interop.Json.Factories
             // Decomb\r
             if (job.EncodingProfile.Decomb != Decomb.Off)\r
             {\r
-                string options = "";\r
+                string options;\r
                 if (job.EncodingProfile.Decomb == Decomb.Fast)\r
                 {\r
                     options = "7:2:6:9:1:80";\r
@@ -336,7 +334,7 @@ namespace HandBrake.Interop.Json.Factories
             // Deinterlace\r
             if (job.EncodingProfile.Deinterlace != Deinterlace.Off)\r
             {\r
-                string options = string.Empty;\r
+                string options;\r
                 if (job.EncodingProfile.Deinterlace == Deinterlace.Fast)\r
                 {\r
                     options = "0";\r
@@ -362,12 +360,12 @@ namespace HandBrake.Interop.Json.Factories
                 filter.FilterList.Add(filterItem);\r
             }\r
 \r
-            // VFR / CFR  TODO\r
+            // VFR / CFR  TODO Setup the framerate shaper.\r
             FilterList framerateShaper = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_VFR, Settings = string.Empty };\r
             filter.FilterList.Add(framerateShaper);\r
 \r
             // Deblock\r
-            if (job.EncodingProfile.Deblock < 5)\r
+            if (job.EncodingProfile.Deblock >= 5)\r
             {\r
                 FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEBLOCK, Settings = job.EncodingProfile.Deblock.ToString() };\r
                 filter.FilterList.Add(filterItem);\r
@@ -397,17 +395,19 @@ namespace HandBrake.Interop.Json.Factories
             }\r
 \r
             // CropScale Filter\r
+            // TODO handle anamorphic.\r
+            Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, title, AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH);\r
             FilterList cropScale = new FilterList\r
             {\r
-                ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE,\r
+                ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE, \r
                 Settings =\r
                     string.Format(\r
-                        "{0}:{1}:{2}:{3}:{4}:{5}",\r
-                        job.EncodingProfile.Width,\r
-                        job.EncodingProfile.Height,\r
-                        job.EncodingProfile.Cropping.Top,\r
-                        job.EncodingProfile.Cropping.Bottom,\r
-                        job.EncodingProfile.Cropping.Left,\r
+                        "{0}:{1}:{2}:{3}:{4}:{5}", \r
+                        resultGeometry.Width, \r
+                        resultGeometry.Height, \r
+                        job.EncodingProfile.Cropping.Top, \r
+                        job.EncodingProfile.Cropping.Bottom, \r
+                        job.EncodingProfile.Cropping.Left, \r
                         job.EncodingProfile.Cropping.Right)\r
             };\r
             filter.FilterList.Add(cropScale);\r
@@ -430,6 +430,8 @@ namespace HandBrake.Interop.Json.Factories
         private static MetaData CreateMetaData(EncodeJob job)\r
         {\r
             MetaData metaData = new MetaData();\r
+\r
+            /* TODO  NOT SUPPORTED YET. */\r
             return metaData;\r
         }\r
     }\r
index bcabcf282d864ef06262a4b2454fb824bdc5f8d5..82cbe55b176d0e4c8b6066649e79d20ff6ac24e0 100644 (file)
@@ -43,11 +43,6 @@ namespace HandBrake.Interop.Model.Encoding
         /// </summary>\r
         public bool IncludeChapterMarkers { get; set; }\r
 \r
-        /// <summary>\r
-        /// Gets or sets a value indicating whether large file.\r
-        /// </summary>\r
-        public bool LargeFile { get; set; }\r
-\r
         /// <summary>\r
         /// Gets or sets a value indicating whether optimize.\r
         /// </summary>\r
@@ -320,7 +315,6 @@ namespace HandBrake.Interop.Model.Encoding
                 ContainerName = this.ContainerName,\r
                 PreferredExtension = this.PreferredExtension,\r
                 IncludeChapterMarkers = this.IncludeChapterMarkers,\r
-                LargeFile = this.LargeFile,\r
                 Optimize = this.Optimize,\r
                 IPod5GSupport = this.IPod5GSupport,\r
 \r