int mpd_server_set_output_device(MpdObj *mi,int device_id,int state) { if(!mpd_check_connected(mi)) { debug_printf(DEBUG_WARNING,"not connected\n"); return MPD_NOT_CONNECTED; } if(mpd_lock_conn(mi)) { debug_printf(DEBUG_ERROR,"lock failed\n"); return MPD_LOCK_FAILED; } if(state) { mpd_sendEnableOutputCommand(mi->connection, device_id); } else { mpd_sendDisableOutputCommand(mi->connection, device_id); } mpd_finishCommand(mi->connection); mpd_unlock_conn(mi); mpd_status_queue_update(mi); return FALSE; }
int cmd_disable(mpd_unused int argc, char **argv, mpd_Connection *conn) { int arg; if( ! parse_int( argv[0], &arg ) || arg <= 0 ) { DIE( "Not a positive integer\n" ); } else { mpd_sendDisableOutputCommand( conn, ( arg - 1 ) ); } mpd_finishCommand( conn ); return cmd_outputs(0, NULL, conn); }