0

In my Qt5.9.2 under RPi3 I launch omxplayer in the following way:

QProcess *_omx = new QProcess(this);

void MyQPlayer::play(QString uri)
{
    QStringList args;
    args << "-o" << "0" << "-i" << "0";
    args << "omxplayer";
    args << "--vol=-6000";
    args << "-I" << "-s";
    args << "-o" << "hdmi" << uri;
    _omx->start("stdbuf", args, QProcess::Unbuffered | QProcess::ReadWrite);
}

I need to use stdbuf to avoid buffering, otherwise I cannot read in "real-time" the output from the application.

When the video ends, omxplayer should exits immediately - and it does when I launch it from command line:

$ stdbuf -o 0 -i 0 omxplayer --vol=6000 -I -s -o hdmi myfile.mp4

Instead, when launched from my application, once the video has ended it remains in execution for about 15s before exits. I catch the finished() signal and it confirms it exited nicely: exit code = 0 and exit status = NormalExits.

I'm not sure if this other information is useful or is completely another issue, but I report here anyway. To pause the video I send on the pipe the letter 'p':

void MyPlayer::pause()
{
    qDebug() << "toggle pause";
    if (_omx->state() == QProcess::Running)
    {
        _omx->write("p");
    }
}

the debug print tells me the function is actually called every time I invoke the function, but often I need to call it multiple times to actually pause or resume the video execution.

It should not be an issue with buffering because my command line should avoid that.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Mark
  • 4,338
  • 7
  • 58
  • 120

0 Answers0