diff options
author | sr55 <[email protected]> | 2021-02-04 20:14:32 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2021-02-04 20:14:32 +0000 |
commit | 8ac490e3e147c84a01d7679c22ba817eba84880f (patch) | |
tree | 7500fa96a36b7522eba0c65eafa00a50098ed0ee /win/CS/HandBrakeWPF | |
parent | e4d9f3313c700acf9d8522aa270d96e806304693 (diff) |
WinGui: HandBrake.Interop API change/cleanup. Making the structs internal to avoid them being exposed to API consumers. This affects hb_geometry*, hb_sutitle*, NativeConstants
Diffstat (limited to 'win/CS/HandBrakeWPF')
22 files changed, 56 insertions, 435 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs deleted file mode 100644 index 613f3fce4..000000000 --- a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs +++ /dev/null @@ -1,222 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="PictureSize.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 PictureSize type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrakeWPF.Helpers
-{
- using HandBrake.Interop.Interop;
- using HandBrake.Interop.Interop.HbLib;
- using HandBrake.Interop.Interop.Model;
- using HandBrake.Interop.Interop.Model.Encoding;
-
- /// <summary>
- /// The picture size Helpers
- /// </summary>
- public class PictureSize
- {
- /// <summary>
- /// The picture settings job.
- /// </summary>
- public class PictureSettingsJob
- {
- /// <summary>
- /// Gets or sets the crop.
- /// </summary>
- public Cropping Crop { get; set; }
-
- /// <summary>
- /// Gets or sets the modulus.
- /// </summary>
- public int? Modulus { get; set; }
-
- /// <summary>
- /// Gets or sets the par w.
- /// </summary>
- public int ParW { get; set; }
-
- /// <summary>
- /// Gets or sets the par h.
- /// </summary>
- public int ParH { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether itu par.
- /// </summary>
- public bool ItuPar { get; set; }
-
- /// <summary>
- /// Gets or sets the width.
- /// </summary>
- public int Width { get; set; }
-
- /// <summary>
- /// Gets or sets the height.
- /// </summary>
- public int Height { get; set; }
-
- /// <summary>
- /// Gets or sets the anamorphic mode.
- /// </summary>
- public Anamorphic AnamorphicMode { get; set; }
-
- /// <summary>
- /// Gets or sets the max width.
- /// </summary>
- public int MaxWidth { get; set; }
-
- /// <summary>
- /// Gets or sets the max height.
- /// </summary>
- public int MaxHeight { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether keep display aspect.
- /// </summary>
- public bool KeepDisplayAspect { get; set; }
-
- /// <summary>
- /// Gets or sets the dar width.
- /// </summary>
- public int DarWidth { get; set; }
-
- /// <summary>
- /// Gets or sets the dar height.
- /// </summary>
- public int DarHeight { get; set; }
- }
-
- /// <summary>
- /// The picture settings title.
- /// </summary>
- public class PictureSettingsTitle
- {
- /// <summary>
- /// Gets or sets the width.
- /// </summary>
- public int Width { get; set; }
-
- /// <summary>
- /// Gets or sets the height.
- /// </summary>
- public int Height { get; set; }
-
- /// <summary>
- /// Gets or sets the par w.
- /// </summary>
- public int ParW { get; set; }
-
- /// <summary>
- /// Gets or sets the par h.
- /// </summary>
- public int ParH { get; set; }
-
- /// <summary>
- /// Gets or sets the aspect.
- /// </summary>
- public double Aspect { get; set; }
- }
-
- /// <summary>
- /// The anamorphic result.
- /// </summary>
- public class AnamorphicResult
- {
- /// <summary>
- /// Gets or sets the output width.
- /// </summary>
- public int OutputWidth { get; set; }
-
- /// <summary>
- /// Gets or sets the output height.
- /// </summary>
- public int OutputHeight { get; set; }
-
- /// <summary>
- /// Gets or sets the output par width.
- /// </summary>
- public double OutputParWidth { get; set; }
-
- /// <summary>
- /// Gets or sets the output par height.
- /// </summary>
- public double OutputParHeight { get; set; }
- }
-
- /// <summary>
- /// The keep setting.
- /// </summary>
- public enum KeepSetting
- {
- HB_KEEP_WIDTH = 0x01,
- HB_KEEP_HEIGHT = 0x02,
- HB_KEEP_DISPLAY_ASPECT = 0x04
- }
-
- /// <summary>
- /// The hb_set_anamorphic_size 2.
- /// </summary>
- /// <param name="job">
- /// The job.
- /// </param>
- /// <param name="title">
- /// The title.
- /// </param>
- /// <param name="setting">
- /// The setting.
- /// </param>
- /// <returns>
- /// The <see cref="AnamorphicResult"/>.
- /// </returns>
- public static AnamorphicResult hb_set_anamorphic_size2(PictureSettingsJob job, PictureSettingsTitle title, KeepSetting setting)
- {
- int settingMode = (int)setting + (job.KeepDisplayAspect ? 0x04 : 0);
-
-
- hb_rational_t computed_par = new hb_rational_t();
- switch (job.AnamorphicMode)
- {
- case Anamorphic.None:
- computed_par = new hb_rational_t { den = 1, num = 1 };
- break;
- case Anamorphic.Custom:
- computed_par = new hb_rational_t { den = job.ParH, num = job.ParW };
- break;
- default:
- computed_par = new hb_rational_t { den = title.ParH, num = title.ParW };
- break;
- }
-
- hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s
- {
- crop = new[] { job.Crop.Top, job.Crop.Bottom, job.Crop.Left, job.Crop.Right },
- itu_par = 0,
- keep = settingMode,
- maxWidth = job.MaxWidth,
- maxHeight = job.MaxHeight,
- mode = (int)job.AnamorphicMode,
- modulus = job.Modulus.HasValue ? job.Modulus.Value : 16,
- geometry = new hb_geometry_s { height = job.Height, width = job.Width, par = computed_par }
- };
-
- hb_geometry_s sourceGeometry = new hb_geometry_s
- {
- width = title.Width,
- height = title.Height,
- par = new hb_rational_t { den = title.ParH, num = title.ParW }
- };
-
- hb_geometry_s result = HandBrakePictureHelpers.GetAnamorphicSizes(sourceGeometry, uiGeometry);
-
- int outputWidth = result.width;
- int outputHeight = result.height;
- int outputParWidth = result.par.num;
- int outputParHeight = result.par.den;
- return new AnamorphicResult { OutputWidth = outputWidth, OutputHeight = outputHeight, OutputParWidth = outputParWidth, OutputParHeight = outputParHeight };
- }
- }
-}
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs index ca70b1b43..312331ae7 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/Resources.Designer.cs @@ -1340,17 +1340,6 @@ namespace HandBrakeWPF.Properties { } /// <summary> - /// Looks up a localized string similar to Warning: If you wish to have subtitles added to each item you are about to queue, please verify that you have the subtitle defaults setup correctly on the subtitles tab. - /// - ///Do you wish to continue?. - /// </summary> - public static string Main_AutoAdd_AudioAndSubWarning { - get { - return ResourceManager.GetString("Main_AutoAdd_AudioAndSubWarning", resourceCulture); - } - } - - /// <summary> /// Looks up a localized string similar to Do you wish to proceed trying to add the rest?. /// </summary> public static string Main_ContinueAddingToQueue { diff --git a/win/CS/HandBrakeWPF/Properties/Resources.co.resx b/win/CS/HandBrakeWPF/Properties/Resources.co.resx index f3b21fe7d..6ca91ac24 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.co.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.co.resx @@ -181,11 +181,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</value> <data name="Error" xml:space="preserve"> <value>Sbagliu</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Avertimentu : s’è vo vulete chì sottutituli sianu aghjunti à ogni elementu chì vo site prontu à mette in fila d’attesa, verificate chì i parametri predefiniti di i sottutituli sianu currettamente cunfigurati in l’unghjetta Sottutituli. - -Vulete cuntinuà ?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Ci vole à attivà u numinà autumaticu di i schedarii È sceglie un chjassu predefinitu in e preferenze nanzu di pudè aghjunghje à a fila d’attesa.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.de.resx b/win/CS/HandBrakeWPF/Properties/Resources.de.resx index 18c5d8d27..e19a9d746 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.de.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.de.resx @@ -188,11 +188,6 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</value> <data name="Error" xml:space="preserve"> <value>Fehler</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Warnung: Wenn jedem Objekt, das in die Warteschlange aufgenommen werden soll, Untertitel hinzugefügt werden sollen, dann sollte vorher geprüft werden, dass die Standardeinstellungen für Untertitel im Untertitel-Tab richtig eingestellt sind. - -Trotzdem fortfahren?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Die automatische Dateibenennung muss aktiviert sein UND es muss ein Standardpfad in den Einstellungen vorgegeben sein, bevor es der Warteschlange hinzugefügt werden kann.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.es.resx b/win/CS/HandBrakeWPF/Properties/Resources.es.resx index 1c49fd8e2..bf9059ddf 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.es.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.es.resx @@ -185,11 +185,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, EE. UU <data name="Error" xml:space="preserve"> <value>Error</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Advertencia: Si desea agregar subtítulos a todos lo que está por ser puesto en cola, por favor verifique si los ajustes son correctos en la pestaña de subtítulos. - -¿Desea continuar?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Debe activar el nombrado automático de archivos Y TAMBIÉN establecer un directorio por defecto en los ajustes antes de poder agregar a la cola.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.fr.resx b/win/CS/HandBrakeWPF/Properties/Resources.fr.resx index e0b081227..fb3738c55 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.fr.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.fr.resx @@ -185,11 +185,6 @@ avec ce programme; sinon écrivez à la Free Software Foundation, Inc., <data name="Error" xml:space="preserve"> <value>Erreur</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Attention : Si vous souhaitez que des sous-titres soient ajoutés à chaque élément que vous êtes sur le point de mettre en file d'attente, vérifiez que les paramètres par défaut des sous-titres soient correctement configurés dans l'onglet Sous-titres. - -Souhaitez-vous continuer ?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Vous devez activer le nommage automatique des fichiers ET définir un chemin par défaut dans les préférences avant de pouvoir ajouter à la file.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.ja.resx b/win/CS/HandBrakeWPF/Properties/Resources.ja.resx index c616a236f..fd419722e 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.ja.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.ja.resx @@ -182,11 +182,6 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 021 <data name="Error" xml:space="preserve"> <value>エラー</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>警告:キューに入れようとしている各アイテムに字幕を追加する場合は、[字幕]タブで字幕のデフォルト設定が正しく設定されていることを確認してください。 - -続けますか?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>キューに追加する前に自動ファイル名を設定し、かつ、既定の保存先を設定から設定しなければいけません。</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.ko.resx b/win/CS/HandBrakeWPF/Properties/Resources.ko.resx index 4d643bc1c..c6a0655e0 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.ko.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.ko.resx @@ -184,11 +184,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA라고 적으� <data name="Error" xml:space="preserve"> <value>에러</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>경고: 대기열에 있는 각각의 항목에 자막을 추가하고 싶다면 자막 탭에서 자막 기본 값이 올바르게 설정되었는지 확인하십시오. - -계속하시겠습니까?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>대기열에 추가하려면 우선적으로 자동 파일 이름 설정을 켜고 기본 경로를 설정해야만 합니다.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.pt-BR.resx b/win/CS/HandBrakeWPF/Properties/Resources.pt-BR.resx index 108415973..97905d8af 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.pt-BR.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.pt-BR.resx @@ -185,11 +185,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</ <data name="Error" xml:space="preserve"> <value>Erro</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Aviso: Se você quer adicionar legendas em cada item a ser enfileirado, verifique se a configuração de legenda padrão está correta na guia "Legendas". - -Você deseja continuar?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Você deve ativar a renomeação automática de arquivos E definir um caminho padrão nas preferências antes de poder adicionar à fila.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.resx b/win/CS/HandBrakeWPF/Properties/Resources.resx index 00069e88c..3b8f1877a 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.resx @@ -185,11 +185,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< <data name="Error" xml:space="preserve">
<value>Error</value>
</data>
- <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve">
- <value>Warning: If you wish to have subtitles added to each item you are about to queue, please verify that you have the subtitle defaults setup correctly on the subtitles tab.
-
-Do you wish to continue?</value>
- </data>
<data name="Main_TurnOnAutoFileNaming" xml:space="preserve">
<value>You must turn on automatic file naming AND set a default path in preferences before you can add to the queue.</value>
</data>
diff --git a/win/CS/HandBrakeWPF/Properties/Resources.ru.resx b/win/CS/HandBrakeWPF/Properties/Resources.ru.resx index 362e6e493..501220505 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.ru.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.ru.resx @@ -186,9 +186,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< <data name="Error" xml:space="preserve"> <value>Ошибка</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Внимание: Если вы хотите добавить субтитры для каждого из файлов, которые вы поместите в очередь, пожалуйста, убедитесь, что стандартные настройки правильно выбраны на вкладке субтитров.</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Вы должны включить автоматическое именование файлов, А ТАКЖЕ указать стандартный путь для сохранения в настройках перед добавлением заданий в очередь.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.tr.resx b/win/CS/HandBrakeWPF/Properties/Resources.tr.resx index aca670f8e..36183d99e 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.tr.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.tr.resx @@ -185,11 +185,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</ <data name="Error" xml:space="preserve"> <value>Hata</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Uyarı: Sıralamak üzere olduğunuz her öğeye altyazı eklenmesini istiyorsanız, lütfen altyazı varsayılan ayarlarının altyazılar sekmesinde doğru bir şekilde ayarlandığını doğrulayın. - -Devam etmek istiyor musun?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Otomatik dosya adlandırma özelliğini açmalısınız ve sıraya ekleyebilmeniz için tercihlerde varsayılan bir yol belirlemelisiniz.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.uk.resx b/win/CS/HandBrakeWPF/Properties/Resources.uk.resx index cd32201cc..95dabb067 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.uk.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.uk.resx @@ -185,11 +185,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< <data name="Error" xml:space="preserve"> <value>Помилка</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>Попередження: якщо ви хочете, щоб субтитри додались до кожного елемента що ви збираєтеся поставити в чергу, переконайтесь, що на вкладці субтитрів правильно налаштовано параметри за замовчуванням. - -Хочете продовжити?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>Ви повинні увімкнути у налаштуваннях автоматичне іменування файлів ТА встановити стандартний шлях, перш ніж зможете додати в чергу.</value> </data> diff --git a/win/CS/HandBrakeWPF/Properties/Resources.zh.resx b/win/CS/HandBrakeWPF/Properties/Resources.zh.resx index f8c689401..32278cfb1 100644 --- a/win/CS/HandBrakeWPF/Properties/Resources.zh.resx +++ b/win/CS/HandBrakeWPF/Properties/Resources.zh.resx @@ -182,11 +182,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< <data name="Error" xml:space="preserve"> <value>错误</value> </data> - <data name="Main_AutoAdd_AudioAndSubWarning" xml:space="preserve"> - <value>警告:如果您希望为要列队的每个项目添加字幕,请确认您在字幕选项卡上正确设置了字幕默认设置。 - -你想继续吗?</value> - </data> <data name="Main_TurnOnAutoFileNaming" xml:space="preserve"> <value>在添加到队列之前,必须启用自动文件命名并在首选项中设置默认路径。</value> </data> diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs index 26eca6b94..9cc904b94 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleTrack.cs @@ -273,7 +273,7 @@ namespace HandBrakeWPF.Services.Encode.Model.Models { if (this.SourceTrack != null) { - return this.SourceTrack.CanForce || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch; + return this.SourceTrack.CanForce || this.SourceTrack.IsFakeForeignAudioScanTrack; } return false; @@ -289,10 +289,15 @@ namespace HandBrakeWPF.Services.Encode.Model.Models { if (this.SourceTrack != null) { - return this.SourceTrack.CanBurnIn || this.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch || this.SubtitleType == SubtitleType.SRT; + return this.SourceTrack.CanBurnIn || this.SourceTrack.IsFakeForeignAudioScanTrack; } - if (this.SubtitleType == SubtitleType.SRT) + if (this.SubtitleType == SubtitleType.IMPORTSRT) + { + return true; + } + + if (this.SubtitleType == SubtitleType.IMPORTSSA) { return true; } diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleType.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleType.cs index 85f9bf473..e0bc7dd07 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleType.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/Models/SubtitleType.cs @@ -12,27 +12,35 @@ namespace HandBrakeWPF.Services.Encode.Model.Models using System.ComponentModel; /// <summary> - /// Subtitle Type. + /// Note this must be kept up to date with HandBrake.Interop.Interop.HbLib.hb_subtitle_s_subsource /// </summary> public enum SubtitleType { - [Description("SSA")] - SSA, - [Description("SRT")] - SRT, [Description("VobSub")] VobSub, - [Description("CC")] - CC, + + [Description("CC608SUB")] + CC608, + + [Description("CC708SUB")] + CC708, + [Description("UTF8")] UTF8Sub, + [Description("TX3G")] TX3G, + + [Description("SSA")] + SSA, + [Description("PGS")] PGS, - [Description("Unknown")] - Unknown, - [Description("Foreign Audio Search")] - ForeignAudioSearch, // Special Type for Foreign Audio Search + + [Description("IMPORTED SRT")] + IMPORTSRT, + + [Description("IMPORTED SSA")] + IMPORTSSA, } }
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs b/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs index 495c9a8c6..5a131cc90 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs @@ -64,38 +64,12 @@ namespace HandBrakeWPF.Services.Scan.Factories int currentSubtitleTrack = 1; foreach (SourceSubtitleTrack track in title.SubtitleList) { - SubtitleType convertedType = new SubtitleType(); - - switch (track.Source) - { - case (int)hb_subtitle_s_subsource.VOBSUB: - convertedType = SubtitleType.VobSub; - break; - case (int)hb_subtitle_s_subsource.CC608SUB: - case (int)hb_subtitle_s_subsource.CC708SUB: - convertedType = SubtitleType.CC; - break; - case (int)hb_subtitle_s_subsource.IMPORTSRT: - convertedType = SubtitleType.SRT; - break; - case (int)hb_subtitle_s_subsource.UTF8SUB: - convertedType = SubtitleType.UTF8Sub; - break; - case (int)hb_subtitle_s_subsource.TX3GSUB: - convertedType = SubtitleType.TX3G; - break; - case (int)hb_subtitle_s_subsource.SSASUB: - convertedType = SubtitleType.SSA; - break; - case (int)hb_subtitle_s_subsource.PGSSUB: - convertedType = SubtitleType.PGS; - break; - } - + SubtitleType convertedType = (SubtitleType)track.Source; + bool canBurn = HandBrakeSubtitleHelpers.CheckCanBurnSubtitle(track.Source) > 0; bool canSetForcedOnly = HandBrakeSubtitleHelpers.CheckCanForceSubtitle(track.Source) > 0; - converted.Subtitles.Add(new Subtitle(track.Source, currentSubtitleTrack, track.Language, track.LanguageCode, convertedType, canBurn, canSetForcedOnly, track.Name)); + converted.Subtitles.Add(new Subtitle(track.Source, currentSubtitleTrack, track.Language, track.LanguageCode, convertedType, canBurn, canSetForcedOnly, track.Name, false)); currentSubtitleTrack++; } diff --git a/win/CS/HandBrakeWPF/Services/Scan/Model/Subtitle.cs b/win/CS/HandBrakeWPF/Services/Scan/Model/Subtitle.cs index ff3b946a9..22187eaae 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/Model/Subtitle.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/Model/Subtitle.cs @@ -23,9 +23,6 @@ namespace HandBrakeWPF.Services.Scan.Model /// </summary> public class Subtitle { - /// <summary> - /// Initializes a new instance of the <see cref="Subtitle"/> class. - /// </summary> public Subtitle() { } @@ -35,10 +32,7 @@ namespace HandBrakeWPF.Services.Scan.Model this.SourceId = sourceId; } - /// <summary> - /// Initializes a new instance of the <see cref="Subtitle"/> class. - /// </summary> - public Subtitle(int sourceId, int trackNumber, string language, string languageCode, SubtitleType subtitleType, bool canBurn, bool canForce, string name) + public Subtitle(int sourceId, int trackNumber, string language, string languageCode, SubtitleType subtitleType, bool canBurn, bool canForce, string name, bool isFakeForeignAudioScanTrack) { this.SourceId = sourceId; this.TrackNumber = trackNumber; @@ -48,32 +42,17 @@ namespace HandBrakeWPF.Services.Scan.Model this.CanBurnIn = canBurn; this.CanForce = canForce; this.Name = name; + this.IsFakeForeignAudioScanTrack = isFakeForeignAudioScanTrack; } - /// <summary> - /// Gets or sets the source id. - /// </summary> public int SourceId { get; set; } - /// <summary> - /// Gets or sets the track number of this Subtitle - /// </summary> public int TrackNumber { get; set; } - /// <summary> - /// Gets or sets the The language (if detected) of this Subtitle - /// </summary> public string Language { get; set; } - /// <summary> - /// Gets or sets the Language Code - /// </summary> public string LanguageCode { get; set; } - /// <summary> - /// Gets the language code clean. - /// TODO Remove this after fixing language code. - /// </summary> public string LanguageCodeClean { get @@ -87,28 +66,16 @@ namespace HandBrakeWPF.Services.Scan.Model } } - /// <summary> - /// Gets a value indicating whether can burn in. - /// </summary> - [XmlIgnore] public bool CanBurnIn { get; private set; } - /// <summary> - /// Gets a value indicating whether can force. - /// </summary> - [XmlIgnore] public bool CanForce { get; private set; } - /// <summary> - /// Gets or sets the Subtitle Type - /// </summary> public SubtitleType SubtitleType { get; set; } public string Name { get; set; } - /// <summary> - /// Gets Subtitle Type - /// </summary> + public bool IsFakeForeignAudioScanTrack { get; set; } + public string TypeString { get @@ -117,44 +84,26 @@ namespace HandBrakeWPF.Services.Scan.Model } } - /// <summary> - /// Override of the ToString method to make this object easier to use in the UI - /// </summary> - /// <returns>A string formatted as: {track #} {language}</returns> public override string ToString() { - return this.SubtitleType == SubtitleType.ForeignAudioSearch ? Resources.Subtitle_ForeignAudioScan : string.Format("{0} {1}", this.TrackNumber, this.Language); + return this.IsFakeForeignAudioScanTrack ? Resources.Subtitle_ForeignAudioScan : string.Format("{0} {1}", this.TrackNumber, this.Language); } - /// <summary> - /// The equals. - /// </summary> - /// <param name="other"> - /// The other. - /// </param> - /// <returns> - /// The System.Boolean. - /// </returns> public bool Equals(Subtitle other) { if (ReferenceEquals(null, other)) { return false; } + if (ReferenceEquals(this, other)) { return true; } + return other.TrackNumber == this.TrackNumber && object.Equals(other.Language, this.Language) && object.Equals(other.LanguageCode, this.LanguageCode) && object.Equals(other.SubtitleType, this.SubtitleType); } - /// <summary> - /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>. - /// </summary> - /// <returns> - /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false. - /// </returns> - /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority> public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) @@ -175,13 +124,6 @@ namespace HandBrakeWPF.Services.Scan.Model return this.Equals((Subtitle)obj); } - /// <summary> - /// Serves as a hash function for a particular type. - /// </summary> - /// <returns> - /// A hash code for the current <see cref="T:System.Object"/>. - /// </returns> - /// <filterpriority>2</filterpriority> public override int GetHashCode() { unchecked diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 02a9c4d19..f0fc67745 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1105,24 +1105,6 @@ namespace HandBrakeWPF.ViewModels }
}
- if (this.CurrentTask != null && this.CurrentTask.SubtitleTracks != null && this.CurrentTask.SubtitleTracks.Count > 0)
- {
- if ((this.SubtitleViewModel.SubtitleBehaviours == null || this.SubtitleViewModel.SubtitleBehaviours.SelectedBehaviour == SubtitleBehaviourModes.None)
- && !(this.CurrentTask.SubtitleTracks.Count == 1 && this.CurrentTask.SubtitleTracks.First().SubtitleType == SubtitleType.ForeignAudioSearch))
- {
- MessageBoxResult result = this.errorService.ShowMessageBox(
- Resources.Main_AutoAdd_AudioAndSubWarning,
- Resources.Warning,
- MessageBoxButton.YesNo,
- MessageBoxImage.Warning);
-
- if (result == MessageBoxResult.No)
- {
- return;
- }
- }
- }
-
foreach (Title title in this.ScannedSource.Titles)
{
this.SelectedTitle = title;
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index f816192b9..ce69012f6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -15,6 +15,7 @@ namespace HandBrakeWPF.ViewModels using System.Globalization;
using HandBrake.Interop.Interop;
+ using HandBrake.Interop.Interop.Interfaces.Model;
using HandBrake.Interop.Interop.Model;
using HandBrake.Interop.Interop.Model.Encoding;
@@ -682,9 +683,9 @@ namespace HandBrakeWPF.ViewModels this.SetSelectedPictureSettingsResLimitMode();
}
- private PictureSize.PictureSettingsTitle GetPictureTitleInfo()
+ private PictureSettingsTitle GetPictureTitleInfo()
{
- PictureSize.PictureSettingsTitle title = new PictureSize.PictureSettingsTitle
+ PictureSettingsTitle title = new PictureSettingsTitle
{
Width = this.sourceResolution.Width,
Height = this.sourceResolution.Height,
@@ -695,9 +696,9 @@ namespace HandBrakeWPF.ViewModels return title;
}
- private PictureSize.PictureSettingsJob GetPictureSettings(ChangedPictureField changedField)
+ private PictureSettingsJob GetPictureSettings(ChangedPictureField changedField)
{
- PictureSize.PictureSettingsJob job = new PictureSize.PictureSettingsJob
+ PictureSettingsJob job = new PictureSettingsJob
{
Width = this.Width,
Height = this.Height,
@@ -763,19 +764,19 @@ namespace HandBrakeWPF.ViewModels }
// Choose which setting to keep.
- PictureSize.KeepSetting setting = PictureSize.KeepSetting.HB_KEEP_WIDTH;
+ HandBrakePictureHelpers.KeepSetting setting = HandBrakePictureHelpers.KeepSetting.HB_KEEP_WIDTH;
switch (changedField)
{
case ChangedPictureField.Width:
- setting = PictureSize.KeepSetting.HB_KEEP_WIDTH;
+ setting = HandBrakePictureHelpers.KeepSetting.HB_KEEP_WIDTH;
break;
case ChangedPictureField.Height:
- setting = PictureSize.KeepSetting.HB_KEEP_HEIGHT;
+ setting = HandBrakePictureHelpers.KeepSetting.HB_KEEP_HEIGHT;
break;
}
// Step 2, For the changed field, call hb_set_anamorphic_size and process the results.
- PictureSize.AnamorphicResult result = PictureSize.hb_set_anamorphic_size2(this.GetPictureSettings(changedField), this.GetPictureTitleInfo(), setting);
+ AnamorphicResult result = HandBrakePictureHelpers.hb_set_anamorphic_size2(this.GetPictureSettings(changedField), this.GetPictureTitleInfo(), setting);
double dispWidth = Math.Round((result.OutputWidth * result.OutputParWidth / result.OutputParHeight), 0);
this.Task.Width = result.OutputWidth;
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 79ca95447..65d0496c6 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -489,7 +489,7 @@ namespace HandBrakeWPF.ViewModels SubtitleTrack scanTrack = null;
foreach (var track in encodeTask.SubtitleTracks)
{
- if (track.SourceTrack != null && track.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch)
+ if (track.SourceTrack != null && track.SourceTrack.IsFakeForeignAudioScanTrack)
{
scanTrack = track;
break;
diff --git a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs index d59add6e4..9e6f22710 100644 --- a/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/SubtitlesViewModel.cs @@ -72,7 +72,7 @@ namespace HandBrakeWPF.ViewModels this.Langauges = LanguageUtilities.MapLanguages().Keys;
this.CharacterCodes = CharCodesUtilities.GetCharacterCodes();
- this.foreignAudioSearchTrack = new Subtitle { SubtitleType = SubtitleType.ForeignAudioSearch, Language = Resources.SubtitleViewModel_ForeignAudioSearch };
+ this.foreignAudioSearchTrack = new Subtitle { IsFakeForeignAudioScanTrack = true, Language = Resources.SubtitleViewModel_ForeignAudioSearch };
this.SourceTracks = new List<Subtitle> { this.foreignAudioSearchTrack };
}
@@ -177,7 +177,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void AddAllClosedCaptions()
{
- foreach (Subtitle subtitle in this.SourceTitlesSubset(null).Where(s => s.SubtitleType == SubtitleType.CC))
+ foreach (Subtitle subtitle in this.SourceTitlesSubset(null).Where(s => s.SubtitleType == SubtitleType.CC608 || s.SubtitleType == SubtitleType.CC708))
{
this.Add(subtitle);
}
@@ -376,7 +376,7 @@ namespace HandBrakeWPF.ViewModels case SubtitleBurnInBehaviourModes.None:
foreach (var track in this.Task.SubtitleTracks)
{
- if (track.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch)
+ if (track.SourceTrack.IsFakeForeignAudioScanTrack)
{
track.Forced = true;
break;
@@ -388,7 +388,7 @@ namespace HandBrakeWPF.ViewModels foreach (var track in this.Task.SubtitleTracks)
{
// Set the Foreign Audio Track to burned-in
- if (track.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch)
+ if (track.SourceTrack.IsFakeForeignAudioScanTrack)
{
track.Burned = true;
track.Forced = true;
@@ -402,7 +402,7 @@ namespace HandBrakeWPF.ViewModels foreach (var track in this.Task.SubtitleTracks)
{
// Foreign Audio Search is always first in the list.
- if (track.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch)
+ if (track.SourceTrack.IsFakeForeignAudioScanTrack)
{
track.Forced = true;
continue;
@@ -429,7 +429,7 @@ namespace HandBrakeWPF.ViewModels }
// But if there is a foreign audio track, prefer this to the first.
- if (track.SourceTrack.SubtitleType == SubtitleType.ForeignAudioSearch)
+ if (track.SourceTrack.IsFakeForeignAudioScanTrack)
{
track.Burned = true;
track.Forced = true;
@@ -654,7 +654,7 @@ namespace HandBrakeWPF.ViewModels ?? ((this.SourceTracks != null)
? (this.SourceTracks.FirstOrDefault(l => l.Language == this.GetPreferredSubtitleTrackLanguage())
?? this.SourceTracks.FirstOrDefault(
- s => s.SubtitleType != SubtitleType.ForeignAudioSearch))
+ s => !s.IsFakeForeignAudioScanTrack))
: null);
if (source == null)
@@ -672,7 +672,7 @@ namespace HandBrakeWPF.ViewModels if (this.SubtitleBehaviours.SelectedBurnInBehaviour == SubtitleBurnInBehaviourModes.ForeignAudio
|| this.SubtitleBehaviours.SelectedBurnInBehaviour == SubtitleBurnInBehaviourModes.ForeignAudioPreferred)
{
- if (subtitle != null && subtitle.SubtitleType == SubtitleType.ForeignAudioSearch)
+ if (subtitle != null && subtitle.IsFakeForeignAudioScanTrack)
{
track.Burned = true;
this.SetBurnedToFalseForAllExcept(track);
@@ -775,7 +775,7 @@ namespace HandBrakeWPF.ViewModels SrtOffset = 0,
SrtCharCode = "UTF-8",
SrtLang = "English",
- SubtitleType = SubtitleType.SRT,
+ SubtitleType = SubtitleType.IMPORTSRT,
SrtPath = srtFile
};
this.Task.SubtitleTracks.Add(track);
|