Skip to content

Commit eb29e53

Browse files
authored
v1.1.0
1 parent bce8ced commit eb29e53

21 files changed

+422
-52
lines changed

Arguments/AudioArgs.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,22 @@ QString Argument::AudioRate(QString rate, QString stream) {
1313
/// Sets the audio title for a specific audio stream.
1414
/// </summary>
1515
/// <param name="stream">The stream file specifier.</param>
16-
/// <param name="stream2">The audio stream specifier.</param>
1716
/// <param name="title">The contents to be added to the title.</param>
1817
/// <returns>String representation of the argument.</returns>
1918
QString Argument::AudioTitle(QString stream, QString title) {
2019
return QString(" -metadata:s:a:%1 title=\"%2\"").arg(stream).arg(title);
2120
}
2221

22+
/// <summary>
23+
/// Sets the audio language for a specific audio stream.
24+
/// </summary>
25+
/// <param name="stream">The stream file specifier.</param>
26+
/// <param name="lang">The language.</param>
27+
/// <returns>String representation of the argument.</returns>
28+
QString Argument::AudioLang(QString stream, QString lang) {
29+
return QString(" -metadata:s:a:%1 language=%2").arg(stream).arg(lang);
30+
}
31+
2332
/// <summary>
2433
/// Sets the number of channels in the audio stream.
2534
/// </summary>

Arguments/MapArgs.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ QString Argument::MapVideo(QString type, QString s1, int s2) {
1111
return QString(" -map %1:%2:%3").arg(s1).arg(type).arg(s2);
1212
}
1313

14+
/// <summary>
15+
/// Maps a stream to a media file.
16+
/// </summary>
17+
/// <param name="type">The type of stream.</param>
18+
/// <param name="s1">Stream specifier.</param>
19+
/// <returns>String representation of argument.</returns>
20+
QString Argument::MapMux(QString type, int s1) {
21+
return QString(" -map %1:%2").arg(type).arg(s1);
22+
}
23+
1424
/// <summary>
1525
/// Maps all of a particular stream in a video container.
1626
/// </summary>

Checks/Checks.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
#include <QFile>
88
#include <QDir>
99

10+
#define AVC 0
11+
#define HEVC 1
12+
#define PRORES 2
13+
#define THEORA 3
14+
#define VP9 4
15+
#define VC1 5
16+
#define MPEG2 6
17+
#define MPEG4 7
18+
1019
#define AAC 0
1120
#define MP3 1
1221
#define AC3 2
@@ -32,6 +41,7 @@ class Checks {
3241
static bool CheckInput(QString);
3342
static bool CheckOutput(QString);
3443
static bool CheckOutputOverwrite(QString);
44+
static bool CheckVideoCompatability(int, QString);
3545
static bool CheckAudioCompatability(int, QString);
3646
static bool CheckSubtitleCompatability(QString, QString);
3747
static bool FileCheck(QString);

Checks/Process.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,68 @@
11
#include "Checks.h"
22

3+
/// <summary>
4+
/// Checks to ensure that the video codec is compatible with the selected output video container.
5+
/// </summary>
6+
/// <param name="format">The video codec index.</param>
7+
/// <param name="container">The output video container.</param>
8+
/// <returns>True or false.</returns>
9+
bool Checks::CheckVideoCompatability(int format, QString container) {
10+
bool result = true;
11+
12+
switch (format) {
13+
case AVC:
14+
if (container.contains(".mp4") || container.contains(".mkv") || container.contains(".mov") || container.contains(".avi") || container.contains(".asf") || container.contains(".ts") || container.contains(".flv") || container.contains(".3gp"))
15+
result = true;
16+
else
17+
result = false;
18+
break;
19+
case HEVC:
20+
if (container.contains(".mp4") || container.contains(".mkv") || container.contains(".mov") || container.contains(".ts"))
21+
result = true;
22+
else
23+
result = false;
24+
break;
25+
case PRORES:
26+
if (container.contains(".mkv") || container.contains(".mov") || container.contains(".avi"))
27+
result = true;
28+
else
29+
result = false;
30+
break;
31+
case THEORA:
32+
if (container.contains(".mkv") || container.contains(".ogv"))
33+
result = true;
34+
else
35+
result = false;
36+
break;
37+
case VP9:
38+
if (container.contains(".mp4") || container.contains(".mkv") || container.contains(".avi") || container.contains(".asf") || container.contains(".webm"))
39+
result = true;
40+
else
41+
result = false;
42+
break;
43+
case VC1:
44+
if (container.contains(".mp4") || container.contains(".mkv") || container.contains(".mov") || container.contains(".avi"))
45+
result = true;
46+
else
47+
result = false;
48+
break;
49+
case MPEG2:
50+
if (container.contains(".mp4") || container.contains(".mkv") || container.contains(".ts") || container.contains(".avi") || container.contains(".asf"))
51+
result = true;
52+
else
53+
result = false;
54+
break;
55+
case MPEG4:
56+
if (container.contains(".mp4") || container.contains(".mov") || container.contains(".avi") || container.contains(".asf"))
57+
result = true;
58+
else
59+
result = false;
60+
break;
61+
}
62+
63+
return result;
64+
}
65+
366
/// <summary>
467
/// Checks to ensure that the audio codec is compatible with the selected output video container.
568
/// </summary>

IO/VideoInfoList.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
QList<QTime> VideoInfoList::Duration;
44
QStringList VideoInfoList::FrameRate;
5+
QStringList VideoInfoList::Vk;
56

67
/// <summary>
78
/// Sets the total duration.
@@ -19,6 +20,14 @@ void VideoInfoList::SetFrameRate(QString frameRate) {
1920
FrameRate << frameRate;
2021
}
2122

23+
/// <summary>
24+
/// Sets the GPU device name.
25+
/// </summary>
26+
/// <param name="name">The GPU device name.</param>
27+
void VideoInfoList::SetVk(QString name) {
28+
Vk << name;
29+
}
30+
2231
/// <summary>
2332
/// Gets the duration from the video list.
2433
/// </summary>
@@ -37,6 +46,15 @@ QString VideoInfoList::GetFrameRate(int index) {
3746
return(FrameRate.at(index));
3847
}
3948

49+
/// <summary>
50+
/// Gets the selected GPU device name.
51+
/// </summary>
52+
/// <param name="index">The index to get.</param>
53+
/// <returns>The GPU device name.</returns>
54+
QString VideoInfoList::GetVk(int index) {
55+
return(Vk.at(index));
56+
}
57+
4058
/// <summary>
4159
/// Removes a duration from the video list.
4260
/// </summary>
@@ -53,10 +71,25 @@ void VideoInfoList::RemoveFrameRate(int index) {
5371
FrameRate.removeAt(index);
5472
}
5573

74+
/// <summary>
75+
/// Resets GPU device list.
76+
/// </summary>
77+
void VideoInfoList::ClearVk() {
78+
Vk.clear();
79+
}
80+
5681
/// <summary>
5782
/// Resets all private variables.
5883
/// </summary>
5984
void VideoInfoList::ClearAll() {
6085
Duration.clear();
6186
FrameRate.clear();
87+
}
88+
89+
/// <summary>
90+
/// The total count of GPU devices.
91+
/// </summary>
92+
/// <returns>The total.</returns>
93+
int VideoInfoList::TotalVk() {
94+
return Vk.count();
6295
}

IO/VideoInfoList.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,23 @@ class VideoInfoList {
1111
public:
1212
static void SetDuration(QTime);
1313
static void SetFrameRate(QString);
14+
static void SetVk(QString);
1415

1516
static QTime GetDuration(int);
1617
static QString GetFrameRate(int);
18+
static QString GetVk(int);
1719

1820
static void RemoveDuration(int);
1921
static void RemoveFrameRate(int);
2022

2123
static void ClearAll();
24+
static void ClearVk();
25+
static int TotalVk();
2226

2327
private:
2428
static QList<QTime> Duration;
2529
static QStringList FrameRate;
30+
static QStringList Vk;
2631
};
2732

2833
#endif // !VIDEOINFOLIST_H

Process/FFLoader.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "..\IO\VideoInfoList.h"
1111

1212
#include <QProcess>
13+
#include <QtGlobal>
1314
#include <QTime>
1415
#include <QDir>
1516

@@ -20,7 +21,9 @@ enum class ProcessType {
2021
EncodeFinish,
2122
Vs,
2223
ExtractInfo,
23-
ExtractFinish
24+
ExtractFinish,
25+
VkInfo,
26+
VkFinish
2427
};
2528

2629
class ProcessWorker : public QObject {
@@ -31,7 +34,7 @@ class ProcessWorker : public QObject {
3134
void KillProcess(QProcess*);
3235
void Deconstruct(QProcess*);
3336

34-
QProcess *video, *encode, *vs;
37+
QProcess *video, *encode, *vs, *vk;
3538
int currentJob;
3639
};
3740

@@ -42,6 +45,7 @@ class FFLoader : public ProcessWorker {
4245
void Encode(QString, QString, bool);
4346
void VideoInfo(QString);
4447
void Action(bool);
48+
void GPU();
4549
void Connector(QProcess*, ProcessType);
4650
void Disconnecter(QProcess*, ProcessType);
4751
void Finisher(QProcess*, ProcessType);
@@ -50,9 +54,11 @@ class FFLoader : public ProcessWorker {
5054
void OutputDataExtract();
5155
void OutputDataInfo();
5256
void OutputDataVs();
57+
void OutputDataVk();
5358
void ExtractFinished();
5459
void VideoFinished();
5560
void EncodeFinished();
61+
void VkFinished();
5662

5763
QElapsedTimer Timer;
5864
QTime PauseTime;
@@ -61,6 +67,7 @@ class FFLoader : public ProcessWorker {
6167
void setVideoInfo();
6268
void setProgress();
6369
void Completed();
70+
void VkComplete();
6471
void ExtractInfo();
6572
void ExtractComplete();
6673
void Logs(QString);

Process/FFLoaderBase.cpp

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ void FFLoader::Encode(QString ffmpeg, QString vsArgs, bool extracti) {
4646
NewProcess(encode, QStringList(), ffmpeg);
4747
}
4848

49+
void FFLoader::GPU() {
50+
vk = new QProcess();
51+
52+
Connector(vk, ProcessType::VkInfo);
53+
Connector(vk, ProcessType::VkFinish);
54+
55+
NewProcess(vk, QStringList() << "/C" << "vapoursynth\\vspipe.exe" << "-c" << "y4m" << "vapoursynth\\dummy.vpy" << "-", "cmd.exe");
56+
}
57+
4958
void FFLoader::Action(bool sd) {
5059
QProcess* proc = new QProcess();
5160

@@ -79,6 +88,10 @@ void FFLoader::OutputDataVs() {
7988
OutputData(vs, ProcessType::Vs);
8089
}
8190

91+
void FFLoader::OutputDataVk() {
92+
OutputData(vk, ProcessType::VkInfo);
93+
}
94+
8295
void FFLoader::VideoFinished() {
8396
Finisher(video, ProcessType::VideoFinish);
8497
}
@@ -91,6 +104,10 @@ void FFLoader::ExtractFinished() {
91104
Finisher(encode, ProcessType::ExtractFinish);
92105
}
93106

107+
void FFLoader::VkFinished() {
108+
Finisher(vk, ProcessType::VkFinish);
109+
}
110+
94111
void FFLoader::OutputData(QProcess* process, ProcessType type) {
95112
process->setReadChannel(QProcess::StandardError);
96113

@@ -127,6 +144,9 @@ void FFLoader::OutputData(QProcess* process, ProcessType type) {
127144
if (ProgressInfoRegex::ExtractRegex(output, VideoInfoList::GetDuration(currentJob)))
128145
emit ExtractInfo();
129146
break;
147+
case ProcessType::VkInfo:
148+
VideoInfoRegex::VkRegex(output);
149+
break;
130150
}
131151
}
132152
}
@@ -136,7 +156,10 @@ void FFLoader::Finisher(QProcess* process, ProcessType type) {
136156
case ProcessType::EncodeFinish:
137157
Disconnecter(process, ProcessType::EncodeFinish);
138158
Disconnecter(process, ProcessType::Encode);
139-
Disconnecter(vs, ProcessType::Vs);
159+
160+
if (vs)
161+
Disconnecter(vs, ProcessType::Vs);
162+
140163
emit Completed();
141164
break;
142165
case ProcessType::VideoFinish:
@@ -148,6 +171,12 @@ void FFLoader::Finisher(QProcess* process, ProcessType type) {
148171
Disconnecter(process, ProcessType::ExtractFinish);
149172
Disconnecter(process, ProcessType::ExtractInfo);
150173
emit ExtractComplete();
174+
break;
175+
case ProcessType::VkFinish:
176+
Disconnecter(process, ProcessType::VkFinish);
177+
Disconnecter(process, ProcessType::VkInfo);
178+
emit VkComplete();
179+
break;
151180
}
152181

153182
Deconstruct(process);
@@ -167,6 +196,9 @@ void FFLoader::Connector(QProcess* process, ProcessType type) {
167196
case ProcessType::ExtractInfo:
168197
process->connect(process, &QProcess::readyReadStandardError, this, &FFLoader::OutputDataExtract);
169198
break;
199+
case ProcessType::VkInfo:
200+
process->connect(process, &QProcess::readyReadStandardError, this, &FFLoader::OutputDataVk);
201+
break;
170202
case ProcessType::VideoFinish:
171203
process->connect(process, &QProcess::finished, this, &FFLoader::VideoFinished);
172204
break;
@@ -176,6 +208,9 @@ void FFLoader::Connector(QProcess* process, ProcessType type) {
176208
case ProcessType::ExtractFinish:
177209
process->connect(process, &QProcess::finished, this, &FFLoader::ExtractFinished);
178210
break;
211+
case ProcessType::VkFinish:
212+
process->connect(process, &QProcess::finished, this, &FFLoader::VkFinished);
213+
break;
179214
}
180215
}
181216

@@ -193,6 +228,9 @@ void FFLoader::Disconnecter(QProcess* process, ProcessType type) {
193228
case ProcessType::ExtractInfo:
194229
process->disconnect(process, &QProcess::readyReadStandardError, this, &FFLoader::OutputDataExtract);
195230
break;
231+
case ProcessType::VkInfo:
232+
process->disconnect(process, &QProcess::readyReadStandardError, this, &FFLoader::OutputDataVk);
233+
break;
196234
case ProcessType::VideoFinish:
197235
process->disconnect(process, &QProcess::finished, this, &FFLoader::VideoFinished);
198236
break;
@@ -202,6 +240,9 @@ void FFLoader::Disconnecter(QProcess* process, ProcessType type) {
202240
case ProcessType::ExtractFinish:
203241
process->disconnect(process, &QProcess::finished, this, &FFLoader::ExtractFinished);
204242
break;
243+
case ProcessType::VkFinish:
244+
process->disconnect(process, &QProcess::finished, this, &FFLoader::VkFinished);
245+
break;
205246
}
206247

207248
process->closeReadChannel(QProcess::StandardError);

0 commit comments

Comments
 (0)