diff options
author | sr55 <[email protected]> | 2019-12-09 17:32:21 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2019-12-09 17:33:10 +0000 |
commit | 083198da477c9004f2dff75a220883d3875c01b4 (patch) | |
tree | b2021482af250e3407c710ad79f749ccf2a77152 | |
parent | d25b84a8c7bf6e15121a048490b1c76d835518d0 (diff) |
WinGui: Limit iPod atom to H.264. Fixes #2490
(cherry picked from commit 56a0493beb33fea858bb3f795799994f37523614)
6 files changed, 58 insertions, 4 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs index e8a2ed485..07da99a20 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="VideoEncoder.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="VideoEncoder.cs" company="HandBrake Project (https://handbrake.fr)"> // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // </copyright> // <summary> diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 41fce78b6..79d66ca7f 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -139,6 +139,7 @@ <Compile Include="Converters\Options\Mp4BehaviourConverter.cs" />
<Compile Include="Converters\Options\UpdateCheckConverter.cs" />
<Compile Include="Converters\ResourceConverterBase.cs" />
+ <Compile Include="Helpers\VideoEncoderHelpers.cs" />
<Compile Include="Model\Options\Mp4Behaviour.cs" />
<Compile Include="Converters\Options\ProcessPriorityConverter.cs" />
<Compile Include="Converters\OptionTabConverter.cs" />
diff --git a/win/CS/HandBrakeWPF/Helpers/VideoEncoderHelpers.cs b/win/CS/HandBrakeWPF/Helpers/VideoEncoderHelpers.cs new file mode 100644 index 000000000..de53cf35c --- /dev/null +++ b/win/CS/HandBrakeWPF/Helpers/VideoEncoderHelpers.cs @@ -0,0 +1,28 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="VideoEncoderHelpers.cs" company="HandBrake Project (http://handbrake.fr)"> +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// </copyright> +// <summary> +// Defines the VideoEncoderHelpers type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrakeWPF.Helpers +{ + using System.Configuration; + + using HandBrake.Interop.Interop.Model.Encoding; + + public class VideoEncoderHelpers + { + public static bool IsH264(VideoEncoder encoder) + { + if (encoder == VideoEncoder.X264 || encoder == VideoEncoder.X264_10 || encoder == VideoEncoder.QuickSync || encoder == VideoEncoder.NvencH264) + { + return true; + } + + return false; + } + } +} diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs index 003f13f17..35bd86c39 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs @@ -23,6 +23,7 @@ namespace HandBrakeWPF.Services.Encode.Factories using HandBrake.Interop.Interop.Model.Encoding; using HandBrake.Interop.Model; + using HandBrakeWPF.Helpers; using HandBrakeWPF.Utilities; using Newtonsoft.Json.Linq; @@ -150,7 +151,7 @@ namespace HandBrakeWPF.Services.Encode.Factories File = job.Destination, Mp4Options = new Mp4Options { - IpodAtom = job.IPod5GSupport, + IpodAtom = VideoEncoderHelpers.IsH264(job.VideoEncoder) ? job.IPod5GSupport : false, Mp4Optimize = job.OptimizeMP4 }, ChapterMarkers = job.IncludeChapterMarkers, diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs index ce4e6969b..161d403a5 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs @@ -228,6 +228,7 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.SelectedOutputFormat); this.NotifyOfPropertyChange(() => this.Task.OutputFormat); this.NotifyOfPropertyChange(() => this.IsMkvOrWebm); + this.NotifyOfPropertyChange(() => this.IsIpodAtomVisible); this.SetExtension(string.Format(".{0}", this.Task.OutputFormat.ToString().ToLower())); this.UpdateDisplayedInfo(); // output format may coreced to another due to container incompatibility @@ -248,6 +249,19 @@ namespace HandBrakeWPF.ViewModels } } + public bool IsIpodAtomVisible + { + get + { + if (this.task == null) + { + return false; + } + + return this.SelectedOutputFormat == OutputFormat.Mp4 && VideoEncoderHelpers.IsH264(this.task.VideoEncoder); + } + } + /// <summary> /// Optimise MP4 Checkbox /// </summary> @@ -278,6 +292,7 @@ namespace HandBrakeWPF.ViewModels { return this.Task?.IPod5GSupport ?? false; } + set { if (value == this.Task.IPod5GSupport) @@ -334,7 +349,8 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.SelectedOutputFormat); this.NotifyOfPropertyChange(() => this.IsMkvOrWebm); - + this.NotifyOfPropertyChange(() => this.IsIpodAtomVisible); + this.NotifyOfPropertyChange(() => this.OptimizeMP4); this.NotifyOfPropertyChange(() => this.IPod5GSupport); this.NotifyOfPropertyChange(() => this.AlignAVStart); @@ -478,7 +494,13 @@ namespace HandBrakeWPF.ViewModels this.AlignAVStart = false; } + if (!VideoEncoderHelpers.IsH264(this.task.VideoEncoder)) + { + this.IPod5GSupport = false; + } + this.NotifyOfPropertyChange(() => this.IsMkvOrWebm); + this.NotifyOfPropertyChange(() => this.IsIpodAtomVisible); // Update The browse file extension display if (Path.HasExtension(newExtension)) @@ -526,6 +548,8 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.PreviewInfo); this.ShowPreview = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowPreviewOnSummaryTab); + + this.NotifyOfPropertyChange(() => this.IsIpodAtomVisible); } private string GetFilterDescription() diff --git a/win/CS/HandBrakeWPF/Views/SummaryView.xaml b/win/CS/HandBrakeWPF/Views/SummaryView.xaml index a6e5081f1..9ec428b0e 100644 --- a/win/CS/HandBrakeWPF/Views/SummaryView.xaml +++ b/win/CS/HandBrakeWPF/Views/SummaryView.xaml @@ -75,7 +75,7 @@ Content="{x:Static Properties:Resources.MainView_iPod5G}" ToolTip="{x:Static Properties:ResourcesTooltips.MainView_IpodAtom}" IsChecked="{Binding Path=IPod5GSupport}" - Visibility="{Binding IsMkvOrWebm, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" /> + Visibility="{Binding IsIpodAtomVisible, Converter={StaticResource boolToVisConverter}}" /> <TextBlock Text="{x:Static Properties:Resources.MainView_Tracks}" FontWeight="Bold" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" /> <TextBlock Text="{Binding VideoTrackInfo}" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" /> |