PDA

View Full Version : QProcess and MူPlayer's slave mode problem in Windows Platform



binary001
24th January 2015, 18:12
Hi,

I want to run MPlayer in My application in WINDOW PLATFORM. I found that code in forum.


QX11EmbedContainer *container=new QX11EmbedContainer(this);
container->setGeomerty(0,0,1280,1024);
QProcess *mp=new QProcess(container);
connect(mp, SIGNAL(finished(int)),this, SLOT(endPlay(int)));
QString command=" -wid "+QString::number(container->winId())+" -slave "+playfile;
mp->start("mplayer "+command);

Now I use Qt 5.4 and QX11EmbedContainer is not included in Qt 5.4.
What is the replacement of QX11EmbedContainer in Qt 5.4?

I replaced QWidget instead of QX11EmbedContainer in Qt 5.4 as follow:


QWidget *Wd = new QWidget(this);
const QString mplayerPath ("C:/mplayer.exe ");
QStringList args;
args << " -slave -quiet -ac mad -zoom -vo directx:noaccel -wid " << QString::number(Wd->winId()) << "c:/text.mpg ";
MyProcess = new QProcess (this);
MyProcess -> start (mplayerPath, args);
Wd->show();

video is played separately from my app's Form. I want it embedded in my Form.

Thanks in advance.

anda_skoa
24th January 2015, 18:21
Now I use Qt 5.4 and QX11EmbedContainer is not included in Qt 5.4.

It wouldn't help you if it did exist. As its name suggests it is for X11.


What is the replacement of QX11EmbedContainer in Qt 5.4?

Qt5's QWindow class has the option of embedding a window given its winId, QWindow::fromWinId().
Not all platforms support that (called the foreign window capability), but I think Windows does.

Of course the way it works is the other way around, the embedee provides the ID and the embedder works with that.

Cheers,
_