PDA

View Full Version : Playing mplayer inside QWidget



sinha.ashish
14th April 2008, 08:17
void VistaMedia:: playMplayer()
{ QWidget *player;
player =new QWidget(0);
mp=new QProcess(0);
player ->setGeometry(0,0,500,400);
QString program = "mplayer";
QStringList argu;
argu<< "-fs" <<"-cache"<<"45231"<< "-slave" << "-wid"<<QString ::number(player->winId()) <<"-playlist"<<"playlist.txt";
mp->start(program,argu);
player->show();
}
Above code is for Windows platform, its showing error on compilation that: "call of overloaded 'number(HWND_*)' is ambiguous"
am i writing the arguments in wrong order or its a problem related to platform?

wysota
14th April 2008, 08:22
winId() does not return a number on windows, but a pointer (handle) to the window.

sinha.ashish
14th April 2008, 08:26
ok, but then how to pass it in the mplayer argument?

wysota
14th April 2008, 11:52
Are you sure it is supported on Windows at all?

sinha.ashish
14th April 2008, 12:01
i am not dead sure,but i did used the same for linux platform with qt 4.3.1, and it worked fine.Now i am using qt4.3.3 on windows.
i don't know its a qt related problem or platform related.
but i just want to play mplayer in a widget...
so help me to get this in any other way...!!

wysota
14th April 2008, 12:19
Linux is different than Windows. MPlayer uses XEmbed in Linux and there you can pass a window id which is an integer. On Windows you have pointers to the window structure and those pointers are only relevant inside one process. So it would be wise to read MPlayer's docs to find out if what you want is possible using the method you are trying. Maybe on Windows there is some other mechanism embedded into MPlayer to obtain the same effect.

sinha.ashish
14th April 2008, 12:22
ok, i am trying...

sinha.ashish
15th April 2008, 05:51
i searched for source code of mplayer written in qt got QXMP but it is for linux, and it used QX11EmbedContainer which is not in Qt of windows platform,do anybody know any player written in Qt for windows...???????

wysota
15th April 2008, 08:11
Why do you need a Qt written player? Can't you embed Windows Media Player using ActiveX or Phonon (Qt4.4+ only)?

sinha.ashish
15th April 2008, 08:27
becoz i didn't know about this , now i will see....:o

ashukla
15th April 2008, 10:17
becoz i didn't know about this , now i will see....:o
Dear Ashish!
You can run MPlayer inside Qt Widget.
See the M-Player windows documentation.
I have done it previously.

wysota
15th April 2008, 10:37
I have done it previously.

On Windows?

sinha.ashish
15th April 2008, 10:53
Dear Ashish!
You can run MPlayer inside Qt Widget.
See the M-Player windows documentation.
I have done it previously.


I know that, but that is not working for windows...

ashukla
16th April 2008, 11:52
I know that, but that is not working for windows...
You should depict MPlayer manual carefully.
There is a solution to play MPlayer in Qt Widget.
I am working on another project that is not Qt Specific thats why the reason I cann't put code to you.
But Sure, It is possible to run MPlayer on Qt Widget in Windows.
This is a tricky one work.
with regards!

sinha.ashish
16th April 2008, 12:25
Ok sir!
i do the same...
thanks a lot for ur time to suggest me...:)

sinha.ashish
16th April 2008, 14:39
Hello all!!!!!

the problem i have gone through is solved and it is possible to embed mplayer inside QWidget ,i have done this......:p:p:D

drake1983
9th June 2008, 04:07
How did you solve the problem ?

MrShahi
9th June 2008, 06:43
hello drake1983...........
its so simple yo play mplayer inside widget.........
just use -wid option of mplayer and provide window id of your QWidget.
and use -vo option with direct:noaccel .............................
;)

SunnySan
10th March 2009, 18:11
winId() does not return a number on windows, but a pointer (handle) to the window.

Then ,how do we get this winID number???

using casting (int)



Qstring winNuber= QString ::number((int) (player->winId()) )
arguments << "-slave" << "-wid" << winNuber << "-vo" << "directx:noaccel" << "-fs" << file ;
m_pProcessVideo->start("C:\\Program Files\\SMPlayer\\mplayer\\mplayer.exe",arguments);

this works but NOT into the intended window (it uses the full computer screen)

wysota
11th March 2009, 11:41
I think you have to use the native API to convert the handle to the id of the window that is to be passed to mplayer.

aswin
13th January 2011, 11:19
what is player in this case...is it a QWidget?


Then ,how do we get this winID number???

using casting (int)



Qstring winNuber= QString ::number((int) (player->winId()) )
arguments << "-slave" << "-wid" << winNuber << "-vo" << "directx:noaccel" << "-fs" << file ;
m_pProcessVideo->start("C:\\Program Files\\SMPlayer\\mplayer\\mplayer.exe",arguments);

this works but NOT into the intended window (it uses the full computer screen)

wysota
14th January 2011, 13:14
Yes, it's an empty QWidget.