From 96dfced7fe9f278b8985ead77bd34d4ae39fb0fb Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 2 Feb 2014 20:34:09 +0000 Subject: [PATCH] WinGui: Use libhb for subtitle burnin / forced checking. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6012 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../Model/Encoding/SubtitleTrack.cs | 8 ++--- .../Parsing/Subtitle.cs | 32 ++++++++++++++++++- .../Services/LibScan.cs | 2 +- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs index 02bacc429..512aa9b44 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/Encoding/SubtitleTrack.cs @@ -233,8 +233,7 @@ namespace HandBrake.ApplicationServices.Model.Encoding { if (this.SourceTrack != null) { - return this.SourceTrack.SubtitleType == SubtitleType.VobSub || this.SourceTrack.SubtitleType == SubtitleType.PGS - || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch; + return this.SourceTrack.CanForce || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch; } return false; @@ -247,11 +246,10 @@ namespace HandBrake.ApplicationServices.Model.Encoding public bool CanBeBurned { get - { + { if (this.SourceTrack != null) { - return this.SourceTrack.SubtitleType == SubtitleType.VobSub || this.SourceTrack.SubtitleType == SubtitleType.PGS - || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch || this.SourceTrack.SubtitleType == SubtitleType.SSA; + return this.SourceTrack.CanBurnIn || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch; } return false; diff --git a/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs b/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs index e40734b55..3b026bdf5 100644 --- a/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs +++ b/win/CS/HandBrake.ApplicationServices/Parsing/Subtitle.cs @@ -10,6 +10,7 @@ namespace HandBrake.ApplicationServices.Parsing { using System; + using System.Xml.Serialization; using HandBrake.ApplicationServices.Model.Encoding; using HandBrake.ApplicationServices.Utilities; @@ -29,6 +30,9 @@ namespace HandBrake.ApplicationServices.Parsing /// /// Initializes a new instance of the class. /// + /// + /// The source Id. + /// /// /// The track number. /// @@ -41,14 +45,28 @@ namespace HandBrake.ApplicationServices.Parsing /// /// The subtitle type. /// - public Subtitle(int trackNumber, string language, string languageCode, SubtitleType subtitleType) + /// + /// The can Burn. + /// + /// + /// The can Force. + /// + public Subtitle(int sourceId, int trackNumber, string language, string languageCode, SubtitleType subtitleType, bool canBurn, bool canForce) { + this.SourceId = sourceId; this.TrackNumber = trackNumber; this.Language = language; this.LanguageCode = languageCode; this.SubtitleType = subtitleType; + this.CanBurnIn = canBurn; + this.CanForce = canForce; } + /// + /// Gets or sets the source id. + /// + public int SourceId { get; set; } + /// /// Gets or sets the track number of this Subtitle /// @@ -80,6 +98,18 @@ namespace HandBrake.ApplicationServices.Parsing } } + /// + /// Gets a value indicating whether can burn in. + /// + [XmlIgnore] + public bool CanBurnIn { get; private set; } + + /// + /// Gets a value indicating whether can force. + /// + [XmlIgnore] + public bool CanForce { get; private set; } + /// /// Gets or sets the Subtitle Type /// diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs index 7831f6bb2..203459e9c 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs @@ -501,7 +501,7 @@ namespace HandBrake.ApplicationServices.Services break; } - converted.Subtitles.Add(new Subtitle(track.TrackNumber, track.Language, track.LanguageCode, convertedType)); + converted.Subtitles.Add(new Subtitle(track.SubtitleSourceInt, track.TrackNumber, track.Language, track.LanguageCode, convertedType, track.CanBurn, track.CanSetForcedOnly)); } titleList.Add(converted); -- 2.40.0