// Get all the callbacks static int AllCallback( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { (void)p_this; (void)oldval; intf_thread_t *p_intf = (intf_thread_t*)p_data; callback_info_t *info = calloc( 1, sizeof( callback_info_t ) ); if( !info ) return VLC_ENOMEM; vlc_mutex_lock( &p_intf->p_sys->lock ); // Wich event is it ? if( !strcmp( "item-current", psz_var ) ) info->signal = SIGNAL_ITEM_CURRENT; else if( !strcmp( "intf-change", psz_var ) ) info->signal = SIGNAL_INTF_CHANGE; else if( !strcmp( "playlist-item-append", psz_var ) ) { info->signal = SIGNAL_PLAYLIST_ITEM_APPEND; info->i_node = ((playlist_add_t*)newval.p_address)->i_node; } else if( !strcmp( "playlist-item-deleted", psz_var ) ) info->signal = SIGNAL_PLAYLIST_ITEM_DELETED; else if( !strcmp( "random", psz_var ) ) info->signal = SIGNAL_RANDOM; else if( !strcmp( "repeat", psz_var ) ) info->signal = SIGNAL_REPEAT; else if( !strcmp( "loop", psz_var ) ) info->signal = SIGNAL_LOOP; else if( !strcmp( "intf-event", psz_var ) ) { int i_res; i_res = InputIntfEventCallback( p_intf, p_this, newval.i_int, info ); if( VLC_SUCCESS != i_res ) { vlc_mutex_unlock( &p_intf->p_sys->lock ); free( info ); return i_res; } } else assert(0); // Append the event vlc_array_append( p_intf->p_sys->p_events, info ); vlc_mutex_unlock( &p_intf->p_sys->lock ); msg_Dbg( p_intf, "Got a VLC event on %s. The main loop needs to wake up " "in order to process it", psz_var ); wakeup_main_loop( p_intf ); return VLC_SUCCESS; }
// Get all the callbacks static int AllCallback( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { (void)p_this; (void)oldval; intf_thread_t *p_intf = (intf_thread_t*)p_data; callback_info_t *info = calloc( 1, sizeof( callback_info_t ) ); if( !info ) return VLC_ENOMEM; vlc_mutex_lock( &p_intf->p_sys->lock ); // Wich event is it ? if( !strcmp( "item-current", psz_var ) ) info->signal = SIGNAL_ITEM_CURRENT; else if( !strcmp( "volume", psz_var ) ) info->signal = SIGNAL_VOLUME_CHANGE; else if( !strcmp( "mute", psz_var ) ) info->signal = SIGNAL_VOLUME_MUTED; else if( !strcmp( "intf-change", psz_var ) ) info->signal = SIGNAL_INTF_CHANGE; else if( !strcmp( "playlist-item-append", psz_var ) ) { info->signal = SIGNAL_PLAYLIST_ITEM_APPEND; info->i_node = ((playlist_add_t*)newval.p_address)->i_node; } else if( !strcmp( "playlist-item-deleted", psz_var ) ) info->signal = SIGNAL_PLAYLIST_ITEM_DELETED; else if( !strcmp( "random", psz_var ) ) info->signal = SIGNAL_RANDOM; else if( !strcmp( "fullscreen", psz_var ) ) info->signal = SIGNAL_FULLSCREEN; else if( !strcmp( "repeat", psz_var ) ) info->signal = SIGNAL_REPEAT; else if( !strcmp( "loop", psz_var ) ) info->signal = SIGNAL_LOOP; else if( !strcmp( "intf-event", psz_var ) ) { int i_res = InputIntfEventCallback( p_intf, (input_thread_t*) p_this, newval.i_int, info ); if( VLC_SUCCESS != i_res ) { vlc_mutex_unlock( &p_intf->p_sys->lock ); free( info ); return i_res; } } else if( !strcmp( "can-seek", psz_var ) ) info->signal = SIGNAL_CAN_SEEK; else if( !strcmp( "can-pause", psz_var ) ) info->signal = SIGNAL_CAN_PAUSE; else assert(0); // Append the event vlc_array_append( p_intf->p_sys->p_events, info ); vlc_mutex_unlock( &p_intf->p_sys->lock ); wakeup_main_loop( p_intf ); return VLC_SUCCESS; }