+ case EXTENSION_SET_INPUT:
+ {
+ p_ext = ( extension_t* ) va_arg( args, extension_t* );
+ input_thread_t *p_input = va_arg( args, struct input_thread_t * );
+
+ if( !LockExtension( p_ext ) )
+ return VLC_EGENERIC;
+
+ // Change input
+ input_thread_t *old = p_ext->p_sys->p_input;
+ input_item_t *p_item;
+ if( old )
+ {
+ // Untrack meta fetched events
+ if( p_ext->p_sys->i_capabilities & EXT_META_LISTENER )
+ {
+ p_item = input_GetItem( old );
+ vlc_event_detach( &p_item->event_manager,
+ vlc_InputItemMetaChanged,
+ inputItemMetaChanged,
+ p_ext );
+ vlc_gc_decref( p_item );
+ }
+ vlc_object_release( old );
+ }
+
+ p_ext->p_sys->p_input = p_input ? vlc_object_hold( p_input )
+ : p_input;
+
+ // Tell the script the input changed
+ if( p_ext->p_sys->i_capabilities & EXT_INPUT_LISTENER )
+ {
+ PushCommandUnique( p_ext, CMD_SET_INPUT );
+ }
+
+ // Track meta fetched events
+ if( p_ext->p_sys->p_input &&
+ p_ext->p_sys->i_capabilities & EXT_META_LISTENER )
+ {
+ p_item = input_GetItem( p_ext->p_sys->p_input );
+ vlc_gc_incref( p_item );
+ vlc_event_attach( &p_item->event_manager,
+ vlc_InputItemMetaChanged,
+ inputItemMetaChanged,
+ p_ext );
+ }
+
+ UnlockExtension( p_ext );
+ break;
+ }
+ case EXTENSION_PLAYING_CHANGED:
+ {
+ extension_t *p_ext;
+ p_ext = ( extension_t* ) va_arg( args, extension_t* );
+ assert( p_ext->psz_name != NULL );
+ i = ( int ) va_arg( args, int );
+ if( p_ext->p_sys->i_capabilities & EXT_PLAYING_LISTENER )
+ {
+ PushCommand( p_ext, CMD_PLAYING_CHANGED, i );
+ }
+ break;
+ }