libvlc multi instances

This forum is about all development around libVLC.
g6r6e6g
New Cone
New Cone
Posts: 8
Joined: 05 May 2008 16:39

libvlc multi instances

Postby g6r6e6g » 23 Jan 2009 15:36

Hello,

I m using libvlc into 1 visual studio project but since vlc0.8.6 I have troubles when I m trying to
use multiple instances in the same time. With latest releases (new libvlc API), I always have same
trouble, in sample code below I just play video1 without video-title-show then meanwhile I play video2
with video-title-show, all is OK
after I stop/play video1 and whaooo I have video-title-show on video1 => video1 libvlc instance lost its params !!!

I though in new libvlc API parameters were saved in local private libvlc instance.
Otherwise is there a possibility to get a workaround (my real usage is the vmem plugin using a lot of params
to copy frame buffer into 1 dedicated mem buffer)

Please help me ...
Thank you

Code: Select all

#include <stdio.h> #include <windows.h> typedef long long int64_t; #include <vlc/libvlc_structures.h> #include <vlc/libvlc_events.h> #include <vlc/libvlc.h> static void quit_on_exception(libvlc_exception_t *excp) { if (libvlc_exception_raised(excp)) { fprintf(stderr, "error: %s\n", libvlc_exception_get_message(excp)); exit(-1); } } int main(int argc, char **argv) { libvlc_exception_t excp; libvlc_instance_t *inst, *inst2; libvlc_media_t *media, *media2; libvlc_media_player_t *player, *player2; char const *myargs[] = { "--no-one-instance", "--no-stats", "--quiet", "--dummy-quiet", "--rc-quiet", "--no-video-title-show", "--intf", "dummy", "--ignore-config", // "--loop", "--plugin-path=D:\\DevTools\\vlc\\build_vlc\\vlc-0.9.6\\plugins", }; int myargsc = sizeof(myargs) / sizeof(*myargs); char *filename = "D:\\8103D9F9d01.mpeg"; char *filename2 = "D:\\E5535DC8d01.mpeg"; char const *myargs2[] = { "--no-one-instance", "--no-stats", "--quiet", "--dummy-quiet", "--rc-quiet", "--video-title-show", "--intf", "dummy", "--ignore-config", // "--loop", "--plugin-path=D:\\DevTools\\vlc\\build_vlc\\vlc-0.9.6\\plugins", }; int myargsc2 = sizeof(myargs2) / sizeof(*myargs2); libvlc_exception_init(&excp); printf("Starting 1st video\n"); inst = libvlc_new(myargsc, (char**)myargs, &excp); quit_on_exception(&excp); media = libvlc_media_new(inst, filename, &excp); quit_on_exception(&excp); player = libvlc_media_player_new_from_media(media, &excp); quit_on_exception(&excp); libvlc_media_release(media); libvlc_media_player_play(player, &excp); quit_on_exception(&excp); // while (libvlc_media_player_is_playing(player, &excp) == libvlc_Playing) Sleep(3000); printf("Starting 2nd video\n"); inst2 = libvlc_new(myargsc2, (char**)myargs2, &excp); quit_on_exception(&excp); media2 = libvlc_media_new(inst2, filename2, &excp); quit_on_exception(&excp); player2 = libvlc_media_player_new_from_media(media2, &excp); quit_on_exception(&excp); libvlc_media_release(media2); libvlc_media_player_play(player2, &excp); quit_on_exception(&excp); Sleep(3000); libvlc_media_player_stop(player, &excp); quit_on_exception(&excp); Sleep(1000); libvlc_media_player_play(player, &excp); quit_on_exception(&excp); Sleep(7000); printf("End of 2nd video\n"); libvlc_media_player_stop(player2, &excp); quit_on_exception(&excp); libvlc_media_player_release(player2); libvlc_release(inst2); Sleep(3000); printf("End of 1st video\n"); libvlc_media_player_stop(player, &excp); quit_on_exception(&excp); libvlc_media_player_release(player); libvlc_release(inst); printf("End.\n"); return 0; }

Beardless2
Cone that earned his stripes
Cone that earned his stripes
Posts: 125
Joined: 02 Feb 2007 09:53

Re: libvlc multi instances

Postby Beardless2 » 23 Jan 2009 15:48

yep. this is a problem everyone has and as far as i know it hasn't been fixed yet even in the nightly builds

viewtopic.php?f=32&t=54354

https://trac.videolan.org/vlc/ticket/2325

g6r6e6g
New Cone
New Cone
Posts: 8
Joined: 05 May 2008 16:39

Re: libvlc multi instances

Postby g6r6e6g » 23 Jan 2009 16:00

Thank you for those links,
I will try to develop 1 workaround ...


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 34 guests