/***************************************************************************** * TrackChangeEmit: Emits the TrackChange signal *****************************************************************************/ int TrackChangeEmit( intf_thread_t * p_intf, input_item_t* p_item ) { if( p_intf->p_sys->b_dead ) return VLC_SUCCESS; UpdateCaps( p_intf ); TrackChangeSignal( p_intf->p_sys->p_conn, p_item ); return VLC_SUCCESS; }
/***************************************************************************** * TrackChange: callback on playlist "item-current" *****************************************************************************/ static int TrackChange( intf_thread_t *p_intf ) { intf_sys_t *p_sys = p_intf->p_sys; playlist_t *p_playlist; input_thread_t *p_input = NULL; input_item_t *p_item = NULL; if( p_intf->p_sys->b_dead ) return VLC_SUCCESS; p_sys->b_meta_read = false; p_playlist = pl_Hold( p_intf ); p_input = playlist_CurrentInput( p_playlist ); if( !p_input ) { pl_Release( p_intf ); return VLC_SUCCESS; } pl_Release( p_intf ); p_item = input_GetItem( p_input ); if( !p_item ) { vlc_object_release( p_input ); return VLC_EGENERIC; } if( input_item_IsPreparsed( p_item ) ) { p_sys->b_meta_read = true; TrackChangeSignal( p_sys->p_conn, p_item ); } var_AddCallback( p_input, "state", AllCallback, p_intf ); vlc_object_release( p_input ); return VLC_SUCCESS; }
//static int StateChange( vlc_object_t *p_this, const char* psz_var, // vlc_value_t oldval, vlc_value_t newval, void *p_data ) static int StateChange( intf_thread_t *p_intf, int i_input_state ) { intf_sys_t *p_sys = p_intf->p_sys; playlist_t *p_playlist; input_thread_t *p_input; input_item_t *p_item; if( p_intf->p_sys->b_dead ) return VLC_SUCCESS; UpdateCaps( p_intf ); if( !p_sys->b_meta_read && i_input_state == PLAYING_S ) { p_playlist = pl_Hold( p_intf ); p_input = playlist_CurrentInput( p_playlist ); if( p_input ) { p_item = input_GetItem( p_input ); if( p_item ) { p_sys->b_meta_read = true; TrackChangeSignal( p_sys->p_conn, p_item ); } vlc_object_release( p_input ); } pl_Release( p_intf ); } if( i_input_state == PLAYING_S || i_input_state == PAUSE_S || i_input_state == END_S ) { StatusChangeSignal( p_sys->p_conn, p_intf ); } return VLC_SUCCESS; }