From 50445c5138c234e860dcf8b54134aa6668c896df Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 19 Jan 2015 21:55:29 +0000 Subject: WinGui: Quick Fix for the batch encoding with libhb mode. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6775 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs | 10 ++++++---- win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs | 5 ++++- win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs | 5 ++++- .../ViewModels/EncoderOptionsViewModel.cs | 6 ++++-- win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs | 5 ++++- .../ViewModels/Interfaces/IStaticPreviewViewModel.cs | 7 +++++-- .../ViewModels/Interfaces/ITabInterface.cs | 6 ++++-- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 19 ++++++++++--------- .../ViewModels/PictureSettingsViewModel.cs | 14 ++++++++++++-- .../HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs | 14 ++++++++++++-- win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs | 5 ++++- win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 5 ++++- win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs | 5 ++++- 13 files changed, 77 insertions(+), 29 deletions(-) (limited to 'win/CS/HandBrakeWPF/ViewModels') diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs index 6f2dee1a0..e01a38210 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -9,7 +9,6 @@ namespace HandBrakeWPF.ViewModels { - using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services.Encode.Model; using HandBrake.ApplicationServices.Services.Scan.Model; using HandBrake.Interop.Model.Encoding; @@ -148,6 +147,9 @@ namespace HandBrakeWPF.ViewModels /// /// Setup this window for a new source /// + /// + /// The source. + /// /// /// The title. /// @@ -157,10 +159,10 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { - this.EncoderOptionsViewModel.SetSource(title, preset, task); - this.X264ViewModel.SetSource(title, preset, task); + this.EncoderOptionsViewModel.SetSource(source, title, preset, task); + this.X264ViewModel.SetSource(source, title, preset, task); } #endregion diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index b0e30f3ac..22a7094e7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -400,6 +400,9 @@ namespace HandBrakeWPF.ViewModels /// /// Set the Source Title /// + /// + /// The source. + /// /// /// The title. /// @@ -409,7 +412,7 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { this.SourceTracks = title.AudioTracks; diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index a965440df..0e889d176 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -194,6 +194,9 @@ namespace HandBrakeWPF.ViewModels /// /// Setup this window for a new source /// + /// + /// The source. + /// /// /// The title. /// @@ -203,7 +206,7 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { this.Task = task; this.NotifyOfPropertyChange(() => this.Task); diff --git a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs index 12ba85a49..ae9cc386f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs @@ -11,7 +11,6 @@ namespace HandBrakeWPF.ViewModels { using System.Collections.Generic; - using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services.Encode.Model; using HandBrake.ApplicationServices.Services.Scan.Model; using HandBrake.Interop.Model.Encoding; @@ -71,6 +70,9 @@ namespace HandBrakeWPF.ViewModels /// /// The set source. /// + /// + /// The source. + /// /// /// The selected title. /// @@ -80,7 +82,7 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title selectedTitle, Preset currentPreset, EncodeTask task) + public void SetSource(Source source, Title selectedTitle, Preset currentPreset, EncodeTask task) { this.Task = task; this.Preset = currentPreset; diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index 0a983348e..84b649b21 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -550,6 +550,9 @@ namespace HandBrakeWPF.ViewModels /// /// Setup this window for a new source /// + /// + /// The source. + /// /// /// The title. /// @@ -559,7 +562,7 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { this.CurrentTask = task; } diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs index 448faca36..aa2ba9d1b 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs @@ -9,8 +9,8 @@ namespace HandBrakeWPF.ViewModels.Interfaces { - using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services.Encode.Model; + using HandBrake.ApplicationServices.Services.Scan.Model; /// /// The Static Preview View Model Interface @@ -23,7 +23,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// /// The task. /// - void UpdatePreviewFrame(EncodeTask task); + /// + /// The scanned Source. + /// + void UpdatePreviewFrame(EncodeTask task, Source scannedSource); /// /// Gets or sets a value indicating whether is open. diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs index 437534181..43a536ab4 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/ITabInterface.cs @@ -9,7 +9,6 @@ namespace HandBrakeWPF.ViewModels.Interfaces { - using HandBrake.ApplicationServices.Model; using HandBrake.ApplicationServices.Services.Encode.Model; using HandBrake.ApplicationServices.Services.Scan.Model; @@ -23,6 +22,9 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// /// Setup the window after a scan. /// + /// + /// The source. + /// /// /// The selected title. /// @@ -32,7 +34,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// /// The task. /// - void SetSource(Title selectedTitle, Preset currentPreset, EncodeTask task); + void SetSource(Source source, Title selectedTitle, Preset currentPreset, EncodeTask task); /// /// Set the selected preset diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 788b2ba0f..523f07312 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1166,7 +1166,7 @@ namespace HandBrakeWPF.ViewModels if (!string.IsNullOrEmpty(this.CurrentTask.Source)) { this.StaticPreviewViewModel.IsOpen = true; - this.StaticPreviewViewModel.UpdatePreviewFrame(this.CurrentTask); + this.StaticPreviewViewModel.UpdatePreviewFrame(this.CurrentTask, this.ScannedSource); this.WindowManager.ShowWindow(this.StaticPreviewViewModel); } } @@ -1229,7 +1229,7 @@ namespace HandBrakeWPF.ViewModels return false; } - QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create()); + QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create(), this.ScannedSource); if (!this.queueProcessor.CheckForDestinationPathDuplicates(task.Task.Destination)) { @@ -1813,6 +1813,7 @@ namespace HandBrakeWPF.ViewModels /// private void QueueEditAction(bool successful) { + /* TODO Fix this. */ Execute.OnUIThread(() => { // Copy all the Scan data into the UI @@ -1903,13 +1904,13 @@ namespace HandBrakeWPF.ViewModels // Setup the Tabs if (this.selectedTitle != null) { - this.PictureSettingsViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask); - this.VideoViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask); - this.FiltersViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask); - this.AudioViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask); - this.SubtitleViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask); - this.ChaptersViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask); - this.AdvancedViewModel.SetSource(this.SelectedTitle, this.SelectedPreset, this.CurrentTask); + this.PictureSettingsViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.SelectedPreset, this.CurrentTask); + this.VideoViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.SelectedPreset, this.CurrentTask); + this.FiltersViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.SelectedPreset, this.CurrentTask); + this.AudioViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.SelectedPreset, this.CurrentTask); + this.SubtitleViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.SelectedPreset, this.CurrentTask); + this.ChaptersViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.SelectedPreset, this.CurrentTask); + this.AdvancedViewModel.SetSource(this.ScannedSource, this.SelectedTitle, this.SelectedPreset, this.CurrentTask); } } diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 3a1df33bf..56ceacf71 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -112,6 +112,11 @@ namespace HandBrakeWPF.ViewModels /// private Title currentTitle; + /// + /// The scanned source. + /// + private Source scannedSource; + #endregion #region Constructors and Destructors @@ -701,6 +706,9 @@ namespace HandBrakeWPF.ViewModels /// /// Setup this window for a new source /// + /// + /// The source. + /// /// /// The title. /// @@ -710,11 +718,13 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { this.currentTitle = title; this.Task = task; + this.scannedSource = source; + if (title != null) { // Set cached info @@ -956,7 +966,7 @@ namespace HandBrakeWPF.ViewModels // Step 5, Update the Preview if (delayedPreviewprocessor != null && this.Task != null && this.StaticPreviewViewModel != null && this.StaticPreviewViewModel.IsOpen) { - delayedPreviewprocessor.PerformTask(() => this.StaticPreviewViewModel.UpdatePreviewFrame(this.Task), 800); + delayedPreviewprocessor.PerformTask(() => this.StaticPreviewViewModel.UpdatePreviewFrame(this.Task, this.scannedSource), 800); } } diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index d360ab0ea..a05ea2194 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -26,6 +26,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Encode.Model.Models; using HandBrake.ApplicationServices.Services.Interfaces; using HandBrake.ApplicationServices.Services.Scan.Interfaces; + using HandBrake.ApplicationServices.Services.Scan.Model; using HandBrake.Interop.Model.Encoding; using HandBrakeWPF.Factories; @@ -217,6 +218,11 @@ namespace HandBrakeWPF.ViewModels /// public EncodeTask Task { get; set; } + /// + /// Gets or sets the scanned source. + /// + public Source ScannedSource { get; set; } + /// /// Gets the total previews. /// @@ -395,12 +401,16 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void UpdatePreviewFrame(EncodeTask task) + /// + /// The scanned Source. + /// + public void UpdatePreviewFrame(EncodeTask task, Source scannedSource) { this.Task = task; this.UpdatePreviewFrame(); this.DisplayName = "Picture Preview"; this.Title = Properties.Resources.Preview; + this.ScannedSource = scannedSource; } /// @@ -543,7 +553,7 @@ namespace HandBrakeWPF.ViewModels encodeTask.IsPreviewEncode = true; encodeTask.PreviewEncodeStartAt = this.SelectedPreviewImage; // TODO 0 and 1 mean the same. Need to fix this as it knocks the video out of sync with the still preview. encodeTask.PreviewEncodeDuration = this.Duration; - QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create()); + QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create(), this.ScannedSource); ThreadPool.QueueUserWorkItem(this.CreatePreview, task); } diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index 7d0b16cdb..660c99843 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -531,6 +531,9 @@ namespace HandBrakeWPF.ViewModels /// /// Setup this window for a new source /// + /// + /// The source. + /// /// /// The title. /// @@ -540,7 +543,7 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { this.SourceTracks.Clear(); this.SourceTracks.Add(ForeignAudioSearchTrack); diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 8b745aa3c..7060530ef 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -1059,6 +1059,9 @@ namespace HandBrakeWPF.ViewModels /// /// Setup this window for a new source /// + /// + /// The source. + /// /// /// The title. /// @@ -1068,7 +1071,7 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { this.Task = task; } diff --git a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs index 69e4a0f33..2647e2ae8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs @@ -962,6 +962,9 @@ namespace HandBrakeWPF.ViewModels /// /// Setup this window for a new source /// + /// + /// The source. + /// /// /// The title. /// @@ -971,7 +974,7 @@ namespace HandBrakeWPF.ViewModels /// /// The task. /// - public void SetSource(Title title, Preset preset, EncodeTask task) + public void SetSource(Source source, Title title, Preset preset, EncodeTask task) { this.Task = task; this.NotifyOfPropertyChange(() => this.AdvancedOptionsString); -- cgit v1.2.3