diff options
Diffstat (limited to 'win')
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;
}
|