Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Data transfer
Forum Updated to NodeBB v4.3 + New Features

Qt Data transfer

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 509 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Omri
    wrote on last edited by
    #1

    hello! I have 2 unrelated questions:

    1. Is there a way to hold the main in a wait mode?
      meaning the main will pass the return a.exec(); (a is a Qapplication) and enter a wait mode until his subprocesses will end(the gui for example).

    2. I'm streaming a video through netcat to a socket. from that socket I need to stream the data to an mplayer process.
      I've managed to do that through this code:
      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);
    

    }

    simply when ready read is emitted the socket is read and then writing to the process.
    The problem is that the video is really slow with a lot of lag.
    What is the best and fastest way in transferring data into a process?
    What is the difference between read/write to readdata/writedata functions, and how to use them(they're virtual protected)?
    Thanks for the helpers.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved