void ClientVidless::run()
{
args1 += "-fps";
args1 += "60";
args1 += "-cache";
args1 += "1024";
args1 += "-slave";
args1 += "-wid";
args1
+= QString::number((int)ui
->widget
->winId
());
args1 += "-";
process1->start("C:\\Program Files (x86)\\MPlayer for Windows\\mplayer.exe",args1);
qDebug() << "Connecting...";
socket->connectToHost("192.168.1.109",5001);
if (!socket->waitForConnected(1000))
qDebug() << "Error:" << socket->errorString();
connect(socket,SIGNAL(connected()),this,SLOT(connected()));
connect(socket,SIGNAL(disconnected()),this,SLOT(disconnected()));
connect(socket,SIGNAL(bytesWritten(qint64)),this,SLOT(bytesWritten(qint64)));
connect(socket,SIGNAL(readyRead()),this,SLOT(readyRead()));
}
void ClientVidless::readyRead()
{
Data = socket->readAll(); //Data is a QByteArray
qDebug() << " Data in: " << Data;
process1->write(Data);
}
void ClientVidless::run()
{
socket = new QTcpSocket(this);
QStringList args1;
args1 += "-fps";
args1 += "60";
args1 += "-cache";
args1 += "1024";
args1 += "-slave";
args1 += "-wid";
args1 += QString::number((int)ui->widget->winId());
args1 += "-";
process1 = new QProcess(0);
process1->start("C:\\Program Files (x86)\\MPlayer for Windows\\mplayer.exe",args1);
qDebug() << "Connecting...";
socket->connectToHost("192.168.1.109",5001);
if (!socket->waitForConnected(1000))
qDebug() << "Error:" << socket->errorString();
connect(socket,SIGNAL(connected()),this,SLOT(connected()));
connect(socket,SIGNAL(disconnected()),this,SLOT(disconnected()));
connect(socket,SIGNAL(bytesWritten(qint64)),this,SLOT(bytesWritten(qint64)));
connect(socket,SIGNAL(readyRead()),this,SLOT(readyRead()));
}
void ClientVidless::readyRead()
{
Data = socket->readAll(); //Data is a QByteArray
qDebug() << " Data in: " << Data;
process1->write(Data);
}
To copy to clipboard, switch view to plain text mode
simply when ready read is emitted the socket is read and then writing to the process.
Bookmarks