/// <summary> /// The create subtitle. /// </summary> /// <param name="job"> /// The job. /// </param> /// <returns> /// The <see cref="HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles"/>. /// </returns> private static Subtitle CreateSubtitle(EncodeTask job) { Subtitles subtitle = new Subtitles { Search = new SubtitleSearch { Enable = false, Default = false, Burn = false, Forced = false }, SubtitleList = new List<HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack>() }; foreach (HandBrake.ApplicationServices.Services.Encode.Model.Models.SubtitleTrack item in job.SubtitleTracks) { if (!item.IsSrtSubtitle) { // Handle Foreign Audio Search if (item.SourceTrack.TrackNumber == 0) { subtitle.Search.Enable = true; subtitle.Search.Burn = item.Burned; subtitle.Search.Default = item.Default; subtitle.Search.Forced = item.Forced; } else { HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack { Burn = item.Burned, Default = item.Default, Forced = item.Forced, ID = item.SourceTrack.TrackNumber, Track = (item.SourceTrack.TrackNumber - 1) }; subtitle.SubtitleList.Add(track); } } else { HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack { Track = -1, // Indicates SRT Default = item.Default, Offset = item.SrtOffset, Burn = item.Burned, SRT = new SRT { Filename = item.SrtPath, Codeset = item.SrtCharCode, Language = item.SrtLang } }; subtitle.SubtitleList.Add(track); } } return subtitle; }
/// <summary> /// The create subtitle. /// </summary> /// <param name="job"> /// The job. /// </param> /// <returns> /// The <see cref="HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles"/>. /// </returns> private static Subtitle CreateSubtitle(EncodeTask job) { Subtitles subtitle = new Subtitles { Search = new SubtitleSearch { Enable = false, Default = false, Burn = false, Forced = false }, SubtitleList = new List <HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack>() }; foreach (HandBrake.ApplicationServices.Services.Encode.Model.Models.SubtitleTrack item in job.SubtitleTracks) { if (!item.IsSrtSubtitle) { // Handle Foreign Audio Search if (item.SourceTrack.TrackNumber == 0) { subtitle.Search.Enable = true; subtitle.Search.Burn = item.Burned; subtitle.Search.Default = item.Default; subtitle.Search.Forced = item.Forced; } else { HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack { Burn = item.Burned, Default = item.Default, Forced = item.Forced, ID = item.SourceTrack.TrackNumber, Track = (item.SourceTrack.TrackNumber - 1) }; subtitle.SubtitleList.Add(track); } } else { HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack { Track = -1, // Indicates SRT Default = item.Default, Offset = item.SrtOffset, Burn = item.Burned, SRT = new SRT { Filename = item.SrtPath, Codeset = item.SrtCharCode, Language = item.SrtLang } }; subtitle.SubtitleList.Add(track); } } return(subtitle); }