libvlc_media_player_stop call in callback stuck application

This forum is about all development around libVLC.
ekim.tecul
New Cone
New Cone
Posts: 5
Joined: 29 Jul 2010 22:26

libvlc_media_player_stop call in callback stuck application

Postby ekim.tecul » 29 Jul 2010 22:37

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

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

Re: libvlc_media_player_stop call in callback stuck applicat

Postby Rémi Denis-Courmont » 30 Jul 2010 07:33

libvlc is not reentrant from within its own callbacks.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

ekim.tecul
New Cone
New Cone
Posts: 5
Joined: 29 Jul 2010 22:26

Re: libvlc_media_player_stop call in callback stuck applicat

Postby ekim.tecul » 30 Jul 2010 08:04

Ok thanks for the info. I was not able to found it into documentation. Is it somewhere ?

thanks again


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests