Skip to content

Commit 74d6f6f

Browse files
committed
1. Further refine the detection of unnecessary chapter node
2. Added detection of HEVC video track, FLAC audio track and AAC audio track. 3. Fixed a bug on numa scheduling.
1 parent 076d330 commit 74d6f6f

File tree

9 files changed

+48
-7
lines changed

9 files changed

+48
-7
lines changed

OKEGui/OKEGui/Gui/MainWindow.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public MainWindow()
3535

3636
wm = new WorkerManager(tm);
3737

38+
BtnRun.IsEnabled = false;
3839
BtnMoveDown.IsEnabled = false;
3940
BtnMoveup.IsEnabled = false;
4041
BtnStop.IsEnabled = false;

OKEGui/OKEGui/JobProcessor/Chapter/ChapterChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void RemoveUnnecessaryEnd()
7070
foreach (KeyValuePair<string, string> chapter in Chapters)
7171
{
7272
long timeInMiliSec = StrToMilisec(chapter.Key);
73-
if (timeInMiliSec > LengthInMiliSec - 1000)
73+
if (timeInMiliSec >= LengthInMiliSec - 1001)
7474
{
7575
Logger.Info(chapter.Value + ":" + chapter.Key + "的时间在文件结尾1秒内,删除。");
7676
toRemove.Add(chapter.Key);

OKEGui/OKEGui/JobProcessor/Demuxer/EACDemuxer.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ public EacOutputTrackType(TrackCodec codec, string rawOutput, string extension,
6363
new EacOutputTrackType(TrackCodec.TRUEHD_AC3, "TrueHD/AC3", "flac", true, TrackType.Audio),
6464
new EacOutputTrackType(TrackCodec.TRUEHD_AC3, "TrueHD", "flac", true, TrackType.Audio),
6565
new EacOutputTrackType(TrackCodec.AC3, "AC3", "ac3", true, TrackType.Audio),
66+
new EacOutputTrackType(TrackCodec.FLAC, "FLAC", "flac", true, TrackType.Audio),
67+
new EacOutputTrackType(TrackCodec.AAC, "AAC", "aac", true, TrackType.Audio),
68+
new EacOutputTrackType(TrackCodec.AC3, "AC3", "ac3", true, TrackType.Audio),
6669
new EacOutputTrackType(TrackCodec.DTS, "DTS", "dts", true, TrackType.Audio),
6770
new EacOutputTrackType(TrackCodec.MPEG2, "MPEG2", "m2v", false, TrackType.Video),
6871
new EacOutputTrackType(TrackCodec.H264_AVC, "h264/AVC", "h264", false, TrackType.Video),
72+
new EacOutputTrackType(TrackCodec.H265_HEVC, "h265/HEVC", "265", false, TrackType.Video),
6973
new EacOutputTrackType(TrackCodec.PGS, "Subtitle (PGS)", "sup", true, TrackType.Subtitle),
7074
new EacOutputTrackType(TrackCodec.Chapter, "Chapters", "txt", true, TrackType.Chapter),
7175
};
@@ -415,8 +419,15 @@ public MediaFile Extract(Action<double, EACProgressType> progressCallback)
415419
mf.AddTrack(new SubtitleTrack(file, subInfo));
416420
break;
417421
case TrackType.Chapter:
418-
//TODO: 暂时不加入原盘自带的章节,否则无法检测末端多余章节点。
419-
//mf.AddTrack(new ChapterTrack(file));
422+
FileInfo txtChapter = new FileInfo(Path.ChangeExtension(sourceFile, ".txt"));
423+
if (txtChapter.Exists)
424+
{
425+
Logger.Info("检测到单独准备的章节,不予添加");
426+
}
427+
else
428+
{
429+
file.Rename(txtChapter.FullName);
430+
}
420431
break;
421432
case TrackType.Video:
422433
mf.AddTrack(new VideoTrack(file, new VideoInfo()));

OKEGui/OKEGui/JobProcessor/Demuxer/TrackInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ public enum TrackCodec
1111
Unknown,
1212
MPEG2,
1313
H264_AVC,
14+
H265_HEVC,
1415
RAW_PCM,
16+
FLAC,
17+
AAC,
1518
DTSMA,
1619
TRUEHD_AC3,
1720
AC3,

OKEGui/OKEGui/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
4848
// 方法是按如下所示使用“*”: :
4949
// [assembly: AssemblyVersion("1.0.*")]
50-
[assembly: AssemblyVersion("4.10.*")]
50+
[assembly: AssemblyVersion("4.11.*")]

OKEGui/OKEGui/Task/TaskManager.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,23 @@ public bool HasNextTask()
128128

129129
return false;
130130
}
131+
132+
public int GetActiveTaskCount()
133+
{
134+
lock (o)
135+
{
136+
int activeTaskCount = 0;
137+
138+
foreach (var task in taskStatus)
139+
{
140+
if (task.IsEnabled)
141+
{
142+
activeTaskCount ++;
143+
}
144+
}
145+
146+
return activeTaskCount;
147+
}
148+
}
131149
}
132150
}

OKEGui/OKEGui/Worker/ExecuteTaskService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private void WorkerDoWork(object sender, DoWorkEventArgs e)
217217
processor = new X264Encoder(videoJob);
218218
}
219219

220-
lengthInMiliSec = (long)(processor.NumberOfFrames / videoJob.Fps * 1000 + 0.5);
220+
lengthInMiliSec = (long)((processor.NumberOfFrames - 1) / videoJob.Fps * 1000 + 0.5);
221221

222222
task.CurrentStatus = "压制中";
223223
task.ProgressValue = 0.0;

OKEGui/OKEGui/Worker/WorkerManager.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public void AddTask(TaskDetail detail)
6161
{
6262
CreateWorker(worker);
6363
StartWorker(worker);
64+
break;
6465
}
6566
}
6667
}
@@ -75,14 +76,20 @@ public bool Start()
7576
return false;
7677
}
7778

79+
int activeTaskCount = tm.GetActiveTaskCount();
7880
isRunning = true;
7981

8082
foreach (string worker in workerList)
8183
{
84+
if (activeTaskCount == 0)
85+
{
86+
break;
87+
}
8288
if (!bgworkerlist.ContainsKey(worker))
8389
{
8490
CreateWorker(worker);
8591
StartWorker(worker);
92+
activeTaskCount--;
8693
}
8794
}
8895

@@ -117,6 +124,7 @@ public bool StartWorker(string name)
117124
args.taskManager = tm;
118125
args.bgWorker = worker;
119126
args.numaNode = NumaNode.NextNuma();
127+
Logger.Trace(name + "所拥有的Numa Node编号是" + args.numaNode.ToString());
120128

121129
worker.RunWorkerAsync(args);
122130
return true;

OKEGui/OKEGui/demo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
],
2525
"Config" : {
2626
"VspipeArgs" : [
27-
"op_start = 10000",
28-
"op_end = 15000"
27+
"op_start=10000",
28+
"op_end=15000"
2929
]
3030
}
3131
}

0 commit comments

Comments
 (0)