From ddd7559ad97d3cde401ce096262af6375685ea22 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 7 Dec 2012 13:09:20 -0800 Subject: [PATCH 1/5] h264: check for invalid zeros_left before writing Prevent an invalid write into coeffs[scantable[-1]] if zeros_left itself was an invalid VLC code (and thus -1). Signed-off-by: Luca Barbato --- libavcodec/h264_cavlc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index 87021229d4..0cc7214666 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -610,17 +610,18 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in } \ } + if (zeros_left < 0) { + av_log(h->s.avctx, AV_LOG_ERROR, + "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y); + return AVERROR_INVALIDDATA; + } + if (h->pixel_shift) { STORE_BLOCK(int32_t) } else { STORE_BLOCK(int16_t) } - if(zeros_left<0){ - av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y); - return -1; - } - return 0; } From 5fbceb2c6339c9d0a370c0e5bf6dc229812865eb Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 8 Dec 2012 05:32:00 +0100 Subject: [PATCH 2/5] hls: add start_number option --- doc/muxers.texi | 1 + libavformat/hlsenc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index 570041d679..a2a9ce4af2 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -109,6 +109,7 @@ avconv -i in.nut out.m3u8 @item -hls_time segment length in seconds @item -hls_list_size maximum number of playlist entries @item -hls_wrap number after which index wraps +@item -start_number first number in the sequence @end table @anchor{image2} diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 88f47e0f37..1003b85aa9 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -295,6 +295,7 @@ static int hls_write_trailer(struct AVFormatContext *s) #define OFFSET(x) offsetof(HLSContext, x) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { + { "start_number", "first number in the sequence", OFFSET(number), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E}, {"hls_time", "segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E}, {"hls_list_size", "maximum number of playlist entries", OFFSET(size), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E}, {"hls_wrap", "number after which the index wraps", OFFSET(wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E}, From adbe03077d197813d5ecba43e918ece9c2b8e9b9 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 8 Dec 2012 06:00:46 +0100 Subject: [PATCH 3/5] hls: use a meaningful long name --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 1003b85aa9..9d3b46645e 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -312,7 +312,7 @@ static const AVClass hls_class = { AVOutputFormat ff_hls_muxer = { .name = "hls", - .long_name = NULL_IF_CONFIG_SMALL("hls"), + .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"), .extensions = "m3u8", .priv_data_size = sizeof(HLSContext), .audio_codec = AV_CODEC_ID_MP2, From 3c3a580f93c9bb2d579ba0c87f4c704785641744 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 8 Dec 2012 06:14:41 +0100 Subject: [PATCH 4/5] hls: improve options description --- doc/muxers.texi | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index a2a9ce4af2..41041372c3 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -106,10 +106,14 @@ avconv -i in.nut out.m3u8 @end example @table @option -@item -hls_time segment length in seconds -@item -hls_list_size maximum number of playlist entries -@item -hls_wrap number after which index wraps -@item -start_number first number in the sequence +@item -hls_time @var{seconds} +Set the segment length in seconds. +@item -hls_list_size @var{size} +Set the maximum number of playlist entries. +@item -hls_wrap @var{wrap} +Set the number after which index wraps. +@item -start_number @var{number} +Start the sequence from @var{number}. @end table @anchor{image2} From 18e6f087c4a50bede8449ee164778945480be50c Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sat, 8 Dec 2012 05:49:37 +0100 Subject: [PATCH 5/5] img2: document the options available --- doc/demuxers.texi | 13 +++++++++++++ doc/muxers.texi | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index c3049ddfc4..2d5c425922 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -64,6 +64,19 @@ Note that the pattern must not necessarily contain "%d" or avconv -i img.jpeg img.png @end example +@table @option +@item -pixel_format @var{format} +Set the pixel format (for raw image) +@item -video_size @var{size} +Set the frame size (for raw image) +@item -framerate @var{rate} +Set the frame rate +@item -loop @var{bool} +Loop over the images +@item -start_number @var{start} +Specify the first number in the sequence +@end table + @section applehttp Apple HTTP Live Streaming demuxer. diff --git a/doc/muxers.texi b/doc/muxers.texi index 41041372c3..4973f1af1d 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -168,6 +168,11 @@ Note also that the pattern must not necessarily contain "%d" or avconv -i in.avi -f image2 -frames:v 1 img.jpeg @end example +@table @option +@item -start_number @var{number} +Start the sequence from @var{number}. +@end table + @section MOV/MP4/ISMV The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4