summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Helpers
diff options
context:
space:
mode:
authorScott <[email protected]>2015-12-27 21:57:05 +0000
committerScott <[email protected]>2015-12-27 21:57:05 +0000
commite2a5481e83511c59a3322eadab2e71b9f0796cb7 (patch)
tree971464d9cb8039e65c88aaae3a3a8b41b42d3c80 /win/CS/HandBrakeWPF/Helpers
parent930039b3154fcbf919b77ca0448865467e352896 (diff)
WinGui: Some API and warnings cleanup.
Diffstat (limited to 'win/CS/HandBrakeWPF/Helpers')
-rw-r--r--win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs2
-rw-r--r--win/CS/HandBrakeWPF/Helpers/MP4Helper.cs49
-rw-r--r--win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs23
3 files changed, 66 insertions, 8 deletions
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
index 18f4a6392..a0fdbb0dc 100644
--- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs
@@ -116,7 +116,7 @@ namespace HandBrakeWPF.Helpers
switch (userSettingService.GetUserSetting<int>(UserSettingConstants.UseM4v))
{
case 0: // Automatic
- destinationFilename += task.IncludeChapterMarkers || task.RequiresM4v ? ".m4v" : ".mp4";
+ destinationFilename += task.IncludeChapterMarkers || MP4Helper.RequiresM4v(task) ? ".m4v" : ".mp4";
break;
case 1: // Always MP4
destinationFilename += ".mp4";
diff --git a/win/CS/HandBrakeWPF/Helpers/MP4Helper.cs b/win/CS/HandBrakeWPF/Helpers/MP4Helper.cs
new file mode 100644
index 000000000..78e3b5ee2
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Helpers/MP4Helper.cs
@@ -0,0 +1,49 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="MP4Helper.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 MP4Helper type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Helpers
+{
+ using System.Linq;
+
+ using HandBrakeWPF.Services.Encode.Model;
+ using HandBrakeWPF.Services.Encode.Model.Models;
+
+ /// <summary>
+ /// The MP4 Format helper class
+ /// </summary>
+ public class MP4Helper
+ {
+ /// <summary>
+ /// Gets a value indicating whether M4v extension is required.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ /// <returns>
+ /// The <see cref="bool"/> to indicate if this task requires m4v extension
+ /// </returns>
+ public static bool RequiresM4v(EncodeTask task)
+ {
+ if (task.OutputFormat == OutputFormat.Mp4)
+ {
+ bool audio =
+ task.AudioTracks.Any(
+ item =>
+ item.Encoder == AudioEncoder.Ac3Passthrough || item.Encoder == AudioEncoder.Ac3
+ || item.Encoder == AudioEncoder.DtsPassthrough || item.Encoder == AudioEncoder.Passthrough);
+
+ bool subtitles = task.SubtitleTracks.Any(track => track.SubtitleType != SubtitleType.VobSub);
+
+ return audio || subtitles;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs b/win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs
index 94d7629b9..816b9ca82 100644
--- a/win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs
+++ b/win/CS/HandBrakeWPF/Helpers/TimeSpanHelper.cs
@@ -1,12 +1,16 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="TimeSpanHelper.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>
+// Helper functions for handling <see cref="TimeSpan" /> structures
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Helpers
{
using System.Globalization;
+ using System;
/// <summary>
/// Helper functions for handling <see cref="TimeSpan"/> structures
@@ -16,10 +20,15 @@ namespace HandBrakeWPF.Helpers
/// <summary>
/// Parses chapter time start value from a chapter marker input file.
/// </summary>
- /// <param name="chapterStartRaw">The raw string value parsed from the input file</param>
+ /// <param name="chapterStartRaw">
+ /// The raw string value parsed from the input file
+ /// </param>
+ /// <returns>
+ /// The <see cref="TimeSpan"/>.
+ /// </returns>
internal static TimeSpan ParseChapterTimeStart(string chapterStartRaw)
{
- //Format: 02:35:05 and 02:35:05.2957333
+ // Format: 02:35:05 and 02:35:05.2957333
return TimeSpan.ParseExact(chapterStartRaw,
new[]
{