[vlc-devel] [PATCH 1/4] vlc_url: parse '@[bindhost]:[bindport]' in '[serveraddr[:serverport]][@[bindaddr]:[bindport]]'
Rémi Denis-Courmont
remi at remlab.net
Thu Oct 27 17:06:22 CEST 2016
Le torstaina 27. lokakuuta 2016, 15.42.24 EEST Jean-Paul Saman a écrit :
> ---
> include/vlc_url.h | 2 ++
> src/text/url.c | 80
> ++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 69
> insertions(+), 13 deletions(-)
>
> diff --git a/include/vlc_url.h b/include/vlc_url.h
> index 5a20c27..802227e 100644
> --- a/include/vlc_url.h
> +++ b/include/vlc_url.h
> @@ -149,6 +149,8 @@ struct vlc_url_t
> char *psz_password;
> char *psz_host;
> unsigned i_port;
> + char *psz_bind_host;
> + unsigned i_bind_port;
> char *psz_path;
> char *psz_option;
>
> diff --git a/src/text/url.c b/src/text/url.c
> index 6116893..566d954 100644
> --- a/src/text/url.c
> +++ b/src/text/url.c
> @@ -407,6 +407,8 @@ int vlc_UrlParse(vlc_url_t *restrict url, const char
> *str) url->psz_password = NULL;
> url->psz_host = NULL;
> url->i_port = 0;
> + url->psz_bind_host = NULL;
> + url->i_bind_port = 0;
> url->psz_path = NULL;
> url->psz_option = NULL;
> url->psz_buffer = NULL;
> @@ -473,27 +475,78 @@ int vlc_UrlParse(vlc_url_t *restrict url, const char
> *str) /*else
> url->psz_path = "/";*/
>
> - /* User name */
> - next = strrchr(cur, '@');
> - if (next != NULL)
> + if (url->psz_protocol && (strcmp(url->psz_protocol, "udp") == 0))
What is the point in hacking vlc_UrlParse()? With this, we will need to patch
libvlccore everytime a new UDP-like is introduced, and exact for what
benefits?!
Plus this is not even correct. Schemes are case-insensitive, and all the RTP
plugin schemes using the same syntax are missing already. Stating the obvious
here, but if there is only one use of the functionality, it´s not code
factorization. Rather this is coding by exception (or magic strings).
We will never factor all MRL formats into one single function. It is pointless
and even counter-productive. We already have vlc_UrlParse() and
var_LocationParse() handling them differently anyway, not to mention a number
of plugin-specific syntaxes.
--
Rémi Denis-Courmont
Nonsponsored VLC developer
http://www.remlab.net/CV.pdf
More information about the vlc-devel
mailing list