-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfakeplayerthread.cpp
More file actions
52 lines (47 loc) · 1.33 KB
/
fakeplayerthread.cpp
File metadata and controls
52 lines (47 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "fakeplayerthread.h"
#include <QDebug>
#include <FakeMicWavPlayer/FakeMicWavPlayerLib.h>
FakePlayerThread::FakePlayerThread(QObject* parent) :
QThread(parent), canRun(true)
{
}
void FakePlayerThread::run() {
error = false;
qDebug() << "Thread : source : " << source;
qDebug() << "Thread : sinks : " << sinks;
qDebug() << "Thread : processBinaryName : " << processBinaryName;
switch (streamInputMode) {
case AUDIO_FILE: {
qDebug() << "Thread : oggFilePath : " << oggFilePath;
if (FakeMicWavPlayer::initWithAudioFile(oggFilePath.toStdString(),
source.toStdString(),
sinks.toStdString(),
processBinaryName.toStdString()) != 0) {
error = true;
emit processFinished();
return;
}
canRun = true;
while (canRun && FakeMicWavPlayer::playNonBlocking() == 0) {
}
FakeMicWavPlayer::cleanPlayer();
FakeMicWavPlayer::clean();
break;
}
case APPLICATION: {
qDebug() << "Thread : Application : " << applicationBinaryName;
if (FakeMicWavPlayer::initWithSinkInput(applicationBinaryName.toStdString(),
source.toStdString(),
sinks.toStdString(),
processBinaryName.toStdString()) != 0) {
error = true;
emit processFinished();
return;
}
}
}
emit processFinished();
}
void FakePlayerThread::stop(){
canRun = false;
}