summaryrefslogtreecommitdiffstats
path: root/win/CS/Controls
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-04-29 00:33:13 +0000
committersr55 <[email protected]>2012-04-29 00:33:13 +0000
commitc412ca81dd55d568c362ddef07de52dab90fcf4d (patch)
treec1c48828d8b7efaecd086f7875594c4532de3dbb /win/CS/Controls
parent78a297cb5580f37bca62cd660d3a04a72bcf7681 (diff)
WinGui: Basic support for PGS subtitles in the forms UI.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4612 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/Controls')
-rw-r--r--win/CS/Controls/Subtitles.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/win/CS/Controls/Subtitles.cs b/win/CS/Controls/Subtitles.cs
index 1775f3b6e..88e97b7fb 100644
--- a/win/CS/Controls/Subtitles.cs
+++ b/win/CS/Controls/Subtitles.cs
@@ -16,6 +16,7 @@ namespace Handbrake.Controls
using HandBrake.ApplicationServices;
using HandBrake.ApplicationServices.Model.Encoding;
+ using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Utilities;
@@ -46,6 +47,10 @@ namespace Handbrake.Controls
/// </summary>
private static readonly IUserSettingService UserSettingService = ServiceManager.UserSettingService;
+ /// <summary>
+ /// The current output extension
+ /// </summary>
+ private string currentOutputExtension;
#endregion
/// <summary>
@@ -191,6 +196,17 @@ namespace Handbrake.Controls
}
/// <summary>
+ /// Set the current extension to allow this window to behave correctly based on extension.
+ /// </summary>
+ /// <param name="extension">
+ /// The extension.
+ /// </param>
+ public void SetExtension(string extension)
+ {
+ currentOutputExtension = extension.Replace(".", string.Empty);
+ }
+
+ /// <summary>
/// Automatically setup the subtitle tracks.
/// This handles the automatic setup of subitles which the user can control from the program options
/// </summary>
@@ -401,6 +417,24 @@ namespace Handbrake.Controls
SrtFileName = srtFile
};
+ track.SubtitleType = ((Subtitle)drp_subtitleTracks.SelectedItem).SubtitleType;
+
+ if (currentOutputExtension.Equals("mp4", StringComparison.InvariantCultureIgnoreCase) ||
+ currentOutputExtension.Equals("m4v", StringComparison.CurrentCultureIgnoreCase))
+ {
+ // Default it to burned as mp4 doesn't allow PGS
+ track.Burned = true;
+
+ // Check to make sure we don't have more than one PGS. Fail if we do.
+ if (this.subList.Any(item => item.SubtitleType == SubtitleType.PGS))
+ {
+ MessageBox.Show(
+ "You can only burn-in one PGS subtitle track into an MP4 file. You must first remove the current track to add a new one.",
+ "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+ }
+
lv_subList.Items.Add(track.ListView);
subList.Add(track);
}
@@ -417,14 +451,35 @@ namespace Handbrake.Controls
private void mnu_AddAll_Click(object sender, EventArgs e)
{
// TODO - Might need to be a bit more clever with this. Will wait and see if this causes any problems.
+ bool addedPGS = false;
foreach (object item in drp_subtitleTracks.Items)
{
+ Subtitle sub = item as Subtitle;
+
+ // PGS Handling.
+ if (addedPGS)
+ {
+ // Skip over any pgs tracks after we've added the first.
+ continue;
+ }
+
+ if (currentOutputExtension.Equals("mp4", StringComparison.InvariantCultureIgnoreCase) ||
+ currentOutputExtension.Equals("m4v", StringComparison.CurrentCultureIgnoreCase))
+ {
+ if (sub != null && sub.SubtitleType == SubtitleType.PGS)
+ {
+ addedPGS = true;
+ }
+ }
+
if (!item.ToString().Contains("Foreign Audio Search"))
{
drp_subtitleTracks.SelectedItem = item;
btn_addSubtitleTrack_Click(this, EventArgs.Empty);
}
}
+
+
}
/// <summary>