diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-08-04 14:13:45 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-08-04 14:14:13 +0200 |
commit | 491c52d3b077dc1f298322a719059398a5f76af8 (patch) | |
tree | fd1c32bfdcc217e39a7a31aa5b07ffee3491cff7 | |
parent | e3dc2c86fc4178b100484c54f12c88705cdf6724 (diff) | |
parent | eb9244f20210fd420fb9b3c98126f9cae525d1cc (diff) | |
download | ffmpeg-491c52d3b077dc1f298322a719059398a5f76af8.tar.gz |
Merge commit 'eb9244f20210fd420fb9b3c98126f9cae525d1cc'
* commit 'eb9244f20210fd420fb9b3c98126f9cae525d1cc':
Add Icecast protocol
Conflicts:
Changelog
configure
doc/protocols.texi
libavformat/icecast.c
libavformat/version.h
See: e3dc2c86fc4178b100484c54f12c88705cdf6724
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | doc/protocols.texi | 34 | ||||
-rw-r--r-- | libavformat/icecast.c | 37 | ||||
-rw-r--r-- | libavformat/version.h | 3 |
4 files changed, 44 insertions, 32 deletions
@@ -2484,7 +2484,7 @@ gopher_protocol_select="network" http_protocol_select="tcp_protocol" httpproxy_protocol_select="tcp_protocol" https_protocol_select="tls_protocol" -icecast_protocol_select="http" +icecast_protocol_select="http_protocol" librtmp_protocol_deps="librtmp" librtmpe_protocol_deps="librtmp" librtmps_protocol_deps="librtmp" diff --git a/doc/protocols.texi b/doc/protocols.texi index cb75d92a97..49ca750b76 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -295,39 +295,41 @@ ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somed @section Icecast -Icecast protocol +Icecast protocol (stream to Icecast servers) + +This protocol accepts the following options: @table @option @item ice_genre -Set the genre of the stream. +Set the stream genre. @item ice_name -Set the name of the stream. +Set the stream name. @item ice_description -Set the description of the stream. +Set the stream description. @item ice_url -Set the stream website url. +Set the stream website URL. @item ice_public Set if the stream should be public. -Default is 0 (not public). +The default is 0 (not public). -@item ice_password -Password for the mountpoint. +@item user_agent +Override the User-Agent header. If not specified a string of the form +"Lavf/<version>" will be used. -@item legacy_icecast -If set to 1, enable support for legacy Icecast (Version < 2.4), using the SOURCE method -instead of the PUT method. +@item password +Set the Icecast mountpoint password. @item content_type -Set a specific content type for the stream. -This MUST be set if streaming else than audio/mpeg +Set the stream content type. This must be set if it is different from +audio/mpeg. -@item user_agent -Override the User-Agent header. If not specified the protocol will use a -string describing the libavformat build. ("Lavf/<version>") +@item legacy_icecast +This enables support for Icecast versions < 2.4.0, that do not support the +HTTP PUT method but the SOURCE method. @end table diff --git a/libavformat/icecast.c b/libavformat/icecast.c index 67d807e2ce..56a2976f06 100644 --- a/libavformat/icecast.c +++ b/libavformat/icecast.c @@ -72,6 +72,14 @@ static void cat_header(AVBPrint *bp, const char key[], const char value[]) av_bprintf(bp, "%s: %s\r\n", key, value); } +static int icecast_close(URLContext *h) +{ + IcecastContext *s = h->priv_data; + if (s->hd) + ffurl_close(s->hd); + return 0; +} + static int icecast_open(URLContext *h, const char *uri, int flags) { IcecastContext *s = h->priv_data; @@ -81,10 +89,13 @@ static int icecast_open(URLContext *h, const char *uri, int flags) // URI part variables char h_url[1024], host[1024], auth[1024], path[1024]; - char *user = NULL, *headers = NULL; + char *headers = NULL, *user = NULL; int port, ret; AVBPrint bp; + if (flags & AVIO_FLAG_READ) + return AVERROR(ENOSYS); + av_bprint_init(&bp, 0, 1); // Build header strings @@ -122,9 +133,15 @@ static int icecast_open(URLContext *h, const char *uri, int flags) av_free(s->pass); av_log(h, AV_LOG_WARNING, "Overwriting -password <pass> with URI password!\n"); } - s->pass = av_strdup(sep); + if (!(s->pass = av_strdup(sep))) { + ret = AVERROR(ENOMEM); + goto cleanup; + } + } + if (!(user = av_strdup(auth))) { + ret = AVERROR(ENOMEM); + goto cleanup; } - user = av_strdup(auth); } // Build new authstring @@ -163,13 +180,13 @@ static int icecast_write(URLContext *h, const uint8_t *buf, int size) static const uint8_t webm[4] = { 0x1A, 0x45, 0xDF, 0xA3 }; static const uint8_t opus[8] = { 0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64 }; if (memcmp(buf, oggs, sizeof(oggs)) == 0) { - av_log(h, AV_LOG_WARNING, "Streaming ogg but appropriate content type NOT set!\n"); + av_log(h, AV_LOG_WARNING, "Streaming Ogg but appropriate content type NOT set!\n"); av_log(h, AV_LOG_WARNING, "Set it with -content_type application/ogg\n"); } else if (memcmp(buf, opus, sizeof(opus)) == 0) { - av_log(h, AV_LOG_WARNING, "Streaming opus but appropriate content type NOT set!\n"); + av_log(h, AV_LOG_WARNING, "Streaming Opus but appropriate content type NOT set!\n"); av_log(h, AV_LOG_WARNING, "Set it with -content_type audio/ogg\n"); } else if (memcmp(buf, webm, sizeof(webm)) == 0) { - av_log(h, AV_LOG_WARNING, "Streaming webm but appropriate content type NOT set!\n"); + av_log(h, AV_LOG_WARNING, "Streaming WebM but appropriate content type NOT set!\n"); av_log(h, AV_LOG_WARNING, "Set it with -content_type video/webm\n"); } else { av_log(h, AV_LOG_WARNING, "It seems you are streaming an unsupported format.\n"); @@ -180,14 +197,6 @@ static int icecast_write(URLContext *h, const uint8_t *buf, int size) return ffurl_write(s->hd, buf, size); } -static int icecast_close(URLContext *h) -{ - IcecastContext *s = h->priv_data; - if (s->hd) - ffurl_close(s->hd); - return 0; -} - static const AVClass icecast_context_class = { .class_name = "icecast", .item_name = av_default_item_name, diff --git a/libavformat/version.h b/libavformat/version.h index 6f793d65ce..9a1c40c1db 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,8 +30,9 @@ #include "libavutil/version.h" #define LIBAVFORMAT_VERSION_MAJOR 55 + #define LIBAVFORMAT_VERSION_MINOR 51 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ |