Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: Playing mplayer inside QWidget

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Playing mplayer inside QWidget

    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?
    @shish

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing mplayer inside QWidget

    winId() does not return a number on windows, but a pointer (handle) to the window.

  3. #3
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Playing mplayer inside QWidget

    ok, but then how to pass it in the mplayer argument?
    @shish

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing mplayer inside QWidget

    Are you sure it is supported on Windows at all?

  5. #5
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Unhappy Re: Playing mplayer inside QWidget

    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...!!
    @shish

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing mplayer inside QWidget

    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.

  7. #7
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Playing mplayer inside QWidget

    ok, i am trying...
    @shish

  8. #8
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Re: Playing mplayer inside QWidget

    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...???????
    @shish

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing mplayer inside QWidget

    Why do you need a Qt written player? Can't you embed Windows Media Player using ActiveX or Phonon (Qt4.4+ only)?

  10. #10
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Red face Re: Playing mplayer inside QWidget

    becoz i didn't know about this , now i will see....
    @shish

  11. #11
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Playing mplayer inside QWidget

    Quote Originally Posted by sinha.ashish View Post
    becoz i didn't know about this , now i will see....
    Dear Ashish!
    You can run MPlayer inside Qt Widget.
    See the M-Player windows documentation.
    I have done it previously.
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing mplayer inside QWidget

    Quote Originally Posted by ashukla View Post
    I have done it previously.
    On Windows?

  13. #13
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Re: Playing mplayer inside QWidget

    Quote Originally Posted by ashukla View Post
    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...
    @shish

  14. #14
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Playing mplayer inside QWidget

    Quote Originally Posted by sinha.ashish View Post
    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!
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  15. #15
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Smile Re: Playing mplayer inside QWidget

    Ok sir!
    i do the same...
    thanks a lot for ur time to suggest me...
    @shish

  16. #16
    Join Date
    Jan 2008
    Location
    India
    Posts
    31
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Talking Re: Playing mplayer inside QWidget

    Hello all!!!!!

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

  17. #17
    Join Date
    Mar 2007
    Posts
    31
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Playing mplayer inside QWidget

    How did you solve the problem ?

  18. #18
    Join Date
    Jan 2008
    Posts
    72
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Wink Re: Playing mplayer inside QWidget

    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 .............................

  19. #19
    Join Date
    Jul 2008
    Posts
    69
    Thanks
    9
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Playing mplayer inside QWidget

    Quote Originally Posted by wysota View Post
    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)

    Qt Code:
    1. Qstring winNuber= QString ::number((int) (player->winId()) )
    2. arguments << "-slave" << "-wid" << winNuber << "-vo" << "directx:noaccel" << "-fs" << file ;
    3. m_pProcessVideo->start("C:\\Program Files\\SMPlayer\\mplayer\\mplayer.exe",arguments);
    To copy to clipboard, switch view to plain text mode 

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

  20. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Playing mplayer inside QWidget

    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QWidget inside MFC project
    By hINTModuleState in forum Newbie
    Replies: 3
    Last Post: 9th October 2015, 15:22
  2. running an app inside QWidget ?
    By drake1983 in forum Newbie
    Replies: 2
    Last Post: 14th March 2008, 15:33
  3. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 22:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.