From 49c45a26244cee7594b3530c1d8975ce13d6b8f0 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Tue, 24 Jul 2012 23:58:59 +0200 Subject: [PATCH 1/7] avfilter: Fix printf format string conversion specifier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit libavfilter/avfilter.c:224:9: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘int’ [-Wformat] --- libavfilter/avfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index dc828153f9..d302264137 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -222,7 +222,7 @@ void ff_dlog_link(void *ctx, AVFilterLink *link, int end) av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); av_dlog(ctx, - "link[%p r:%"PRId64" cl:%s fmt:%-16s %-16s->%-16s]%s", + "link[%p r:%d cl:%s fmt:%-16s %-16s->%-16s]%s", link, link->sample_rate, buf, av_get_sample_fmt_name(link->format), link->src ? link->src->filter->name : "", From f9a9a148622530cb02dbb81b31d951785f6d331a Mon Sep 17 00:00:00 2001 From: Jordi Ortiz Date: Tue, 24 Jul 2012 19:59:53 +0200 Subject: [PATCH 2/7] tcp: add port missing error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch a user a bit absent-minded may not notice that the connection doesn't work because the port is missing. Signed-off-by: Martin Storsjö --- libavformat/tcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 1d953e3a11..bdaab7f806 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -49,9 +49,12 @@ static int tcp_open(URLContext *h, const char *uri, int flags) av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), uri); - if (strcmp(proto,"tcp") || port <= 0 || port >= 65536) + if (strcmp(proto, "tcp")) return AVERROR(EINVAL); - + if (port <= 0 || port >= 65536) { + av_log(h, AV_LOG_ERROR, "Port missing in uri\n"); + return AVERROR(EINVAL); + } p = strchr(uri, '?'); if (p) { if (av_find_info_tag(buf, sizeof(buf), "listen", p)) From ecfff0e9929f399119437cd7113bad1cd968e8ea Mon Sep 17 00:00:00 2001 From: Jordi Ortiz Date: Tue, 24 Jul 2012 19:56:39 +0200 Subject: [PATCH 3/7] sctp: add port missing error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this patch a user a bit absent-minded may not notice that the connection doesn't work because the port is missing. Signed-off-by: Martin Storsjö --- libavformat/sctp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/sctp.c b/libavformat/sctp.c index 7bcb5ae0a9..b8ab63e7da 100644 --- a/libavformat/sctp.c +++ b/libavformat/sctp.c @@ -170,8 +170,12 @@ static int sctp_open(URLContext *h, const char *uri, int flags) av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), uri); - if (strcmp(proto,"sctp") || port <= 0 || port >= 65536) + if (strcmp(proto, "sctp")) return AVERROR(EINVAL); + if (port <= 0 || port >= 65536) { + av_log(s, AV_LOG_ERROR, "Port missing in uri\n"); + return AVERROR(EINVAL); + } s->max_streams = 0; p = strchr(uri, '?'); From 160a27c5904c48bd83461253e7d58c63ca695de0 Mon Sep 17 00:00:00 2001 From: Kieran Kunhya Date: Mon, 23 Jul 2012 11:20:04 -0500 Subject: [PATCH 4/7] libfdk-aacenc: add LATM/LOAS encapsulation support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/libfdk-aacenc.c | 15 ++++++++++++++- libavcodec/version.h | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index f2c3fbdb73..4d7aa7b26a 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -33,6 +33,8 @@ typedef struct AACContext { int afterburner; int eld_sbr; int signaling; + int latm; + int header_period; AudioFrameQueue afq; } AACContext; @@ -45,6 +47,8 @@ static const AVOption aac_enc_options[] = { { "implicit", "Implicit backwards compatible signaling", 0, AV_OPT_TYPE_CONST, { 0 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" }, { "explicit_sbr", "Explicit SBR, implicit PS signaling", 0, AV_OPT_TYPE_CONST, { 1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" }, { "explicit_hierarchical", "Explicit hierarchical signaling", 0, AV_OPT_TYPE_CONST, { 2 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" }, + { "latm", "Output LATM/LOAS encapsulated data", offsetof(AACContext, latm), AV_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, + { "header_period", "StreamMuxConfig and PCE repetition period (in frames)", offsetof(AACContext, header_period), AV_OPT_TYPE_INT, { 0 }, 0, 0xffff, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, { NULL } }; @@ -204,12 +208,21 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) /* Choose bitstream format - if global header is requested, use * raw access units, otherwise use ADTS. */ if ((err = aacEncoder_SetParam(s->handle, AACENC_TRANSMUX, - avctx->flags & CODEC_FLAG_GLOBAL_HEADER ? 0 : 2)) != AACENC_OK) { + avctx->flags & CODEC_FLAG_GLOBAL_HEADER ? 0 : s->latm ? 10 : 2)) != AACENC_OK) { av_log(avctx, AV_LOG_ERROR, "Unable to set the transmux format: %s\n", aac_get_error(err)); goto error; } + if (s->latm && s->header_period) { + if ((err = aacEncoder_SetParam(s->handle, AACENC_HEADER_PERIOD, + s->header_period)) != AACENC_OK) { + av_log(avctx, AV_LOG_ERROR, "Unable to set header period: %s\n", + aac_get_error(err)); + goto error; + } + } + /* If no signaling mode is chosen, use explicit hierarchical signaling * if using mp4 mode (raw access units, with global header) and * implicit signaling if using ADTS. */ diff --git a/libavcodec/version.h b/libavcodec/version.h index 98d6690a9f..acad4d4a2a 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 23 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ From 63ffa154e93f8cf7e4dc197dce207acd402bea81 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 24 Jul 2012 16:29:38 +0200 Subject: [PATCH 5/7] rtmp: Make the description of the rtmp_tcurl option more generic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavformat/rtmpproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 1d25ae9a60..3dac9fab47 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -1500,7 +1500,7 @@ static const AVOption rtmp_options[] = { {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, "rtmp_live"}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_swfurl", "URL of the SWF player. By default no value will be sent", OFFSET(swfurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, - {"rtmp_tcurl", "URL of the target stream. Defaults to rtmp://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, + {"rtmp_tcurl", "URL of the target stream. Defaults to proto://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, { NULL }, }; From 98df48db6dfc2ed2cef7472e564d0de9639e8774 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 24 Jul 2012 16:29:39 +0200 Subject: [PATCH 6/7] doc: Update the description of the rtmp_tcurl option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- doc/protocols.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index 7b84f25815..616c9cda78 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -237,7 +237,7 @@ parameter specified in the URI. URL of the SWF player for the media. By default no value will be sent. @item rtmp_tcurl -URL of the target stream. +URL of the target stream. Defaults to proto://host[:port]/app. @end table From 758377a2b79a35386978b0af1196d36cbcfb8f64 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 24 Jul 2012 16:29:40 +0200 Subject: [PATCH 7/7] rtmp: Add a new option 'rtmp_pageurl' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option specifies the URL of the web page in which the media was embedded. Signed-off-by: Martin Storsjö --- doc/protocols.texi | 4 ++++ libavformat/rtmpproto.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 616c9cda78..ff872fcdca 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -229,6 +229,10 @@ playpath. If a live stream of that name is not found, it plays the recorded stream. The other possible values are @code{live} and @code{recorded}. +@item rtmp_pageurl +URL of the web page in which the media was embedded. By default no +value will be sent. + @item rtmp_playpath Stream identifier to play or to publish. This option overrides the parameter specified in the URI. diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 3dac9fab47..e20aacbc6c 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -90,6 +90,7 @@ typedef struct RTMPContext { char* tcurl; ///< url of the target stream char* flashver; ///< version of the flash plugin char* swfurl; ///< url of the swf player + char* pageurl; ///< url of the web page int server_bw; ///< server bandwidth int client_buffer_time; ///< client buffer time in ms int flush_interval; ///< number of packets flushed in the same request (RTMPT only) @@ -232,6 +233,11 @@ static int gen_connect(URLContext *s, RTMPContext *rt) ff_amf_write_number(&p, 252.0); ff_amf_write_field_name(&p, "videoFunction"); ff_amf_write_number(&p, 1.0); + + if (rt->pageurl) { + ff_amf_write_field_name(&p, "pageUrl"); + ff_amf_write_string(&p, rt->pageurl); + } } ff_amf_write_object_end(&p); @@ -1498,6 +1504,7 @@ static const AVOption rtmp_options[] = { {"any", "both", 0, AV_OPT_TYPE_CONST, {-2}, 0, 0, DEC, "rtmp_live"}, {"live", "live stream", 0, AV_OPT_TYPE_CONST, {-1}, 0, 0, DEC, "rtmp_live"}, {"recorded", "recorded stream", 0, AV_OPT_TYPE_CONST, {0}, 0, 0, DEC, "rtmp_live"}, + {"rtmp_pageurl", "URL of the web page in which the media was embedded. By default no value will be sent.", OFFSET(pageurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC}, {"rtmp_playpath", "Stream identifier to play or to publish", OFFSET(playpath), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_swfurl", "URL of the SWF player. By default no value will be sent", OFFSET(swfurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_tcurl", "URL of the target stream. Defaults to proto://host[:port]/app.", OFFSET(tcurl), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC},