summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-01-26 16:21:27 +0000
committersr55 <[email protected]>2013-01-26 16:21:27 +0000
commit97d4f114df3e35c559e7f1564a542631b55f2845 (patch)
treeaa31b44c0f5fbc952c1648edcf76107a8959874a /win
parent5aa8001465c0e94ac2470969613042bff221c6d4 (diff)
WinGui: Code Tidyup.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5206 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs43
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs39
3 files changed, 58 insertions, 25 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index 67cad52e5..866edb794 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -15,6 +15,8 @@ namespace HandBrake.ApplicationServices.Services.Base
using System.Text;
using System.Text.RegularExpressions;
+ using Caliburn.Micro;
+
using HandBrake.ApplicationServices.EventArgs;
using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
@@ -150,11 +152,15 @@ namespace HandBrake.ApplicationServices.Services.Base
/// </param>
public void InvokeEncodeStatusChanged(EncodeProgressEventArgs e)
{
- EncodeProgessStatus handler = this.EncodeStatusChanged;
- if (handler != null)
- {
- handler(this, e);
- }
+ Execute.OnUIThread(
+ () =>
+ {
+ EncodeProgessStatus handler = this.EncodeStatusChanged;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ });
}
/// <summary>
@@ -165,11 +171,15 @@ namespace HandBrake.ApplicationServices.Services.Base
/// </param>
public void InvokeEncodeCompleted(EncodeCompletedEventArgs e)
{
- EncodeCompletedStatus handler = this.EncodeCompleted;
- if (handler != null)
- {
- handler(this, e);
- }
+ Execute.OnUIThread(
+ () =>
+ {
+ EncodeCompletedStatus handler = this.EncodeCompleted;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ });
}
/// <summary>
@@ -180,11 +190,14 @@ namespace HandBrake.ApplicationServices.Services.Base
/// </param>
public void InvokeEncodeStarted(EventArgs e)
{
- EventHandler handler = this.EncodeStarted;
- if (handler != null)
- {
- handler(this, e);
- }
+ Execute.OnUIThread(() =>
+ {
+ EventHandler handler = this.EncodeStarted;
+ if (handler != null)
+ {
+ handler(this, e);
+ }
+ });
}
#endregion
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index f194700ed..320b96f1b 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -12,7 +12,6 @@ namespace HandBrake.ApplicationServices.Services
using System;
using System.Diagnostics;
- using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Base;
using HandBrake.ApplicationServices.Services.Interfaces;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
index 8f9260079..d5bcb930e 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
@@ -23,10 +23,6 @@ namespace HandBrake.ApplicationServices.Utilities
/// </summary>
public class InteropModelCreator
{
- /*
- * TODO: This conversion class needs to be finished off before libencode will work.
- */
-
/// <summary>
/// Get an EncodeJob model for a LibHB Encode.
/// </summary>
@@ -180,12 +176,37 @@ namespace HandBrake.ApplicationServices.Utilities
// job.SourceType = work.Type;
job.Title = work.Title;
- // TODO Setup subtitles
+ // Subtitles
job.Subtitles = new Subtitles { SourceSubtitles = new List<SourceSubtitle>(), SrtSubtitles = new List<SrtSubtitle>() };
- //foreach (SubtitleTrack track in work.SubtitleTracks)
- //{
- // // TODO
- //}
+ foreach (SubtitleTrack track in work.SubtitleTracks)
+ {
+ if (track.IsSrtSubtitle)
+ {
+ job.Subtitles.SrtSubtitles.Add(
+ new SrtSubtitle
+ {
+ CharacterCode = track.SrtCharCode,
+ Default = track.Default,
+ FileName = track.SrtFileName,
+ LanguageCode = track.SrtLang,
+ Offset = track.SrtOffset
+ });
+ }
+ else
+ {
+ if (track.SourceTrack != null)
+ {
+ job.Subtitles.SourceSubtitles.Add(
+ new SourceSubtitle
+ {
+ BurnedIn = track.Burned,
+ Default = track.Default,
+ Forced = track.Forced,
+ TrackNumber = track.SourceTrack.TrackNumber
+ });
+ }
+ }
+ }
return job;
}