I want to use libvlc for a multimedia open source project for which I need to be able to dynamically insert and delete playlist entries while the player is playing. Similar to the HTTP-Frontend of VLC but as a RPC.
For getting started with libvlc I stumbled upon http://wiki.videolan.org/LibVLC_Media_List_Management which worked fine after replacing some outdated stuff. However whenever I add a call to libvlc_media_list_remove_index after the medialist has been assigned to a list player with libvlc_media_list_player_set_media_list I get a segfault (the list_player hasn't got an assigned libvlc_media_player_t and also hasn't been started to play an item yet).
The sourcecode of my little testprogram can be found here: http://pastebin.com/m279200e5
Program received signal SIGSEGV, Segmentation fault.
libvlc_media_list_item_at_path (p_mlist=0x602970, path=0x0) at control/media_list_path.h:168
168 for( i = 0; path != -1; i++ )
(gdb) backtrace
#0 libvlc_media_list_item_at_path (p_mlist=0x602970, path=0x0) at control/media_list_path.h:168
#1 0x00007ffff7bd781a in mlist_item_deleted (p_event=0x7fffffffe130, p_user_data=0x636580) at control/media_list_player.c:153
#2 0x00007ffff7bd28ba in libvlc_event_send (p_em=0x602a10, p_event=0x7fffffffe130) at control/event.c:217
#3 0x00007ffff7bd6eed in notify_item_deletion (p_mlist=0x602970, index=1, p_e=<value optimized out>) at control/media_list.c:118
#4 _libvlc_media_list_remove_index (p_mlist=0x602970, index=1, p_e=<value optimized out>) at control/media_list.c:426
#5 0x0000000000400c67 in main (argc=1, argv=0x7fffffffe2d8) at vlc-media_list_remove_index-segfault.c:42
It seems that adding items does not cause a segfault though. If I remove the media_list_remove_index-stuff than the player is playing both MP3s fine. Is there anything wrong with my approach? Should a media_list be treated as immutable when it is assigned to a media_list_player or is this simply a bug?
In case this is a bug:
I see most of the frontend / interfaces seem to use an API with functions named playlist_*. Is it worth to try it out with this alternative / older(?) API instead and maybe later migratie to media_list_*?
Thanks,
Cyranjo
PS: Sorry forgot to add: VLC 1.0.3 on Debian testing amd64. gcc 4.3.4, gdb 7, eglibc 2.10.2