int VlcProc::onGenericCallback( vlc_object_t *pObj, const char *pVariable, vlc_value_t oldVal, vlc_value_t newVal, void *pParam ) { (void)oldVal; VlcProc *pThis = (VlcProc*)pParam; AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() ); #define ADD_CALLBACK_ENTRY( var, func, remove ) \ { \ if( strcmp( pVariable, var ) == 0 ) \ { \ string label = var; \ CmdGeneric *pCmd = new CmdCallback( pThis->getIntf(), pObj, newVal, \ &VlcProc::func, label ); \ if( pCmd ) \ pQueue->push( CmdGenericPtr( pCmd ), remove ); \ return VLC_SUCCESS; \ } \ } ADD_CALLBACK_ENTRY( "item-current", on_item_current_changed, false ) ADD_CALLBACK_ENTRY( "volume", on_volume_changed, true ) ADD_CALLBACK_ENTRY( "bit-rate", on_bit_rate_changed, false ) ADD_CALLBACK_ENTRY( "sample-rate", on_sample_rate_changed, false ) ADD_CALLBACK_ENTRY( "can-record", on_can_record_changed, false ) ADD_CALLBACK_ENTRY( "random", on_random_changed, false ) ADD_CALLBACK_ENTRY( "loop", on_loop_changed, false ) ADD_CALLBACK_ENTRY( "repeat", on_repeat_changed, false ) ADD_CALLBACK_ENTRY( "audio-filter", on_audio_filter_changed, false ) ADD_CALLBACK_ENTRY( "intf-toggle-fscontrol", on_intf_show_changed, false ) ADD_CALLBACK_ENTRY( "mouse-moved", on_mouse_moved_changed, false ) #undef ADD_CALLBACK_ENTRY msg_Err( pThis->getIntf(), "no callback entry for %s", pVariable ); return VLC_EGENERIC; }
int VlcProc::onGenericCallback( vlc_object_t *pObj, const char *pVariable, vlc_value_t oldVal, vlc_value_t newVal, void *pParam ) { VlcProc *pThis = (VlcProc*)pParam; AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() ); CmdGeneric *pCmd = NULL; #define ADD_CALLBACK_ENTRY( var, label ) \ { \ if( strcmp( pVariable, var ) == 0 ) \ pCmd = new Cmd_##label( pThis->getIntf(), pObj, newVal ); \ } ADD_CALLBACK_ENTRY( "item-current", item_current_changed ) ADD_CALLBACK_ENTRY( "volume-change", volume_changed ) ADD_CALLBACK_ENTRY( "intf-event", intf_event_changed ) ADD_CALLBACK_ENTRY( "bit-rate", bit_rate_changed ) ADD_CALLBACK_ENTRY( "sample-rate", sample_rate_changed ) ADD_CALLBACK_ENTRY( "can-record", can_record_changed ) ADD_CALLBACK_ENTRY( "random", random_changed ) ADD_CALLBACK_ENTRY( "loop", loop_changed ) ADD_CALLBACK_ENTRY( "repeat", repeat_changed ) ADD_CALLBACK_ENTRY( "audio-filter", audio_filter_changed ) ADD_CALLBACK_ENTRY( "intf-show", intf_show_changed ) #undef ADD_CALLBACK_ENTRY if( pCmd ) pQueue->push( CmdGenericPtr( pCmd ), false ); else msg_Err( pObj, "no Callback entry provided for %s", pVariable ); return VLC_SUCCESS; }