#ifndef VLC_SERVICES_DISCOVERY_H_
#define VLC_SERVICES_DISCOVERY_H_
+#include <vlc_input.h>
+#include <vlc_events.h>
+#include <vlc_probe.h>
+
/**
* \file
* This file functions and structures for service discovery in vlc
* @{
*/
-#include <vlc_input.h>
-#include <vlc_events.h>
-
struct services_discovery_t
{
VLC_COMMON_MEMBERS
VLC_EXPORT( void, services_discovery_AddItem, ( services_discovery_t * p_this, input_item_t * p_item, const char * psz_category ) );
VLC_EXPORT( void, services_discovery_RemoveItem, ( services_discovery_t * p_this, input_item_t * p_item ) );
+
+/* SD probing */
+
+VLC_EXPORT(int, vlc_sd_probe_Add, (vlc_probe_t *, const char *, const char *));
+
+#define VLC_SD_PROBE_SUBMODULE \
+ add_submodule() \
+ set_capability( "services probe", 100 ) \
+ set_callbacks( vlc_sd_probe_Open, NULL )
+
+#define VLC_SD_PROBE_HELPER(name, longname) \
+static int vlc_sd_probe_Open (vlc_object_t *obj) \
+{ \
+ return vlc_sd_probe_Add ((struct vlc_probe_t *)obj, name, longname); \
+}
+
/** @} */
# ifdef __cplusplus
}
#include "playlist_internal.h"
#include "../libvlc.h"
-#undef vlc_sd_GetNames
-
typedef struct
{
char *name;
char *longname;
} vlc_sd_probe_t;
+int vlc_sd_probe_Add (vlc_probe_t *probe, const char *name,
+ const char *longname)
+{
+ vlc_sd_probe_t names = { strdup(name), strdup(longname) };
+
+ if (unlikely (names.name == NULL || names.longname == NULL
+ || vlc_probe_add (probe, &names, sizeof (names))))
+ {
+ free (names.name);
+ free (names.longname);
+ return VLC_ENOMEM;
+ }
+ return VLC_PROBE_CONTINUE;
+}
+
+#undef vlc_sd_GetNames
+
/**
* Gets the list of available services discovery plugins.
*/