Skip to content

Commit

Permalink
Fixed the issues when adding audio tracks for multiple tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
LittlePox committed Aug 10, 2019
1 parent 28dc938 commit bde3976
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 2 additions & 6 deletions OKEGui/OKEGui/Gui/WizardWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ private bool LoadJsonProfile(string profile)
// 主音轨
wizardInfo.AudioFormat = okeProj.AudioTracks[0].OutputCodec.ToUpper();
wizardInfo.AudioBitrate = okeProj.AudioTracks[0].Bitrate;
wizardInfo.AudioTracks.Clear();

// 添加音频参数到任务里面
foreach (var track in okeProj.AudioTracks)
Expand Down Expand Up @@ -465,11 +466,6 @@ private void WizardFinish(object sender, RoutedEventArgs e)
{
// 使用正则解析模板, 多行忽略大小写
string[] inputTemplate = Constants.inputRegex.Split(wizardInfo.VSScript);
Debugger.Log(0, "", inputTemplate.Length.ToString() + "\n");
foreach (string s in inputTemplate)
{
Debugger.Log(0, "", s + "\n");
}
if (inputTemplate.Length < 4 && wizardInfo.InputFile.Count() > 1)
{
System.Windows.MessageBox.Show("任务创建失败!添加多个输入文件请确保VapourSynth脚本使用OKE提供的模板。", "新建任务向导", MessageBoxButton.OK, MessageBoxImage.Error);
Expand Down Expand Up @@ -535,7 +531,7 @@ private void WizardFinish(object sender, RoutedEventArgs e)

foreach (var audio in wizardInfo.AudioTracks)
{
td.AudioTracks.Add(audio);
td.AudioTracks.Add(audio.Clone() as AudioInfo);
}

// 更新输出文件拓展名
Expand Down
7 changes: 6 additions & 1 deletion OKEGui/OKEGui/Job/Interface/MediaFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public VideoInfo(uint width, uint height,
}

// 音轨信息
public class AudioInfo
public class AudioInfo : ICloneable
{
public int TrackId { get; set; }
public string SourceCodec { get; set; }
Expand All @@ -163,6 +163,11 @@ public class AudioInfo
public string Language { get; set; }
public string ExtraArg { get; set; }
public bool SkipMuxing { get; set; }

public Object Clone()
{
return this.MemberwiseClone() as AudioInfo;
}
}

/// <summary>
Expand Down

0 comments on commit bde3976

Please sign in to comment.