c++ libVLC problem openning several windows

This forum is about all development around libVLC.
johnyRobot5
New Cone
New Cone
Posts: 4
Joined: 09 Jul 2015 15:56

c++ libVLC problem openning several windows

Postby johnyRobot5 » 09 Jul 2015 16:04

Dear Forum,

I would like your help in a issue I am having. I am using the libvlc in a small c++ program in Ubuntu . I am trying to play 2 videos in a raw , first the a.mp4 video and when it finishes to play b.mp4 . I can do this but the libvlc creates 2 separate windows.

I want on the same window to load my choices of videos. I saw that there is the command

libvlc_media_player_set_xwindow (mp, xid) is this what I can do to maintain on play window? If yes how do I get the xid?

here is my code :

int main(int argc, char* argv[])
{
libvlc_instance_t * inst;
libvlc_media_player_t *mp;
libvlc_media_t *m;
libvlc_instance_t * inst1;
libvlc_media_player_t *mp1;
libvlc_media_t *m1;


int idpl;
/* Load the VLC engine */
inst = libvlc_new (0, NULL);
m = libvlc_media_new_path (inst, "/home/ioannis/a.mp4");

/* Create a media player playing environement */
mp = libvlc_media_player_new_from_media (m);

/* No need to keep the media now */
libvlc_media_release (m);


#if 0
/* This is a non working code that show how to hooks into a window,
* if we have a window around */
libvlc_media_player_set_xwindow (mp, xid);
/* or on windows */
libvlc_media_player_set_hwnd (mp, hwnd);
/* or on mac os */
libvlc_media_player_set_nsobject (mp, view);
#endif


libvlc_media_player_play (mp);


sleep (3); /* Let it play a bit */
m = libvlc_media_new_path (inst, "/home/ioannis/b.mp4");
mp = libvlc_media_player_new_from_media (m);
libvlc_media_player_next_chapter(mp);

libvlc_media_player_play (mp);
sleep (20);


return 0;
}


Thank you in advance
Waiting for any answer

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: c++ libVLC problem openning several windows

Postby Rémi Denis-Courmont » 09 Jul 2015 17:38

As the name implies, libvlc_media_player_set_xwindow() is for use with X11. How to obtain the window ID depends on your UI framework and is outside of VLC scope.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

johnyRobot5
New Cone
New Cone
Posts: 4
Joined: 09 Jul 2015 15:56

Re: c++ libVLC problem openning several windows

Postby johnyRobot5 » 09 Jul 2015 17:47

Dear Remi

Thank you for your fast reply. Could you please help me in my problem? I am using geany for compiling the cpp file and I am using ubuntu 14.
Can you advice me how to obtain the window ID?

Regards

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: c++ libVLC problem openning several windows

Postby Rémi Denis-Courmont » 09 Jul 2015 20:47

No I cannot. Read the framework reference documentation.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

johnyRobot5
New Cone
New Cone
Posts: 4
Joined: 09 Jul 2015 15:56

Re: c++ libVLC problem openning several windows

Postby johnyRobot5 » 10 Jul 2015 08:18

Do you know maybe where can I find the framework reference?

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: c++ libVLC problem openning several windows

Postby Rémi Denis-Courmont » 10 Jul 2015 09:15

What? Why would I know better than you what framework you are using?

This is a LibVLC forum, not Stackoverflow.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

johnyRobot5
New Cone
New Cone
Posts: 4
Joined: 09 Jul 2015 15:56

Re: c++ libVLC problem openning several windows

Postby johnyRobot5 » 10 Jul 2015 09:21

Dear Remi you are right , I thought you might had an idea :)

But is this command " libvlc_media_player_set_xwindow " the correct one to keep one window of vlc playing several videos? I do not want vlc to reopen windows as I load it with videos during my program.

Regards


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 25 guests