libVLC to render a mosaic to the display

This forum is about all development around libVLC.
ejam
New Cone
New Cone
Posts: 2
Joined: 27 Sep 2022 17:43

libVLC to render a mosaic to the display

Postby ejam » 27 Sep 2022 18:49

Hi libVLC Gurus,

I am creating an application that subscribes to multicast streams and I was wondering if it is possible using libVLC to create a stream mosaic. I have looked through a lot of the libVLC documentation, but I haven't found anything pertaining to output mosaics.

Currently, I am using C/C++ with Qt 6.2.4 and libVLC 3.0.17.4 to create the application. Rendering a single multicast stream to the display is working as expected.

Can someone provide a source-code snippet of what it would take to render 4 videos in a quad?

Thank You!
ejam

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: libVLC to render a mosaic to the display

Postby chubinou » 28 Sep 2022 10:00

just spawn multiple player

something like this

Code: Select all

#include <QApplication> #include <QMainWindow> #include <QHBoxLayout> #include <vlc/vlc.h> int main(int argc, char *argv[]) { QApplication qtApp(argc, argv); QWidget* v1 = new QWidget(); QWidget* v2 = new QWidget(); QHBoxLayout* layout = new QHBoxLayout(); layout->addWidget(v1); layout->addWidget(v2); QWidget* central = new QWidget(); central->setLayout(layout); QMainWindow window; window.setCentralWidget(central); window.show(); const char* vlcargs[] = { "--no-osd", //"--no-audio" }; libvlc_instance_t* vlc = libvlc_new(sizeof(vlcargs)/sizeof(*vlcargs), vlcargs); libvlc_media_t* m1 = libvlc_media_new_path(vlc, "/home/pierre/Videos/BBC.ts"); libvlc_media_player_t* p1 = libvlc_media_player_new_from_media(m1); libvlc_media_release(m1); //use libvlc_media_player_set_hwnd on windows libvlc_media_player_set_xwindow(p1, v1->winId()); libvlc_media_t* m2 = libvlc_media_new_path(vlc, "/home/pierre/Videos/sheep.mp4"); libvlc_media_player_t* p2 = libvlc_media_player_new_from_media(m2); libvlc_media_player_set_media(p2, m2); libvlc_media_release(m2); libvlc_media_player_set_xwindow(p2, v2->winId()); libvlc_media_player_play(p1); libvlc_media_player_play(p2); qtApp.exec(); libvlc_free(vlc); }
well, you get the idea

ejam
New Cone
New Cone
Posts: 2
Joined: 27 Sep 2022 17:43

Re: libVLC to render a mosaic to the display

Postby ejam » 28 Sep 2022 17:18

Aha! I guess I was overthinking the problem a bit. This will definitely work for me.

Thank you!
ejam


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests