From e86b6a0a13039f3ed0b7c706d381a0a8ef6d071d Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Thu, 22 Feb 2007 19:35:28 +0000 Subject: [PATCH] Do not use p_demux->p_parent to get the p_input (Use vlc_find_object(PARENT) --- modules/demux/mp4/mp4.c | 52 ++++++++++++++++++++++------------------- modules/demux/ogg.c | 10 +++++--- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index c33367221d..200f337067 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -2210,31 +2210,35 @@ static void MP4_TrackSetELST( demux_t *p_demux, mp4_track_t *tk, } static vlc_bool_t FindItem( demux_t *p_demux, playlist_t *p_playlist, - playlist_item_t **pp_item ) + playlist_item_t **pp_item ) { - vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" ); - - if( b_play && p_playlist->status.p_item && - p_playlist->status.p_item->p_input == - input_GetItem((input_thread_t *)p_demux->p_parent)) - { - msg_Dbg( p_playlist, "starting playlist playback" ); - *pp_item = p_playlist->status.p_item; - b_play = VLC_TRUE; - } - else - { - input_item_t *p_current = input_GetItem( - (input_thread_t*)p_demux->p_parent); - *pp_item = playlist_ItemGetByInput( p_playlist, p_current, VLC_FALSE ); - if( !*pp_item ) - { - msg_Dbg( p_playlist, "unable to find item in playlist"); - } - msg_Dbg( p_playlist, "not starting playlist playback"); - b_play = VLC_FALSE; - } - return b_play; + input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); + vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" ); + + *pp_item = NULL; + if( p_input ) + { + if( b_play && p_playlist->status.p_item && + p_playlist->status.p_item->p_input == input_GetItem(p_input) ) + { + msg_Dbg( p_playlist, "starting playlist playback" ); + *pp_item = p_playlist->status.p_item; + b_play = VLC_TRUE; + } + else + { + input_item_t *p_current = input_GetItem( p_input ); + + *pp_item = playlist_ItemGetByInput( p_playlist, p_current, VLC_FALSE ); + if( !*pp_item ) + msg_Dbg( p_playlist, "unable to find item in playlist"); + + msg_Dbg( p_playlist, "not starting playlist playback"); + b_play = VLC_FALSE; + } + vlc_object_release( p_input ); + } + return b_play; } diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c index 2f0b422bf8..ab92cec9ec 100644 --- a/modules/demux/ogg.c +++ b/modules/demux/ogg.c @@ -179,6 +179,7 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *, logical_stream_t *, ogg_packe static int Open( vlc_object_t * p_this ) { demux_t *p_demux = (demux_t *)p_this; + input_thread_t *p_input; demux_sys_t *p_sys; uint8_t *p_peek; @@ -203,17 +204,20 @@ static int Open( vlc_object_t * p_this ) p_sys->i_eos = 0; - if( ((input_thread_t* )(p_demux->p_parent ))->b_preparsing == VLC_TRUE ) + p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); + if( p_input && p_input->b_preparsing ) { module_t *p_meta = module_Need( p_demux, "meta reader", NULL, 0 ); if( p_meta ) { - vlc_meta_Merge( input_GetItem((input_thread_t* )(p_demux->p_parent ))->p_meta, - (vlc_meta_t*)(p_demux->p_private ) ); + vlc_meta_Merge( input_GetItem(p_input)->p_meta, (vlc_meta_t*)(p_demux->p_private ) ); module_Unneed( p_demux, p_meta ); } + vlc_object_release( p_input ); return VLC_SUCCESS; } + if( p_input ) + vlc_object_release( p_input ); /* Initialize the Ogg physical bitstream parser */ ogg_sync_init( &p_sys->oy ); -- GitLab