Extract SD DNS-SD TXT field parsing from DNS-SD modules
Currently the protocol list supported by microdns.c, bonjour.m and avahi.c is hardcoded into the discovery modules, the chromecast parsing is duplicated in those three files, and there is no way to add new protocol, or remove them.
It also means that even if chromecast is disabled, the discovery modules will still report that there is a chromecast available for rendering.
Extract the parsing from those modules and move it to a new capability in the renderer themselves.
Example:
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index ae2cd639b8c..65fbacc427b 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -184,6 +184,7 @@ static void Close(vlc_object_t *);
static int ProxyOpen(vlc_object_t *);
static int AccessOpen(vlc_object_t *);
static void AccessClose(vlc_object_t *);
+static int SDParserOpen(vlc_sd_parser_t *);
static const char *const ppsz_sout_options[] = {
"ip", "port", "http-port", "video", NULL
@@ -239,8 +240,24 @@ vlc_module_begin ()
add_shortcut("chromecast-http")
set_capability("sout access", 0)
set_callbacks(AccessOpen, AccessClose)
+ add_submodule()
+ set_capability("renderer discovery parser", 100)
+ set_callback(SDParserOpen)
vlc_module_end ()
+static int SDParserOpen(vlc_sd_parser_t *parser)
+{
+ if (strcmp(parser->type, "chromecast") != 0)
+ return VLC_EGENERIC;
+
+ // parsing stuff
+
+ // Inject the new renderer
+ vlc_sd_parser_AddRenderer(parser, ...);
+
+ return VLC_SUCCESS;
+}
+
static void *ProxyAdd(sout_stream_t *p_stream, const es_format_t *p_fmt)
{
sout_stream_sys_t *p_sys = reinterpret_cast<sout_stream_sys_t *>( p_stream->p_sys );