1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-27 04:21:53 +02:00

control/media_descriptor.c: Keep a media_list of our own subitems if we have some (we are then a media_descriptor playlist).

This commit is contained in:
Pierre d'Herbemont 2007-08-21 19:43:04 +00:00
parent 331df5b8ed
commit 2e3d42f8b9

View File

@ -1,5 +1,5 @@
/*****************************************************************************
* media_descriptor.c: Libvlc API media descriport management
* media_descriptor.c: Libvlc API media descripor management
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id$
@ -83,6 +83,14 @@ static void input_item_subitem_added( const vlc_event_t *p_event,
p_md->p_libvlc_instance,
p_event->u.input_item_subitem_added.p_new_child, NULL );
/* Add this to our media list */
if( !p_md->p_subitems )
p_md->p_subitems = libvlc_media_list_new( p_md->p_libvlc_instance, NULL );
if( !p_md->p_subitems )
{
libvlc_media_list_add_media_descriptor( p_md->p_subitems, p_md_child, NULL );
}
/* Construct the event */
event.type = libvlc_MediaDescriptorSubItemAdded;
event.u.media_descriptor_subitem_added.new_child = p_md_child;
@ -179,6 +187,10 @@ libvlc_media_descriptor_t * libvlc_media_descriptor_new_from_input_item(
p_md->b_preparsed = VLC_TRUE;
p_md->i_refcount = 1;
/* A media descriptor can be a playlist. When you open a playlist
* It can give a bunch of item to read. */
p_md->p_subitems = NULL;
vlc_dictionary_init( &p_md->tags, 1 );
p_md->p_event_manager = libvlc_event_manager_new( p_md, p_instance, p_e );
@ -233,6 +245,8 @@ void libvlc_media_descriptor_release( libvlc_media_descriptor_t *p_md )
if( p_md->i_refcount > 0 )
return;
libvlc_media_list_release( p_md->p_subitems );
uninstall_input_item_observer( p_md );
vlc_gc_decref( p_md->p_input_item );