Page 1 of 1

libvlc_media_player_stop call in callback stuck application

Posted: 29 Jul 2010 22:37
by ekim.tecul
Hello,

calling libvlc_media_player_stop() in an event callback stuck my application.
I'm working with libvlc 1.1.1 on windows vista sp2 and compile with visual C++ 8.

Below code that show the problem :

Code: Select all

static void testStopInCBCallback1(const libvlc_event_t *pEvent, void *param) { printf("receive event %s\n", libvlc_event_type_name(pEvent->type)); if (pEvent->type == libvlc_MediaPlayerPlaying) { printf("Before stop\n"); libvlc_media_player_stop((libvlc_media_player_t *) pEvent->p_obj); printf("After stop\n"); } } void testStopInCB() { libvlc_media_t *pMedia; libvlc_instance_t *pVlc; libvlc_media_player_t *pPlayer; libvlc_event_manager_t *pEvent = NULL; pVlc = libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); printf("vlc = 0x%08x\n", pVlc); pPlayer = libvlc_media_player_new(pVlc); printf("player = 0x%08x\n", pPlayer); pEvent = libvlc_media_player_event_manager(pPlayer); printf("event = 0x%08x\n", pEvent); libvlc_event_attach(pEvent, libvlc_MediaPlayerOpening, testStopInCBCallback1, NULL); libvlc_event_attach(pEvent, libvlc_MediaPlayerEndReached, testStopInCBCallback1, NULL); libvlc_event_attach(pEvent, libvlc_MediaPlayerEncounteredError, testStopInCBCallback1, NULL); libvlc_event_attach(pEvent, libvlc_MediaPlayerPlaying, testStopInCBCallback1, NULL); libvlc_event_attach(pEvent, libvlc_MediaPlayerStopped, testStopInCBCallback1, NULL); pMedia = libvlc_media_new_location(pVlc, "http://vipicecast.yacast.net/europe1"); printf("Media = 0x%08x\n", pMedia); libvlc_media_player_set_media(pPlayer, pMedia); libvlc_media_release(pMedia); libvlc_media_player_play(pPlayer); Sleep(10000); }
I receive "Before stop" message but not "After stop" one.
Is it allowed to call such api in the context of an event callback ?

Thanks in advance for any reply

Re: libvlc_media_player_stop call in callback stuck applicat

Posted: 30 Jul 2010 07:33
by RĂ©mi Denis-Courmont
libvlc is not reentrant from within its own callbacks.

Re: libvlc_media_player_stop call in callback stuck applicat

Posted: 30 Jul 2010 08:04
by ekim.tecul
Ok thanks for the info. I was not able to found it into documentation. Is it somewhere ?

thanks again