On Tue, Jul 22, 2014 at 12:12:34AM +0200, [email protected] wrote:
> From: ePirat <[email protected]>
Something seems to be amiss in your Git setup wrt your name.
> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -138,6 +138,46 @@ Set initial byte offset.
>
> +@item ice_url
> +Set the stream website URL
End this sentence in a period.
> +@item password
> +Set the Icecast Mount password.
s/Mount/mount/ I guess.
> +@item content_type
> +Set the stream content type. This must be set if it is different from
> +audio/mpeg
Again, end the sentence in a period.
> --- a/libavformat/Makefile
> +++ b/libavformat/Makefile
> @@ -392,6 +392,7 @@ OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o
> OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o
> OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o
> OBJS-$(CONFIG_UNIX_PROTOCOL) += unix.o
> +OBJS-$(CONFIG_ICECAST_PROTOCOL) += icecast.o
>
> OBJS-$(HAVE_LIBC_MSVCRT) += file_open.o
>
> --- a/libavformat/allformats.c
> +++ b/libavformat/allformats.c
> @@ -287,6 +287,7 @@ void av_register_all(void)
> REGISTER_PROTOCOL(TLS, tls);
> REGISTER_PROTOCOL(UDP, udp);
> REGISTER_PROTOCOL(UNIX, unix);
> + REGISTER_PROTOCOL(ICECAST, icecast);
Maintain order in both of these files please.
> --- /dev/null
> +++ b/libavformat/icecast.c
> @@ -0,0 +1,236 @@
> +
> +
> +#include "libavutil/avstring.h"
> +
> +#include "libavutil/opt.h"
> +
> +#include "avformat.h"
> +#include "network.h"
Drop the empty line between libavutil headers.
> +static const AVOption options[] = {
> + { "ice_genre", "set stream genre", OFFSET(genre), AV_OPT_TYPE_STRING, {
> 0 }, 0, 0, E },
> + { "ice_name", "set stream description", OFFSET(name),
> AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
> + { "ice_description", "set stream description", OFFSET(description),
> AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
> + { "ice_url", "set stream website", OFFSET(url), AV_OPT_TYPE_STRING, { 0
> }, 0, 0, E },
> + { "ice_public", "set if stream is public", OFFSET(public),
> AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
> + { "user_agent", "override User-Agent header", OFFSET(user_agent),
> AV_OPT_TYPE_STRING, { .str = DEFAULT_USER_AGENT }, 0, 0, E },
> + { "password", "set password", OFFSET(pass), AV_OPT_TYPE_STRING, { 0 },
> 0, 0, E },
> + { "content_type", "set content-type, MUST be set if not audio/mpeg",
> OFFSET(content_type), AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
> + { "legacy_icecast", "use legacy SOURCE method, for Icecast < v2.4",
> OFFSET(legacy_icecast), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, E },
> + {NULL}
Spaces inside the last {} as well please.
> +static char * cat_header(char buf[], const char key[], const char value[])
*cat_header
> +static int icecast_open(URLContext *h, const char *uri, int flags)
> +{
> + IcecastContext *s = h->priv_data;
> +
trailing whitespace, more below
> + // URI part variables
> + char h_url[1024];
> + char host[1024];
> + char auth[1024];
> + char path[1024];
nit: Maybe coalesce these declarations.
> + // Check for auth data in URI
> + if (!EMPTY(auth)) {
> + char *p = strchr(auth, ':');
> + if (p){
> + // Setting user and pass from URI
> + if (s->user != NULL)
> + av_free(s->user);
> + int user_len = p + 1 - auth;
> + s->user = av_malloc(user_len);
> + av_strlcpy(s->user, auth, user_len);
> + p++;
> + if (s->pass != NULL) {
> + av_free(s->pass);
> + av_log(h, AV_LOG_WARNING, "Overwriting -password <pass> with
> URI password!\n");
> + }
> + s->pass = av_malloc((int)(auth - user_len));
> + av_strlcpy(s->pass, p, (int)(auth - user_len));
> + } else {
> + // Setting user from URI
> + if (s->user != NULL)
> + av_free(s->user);
> + s->user = av_malloc(strlen(auth));
> + av_strlcpy(s->user, auth, (int) auth);
> + }
> + }
There are three unchecked memory allocations in this block.
> + const uint8_t oggs[4] = {0x4F, 0x67, 0x67, 0x53};
> + const uint8_t webm[4] = {0x1A, 0x45, 0xDF, 0xA3};
> + const uint8_t opus[8] = {0x4F, 0x70, 0x75, 0x73, 0x48, 0x65,
> 0x61, 0x64};
spaces inside {}
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel