]> granicus.if.org Git - handbrake/commitdiff
WinGui: Fix up libhb encode feature.
authorsr55 <sr55.hb@outlook.com>
Sat, 21 Sep 2013 17:47:12 +0000 (17:47 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 21 Sep 2013 17:47:12 +0000 (17:47 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5790 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
win/CS/HandBrake.ApplicationServices/Services/Encode.cs
win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs

index 31c1d8cec67419f5d7fff61f7875d82ef30f97e1..2f29d705442f60c0db5736c13bbff459b942558e 100644 (file)
@@ -92,6 +92,17 @@ namespace HandBrake.ApplicationServices.Isolation
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets a value indicating whether can pause.\r
+        /// </summary>\r
+        public bool CanPause\r
+        {\r
+            get\r
+            {\r
+                return false; // TODO make this work.\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Gets a value indicating whether IsEncoding.\r
         /// </summary>\r
@@ -171,6 +182,20 @@ namespace HandBrake.ApplicationServices.Isolation
                 delegate { this.Service.StartEncode(job, enableLogging); });\r
         }\r
 \r
+        /// <summary>\r
+        /// The pause.\r
+        /// </summary>\r
+        public void Pause()\r
+        {\r
+        }\r
+\r
+        /// <summary>\r
+        /// The resume.\r
+        /// </summary>\r
+        public void Resume()\r
+        {\r
+        }\r
+\r
         /// <summary>\r
         /// Kill the CLI process\r
         /// </summary>\r
index 4779d353ebe01598954175da213d881c1b07a8b4..806c08fa5b8b22fabae0506f0d92cbc4bd019116 100644 (file)
@@ -74,6 +74,17 @@ namespace HandBrake.ApplicationServices.Services
         /// </summary>\r
         protected Process HbProcess { get; set; }\r
 \r
+        /// <summary>\r
+        /// Gets a value indicating whether can pause.\r
+        /// </summary>\r
+        public bool CanPause\r
+        {\r
+            get\r
+            {\r
+                return false;\r
+            }\r
+        }\r
+\r
         #endregion\r
 \r
         #region Public Methods\r
@@ -201,6 +212,28 @@ namespace HandBrake.ApplicationServices.Services
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// The pause.\r
+        /// </summary>\r
+        /// <exception cref="NotImplementedException">\r
+        /// This feature is not available for CLI based encoding.\r
+        /// </exception>\r
+        public void Pause()\r
+        {\r
+            throw new NotImplementedException("This feature is not available for CLI based encoding.");\r
+        }\r
+\r
+        /// <summary>\r
+        /// The resume.\r
+        /// </summary>\r
+        /// <exception cref="NotImplementedException">\r
+        /// This feature is not available for CLI based encoding.\r
+        /// </exception>\r
+        public void Resume()\r
+        {\r
+            throw new NotImplementedException("This feature is not available for CLI based encoding.");\r
+        }\r
+\r
         /// <summary>\r
         /// Kill the CLI process\r
         /// </summary>\r
index fbb59ec2b8c2f83967d86ae0a3348b027f14081f..8d70247f7f6abcd15311213411828851b5f7e9ee 100644 (file)
@@ -71,6 +71,11 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
         /// </summary>\r
         int LogIndex { get; }\r
 \r
+        /// <summary>\r
+        /// Gets a value indicating whether can pause.\r
+        /// </summary>\r
+        bool CanPause { get; }\r
+\r
         /// <summary>\r
         /// Start with a LibHb EncodeJob Object\r
         /// </summary>\r
@@ -82,6 +87,16 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
         /// </param>\r
         void Start(QueueTask job, bool enableLogging);\r
 \r
+        /// <summary>\r
+        /// The pause.\r
+        /// </summary>\r
+        void Pause();\r
+\r
+        /// <summary>\r
+        /// The resume.\r
+        /// </summary>\r
+        void Resume();\r
+\r
         /// <summary>\r
         /// Kill the CLI process\r
         /// </summary>\r
index f7247f6cf2e48223d1ec4bf12f3598a3b9c7f2e3..f6da448acd3e5df88c9ce20eabe1fd5b0418d6d3 100644 (file)
@@ -42,14 +42,14 @@ namespace HandBrake.ApplicationServices.Services
         private readonly IUserSettingService userSettingService;\r
 \r
         /// <summary>\r
-        /// The Start time of the current Encode;\r
+        /// The instance.\r
         /// </summary>\r
-        private DateTime startTime;\r
+        private IHandBrakeInstance instance;\r
 \r
         /// <summary>\r
-        /// An Instance of the HandBrake Interop Library\r
+        /// The Start time of the current Encode;\r
         /// </summary>\r
-        private IHandBrakeInstance instance;\r
+        private DateTime startTime;\r
 \r
         /// <summary>\r
         /// A flag to indicate if logging is enabled or not.\r
@@ -69,23 +69,26 @@ namespace HandBrake.ApplicationServices.Services
         /// <param name="userSettingService">\r
         /// The user Setting Service.\r
         /// </param>\r
-        /// <param name="handBrakeInstance">\r
-        /// The hand Brake Instance.\r
-        /// </param>\r
-        public LibEncode(IUserSettingService userSettingService, IHandBrakeInstance handBrakeInstance)\r
+        public LibEncode(IUserSettingService userSettingService)\r
             : base(userSettingService)\r
         {\r
             this.userSettingService = userSettingService;\r
 \r
-            // Setup the HandBrake Instance\r
-            this.instance = handBrakeInstance;\r
-            this.instance.EncodeCompleted += this.InstanceEncodeCompleted;\r
-            this.instance.EncodeProgress += this.InstanceEncodeProgress;\r
-\r
             HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;\r
             HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged;\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets a value indicating whether can pause.\r
+        /// </summary>\r
+        public bool CanPause\r
+        {\r
+            get\r
+            {\r
+                return true;\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Start with a LibHb EncodeJob Object\r
         /// </summary>\r
@@ -97,10 +100,18 @@ namespace HandBrake.ApplicationServices.Services
         /// </param>\r
         public void Start(QueueTask job, bool enableLogging)\r
         {\r
+            // Setup\r
             this.startTime = DateTime.Now;\r
             this.loggingEnabled = enableLogging;\r
             this.currentTask = job;\r
 \r
+            // Create a new HandBrake instance\r
+            // Setup the HandBrake Instance\r
+            instance = new HandBrakeInstance();\r
+            instance.Initialize(1);\r
+            instance.EncodeCompleted += this.InstanceEncodeCompleted;\r
+            instance.EncodeProgress += this.InstanceEncodeProgress;\r
+            \r
             try\r
             {\r
                 // Sanity Checking and Setup\r
@@ -111,9 +122,6 @@ namespace HandBrake.ApplicationServices.Services
 \r
                 this.IsEncoding = true;\r
 \r
-                // Get an EncodeJob object for the Interop Library\r
-                EncodeJob encodeJob = InteropModelCreator.GetEncodeJob(job);\r
-\r
                 // Enable logging if required.\r
                 if (enableLogging)\r
                 {\r
@@ -131,34 +139,14 @@ namespace HandBrake.ApplicationServices.Services
                 // Verify the Destination Path Exists, and if not, create it.\r
                 this.VerifyEncodeDestinationPath(job);\r
 \r
-                // Start the Encode\r
-                this.instance.StartEncode(encodeJob);\r
-\r
-                // Set the Process Priority\r
-                switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))\r
-                {\r
-                    case "Realtime":\r
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;\r
-                        break;\r
-                    case "High":\r
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;\r
-                        break;\r
-                    case "Above Normal":\r
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;\r
-                        break;\r
-                    case "Normal":\r
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;\r
-                        break;\r
-                    case "Low":\r
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;\r
-                        break;\r
-                    default:\r
-                        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;\r
-                        break;\r
-                }\r
+                // We have to scan the source again but only the title so the HandBrake instance is initialised correctly. \r
+                // Since the UI sends the crop params down, we don't have to do all the previews.\r
+                instance.StartScan(job.Task.Source, 1, job.Task.Title);\r
 \r
-                // Fire the Encode Started Event\r
-                this.InvokeEncodeStarted(EventArgs.Empty);\r
+                instance.ScanCompleted += delegate\r
+                    {\r
+                        ScanCompleted(job, instance);\r
+                    };\r
             }\r
             catch (Exception exc)\r
             {\r
@@ -166,6 +154,28 @@ namespace HandBrake.ApplicationServices.Services
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Pause the currently running encode.\r
+        /// </summary>\r
+        public void Pause()\r
+        {\r
+            if (this.instance != null)\r
+            {\r
+                this.instance.PauseEncode();\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Resume the currently running encode.\r
+        /// </summary>\r
+        public void Resume()\r
+        {\r
+            if (this.instance != null)\r
+            {\r
+                this.instance.ResumeEncode();\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Kill the CLI process\r
         /// </summary>\r
@@ -190,6 +200,50 @@ namespace HandBrake.ApplicationServices.Services
             // Nothing to do for this implementation.\r
         }\r
 \r
+        /// <summary>\r
+        /// The scan completed.\r
+        /// </summary>\r
+        /// <param name="job">\r
+        /// The job.\r
+        /// </param>\r
+        /// <param name="instance">\r
+        /// The instance.\r
+        /// </param>\r
+        private void ScanCompleted(QueueTask job, IHandBrakeInstance instance)\r
+        {\r
+            // Get an EncodeJob object for the Interop Library\r
+            EncodeJob encodeJob = InteropModelCreator.GetEncodeJob(job);\r
+\r
+            // Start the Encode\r
+            instance.StartEncode(encodeJob);\r
+\r
+            // Fire the Encode Started Event\r
+            this.InvokeEncodeStarted(EventArgs.Empty);\r
+\r
+            // Set the Process Priority\r
+            switch (this.userSettingService.GetUserSetting<string>(ASUserSettingConstants.ProcessPriority))\r
+            {\r
+                case "Realtime":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;\r
+                    break;\r
+                case "High":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;\r
+                    break;\r
+                case "Above Normal":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.AboveNormal;\r
+                    break;\r
+                case "Normal":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Normal;\r
+                    break;\r
+                case "Low":\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.Idle;\r
+                    break;\r
+                default:\r
+                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.BelowNormal;\r
+                    break;\r
+            }\r
+        }\r
+\r
         #region HandBrakeInstance Event Handlers.\r
         /// <summary>\r
         /// Log a message\r
index 157380b8c48222f7d13aeb1090012d2c2572b247..a6a634b53dd6c2fb48ca364055b1c9a1b8176413 100644 (file)
@@ -13,7 +13,6 @@ namespace HandBrake.ApplicationServices.Services
     using System.Collections.Generic;\r
     using System.IO;\r
     using System.Text;\r
-    using System.Threading;\r
 \r
     using HandBrake.ApplicationServices.EventArgs;\r
     using HandBrake.ApplicationServices.Model.Encoding;\r
index 4e0039c55e1bec696f275a1fa30df3f06c51e2cb..ab0acd596b91bc7dc6910a22ec28ce892ad92900 100644 (file)
@@ -16,8 +16,6 @@ namespace HandBrake.ApplicationServices.Services
 \r
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
-    using HandBrake.Interop;\r
-    using HandBrake.Interop.Interfaces;\r
 \r
     using EncodeCompletedEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs;\r
     using EncodeProgressEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs;\r
@@ -104,8 +102,7 @@ namespace HandBrake.ApplicationServices.Services
                 Console.WriteLine("Service Started. Waiting for Clients...");\r
 \r
                 // Setup the services we are going to use.\r
-                IHandBrakeInstance instance = new HandBrakeInstance();\r
-                encodeService = new LibEncode(new UserSettingService(), instance); // TODO this needs wired up with castle\r
+                encodeService = new LibEncode(new UserSettingService()); // TODO this needs wired up with castle\r
 \r
                 shutdownFlag = new ManualResetEvent(false);\r
                 shutdownFlag.WaitOne();\r
index b6a50485f35ecda2148e2de0711fcb7b8c0a5bd4..81b4a63c1863d7009f47643843c3b4c62b453522 100644 (file)
@@ -17,6 +17,7 @@ namespace HandBrake.ApplicationServices.Utilities
     using HandBrake.ApplicationServices.Model.Encoding;\r
     using HandBrake.Interop.Model;\r
     using HandBrake.Interop.Model.Encoding;\r
+    using HandBrake.Interop.Model.Encoding.x264;\r
 \r
     /// <summary>\r
     /// A Utility Class to Convert a \r
@@ -45,12 +46,10 @@ namespace HandBrake.ApplicationServices.Utilities
 \r
             // Which will be converted to this EncodeJob Model.\r
             EncodeJob job = new EncodeJob();\r
-\r
             EncodingProfile profile = new EncodingProfile();\r
             job.EncodingProfile = profile;\r
 \r
-            profile.Anamorphic = work.Anamorphic;\r
-\r
+            // Audio Settings\r
             profile.AudioEncodings = new List<AudioEncoding>();\r
             job.ChosenAudioTracks = new List<int>();\r
             foreach (AudioTrack track in work.AudioTracks)\r
@@ -63,7 +62,7 @@ namespace HandBrake.ApplicationServices.Utilities
                         Encoder = Converters.GetCliAudioEncoder(track.Encoder),\r
                         InputNumber = track.Track.HasValue ? track.Track.Value : 0,\r
                         Mixdown = Converters.GetCliMixDown(track.MixDown),\r
-                        SampleRateRaw = GetSampleRateRaw(track.SampleRate),         \r
+                        SampleRateRaw = GetSampleRateRaw(track.SampleRate),\r
                     };\r
 \r
                 profile.AudioEncodings.Add(newTrack);\r
@@ -72,6 +71,60 @@ namespace HandBrake.ApplicationServices.Utilities
                     job.ChosenAudioTracks.Add(track.Track.Value);\r
                 }\r
             }\r
+\r
+            // Title Settings\r
+            job.OutputPath = work.Destination;\r
+            job.SourcePath = work.Source;\r
+            job.Title = work.Title;\r
+            // job.SourceType = work.Type;\r
+            switch (work.PointToPointMode)\r
+            {\r
+                case PointToPointMode.Chapters:\r
+                    job.RangeType = VideoRangeType.Chapters;\r
+                    break;\r
+                case PointToPointMode.Seconds:\r
+                    job.RangeType = VideoRangeType.Seconds;\r
+                    break;\r
+                case PointToPointMode.Frames:\r
+                    job.RangeType = VideoRangeType.Frames;\r
+                    break;\r
+            }\r
+\r
+            if (work.PointToPointMode == PointToPointMode.Seconds)\r
+            {\r
+                job.SecondsEnd = work.EndPoint;\r
+                job.SecondsStart = work.StartPoint;\r
+            }\r
+            if (work.PointToPointMode == PointToPointMode.Chapters)\r
+            {\r
+                job.ChapterStart = work.StartPoint;\r
+                job.ChapterEnd = work.EndPoint;\r
+            }\r
+            if (work.PointToPointMode == PointToPointMode.Frames)\r
+            {\r
+                job.FramesEnd = work.EndPoint;\r
+                job.FramesStart = work.StartPoint;\r
+            }\r
+\r
+            job.Angle = work.Angle;\r
+            job.EncodingProfile = profile;\r
+\r
+            // Output Settings\r
+            profile.IPod5GSupport = work.IPod5GSupport;\r
+            profile.Optimize = work.OptimizeMP4;\r
+            switch (work.OutputFormat)\r
+            {\r
+                case OutputFormat.Mp4:\r
+                case OutputFormat.M4V:\r
+                    profile.OutputFormat = Container.Mp4;\r
+                    break;\r
+                case OutputFormat.Mkv:\r
+                    profile.OutputFormat = Container.Mkv;\r
+                    break;\r
+            }\r
+\r
+            // Picture Settings\r
+            profile.Anamorphic = work.Anamorphic;\r
             profile.Cropping = new Cropping\r
                 {\r
                     Top = work.Cropping.Top,\r
@@ -79,101 +132,63 @@ namespace HandBrake.ApplicationServices.Utilities
                     Left = work.Cropping.Left,\r
                     Right = work.Cropping.Right\r
                 };\r
-\r
             profile.CroppingType = CroppingType.Custom; // TODO deal with this better\r
+            profile.DisplayWidth = work.DisplayWidth.HasValue\r
+                           ? int.Parse(Math.Round(work.DisplayWidth.Value, 0).ToString())\r
+                           : 0;\r
+            profile.PixelAspectX = work.PixelAspectX;\r
+            profile.PixelAspectY = work.PixelAspectY;\r
+            profile.Height = work.Height.HasValue ? work.Height.Value : 0;\r
+            profile.KeepDisplayAspect = work.KeepDisplayAspect;\r
+            profile.MaxHeight = work.MaxHeight.HasValue ? work.MaxHeight.Value : 0;\r
+            profile.MaxWidth = work.MaxWidth.HasValue ? work.MaxWidth.Value : 0;\r
+            profile.Modulus = work.Modulus.HasValue ? work.Modulus.Value : 16;\r
+            profile.UseDisplayWidth = true;\r
+            profile.Width = work.Width.HasValue ? work.Width.Value : 0;\r
+\r
+            // Filter Settings\r
             profile.CustomDecomb = work.CustomDecomb;\r
             profile.CustomDeinterlace = work.CustomDeinterlace;\r
             profile.CustomDenoise = work.CustomDenoise;\r
             profile.CustomDetelecine = work.CustomDetelecine;\r
-            profile.Deblock = work.Deblock;\r
+            if (work.Deblock > 4)\r
+                profile.Deblock = work.Deblock;\r
             profile.Decomb = work.Decomb;\r
             profile.Deinterlace = work.Deinterlace;\r
             profile.Denoise = work.Denoise;\r
             profile.Detelecine = work.Detelecine;\r
-            profile.DisplayWidth = work.DisplayWidth.HasValue\r
-                                       ? int.Parse(Math.Round(work.DisplayWidth.Value, 0).ToString())\r
-                                       : 0;\r
-            profile.Framerate = work.Framerate.HasValue ? work.Framerate.Value : 0;\r
             profile.Grayscale = work.Grayscale;\r
-            profile.Height = work.Height.HasValue ? work.Height.Value : 0;\r
-            profile.IPod5GSupport = work.IPod5GSupport;\r
-            profile.IncludeChapterMarkers = work.IncludeChapterMarkers;\r
-            profile.KeepDisplayAspect = work.KeepDisplayAspect;\r
-            profile.MaxHeight = work.MaxHeight.HasValue ? work.MaxHeight.Value : 0;\r
-            profile.MaxWidth = work.MaxWidth.HasValue ? work.MaxWidth.Value : 0;\r
-            profile.Modulus = work.Modulus.HasValue ? work.Modulus.Value : 16;\r
-            profile.Optimize = work.OptimizeMP4;\r
-            switch (work.OutputFormat)\r
-            {\r
-                case OutputFormat.Mp4:\r
-                case OutputFormat.M4V:\r
-                    profile.OutputFormat = Container.Mp4;\r
-                    break;\r
-                case OutputFormat.Mkv:\r
-                    profile.OutputFormat = Container.Mkv;\r
-                    break;\r
-            }\r
-            profile.ConstantFramerate = work.FramerateMode == FramerateMode.CFR;\r
-            profile.PixelAspectX = work.PixelAspectX;\r
-            profile.PixelAspectY = work.PixelAspectY;\r
 \r
-            switch (work.OutputFormat)\r
-            {\r
-                case OutputFormat.Mp4:\r
-                    profile.PreferredExtension = OutputExtension.Mp4;\r
-                    break;\r
-                case OutputFormat.M4V:\r
-                    profile.PreferredExtension = OutputExtension.M4v;\r
-                    break;\r
-            }\r
+            // Video Settings\r
+            profile.Framerate = work.Framerate.HasValue ? work.Framerate.Value : 0;\r
+            profile.ConstantFramerate = work.FramerateMode == FramerateMode.CFR;\r
             profile.Quality = work.Quality.HasValue ? work.Quality.Value : 0;\r
-            profile.UseDisplayWidth = true;\r
             profile.VideoBitrate = work.VideoBitrate.HasValue ? work.VideoBitrate.Value : 0;\r
             profile.VideoEncodeRateType = work.VideoEncodeRateType;\r
             profile.VideoEncoder = Converters.GetVideoEncoder(work.VideoEncoder);\r
-            profile.Width = work.Width.HasValue ? work.Width.Value : 0;\r
-            profile.X264Options = work.AdvancedEncoderOptions;\r
 \r
-            if (work.PointToPointMode == PointToPointMode.Chapters)\r
+            profile.H264Level = work.H264Level;\r
+            profile.X264Profile = work.H264Profile.ToString().ToLower().Replace(" ", string.Empty); // TODO change these away from strings.\r
+            profile.X264Preset = work.X264Preset.ToString().ToLower().Replace(" ", string.Empty);\r
+            profile.X264Tunes = new List<string>();\r
+\r
+            if (work.X264Tune != x264Tune.None)\r
             {\r
-                job.ChapterStart = work.StartPoint;\r
-                job.ChapterEnd = work.EndPoint;\r
+                profile.X264Tunes.Add(work.X264Tune.ToString().ToLower().Replace(" ", string.Empty));\r
             }\r
 \r
-            job.Angle = work.Angle;\r
-            job.EncodingProfile = profile;\r
-            if (work.PointToPointMode == PointToPointMode.Frames)\r
+            if (work.FastDecode)\r
             {\r
-                job.FramesEnd = work.EndPoint;\r
-                job.FramesStart = work.StartPoint;\r
+                profile.X264Tunes.Add("fastdecode");\r
             }\r
 \r
+            // Chapter Markers\r
+            profile.IncludeChapterMarkers = work.IncludeChapterMarkers;\r
             job.CustomChapterNames = work.ChapterNames.Select(item => item.ChapterName).ToList();\r
             job.UseDefaultChapterNames = work.IncludeChapterMarkers;\r
 \r
-            job.OutputPath = work.Destination;\r
-            switch (work.PointToPointMode)\r
-            {\r
-                case PointToPointMode.Chapters:\r
-                    job.RangeType = VideoRangeType.Chapters;\r
-                    break;\r
-                case PointToPointMode.Seconds:\r
-                    job.RangeType = VideoRangeType.Seconds;\r
-                    break;\r
-                case PointToPointMode.Frames:\r
-                    job.RangeType = VideoRangeType.Frames;\r
-                    break;\r
-            }\r
-\r
-            if (work.PointToPointMode == PointToPointMode.Seconds)\r
-            {\r
-                job.SecondsEnd = work.EndPoint;\r
-                job.SecondsStart = work.StartPoint;\r
-            }\r
-\r
-            job.SourcePath = work.Source;\r
-            // job.SourceType = work.Type;\r
-            job.Title = work.Title;\r
+            // Advanced Settings\r
+            profile.X264Options = work.AdvancedEncoderOptions;\r
 \r
             // Subtitles\r
             job.Subtitles = new Subtitles { SourceSubtitles = new List<SourceSubtitle>(), SrtSubtitles = new List<SrtSubtitle>() };\r
index 014ecd6345578bdadd820ea1bba04bace6fbf889..57c19659a8e78e39f3ec36c91a2cd7b6bf825337 100644 (file)
@@ -12,7 +12,7 @@ namespace HandBrake.Interop
        using System;\r
        using System.Collections.Generic;\r
        using System.Globalization;\r
-       using System.Runtime.InteropServices;\r
+\r
        using HandBrake.Interop.HbLib;\r
        using HandBrake.Interop.Model.Encoding;\r
        using HandBrake.Interop.SourceData;\r
index 9f7c17a79eeb491ad3bcc8cb56100c737824ed71..e1e602e7afa2253b6064b75596072b49d8512735 100644 (file)
@@ -257,7 +257,6 @@ namespace HandBrake.Interop
                        this.scanPollTimer.Start();\r
                }\r
 \r
-\r
                /// <summary>\r
                /// Stops an ongoing scan.\r
                /// </summary>\r
@@ -266,6 +265,8 @@ namespace HandBrake.Interop
                        HBFunctions.hb_scan_stop(this.hbHandle);\r
                }\r
 \r
+\r
+\r
                /// <summary>\r
                /// Gets an image for the given job and preview\r
                /// </summary>\r
index 7fc3c76ffe943b3da9d3d5f1d11d4016f4c66a84..1fe1a448e098064dcd11dccd62bbd3ecac9c1689 100644 (file)
@@ -18,7 +18,6 @@ namespace HandBrakeWPF.Services
     using HandBrake.ApplicationServices.Model;\r
     using HandBrake.ApplicationServices.Services;\r
     using HandBrake.ApplicationServices.Services.Interfaces;\r
-    using HandBrake.Interop;\r
 \r
     using EncodeCompletedEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeCompletedEventArgs;\r
     using EncodeProgressEventArgs = HandBrake.ApplicationServices.EventArgs.EncodeProgressEventArgs;\r
@@ -64,7 +63,7 @@ namespace HandBrakeWPF.Services
                     }\r
                     else\r
                     {\r
-                        this.encodeService = new LibEncode(userSettingService, new HandBrakeInstance());\r
+                        this.encodeService = new LibEncode(userSettingService);\r
                     }\r
                 }\r
                 catch (Exception exc)\r
@@ -132,6 +131,17 @@ namespace HandBrakeWPF.Services
             }\r
         }\r
 \r
+        /// <summary>\r
+        /// Gets a value indicating whether can pause.\r
+        /// </summary>\r
+        public bool CanPause\r
+        {\r
+            get\r
+            {\r
+                return this.encodeService.CanPause;\r
+            }\r
+        }\r
+\r
         /// <summary>\r
         /// Gets a value indicating whether IsEncoding.\r
         /// </summary>\r
@@ -185,6 +195,22 @@ namespace HandBrakeWPF.Services
             this.encodeService.Start(job, enableLogging);\r
         }\r
 \r
+        /// <summary>\r
+        /// The pause.\r
+        /// </summary>\r
+        public void Pause()\r
+        {\r
+            this.encodeService.Pause();\r
+        }\r
+\r
+        /// <summary>\r
+        /// The resume.\r
+        /// </summary>\r
+        public void Resume()\r
+        {\r
+            this.encodeService.Resume();\r
+        }\r
+\r
         /// <summary>\r
         /// Kill the CLI process\r
         /// </summary>\r