/***************************************************************************** * probe.c : run-time service listing ***************************************************************************** * Copyright © 2009 Rémi Denis-Courmont * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include "libvlc.h" #undef vlc_probe void *vlc_probe (vlc_object_t *obj, const char *capability, size_t *restrict pcount) { vlc_probe_t *probe = vlc_custom_create (obj, sizeof(*probe), VLC_OBJECT_GENERIC, "probe"); if (unlikely(probe == NULL)) { *pcount = 0; return NULL; } vlc_object_attach (probe, obj); probe->list = NULL; probe->count = 0; module_t *mod = module_need (probe, capability, NULL, false); if (mod != NULL) { msg_Warn (probe, "probing halted"); module_unneed (probe, mod); } void *ret = probe->list; *pcount = probe->count; vlc_object_release (probe); return ret; }