From f41c9f53de467296c64696ba9f25ee842f416cf9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 28 Sep 2012 02:18:32 +0200 Subject: [PATCH 001/328] Update for 1.0 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- VERSION | 1 + doc/RELEASE_NOTES | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 VERSION diff --git a/Doxyfile b/Doxyfile index b91f351800..f70522f050 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = 1.0 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..9f8e9b69a3 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/doc/RELEASE_NOTES b/doc/RELEASE_NOTES index 135165afa1..e3492d5a65 100644 --- a/doc/RELEASE_NOTES +++ b/doc/RELEASE_NOTES @@ -1,7 +1,7 @@ Release Notes ============= -* 0.10 "Freedom" January, 2012 +* 1.0 "Angel" September, 2012 General notes From 2efbff1db314c6a9c0d71ba3638a642dd6cf0ffd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 28 Sep 2012 02:24:05 +0200 Subject: [PATCH 002/328] Revert "ffprobe: Add a few common disposition cases" revert requested by ubitux for 1.0 This reverts commit 8e2a950b297b97605e97c454363f2f8555b004f0. --- doc/ffprobe.xsd | 3 --- ffprobe.c | 6 ------ tests/ref/fate/ffprobe_compact | 6 +++--- tests/ref/fate/ffprobe_csv | 6 +++--- tests/ref/fate/ffprobe_default | 8 -------- tests/ref/fate/ffprobe_flat | 8 -------- tests/ref/fate/ffprobe_ini | 8 -------- tests/ref/fate/ffprobe_json | 8 -------- tests/ref/fate/ffprobe_xml | 6 +++--- 9 files changed, 9 insertions(+), 50 deletions(-) diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd index 403d59e3e5..595d66fd8c 100644 --- a/doc/ffprobe.xsd +++ b/doc/ffprobe.xsd @@ -100,8 +100,6 @@ - - @@ -112,7 +110,6 @@ - diff --git a/ffprobe.c b/ffprobe.c index e9f66b0342..7c419c815a 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -1621,10 +1621,6 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i print_str("codec_tag_string", val_str); print_fmt("codec_tag", "0x%04x", dec_ctx->codec_tag); - /* Print useful disposition */ - print_int("default", !!(stream->disposition & AV_DISPOSITION_DEFAULT)); - print_int("forced", !!(stream->disposition & AV_DISPOSITION_FORCED)); - switch (dec_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: print_int("width", dec_ctx->width); @@ -1653,8 +1649,6 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i } else { print_str_opt("timecode", "N/A"); } - print_int("attached_pic", - !!(stream->disposition & AV_DISPOSITION_ATTACHED_PIC)); break; case AVMEDIA_TYPE_AUDIO: diff --git a/tests/ref/fate/ffprobe_compact b/tests/ref/fate/ffprobe_compact index 71239fe859..0a4733949e 100644 --- a/tests/ref/fate/ffprobe_compact +++ b/tests/ref/fate/ffprobe_compact @@ -26,7 +26,7 @@ packet|codec_type=video|stream_index=1|pts=3|pts_time=0.120000|dts=3|dts_time=0. frame|media_type=video|key_frame=1|pkt_pts=3|pkt_pts_time=0.120000|pkt_dts=3|pkt_dts_time=0.120000|pkt_duration=1|pkt_duration_time=0.040000|pkt_pos=794128|width=320|height=240|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|reference=0 packet|codec_type=video|stream_index=2|pts=3|pts_time=0.120000|dts=3|dts_time=0.120000|duration=1|duration_time=0.040000|convergence_duration=N/A|convergence_duration_time=N/A|size=30000|pos=1024550|flags=K frame|media_type=video|key_frame=1|pkt_pts=3|pkt_pts_time=0.120000|pkt_dts=3|pkt_dts_time=0.120000|pkt_duration=1|pkt_duration_time=0.040000|pkt_pos=1024550|width=100|height=100|pix_fmt=rgb24|sample_aspect_ratio=1:1|pict_type=I|coded_picture_number=0|display_picture_number=0|interlaced_frame=0|top_field_first=0|repeat_pict=0|reference=0 -stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_time_base=1/44100|codec_tag_string=[1][0][0][0]|codec_tag=0x0001|default=0|forced=0|sample_fmt=s16|sample_rate=44100|channels=1|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=527313|duration=11.957211|bit_rate=705600|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6 -stream|index=1|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/25|codec_tag_string=RGB[24]|codec_tag=0x18424752|default=0|forced=0|width=320|height=240|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=4:3|pix_fmt=rgb24|level=-99|timecode=N/A|attached_pic=0|id=N/A|r_frame_rate=25/1|avg_frame_rate=0/0|time_base=1/25|start_pts=0|start_time=0.000000|duration_ts=299|duration=11.960000|bit_rate=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4 -stream|index=2|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/25|codec_tag_string=RGB[24]|codec_tag=0x18424752|default=0|forced=0|width=100|height=100|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=1:1|pix_fmt=rgb24|level=-99|timecode=N/A|attached_pic=0|id=N/A|r_frame_rate=25/1|avg_frame_rate=0/0|time_base=1/25|start_pts=0|start_time=0.000000|duration_ts=299|duration=11.960000|bit_rate=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4 +stream|index=0|codec_name=pcm_s16le|profile=unknown|codec_type=audio|codec_time_base=1/44100|codec_tag_string=[1][0][0][0]|codec_tag=0x0001|sample_fmt=s16|sample_rate=44100|channels=1|bits_per_sample=16|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/44100|start_pts=0|start_time=0.000000|duration_ts=527313|duration=11.957211|bit_rate=705600|nb_frames=N/A|nb_read_frames=6|nb_read_packets=6 +stream|index=1|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/25|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=320|height=240|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=4:3|pix_fmt=rgb24|level=-99|timecode=N/A|id=N/A|r_frame_rate=25/1|avg_frame_rate=0/0|time_base=1/25|start_pts=0|start_time=0.000000|duration_ts=299|duration=11.960000|bit_rate=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4 +stream|index=2|codec_name=rawvideo|profile=unknown|codec_type=video|codec_time_base=1/25|codec_tag_string=RGB[24]|codec_tag=0x18424752|width=100|height=100|has_b_frames=0|sample_aspect_ratio=1:1|display_aspect_ratio=1:1|pix_fmt=rgb24|level=-99|timecode=N/A|id=N/A|r_frame_rate=25/1|avg_frame_rate=0/0|time_base=1/25|start_pts=0|start_time=0.000000|duration_ts=299|duration=11.960000|bit_rate=N/A|nb_frames=N/A|nb_read_frames=4|nb_read_packets=4 format|filename=tests/data/ffprobe-test.nut|nb_streams=3|format_name=nut|start_time=0.000000|duration=11.960000|size=1054625|bit_rate=705434|tag:title=ffprobe test file|tag:comment='A comment with CSV, XML & JSON special chars': |tag:comment2=I ♥ Üñîçød€ diff --git a/tests/ref/fate/ffprobe_csv b/tests/ref/fate/ffprobe_csv index 86e4a1a285..f56acaca69 100644 --- a/tests/ref/fate/ffprobe_csv +++ b/tests/ref/fate/ffprobe_csv @@ -26,7 +26,7 @@ packet,video,1,3,0.120000,3,0.120000,1,0.040000,N/A,N/A,230400,794128,K frame,video,1,3,0.120000,3,0.120000,1,0.040000,794128,320,240,rgb24,1:1,I,0,0,0,0,0,0 packet,video,2,3,0.120000,3,0.120000,1,0.040000,N/A,N/A,30000,1024550,K frame,video,1,3,0.120000,3,0.120000,1,0.040000,1024550,100,100,rgb24,1:1,I,0,0,0,0,0,0 -stream,0,pcm_s16le,unknown,audio,1/44100,[1][0][0][0],0x0001,0,0,s16,44100,1,16,N/A,0/0,0/0,1/44100,0,0.000000,527313,11.957211,705600,N/A,6,6 -stream,1,rawvideo,unknown,video,1/25,RGB[24],0x18424752,0,0,320,240,0,1:1,4:3,rgb24,-99,N/A,0,N/A,25/1,0/0,1/25,0,0.000000,299,11.960000,N/A,N/A,4,4 -stream,2,rawvideo,unknown,video,1/25,RGB[24],0x18424752,0,0,100,100,0,1:1,1:1,rgb24,-99,N/A,0,N/A,25/1,0/0,1/25,0,0.000000,299,11.960000,N/A,N/A,4,4 +stream,0,pcm_s16le,unknown,audio,1/44100,[1][0][0][0],0x0001,s16,44100,1,16,N/A,0/0,0/0,1/44100,0,0.000000,527313,11.957211,705600,N/A,6,6 +stream,1,rawvideo,unknown,video,1/25,RGB[24],0x18424752,320,240,0,1:1,4:3,rgb24,-99,N/A,N/A,25/1,0/0,1/25,0,0.000000,299,11.960000,N/A,N/A,4,4 +stream,2,rawvideo,unknown,video,1/25,RGB[24],0x18424752,100,100,0,1:1,1:1,rgb24,-99,N/A,N/A,25/1,0/0,1/25,0,0.000000,299,11.960000,N/A,N/A,4,4 format,tests/data/ffprobe-test.nut,3,nut,0.000000,11.960000,1054625,705434,ffprobe test file,"'A comment with CSV, XML & JSON special chars': ",I ♥ Üñîçød€ diff --git a/tests/ref/fate/ffprobe_default b/tests/ref/fate/ffprobe_default index a9b555bf36..8b7a1c38ad 100644 --- a/tests/ref/fate/ffprobe_default +++ b/tests/ref/fate/ffprobe_default @@ -482,8 +482,6 @@ codec_type=audio codec_time_base=1/44100 codec_tag_string=[1][0][0][0] codec_tag=0x0001 -default=0 -forced=0 sample_fmt=s16 sample_rate=44100 channels=1 @@ -509,8 +507,6 @@ codec_type=video codec_time_base=1/25 codec_tag_string=RGB[24] codec_tag=0x18424752 -default=0 -forced=0 width=320 height=240 has_b_frames=0 @@ -519,7 +515,6 @@ display_aspect_ratio=4:3 pix_fmt=rgb24 level=-99 timecode=N/A -attached_pic=0 id=N/A r_frame_rate=25/1 avg_frame_rate=0/0 @@ -541,8 +536,6 @@ codec_type=video codec_time_base=1/25 codec_tag_string=RGB[24] codec_tag=0x18424752 -default=0 -forced=0 width=100 height=100 has_b_frames=0 @@ -551,7 +544,6 @@ display_aspect_ratio=1:1 pix_fmt=rgb24 level=-99 timecode=N/A -attached_pic=0 id=N/A r_frame_rate=25/1 avg_frame_rate=0/0 diff --git a/tests/ref/fate/ffprobe_flat b/tests/ref/fate/ffprobe_flat index e9e2f87423..f9692b2fcc 100644 --- a/tests/ref/fate/ffprobe_flat +++ b/tests/ref/fate/ffprobe_flat @@ -425,8 +425,6 @@ streams.stream.0.codec_type="audio" streams.stream.0.codec_time_base="1/44100" streams.stream.0.codec_tag_string="[1][0][0][0]" streams.stream.0.codec_tag="0x0001" -streams.stream.0.default=0 -streams.stream.0.forced=0 streams.stream.0.sample_fmt="s16" streams.stream.0.sample_rate="44100" streams.stream.0.channels=1 @@ -450,8 +448,6 @@ streams.stream.1.codec_type="video" streams.stream.1.codec_time_base="1/25" streams.stream.1.codec_tag_string="RGB[24]" streams.stream.1.codec_tag="0x18424752" -streams.stream.1.default=0 -streams.stream.1.forced=0 streams.stream.1.width=320 streams.stream.1.height=240 streams.stream.1.has_b_frames=0 @@ -460,7 +456,6 @@ streams.stream.1.display_aspect_ratio="4:3" streams.stream.1.pix_fmt="rgb24" streams.stream.1.level=-99 streams.stream.1.timecode="N/A" -streams.stream.1.attached_pic=0 streams.stream.1.id="N/A" streams.stream.1.r_frame_rate="25/1" streams.stream.1.avg_frame_rate="0/0" @@ -480,8 +475,6 @@ streams.stream.2.codec_type="video" streams.stream.2.codec_time_base="1/25" streams.stream.2.codec_tag_string="RGB[24]" streams.stream.2.codec_tag="0x18424752" -streams.stream.2.default=0 -streams.stream.2.forced=0 streams.stream.2.width=100 streams.stream.2.height=100 streams.stream.2.has_b_frames=0 @@ -490,7 +483,6 @@ streams.stream.2.display_aspect_ratio="1:1" streams.stream.2.pix_fmt="rgb24" streams.stream.2.level=-99 streams.stream.2.timecode="N/A" -streams.stream.2.attached_pic=0 streams.stream.2.id="N/A" streams.stream.2.r_frame_rate="25/1" streams.stream.2.avg_frame_rate="0/0" diff --git a/tests/ref/fate/ffprobe_ini b/tests/ref/fate/ffprobe_ini index 1c3865902f..aef5d9a966 100644 --- a/tests/ref/fate/ffprobe_ini +++ b/tests/ref/fate/ffprobe_ini @@ -484,8 +484,6 @@ codec_type=audio codec_time_base=1/44100 codec_tag_string=[1][0][0][0] codec_tag=0x0001 -default=0 -forced=0 sample_fmt=s16 sample_rate=44100 channels=1 @@ -511,8 +509,6 @@ codec_type=video codec_time_base=1/25 codec_tag_string=RGB[24] codec_tag=0x18424752 -default=0 -forced=0 width=320 height=240 has_b_frames=0 @@ -521,7 +517,6 @@ display_aspect_ratio=4\:3 pix_fmt=rgb24 level=-99 timecode=N/A -attached_pic=0 id=N/A r_frame_rate=25/1 avg_frame_rate=0/0 @@ -543,8 +538,6 @@ codec_type=video codec_time_base=1/25 codec_tag_string=RGB[24] codec_tag=0x18424752 -default=0 -forced=0 width=100 height=100 has_b_frames=0 @@ -553,7 +546,6 @@ display_aspect_ratio=1\:1 pix_fmt=rgb24 level=-99 timecode=N/A -attached_pic=0 id=N/A r_frame_rate=25/1 avg_frame_rate=0/0 diff --git a/tests/ref/fate/ffprobe_json b/tests/ref/fate/ffprobe_json index 27b9cd2cfd..fb1a6f6807 100644 --- a/tests/ref/fate/ffprobe_json +++ b/tests/ref/fate/ffprobe_json @@ -479,8 +479,6 @@ "codec_time_base": "1/44100", "codec_tag_string": "[1][0][0][0]", "codec_tag": "0x0001", - "default": 0, - "forced": 0, "sample_fmt": "s16", "sample_rate": "44100", "channels": 1, @@ -503,8 +501,6 @@ "codec_time_base": "1/25", "codec_tag_string": "RGB[24]", "codec_tag": "0x18424752", - "default": 0, - "forced": 0, "width": 320, "height": 240, "has_b_frames": 0, @@ -512,7 +508,6 @@ "display_aspect_ratio": "4:3", "pix_fmt": "rgb24", "level": -99, - "attached_pic": 0, "r_frame_rate": "25/1", "avg_frame_rate": "0/0", "time_base": "1/25", @@ -530,8 +525,6 @@ "codec_time_base": "1/25", "codec_tag_string": "RGB[24]", "codec_tag": "0x18424752", - "default": 0, - "forced": 0, "width": 100, "height": 100, "has_b_frames": 0, @@ -539,7 +532,6 @@ "display_aspect_ratio": "1:1", "pix_fmt": "rgb24", "level": -99, - "attached_pic": 0, "r_frame_rate": "25/1", "avg_frame_rate": "0/0", "time_base": "1/25", diff --git a/tests/ref/fate/ffprobe_xml b/tests/ref/fate/ffprobe_xml index 623766409e..e73a15c7b5 100644 --- a/tests/ref/fate/ffprobe_xml +++ b/tests/ref/fate/ffprobe_xml @@ -32,9 +32,9 @@ - - - + + + From 38df088545b3c9e7e36079286b2bb1fc4cf2c23e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 28 Sep 2012 02:31:07 +0200 Subject: [PATCH 003/328] asfenc: avoid negative timestamps Fixes Ticket1606 Signed-off-by: Michael Niedermayer (cherry picked from commit b4c753487cf819213740d39c49b7bdc45338305d) Signed-off-by: Michael Niedermayer --- libavformat/asfenc.c | 3 +++ tests/ref/lavf/asf | 2 +- tests/ref/seek/lavf_asf | 54 ++++++++++++++++++++--------------------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 8d169f7e2e..82681d24f1 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -579,6 +579,9 @@ static int asf_write_header(AVFormatContext *s) ffio_init_context(&asf->pb, asf->packet_buf, s->packet_size, 1, NULL, NULL, NULL, NULL); + if (s->avoid_negative_ts < 0) + s->avoid_negative_ts = 1; + return 0; } diff --git a/tests/ref/lavf/asf b/tests/ref/lavf/asf index 5777d8b1a7..cfa53dcc73 100644 --- a/tests/ref/lavf/asf +++ b/tests/ref/lavf/asf @@ -1,3 +1,3 @@ -6dfad1f3d0f2638ea46f08edaf482f26 *./tests/data/lavf/lavf.asf +3937dfece4b48c0cdd8f44bcab3cdd2d *./tests/data/lavf/lavf.asf 333581 ./tests/data/lavf/lavf.asf ./tests/data/lavf/lavf.asf CRC=0x51485213 diff --git a/tests/ref/seek/lavf_asf b/tests/ref/seek/lavf_asf index 1427997890..9a14895513 100644 --- a/tests/ref/seek/lavf_asf +++ b/tests/ref/seek/lavf_asf @@ -1,53 +1,53 @@ -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 0 flags:1 ts:-0.317000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:0 ts: 2.577000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 ts: 1.471000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st:-1 flags:1 ts:-0.740831 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 0 flags:0 ts: 2.153000 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 0 flags:1 ts: 1.048000 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:0 ts:-0.058000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:1 ts: 2.836000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 0 flags:0 ts:-0.482000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 0 flags:1 ts: 2.413000 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 1 flags:0 ts: 1.307000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 ts: 0.201000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:0 ts:-0.904994 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 1 flags:1 dts: 0.930000 pts: 0.930000 pos: 301489 size: 209 +ret: 0 st: 1 flags:1 dts: 0.941000 pts: 0.941000 pos: 301489 size: 209 ret: 0 st: 0 flags:0 ts: 0.883000 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st: 0 flags:1 ts:-0.222000 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 ret: 0 st: 1 flags:0 ts: 2.672000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st: 1 flags:1 ts: 1.566000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 330289 size: 209 +ret: 0 st: 1 flags:1 dts: 0.993000 pts: 0.993000 pos: 330289 size: 209 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 1 flags:1 dts: 0.459000 pts: 0.459000 pos: 147889 size: 209 +ret: 0 st: 1 flags:1 dts: 0.470000 pts: 0.470000 pos: 147889 size: 209 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 689 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 689 size: 208 From a74f292d4ab3e800853c3ab7536418e6eb584b27 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 28 Sep 2012 02:58:35 +0200 Subject: [PATCH 004/328] tests/Makefile: fix ffprobe test dependancy This fixes the ffprobe tests under mingw/wine Signed-off-by: Michael Niedermayer (cherry picked from commit a96e3a3e77bdcc9ac8692f1547d867ec58a57e49) Signed-off-by: Michael Niedermayer --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 68620006cb..96d53c0a9b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -30,7 +30,7 @@ tests/data/vsynth1.yuv: tests/videogen$(HOSTEXESUF) | tests/data tests/data/vsynth2.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data $(M)$< $(SRC_PATH)/tests/lena.pnm $@ -tests/data/ffprobe-test.nut: ffmpeg$(HOSTEXESUF) | tests/data +tests/data/ffprobe-test.nut: ffmpeg$(EXESUF) | tests/data $(M)./$< \ -f lavfi -i "aevalsrc=sin(400*PI*2*t)::d=0.125[out0]; testsrc=d=0.125[out1]; testsrc=s=100x100:d=0.125[out2]" \ -f ffmetadata -i $(SRC_PATH)/tests/test.ffmeta \ From 09c79d50d88eada370489dac520e127aa56cf841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Fri, 12 Oct 2012 18:23:46 +0200 Subject: [PATCH 005/328] lavf/swfdec: fix flushing with compressed swf. We now only return in the middle of the refill in case of read error, so inflate can be re-called if zlib needs an empty (z.avail_in=0) inflate call for flushing. --- libavformat/swfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 86ea6dec9e..6136b54b05 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -72,7 +72,7 @@ static int zlib_refill(void *opaque, uint8_t *buf, int buf_size) retry: if (!z->avail_in) { int n = avio_read(s->pb, swf->zbuf_in, ZBUF_SIZE); - if (n <= 0) + if (n < 0) return n; z->next_in = swf->zbuf_in; z->avail_in = n; From 9913ecc68d5ad2cb5d7d4c955180448e0ee33eb4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 28 Sep 2012 05:25:22 +0200 Subject: [PATCH 006/328] configure: add missing dependancies for gpl tests fixes fate without --enable-gpl Signed-off-by: Michael Niedermayer (cherry picked from commit 4fefe91a33956007f17cfd6e0c5ee1cb3a3f36d8) Signed-off-by: Michael Niedermayer --- configure | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure b/configure index d2d3a66574..10c3cec039 100755 --- a/configure +++ b/configure @@ -1921,6 +1921,9 @@ showspectrum_filter_deps="avcodec" super2xsai_filter_deps="gpl" tinterlace_filter_deps="gpl" yadif_filter_deps="gpl" +pixfmts_super2xsai_test_deps="super2xsai_filter" +tinterlace_merge_test_deps="tinterlace_filter" +tinterlace_pad_test_deps="tinterlace_filter" # libraries avdevice_deps="avcodec avformat" From 3be4f230c6152fb88cfd23bb90aed3fc474e093b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 29 Sep 2012 19:11:25 +0200 Subject: [PATCH 007/328] ffv1enc: fix integer overflow with high resolutions and lots of slices. Signed-off-by: Michael Niedermayer (cherry picked from commit f049729e613ed3fb0abf767eb14423f545385c6e) Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 8f89542de7..572bcbb2df 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1313,9 +1313,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, for(i=1; islice_count; i++){ FFV1Context *fs= f->slice_context[i]; - uint8_t *start = pkt->data + (pkt->size-used_count)*i/f->slice_count; + uint8_t *start = pkt->data + (pkt->size-used_count)*(int64_t)i/f->slice_count; int len = pkt->size/f->slice_count; - ff_init_range_encoder(&fs->c, start, len); } avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void*)); From 7a67a70efa9c02ed557f9e4b29964dfa953f6892 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 29 Sep 2012 17:33:05 +0200 Subject: [PATCH 008/328] lavf: free probe data in case we close before probing finished Fixes Ticket1634 Signed-off-by: Michael Niedermayer (cherry picked from commit 44a7a6300d104dd453bcd5c601e9c6944fb34679) Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 05c4b7f5cc..7940037782 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3056,6 +3056,7 @@ void ff_free_stream(AVFormatContext *s, AVStream *st){ av_freep(&st->codec); av_freep(&st->priv_data); av_freep(&st->info); + av_freep(&st->probe_data.buf); av_freep(&s->streams[ --s->nb_streams ]); } From e21a53b6ebb6428b257f9662cb5c833f3e066935 Mon Sep 17 00:00:00 2001 From: jamal Date: Sat, 29 Sep 2012 00:41:32 -0300 Subject: [PATCH 009/328] fate: Fix --disable-zlib Signed-off-by: Michael Niedermayer (cherry picked from commit 062cd9acc129b46256e73900e8e49701e4bb00fd) Signed-off-by: Michael Niedermayer --- configure | 6 ++---- tests/fate/lossless-video.mak | 6 ++++-- tests/fate/qt.mak | 4 +++- tests/fate/screen.mak | 6 ++++-- tests/fate/vcodec.mak | 9 +++++---- tests/fate/video.mak | 4 ++-- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 10c3cec039..5fdf7cfbaa 100755 --- a/configure +++ b/configure @@ -1950,18 +1950,16 @@ doc_deps_any="manpages htmlpages podpages txtpages" # tests colormatrix1_test_deps="colormatrix_filter" colormatrix2_test_deps="colormatrix_filter" -flashsv2_test_deps="zlib" mpg_test_deps="mpeg1system_muxer mpegps_demuxer" -mpng_test_deps="zlib" +png_test_deps="zlib" pp_test_deps="mp_filter" pp2_test_deps="mp_filter" pp3_test_deps="mp_filter" pp4_test_deps="mp_filter" pp5_test_deps="mp_filter" pp6_test_deps="mp_filter" +seek_flashsv_flv_test_deps="zlib" seek_lavf_mxf_d10_test_deps="mxf_d10_test" -zlib_test_deps="zlib" -zmbv_test_deps="zlib" test_deps(){ suf1=$1 diff --git a/tests/fate/lossless-video.mak b/tests/fate/lossless-video.mak index 2ae035b998..cbf7f5292a 100644 --- a/tests/fate/lossless-video.mak +++ b/tests/fate/lossless-video.mak @@ -40,11 +40,13 @@ fate-mszh: CMD = framecrc -i $(SAMPLES)/lcl/mszh-1frame.avi FATE_LOSSLESS_VIDEO += fate-vble fate-vble: CMD = framecrc -i $(SAMPLES)/vble/flowers-partial-2MB.avi -FATE_LOSSLESS_VIDEO += fate-zlib +FATE_LOSSLESS_VIDEO-$(CONFIG_ZLIB) += fate-zlib fate-zlib: CMD = framecrc -i $(SAMPLES)/lcl/zlib-1frame.avi -FATE_LOSSLESS_VIDEO += fate-zerocodec +FATE_LOSSLESS_VIDEO-$(CONFIG_ZLIB) += fate-zerocodec fate-zerocodec: CMD = framecrc -i $(SAMPLES)/zerocodec/sample-zeco.avi +FATE_LOSSLESS_VIDEO += $(FATE_LOSSLESS_VIDEO-yes) + FATE_SAMPLES_FFMPEG += $(FATE_LOSSLESS_VIDEO) fate-lossless-video: $(FATE_LOSSLESS_VIDEO) diff --git a/tests/fate/qt.mak b/tests/fate/qt.mak index c626245157..3068ac63ec 100644 --- a/tests/fate/qt.mak +++ b/tests/fate/qt.mak @@ -46,8 +46,10 @@ fate-rpza: CMD = framecrc -i $(SAMPLES)/rpza/rpza2.mov -t 2 -pix_fmt rgb24 FATE_QT += fate-svq1 fate-svq1: CMD = framecrc -i $(SAMPLES)/svq1/marymary-shackles.mov -an -t 10 -FATE_QT += fate-svq3 +FATE_QT-$(CONFIG_ZLIB) += fate-svq3 fate-svq3: CMD = framecrc -i $(SAMPLES)/svq3/Vertical400kbit.sorenson3.mov -t 6 -an +FATE_QT += $(FATE_QT-yes) + FATE_SAMPLES_FFMPEG += $(FATE_QT) fate-qt: $(FATE_QT) diff --git a/tests/fate/screen.mak b/tests/fate/screen.mak index eb7bafe9c3..14264a6547 100644 --- a/tests/fate/screen.mak +++ b/tests/fate/screen.mak @@ -32,7 +32,7 @@ fate-tscc-15bit: CMD = framecrc -i $(SAMPLES)/tscc/oneminute.avi -t 15 -pix_fmt FATE_TSCC += fate-tscc-32bit fate-tscc-32bit: CMD = framecrc -i $(SAMPLES)/tscc/2004-12-17-uebung9-partial.avi -pix_fmt rgb24 -an -FATE_SCREEN += $(FATE_TSCC) +FATE_SCREEN-$(CONFIG_ZLIB) += $(FATE_TSCC) fate-tscc: $(FATE_TSCC) FATE_VMNC += fate-vmnc-16bit @@ -56,8 +56,10 @@ fate-zmbv-16bit: CMD = framecrc -i $(SAMPLES)/zmbv/zmbv_16bit.avi -pix_fmt rgb24 FATE_ZMBV += fate-zmbv-32bit fate-zmbv-32bit: CMD = framecrc -i $(SAMPLES)/zmbv/zmbv_32bit.avi -pix_fmt rgb24 -t 25 -FATE_SCREEN += $(FATE_ZMBV) +FATE_SCREEN-$(CONFIG_ZLIB) += $(FATE_ZMBV) fate-zmbv: $(FATE_ZMBV) +FATE_SCREEN += $(FATE_SCREEN-yes) + FATE_SAMPLES_FFMPEG += $(FATE_SCREEN) fate-screen: $(FATE_SCREEN) diff --git a/tests/fate/vcodec.mak b/tests/fate/vcodec.mak index d4c4cf60be..f4e39b8ce7 100644 --- a/tests/fate/vcodec.mak +++ b/tests/fate/vcodec.mak @@ -59,12 +59,12 @@ fate-vsynth%-ffv1: ENCOPTS = -strict -2 FATE_VCODEC += ffvhuff -FATE_VCODEC += flashsv +FATE_VCODEC-$(CONFIG_ZLIB) += flashsv fate-vsynth%-flashsv: ENCOPTS = -sws_flags neighbor+full_chroma_int fate-vsynth%-flashsv: DECOPTS = -sws_flags area fate-vsynth%-flashsv: FMT = flv -FATE_VCODEC += flashsv2 +FATE_VCODEC-$(CONFIG_ZLIB) += flashsv2 fate-vsynth%-flashsv2: ENCOPTS = -sws_flags neighbor+full_chroma_int -strict experimental -compression_level 0 fate-vsynth%-flashsv2: DECOPTS = -sws_flags area fate-vsynth%-flashsv2: FMT = flv @@ -193,7 +193,7 @@ fate-vsynth%-msmpeg4: ENCOPTS = -qscale 10 FATE_VCODEC += msmpeg4v2 fate-vsynth%-msmpeg4v2: ENCOPTS = -qscale 10 -FATE_VCODEC += mpng +FATE_VCODEC-$(CONFIG_ZLIB) += mpng fate-vsynth%-mpng: CODEC = png FATE_VCODEC += msvideo1 @@ -277,8 +277,9 @@ FATE_VCODEC += yuv4 FATE_VCODEC += y41p -FATE_VCODEC += zlib +FATE_VCODEC-$(CONFIG_ZLIB) += zlib +FATE_VCODEC += $(FATE_VCODEC-yes) FATE_VSYNTH1 = $(FATE_VCODEC:%=fate-vsynth1-%) FATE_VSYNTH2 = $(FATE_VCODEC:%=fate-vsynth2-%) diff --git a/tests/fate/video.mak b/tests/fate/video.mak index e5dd6201c3..65b98a47d8 100644 --- a/tests/fate/video.mak +++ b/tests/fate/video.mak @@ -49,7 +49,7 @@ fate-cdgraphics: CMD = framecrc -i $(SAMPLES)/cdgraphics/BrotherJohn.cdg -pix_fm FATE_VIDEO += fate-cljr fate-cljr: CMD = framecrc -i $(SAMPLES)/cljr/testcljr-partial.avi -FATE_VIDEO += fate-corepng +FATE_VIDEO-$(CONFIG_ZLIB) += fate-corepng fate-corepng: CMD = framecrc -i $(SAMPLES)/png1/corepng-partial.avi FATE_VIDEO += fate-creatureshock-avs @@ -97,7 +97,7 @@ fate-dxa-feeble: CMD = framecrc -i $(SAMPLES)/dxa/meetsquid.dxa -t 2 -pix_fmt rg FATE_DXA += fate-dxa-scummvm fate-dxa-scummvm: CMD = framecrc -i $(SAMPLES)/dxa/scummvm.dxa -pix_fmt rgb24 -FATE_VIDEO += $(FATE_DXA) +FATE_VIDEO-$(CONFIG_ZLIB) += $(FATE_DXA) fate-dxa: $(FATE_DXA) FATE_SAMPLES_PCM += fate-film-cvid From ce433996d7f0dfa8d20aea01bfdb1930b7a1426c Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Tue, 2 Oct 2012 22:57:25 +0200 Subject: [PATCH 010/328] ffserver: fix potential buffer overflow, based on wrong fscanf format indentifier. Fixed Ticket1780 Signed-off-by: Michael Niedermayer (cherry picked from commit f077e1fb4c912a66ab5d766fd256803821d92c67) Signed-off-by: Michael Niedermayer --- ffserver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffserver.c b/ffserver.c index 1eae3adff3..4044d0fa57 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2034,7 +2034,7 @@ static void compute_status(HTTPContext *c) char cpuperc[10]; char cpuused[64]; - if (fscanf(pid_stat, "%10s %64s", cpuperc, + if (fscanf(pid_stat, "%9s %63s", cpuperc, cpuused) == 2) { avio_printf(pb, "Currently using %s%% of the cpu. Total time used %s.\n", cpuperc, cpuused); From e2935721e00a6eb60fadb0839d3e24591a33a359 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 4 Oct 2012 22:54:29 +0200 Subject: [PATCH 011/328] aacenc: fix out of array writes The value used in allocation is based on a estimate of the maximum size of the spectral coefficients multiplied with 2 and rounded up. The exact or a tighter limit should be found and used instead. But this issue shouldnt be left open until someone works on that. Signed-off-by: Michael Niedermayer (cherry picked from commit d56834201bf7511ed497e956fb7ff78d49454b10) Signed-off-by: Michael Niedermayer --- libavcodec/aacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 9b2b2bbab5..383cb5a7c1 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -576,7 +576,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } start_ch += chans; } - if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels))) { + if ((ret = ff_alloc_packet2(avctx, avpkt, 8192 * s->channels))) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); return ret; } From 5bd5bb9e56c9f15a16ed3b026b87723f81d018f4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 6 Oct 2012 11:50:38 +0200 Subject: [PATCH 012/328] libvorbisenc: fix afq delay setting Signed-off-by: Michael Niedermayer (cherry picked from commit 2c34367b4a17856584b3e8b64cefa1900342ebcd) Signed-off-by: Michael Niedermayer --- libavcodec/libvorbisenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index 76a912d439..b042e0cb4f 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -362,7 +362,9 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, * libvorbis, so we have to update the AudioFrameQueue counts */ if (!avctx->delay) { avctx->delay = duration; - s->afq.remaining_delay += duration; + av_assert0(!s->afq.remaining_delay); + s->afq.frames->duration += duration; + s->afq.frames->pts -= duration; s->afq.remaining_samples += duration; } ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration); From 8c103410a6d5c58636b9e7c3ad4246290109891b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 6 Oct 2012 20:19:05 +0200 Subject: [PATCH 013/328] movenc: fix regression with yuyv caused by c5f23d Signed-off-by: Michael Niedermayer (cherry picked from commit ac6659aff77b08a894967a2880eef13218baacb9) Signed-off-by: Michael Niedermayer --- libavformat/movenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 4b0a547e70..7819f6ec35 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -887,10 +887,11 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) int i; for (i = 0; i < FF_ARRAY_ELEMS(mov_pix_fmt_tags); i++) { - if (track->enc->codec_tag == mov_pix_fmt_tags[i].tag && track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) { + if (track->enc->pix_fmt == mov_pix_fmt_tags[i].pix_fmt) { tag = mov_pix_fmt_tags[i].tag; track->enc->bits_per_coded_sample = mov_pix_fmt_tags[i].bps; - break; + if (track->enc->codec_tag == mov_pix_fmt_tags[i].tag) + break; } } From 86c8ab1fd833cc17efade10f50d8800f038909cd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 8 Oct 2012 02:11:25 +0200 Subject: [PATCH 014/328] ffv1: fix array data types Signed-off-by: Michael Niedermayer (cherry picked from commit 106790a4e92f40fedbe20631c693c95c7c8f3039) Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 572bcbb2df..c637b47b9a 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1242,7 +1242,7 @@ static int encode_slice(AVCodecContext *c, void *arg){ } if(!fs->ac){ if(f->version > 2) - put_rac(&fs->c, (int[]){129}, 0); + put_rac(&fs->c, (uint8_t[]){129}, 0); fs->ac_byte_count = f->version > 2 || (!x&&!y) ? ff_rac_terminate(&fs->c) : 0; init_put_bits(&fs->pb, fs->c.bytestream_start + fs->ac_byte_count, fs->c.bytestream_end - fs->c.bytestream_start - fs->ac_byte_count); } @@ -1677,7 +1677,7 @@ static int decode_slice(AVCodecContext *c, void *arg){ if(!fs->ac){ if (f->version == 3 && f->minor_version > 1 || f->version > 3) - get_rac(&fs->c, (int[]){129}); + get_rac(&fs->c, (uint8_t[]){129}); fs->ac_byte_count = f->version > 2 || (!x&&!y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0; init_get_bits(&fs->gb, fs->c.bytestream_start + fs->ac_byte_count, @@ -1706,7 +1706,7 @@ static int decode_slice(AVCodecContext *c, void *arg){ } if(fs->ac && f->version > 2) { int v; - get_rac(&fs->c, (int[]){129}); + get_rac(&fs->c, (uint8_t[]){129}); v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5*f->ec; if(v) { av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n", v); From 8b170ee5d874199e2462de542c3c2490fdfc3cae Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 24 Oct 2012 00:03:06 +0200 Subject: [PATCH 015/328] mpegvideo enc: choose VBV buffer size for mpeg1/2 when none is specified instead of failing Signed-off-by: Michael Niedermayer (cherry picked from commit 1856162caa912a4a845b7caff51c9e2dff3d39d9) Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo_enc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 4322d65e73..4faf469e9c 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -402,6 +402,18 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) s->loop_filter = !!(s->flags & CODEC_FLAG_LOOP_FILTER); + if (avctx->rc_max_rate && !avctx->rc_buffer_size) { + switch(avctx->codec_id) { + case AV_CODEC_ID_MPEG1VIDEO: + case AV_CODEC_ID_MPEG2VIDEO: + avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112L / 15000000 * 16384; + break; + } + if (avctx->rc_buffer_size) { + av_log(avctx, AV_LOG_INFO, "Automatically choosing VBV buffer size of %d kbyte\n", avctx->rc_buffer_size/8192); + } + } + if ((!avctx->rc_max_rate) != (!avctx->rc_buffer_size)) { av_log(avctx, AV_LOG_ERROR, "Either both buffer size and max rate or neither must be specified\n"); if (avctx->rc_max_rate && !avctx->rc_buffer_size) From 9d9d16b33f73e93309932323134ead3573fbd79a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 24 Oct 2012 00:38:56 +0200 Subject: [PATCH 016/328] mpegvideo enc: choose VBV buffer size for mpeg4 when none is specified instead of failing Signed-off-by: Michael Niedermayer (cherry picked from commit 3556e7ce737edade8c5e628a19e2b5da0809928d) Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo_enc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 4faf469e9c..ab5f12a8dc 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -408,6 +408,20 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) case AV_CODEC_ID_MPEG2VIDEO: avctx->rc_buffer_size = FFMAX(avctx->rc_max_rate, 15000000) * 112L / 15000000 * 16384; break; + case AV_CODEC_ID_MPEG4: + case AV_CODEC_ID_MSMPEG4V1: + case AV_CODEC_ID_MSMPEG4V2: + case AV_CODEC_ID_MSMPEG4V3: + if (avctx->rc_max_rate >= 15000000) { + avctx->rc_buffer_size = 320 + (avctx->rc_max_rate - 15000000L) * (760-320) / (38400000 - 15000000); + } else if(avctx->rc_max_rate >= 2000000) { + avctx->rc_buffer_size = 80 + (avctx->rc_max_rate - 2000000L) * (320- 80) / (15000000 - 2000000); + } else if(avctx->rc_max_rate >= 384000) { + avctx->rc_buffer_size = 40 + (avctx->rc_max_rate - 384000L) * ( 80- 40) / ( 2000000 - 384000); + } else + avctx->rc_buffer_size = 40; + avctx->rc_buffer_size *= 16384; + break; } if (avctx->rc_buffer_size) { av_log(avctx, AV_LOG_INFO, "Automatically choosing VBV buffer size of %d kbyte\n", avctx->rc_buffer_size/8192); From 18817d4b803e67fa56882878267519a2d2878283 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 28 Oct 2012 02:09:08 +0200 Subject: [PATCH 017/328] swr: use 64bit index/len for x86_64 mix Signed-off-by: Michael Niedermayer (cherry picked from commit d23e8f53ad01fde6d0dd96644c2a594f8dd7537e) --- libswresample/rematrix_template.c | 10 +++++----- libswresample/swresample_internal.h | 13 ++++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libswresample/rematrix_template.c b/libswresample/rematrix_template.c index 627bf1f6fc..61d3fe9cc9 100644 --- a/libswresample/rematrix_template.c +++ b/libswresample/rematrix_template.c @@ -18,9 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, int len); +typedef void (RENAME(mix_any_func_type))(SAMPLE **out, const SAMPLE **in1, COEFF *coeffp, integer len); -static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, int index1, int index2, int len){ +static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEFF *coeffp, integer index1, integer index2, integer len){ int i; COEFF coeff1 = coeffp[index1]; COEFF coeff2 = coeffp[index2]; @@ -29,14 +29,14 @@ static void RENAME(sum2)(SAMPLE *out, const SAMPLE *in1, const SAMPLE *in2, COEF out[i] = R(coeff1*in1[i] + coeff2*in2[i]); } -static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF *coeffp, int index, int len){ +static void RENAME(copy)(SAMPLE *out, const SAMPLE *in, COEFF *coeffp, integer index, integer len){ int i; COEFF coeff = coeffp[index]; for(i=0; i Date: Fri, 9 Nov 2012 12:13:30 +0100 Subject: [PATCH 018/328] tiffdec: check count in metadata reading. Fixes out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 6d1c5ea04af3e345232aa70c944de961061dab2d) --- libavcodec/tiff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 579bd0d5f7..d0b302a47d 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -250,7 +250,7 @@ static int add_doubles_metadata(int count, int i; double *dp; - if (count >= INT_MAX / sizeof(int64_t)) + if (count >= INT_MAX / sizeof(int64_t) || count <= 0) return AVERROR_INVALIDDATA; if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t)) return AVERROR_INVALIDDATA; @@ -276,7 +276,7 @@ static int add_shorts_metadata(int count, const char *name, int i; int16_t *sp; - if (count >= INT_MAX / sizeof(int16_t)) + if (count >= INT_MAX / sizeof(int16_t) || count <= 0) return AVERROR_INVALIDDATA; if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int16_t)) return AVERROR_INVALIDDATA; From 112d4c400f0e0d5d1621fc8db515907cffaae259 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 9 Nov 2012 20:58:57 +0100 Subject: [PATCH 019/328] iff/ilbm: check remaining buffer size. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 2fbb37b51bbea891392ad357baf8f3dff00bac05) Conflicts: libavcodec/iff.c --- libavcodec/iff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 2c4ea8f8e6..08360d5c18 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -562,13 +562,13 @@ static int decode_frame_ilbm(AVCodecContext *avctx, } } else if (avctx->codec_tag == MKTAG('P','B','M',' ')) { // IFF-PBM if (avctx->pix_fmt == PIX_FMT_PAL8 || avctx->pix_fmt == PIX_FMT_GRAY8) { - for(y = 0; y < avctx->height; y++ ) { + for(y = 0; y < avctx->height && buf_end > buf; y++ ) { uint8_t *row = &s->frame.data[0][y * s->frame.linesize[0]]; memcpy(row, buf, FFMIN(avctx->width, buf_end - buf)); buf += avctx->width + (avctx->width % 2); // padding if odd } } else if (s->ham) { // IFF-PBM: HAM to PIX_FMT_BGR32 - for (y = 0; y < avctx->height; y++) { + for (y = 0; y < avctx->height && buf_end > buf; y++) { uint8_t *row = &s->frame.data[0][ y*s->frame.linesize[0] ]; memcpy(s->ham_buf, buf, FFMIN(avctx->width, buf_end - buf)); buf += avctx->width + (avctx->width & 1); // padding if odd From e0884eadf6a15e93142131b695f48776f9a0ac31 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 10 Nov 2012 17:14:04 +0100 Subject: [PATCH 020/328] alac: fix nb_samples < order case Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit fd4f4923cce6a2cbf4f48640b4ac706e614a1594) --- libavcodec/alac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 9cd17374a8..e8e844aede 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -224,7 +224,7 @@ static void lpc_prediction(int32_t *error_buffer, int32_t *buffer_out, } /* read warm-up samples */ - for (i = 1; i <= lpc_order; i++) + for (i = 1; i <= lpc_order && i < nb_samples; i++) buffer_out[i] = sign_extend(buffer_out[i - 1] + error_buffer[i], bps); /* NOTE: 4 and 8 are very common cases that could be optimized. */ From c8c9740ee1ea4a4f857a24b1ce05dcd07b72ec2d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 10 Nov 2012 17:41:56 +0100 Subject: [PATCH 021/328] alac: fix integer overflow leading to subsequent out of array accesses. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 3920d1387834e2bc334aff9f518f4beb24e470bd) --- libavcodec/alac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index e8e844aede..6e72bb6a6f 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -542,7 +542,11 @@ static av_cold int alac_decode_close(AVCodecContext *avctx) static int allocate_buffers(ALACContext *alac) { int ch; - int buf_size = alac->max_samples_per_frame * sizeof(int32_t); + int buf_size; + + if (alac->max_samples_per_frame > INT_MAX / sizeof(int32_t)) + goto buf_alloc_fail; + buf_size = alac->max_samples_per_frame * sizeof(int32_t); for (ch = 0; ch < FFMIN(alac->channels, 2); ch++) { FF_ALLOC_OR_GOTO(alac->avctx, alac->predict_error_buffer[ch], From 12fb647994c89cd6c45da9497ff7589d760c6ec1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 11 Nov 2012 00:01:24 +0100 Subject: [PATCH 022/328] mjpegdec: check SE. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index d829b1b53f..0fca3721af 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1097,6 +1097,11 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, int last_scan = 0; int16_t *quant_matrix = s->quant_matrixes[s->quant_index[c]]; + if (se > 63) { + av_log(s->avctx, AV_LOG_ERROR, "SE %d is too large\n", se); + return AVERROR_INVALIDDATA; + } + if (!Al) { s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss); last_scan = !~s->coefs_finished[c]; From c51c5f83c13b0fa3e332e59bf764fdc598476b2e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 12 Nov 2012 14:42:45 +0100 Subject: [PATCH 023/328] wavpack: fix out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit be818df547c3b0ae4fadb50fd210139a8636706a) --- libavcodec/wavpack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index ef4fc4f10d..4be84c754e 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1206,11 +1206,12 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data, } /* get output buffer */ - s->frame.nb_samples = s->samples; + s->frame.nb_samples = s->samples + 1; if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } + s->frame.nb_samples = s->samples; while (buf_size > 0) { if (!s->multichannel) { From 28bf685bfc6d0c744369cdf367f61a78d80d0b01 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 15 Nov 2012 16:41:28 +0100 Subject: [PATCH 024/328] pgssubdec: check RLE size before copying. Fix out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit c0d68be555f5858703383040e04fcd6529777061) --- libavcodec/pgssubdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 728f178ebd..26a3c2a2f7 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -222,6 +222,11 @@ static int parse_picture_segment(AVCodecContext *avctx, return -1; } + if (buf_size > rle_bitmap_len) { + av_log(avctx, AV_LOG_ERROR, "too much RLE data\n"); + return AVERROR_INVALIDDATA; + } + ctx->pictures[picture_id].w = width; ctx->pictures[picture_id].h = height; From c8833a13cf530fbf5b1d579cd1ae527a0904403f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 17 Nov 2012 16:26:55 +0100 Subject: [PATCH 025/328] eamad: fix out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 63ac64864c6e0e84355aa3caa5b92208997a9a8d) --- libavcodec/eamad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index b3382406cd..47a9231868 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -237,7 +237,7 @@ static int decode_frame(AVCodecContext *avctx, int chunk_type; int inter; - if (buf_size < 17) { + if (buf_size < 26) { av_log(avctx, AV_LOG_ERROR, "Input buffer too small\n"); *data_size = 0; return -1; From c82d6e05da0898c45ae915fb808e175f6a4ec7e5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 18 Nov 2012 16:29:04 +0100 Subject: [PATCH 026/328] h264: correct ref count check and limit, fix out of array accesses. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit d6c184880ee2e09fd68c0ae217173832cee5afc1) --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 713fda7421..ec3afea932 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2922,7 +2922,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) h->ref_count[1] = get_ue_golomb(&s->gb) + 1; else // full range is spec-ok in this case, even for frames - max[1] = 31; + h->ref_count[1] = 1; } if (h->ref_count[0]-1 > max[0] || h->ref_count[1]-1 > max[1]){ From 38e8f78c041bd28f5b8d32f2fd945eae8ce28598 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 29 Nov 2012 15:18:17 +0100 Subject: [PATCH 027/328] roqvideodec: check dimensions validity Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 3ae610451170cd5a28b33950006ff0bd23036845) --- libavcodec/roqvideodec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index b4cf454e9a..229022be8b 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -169,6 +169,12 @@ static av_cold int roq_decode_init(AVCodecContext *avctx) RoqContext *s = avctx->priv_data; s->avctx = avctx; + + if (avctx->width%16 || avctx->height%16) { + av_log_ask_for_sample(avctx, "dimensions not being a multiple of 16 are unsupported\n"); + return AVERROR_PATCHWELCOME; + } + s->width = avctx->width; s->height = avctx->height; avcodec_get_frame_defaults(&s->frames[0]); From 74241de7ed501a34e7dfe291eed3339ca7b50755 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 29 Nov 2012 15:56:05 +0100 Subject: [PATCH 028/328] huffyuvdec: check width more completely, avoid out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 6abb9a901fca27da14d4fffbb01948288b5da3ba) --- libavcodec/huffyuv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 2a9ebe1b2c..58da7894e4 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -514,7 +514,10 @@ static av_cold int decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n"); return AVERROR_INVALIDDATA; } - + if (s->predictor == MEDIAN && avctx->pix_fmt == PIX_FMT_YUV422P && avctx->width%4) { + av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 4 this colorspace and predictor\n"); + return AVERROR_INVALIDDATA; + } alloc_temp(s); return 0; From e34369e8ece08b7bd820366dea5965f4c40c0080 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 30 Nov 2012 23:59:40 +0100 Subject: [PATCH 029/328] qdm2: check array index before use, fix out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit a7ee6281f7ef1c29284e3a4cadfe0f227ffde1ed) --- libavcodec/qdm2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 3a77e7fe06..7f565dd3d7 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1259,6 +1259,11 @@ static void qdm2_decode_super_block (QDM2Context *q) for (i = 0; packet_bytes > 0; i++) { int j; + if (i>=FF_ARRAY_ELEMS(q->sub_packet_list_A)) { + SAMPLES_NEEDED_2("too many packet bytes"); + return; + } + q->sub_packet_list_A[i].next = NULL; if (i > 0) { From 528700dd58abf654861bcfc32dd990bd0541baf5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 3 Dec 2012 21:28:45 +0100 Subject: [PATCH 030/328] update for 1.0.1 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index f70522f050..eb9d764055 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0 +PROJECT_NUMBER = 1.0.1 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 4402ec2c05..7dea76edb3 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.git +1.0.1 diff --git a/VERSION b/VERSION index 9f8e9b69a3..7dea76edb3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0 \ No newline at end of file +1.0.1 From e74cd2f4706f71da5e9205003c1d8263b54ed3fb Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Tue, 4 Dec 2012 19:49:51 +0100 Subject: [PATCH 031/328] lavf: compute probe buffer size more reliably. The previous code computes the offset by reversing the growth of the allocated buffer size: it is complex and did lead to inconsistencies when the size limit is reached. Fix trac ticket #1991. (cherry picked from commit 03847eb8259291b4ff1bd840bd779d0699d71f96) Conflicts: libavformat/utils.c --- libavformat/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 7940037782..be73c4acb7 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -459,7 +459,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, { AVProbeData pd = { filename ? filename : "", NULL, -offset }; unsigned char *buf = NULL; - int ret = 0, probe_size; + int ret = 0, probe_size, buf_offset = 0; if (!max_probe_size) { max_probe_size = PROBE_BUF_MAX; @@ -499,7 +499,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, score = 0; ret = 0; /* error was end of file, nothing read */ } - pd.buf_size += ret; + pd.buf_size = buf_offset += ret; pd.buf = &buf[offset]; memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); From e31ace670ef927dd9433f7f1e3373fb447b00551 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Wed, 5 Dec 2012 19:56:36 +0100 Subject: [PATCH 032/328] h264: slice-mt: get last_pic_dropable from master context Fixes fate-h264-conformance-cvnlfi2_sony_h and smllwebdl.mkv from https://github.com/OpenELEC/OpenELEC.tv/issues/1557 . (cherry picked from commit 24c62ea7a5df44804be88150aa0c45e6796b5da9) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index ec3afea932..3b91039286 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2669,7 +2669,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) h->mb_mbaff = 0; h->mb_aff_frame = 0; last_pic_structure = s0->picture_structure; - last_pic_dropable = s->dropable; + last_pic_dropable = s0->dropable; s->dropable = h->nal_ref_idc == 0; if (h->sps.frame_mbs_only_flag) { s->picture_structure = PICT_FRAME; From 1b0c1df3b9d6238e0f9417a88895a7ca8ab43758 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Tue, 9 Oct 2012 19:29:32 +0900 Subject: [PATCH 033/328] lavc: include os2threads.h in vp8.h if HAVE_OS2THREADS is enabled Signed-off-by: Michael Niedermayer (cherry picked from commit 3a45688abc5c98c91fc6a1b0b8b68f0eca641aec) --- libavcodec/vp8.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h index 4f026dfe8d..1d1396989b 100644 --- a/libavcodec/vp8.h +++ b/libavcodec/vp8.h @@ -34,6 +34,8 @@ #include #elif HAVE_W32THREADS #include "w32pthreads.h" +#elif HAVE_OS2THREADS +#include "os2threads.h" #endif #define VP8_MAX_QUANT 127 From 9929991da7b843e7d80154fcacc4e80579b86a2d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 9 Dec 2012 23:34:32 +0100 Subject: [PATCH 034/328] ffserver: set oformat Fix Ticket1986 Signed-off-by: Michael Niedermayer (cherry picked from commit cbe43e62c9ac7d4aefdc13476f6f691bd626525f) --- ffserver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ffserver.c b/ffserver.c index 4044d0fa57..87401402f8 100644 --- a/ffserver.c +++ b/ffserver.c @@ -2937,12 +2937,14 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, { AVFormatContext *avc; AVStream *avs = NULL; + AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); int i; avc = avformat_alloc_context(); - if (avc == NULL) { + if (avc == NULL || !rtp_format) { return -1; } + avc->oformat = rtp_format; av_dict_set(&avc->metadata, "title", stream->title[0] ? stream->title : "No Title", 0); avc->nb_streams = stream->nb_streams; From 15526ac69f14baef857c8bcf84f1f5790548e6dd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 18 Oct 2012 04:58:20 +0200 Subject: [PATCH 035/328] riff: retry reading metadata without padding if it fails with Fixes Ticket1821 Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit d0c27e88d2bb495d61bd32f41769f767a0c2a802) --- libavformat/riff.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/riff.c b/libavformat/riff.c index 1c3411220e..06e69c49be 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -771,8 +771,13 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size) chunk_code = avio_rl32(pb); chunk_size = avio_rl32(pb); if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) { - av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n"); - return AVERROR_INVALIDDATA; + avio_seek(pb, -9, SEEK_CUR); + chunk_code = avio_rl32(pb); + chunk_size = avio_rl32(pb); + if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) { + av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n"); + return AVERROR_INVALIDDATA; + } } chunk_size += (chunk_size & 1); From c389ae543a5cf9176ce935ef685f128227525c5e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 23 Nov 2012 23:35:16 +0100 Subject: [PATCH 036/328] riff: ignore ff_read_riff_info() failure. Some files simply contain invalid info tags. Fixes unrelated bug posted into Ticket1821 Signed-off-by: Michael Niedermayer (cherry picked from commit 09456d0df13404f004ab3a341d9ac21b7e5e6d6d) --- libavformat/wav.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/wav.c b/libavformat/wav.c index f58bcb32ad..ec527b8619 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -527,8 +527,7 @@ static int wav_read_header(AVFormatContext *s) } switch (list_type) { case MKTAG('I', 'N', 'F', 'O'): - if ((ret = ff_read_riff_info(s, size - 4)) < 0) - return ret; + ff_read_riff_info(s, size - 4); } break; } From 73487f7dee13d509dea65d66b1a244736227ad54 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 22 Nov 2012 23:08:01 +0100 Subject: [PATCH 037/328] avidec: try to support oddly muxed MMES stream Fixes ticket1804 Signed-off-by: Michael Niedermayer (cherry picked from commit be89693ddc5a8cdeaf3edf48fb584d6adca54de0) --- libavformat/avidec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index c4d41e5449..1e71522915 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1262,6 +1262,11 @@ static int avi_read_idx1(AVFormatContext *s, int size) avi->stream_index = -1; avio_seek(pb, idx1_pos, SEEK_SET); + if (s->nb_streams == 1 && s->streams[0]->codec->codec_tag == AV_RL32("MMES")){ + first_packet_pos = 0; + data_offset = avi->movi_list; + } + /* Read the entries and sort them in each stream component. */ for(i = 0; i < nb_index_entries; i++) { if(url_feof(pb)) From a875a9a8339f5984b9bd70e3384a3be6ccbd42ba Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 22 Nov 2012 22:28:17 +0100 Subject: [PATCH 038/328] vqavideo: Reinitialise the actually used partial codebook bytestream-reader. Fixes ticket #1942. (cherry picked from commit dd6abc921af19100c4ace5ff72dee5f92c0e6ac0) --- libavcodec/vqavideo.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index e4bad00ca1..c814837049 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -566,9 +566,7 @@ static int vqa_decode_chunk(VqaContext *s) s->partial_countdown--; if (s->partial_countdown <= 0) { - GetByteContext gb; - - bytestream2_init(&gb, s->next_codebook_buffer, s->next_codebook_buffer_index); + bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index); /* decompress codebook */ if ((res = decode_format80(s, s->next_codebook_buffer_index, s->codebook, s->codebook_size, 0)) < 0) From 3ac97550ce3b99d9fb3dfec62806b2f4a0efcdad Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 3 Nov 2012 05:35:35 +0100 Subject: [PATCH 039/328] asfdec: parse payload extension list Signed-off-by: Michael Niedermayer (cherry picked from commit 2d8c76eb1f1c198e81c36a95c0d56e55cc1f4c5a) Conflicts: libavformat/asf.h --- libavformat/asf.h | 8 ++++++++ libavformat/asfdec.c | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libavformat/asf.h b/libavformat/asf.h index 5562865f68..9a32a41c70 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -28,6 +28,11 @@ #define PACKET_SIZE 3200 +typedef struct ASFPayload { + uint8_t type; + uint16_t size; +} ASFPayload; + typedef struct { int num; unsigned char seq; @@ -47,6 +52,9 @@ typedef struct { int palette_changed; uint32_t palette[256]; + + int payload_ext_ct; + ASFPayload payload[8]; } ASFStream; typedef struct { diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index b1b8eeb303..1799ea7601 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -513,8 +513,10 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) stream_ct = avio_rl16(pb); //stream-name-count payload_ext_ct = avio_rl16(pb); //payload-extension-system-count - if (stream_num < 128) + if (stream_num < 128) { asf->stream_bitrates[stream_num] = leak_rate; + asf->streams[stream_num].payload_ext_ct = 0; + } for (i=0; istreams[stream_num].payload)) { + ASFPayload *p = &asf->streams[stream_num].payload[i]; + p->type = g[0]; + p->size = size; + av_log(s, AV_LOG_DEBUG, "Payload extension %x %d\n", g[0], p->size ); + asf->streams[stream_num].payload_ext_ct ++; + } } return 0; From 19de5478f0279c8df7b33eae6013df7a7f64456d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 3 Nov 2012 05:37:18 +0100 Subject: [PATCH 040/328] asfdec: correctly parse payload extensions Signed-off-by: Michael Niedermayer (cherry picked from commit 8c93269e420735f41363e75f8ee4c4e7b3ec49a7) Conflicts: libavformat/asfdec.c --- libavformat/asfdec.c | 53 ++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 1799ea7601..f963aa807b 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -925,13 +925,16 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) */ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ ASFContext *asf = s->priv_data; + ASFStream *asfst; int rsize = 1; int num = avio_r8(pb); + int i; int64_t ts0, ts1 av_unused; asf->packet_segments--; asf->packet_key_frame = num >> 7; asf->stream_index = asf->asfid2avid[num & 0x7f]; + asfst = &asf->streams[num & 0x7f]; // sequence should be ignored! DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); @@ -942,26 +945,48 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ return AVERROR_INVALIDDATA; } if (asf->packet_replic_size >= 8) { + int64_t end = avio_tell(pb) + asf->packet_replic_size; asf->packet_obj_size = avio_rl32(pb); if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); return AVERROR_INVALIDDATA; } asf->packet_frag_timestamp = avio_rl32(pb); // timestamp - if(asf->packet_replic_size >= 8+38+4){ -// for(i=0; ipacket_replic_size-8; i++) -// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); -// av_log(s, AV_LOG_DEBUG, "\n"); - avio_skip(pb, 10); - ts0= avio_rl64(pb); - ts1= avio_rl64(pb); - avio_skip(pb, 12); - avio_rl32(pb); - avio_skip(pb, asf->packet_replic_size - 8 - 38 - 4); - if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; - else asf->packet_frag_timestamp= AV_NOPTS_VALUE; - }else - avio_skip(pb, asf->packet_replic_size - 8); + + for (i=0; ipayload_ext_ct; i++) { + ASFPayload *p = &asfst->payload[i]; + int size = p->size; + int64_t payend; + if(size == 0xFFFF) + size = avio_rl16(pb); + payend = avio_tell(pb) + size; + if (payend > end) { + av_log(s, AV_LOG_ERROR, "too long payload\n"); + break; + } + switch(p->type) { + case 0x50: +// duration = avio_rl16(pb); + break; + case 0x2A: + avio_skip(pb, 8); + ts0= avio_rl64(pb); + ts1= avio_rl64(pb); + if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; + else asf->packet_frag_timestamp= AV_NOPTS_VALUE; + break; + case 0x5B: + case 0xB7: + case 0xCC: + case 0xC0: + case 0xA0: + //unknown + break; + } + avio_seek(pb, payend, SEEK_SET); + } + + avio_seek(pb, end, SEEK_SET); rsize += asf->packet_replic_size; // FIXME - check validity } else if (asf->packet_replic_size==1){ // multipacket - frag_offset is beginning timestamp From 08d75bf545f3fa9caad3f508b82d3da1ca709ed3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 3 Nov 2012 05:38:12 +0100 Subject: [PATCH 041/328] asfdec: parse aspect ratio payload extension Signed-off-by: Michael Niedermayer (cherry picked from commit 343c73e252d3e3c1e5d2037c2e8eb14b504f1e6f) Signed-off-by: Michael Niedermayer --- libavformat/asfdec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index f963aa807b..06f76ba4a7 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -946,6 +946,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ } if (asf->packet_replic_size >= 8) { int64_t end = avio_tell(pb) + asf->packet_replic_size; + AVRational aspect; asf->packet_obj_size = avio_rl32(pb); if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); @@ -968,6 +969,13 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ case 0x50: // duration = avio_rl16(pb); break; + case 0x54: + aspect.num = avio_r8(pb); + aspect.den = avio_r8(pb); + if (aspect.num > 0 && aspect.den > 0) { + s->streams[asf->stream_index]->sample_aspect_ratio = aspect; + } + break; case 0x2A: avio_skip(pb, 8); ts0= avio_rl64(pb); From e432bd071c4f3e564d99e6dbc442695fd18b0398 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 3 Nov 2012 05:39:19 +0100 Subject: [PATCH 042/328] asfdec: flip the interpretation of the header aspect back This reverts 2de88776892093b10522152f1f72b7dfc0320502 Fixes Ticket 1883 Signed-off-by: Michael Niedermayer (cherry picked from commit e5927910c2a156e9ad6388413400b620d1dcf035) Signed-off-by: Michael Niedermayer --- libavformat/asfdec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 06f76ba4a7..8509008711 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -786,12 +786,12 @@ static int asf_read_header(AVFormatContext *s) if (!st->codec->bit_rate) st->codec->bit_rate = asf->stream_bitrates[i]; if (asf->dar[i].num > 0 && asf->dar[i].den > 0){ - av_reduce(&st->sample_aspect_ratio.den, - &st->sample_aspect_ratio.num, + av_reduce(&st->sample_aspect_ratio.num, + &st->sample_aspect_ratio.den, asf->dar[i].num, asf->dar[i].den, INT_MAX); } else if ((asf->dar[0].num > 0) && (asf->dar[0].den > 0) && (st->codec->codec_type==AVMEDIA_TYPE_VIDEO)) // Use ASF container value if the stream doesn't AR set. - av_reduce(&st->sample_aspect_ratio.den, - &st->sample_aspect_ratio.num, + av_reduce(&st->sample_aspect_ratio.num, + &st->sample_aspect_ratio.den, asf->dar[0].num, asf->dar[0].den, INT_MAX); //av_log(s, AV_LOG_INFO, "i=%d, st->codec->codec_type:%d, dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, dar[i].num, dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); From 41bcde6021272fd82deb46da102c4971c90e662f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 3 Nov 2012 05:58:12 +0100 Subject: [PATCH 043/328] asfdec: check stream_index for validity Signed-off-by: Michael Niedermayer (cherry picked from commit b7280cff9a7683395d7f899517b4aea8b52f12a4) Signed-off-by: Michael Niedermayer --- libavformat/asfdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 8509008711..20f212fcd2 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -972,7 +972,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ case 0x54: aspect.num = avio_r8(pb); aspect.den = avio_r8(pb); - if (aspect.num > 0 && aspect.den > 0) { + if (aspect.num > 0 && aspect.den > 0 && asf->stream_index >= 0) { s->streams[asf->stream_index]->sample_aspect_ratio = aspect; } break; From dad5b9560a5cf3f34ddbc1df1a8a18b07b0d24ac Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 14 Oct 2012 23:40:14 +0200 Subject: [PATCH 044/328] ffplay: Prevent 0/0 aspect from being passed on to lavfi 0/0 fails to be parsed Fixes Ticket1814 Signed-off-by: Michael Niedermayer (cherry picked from commit a63d7213b3eb96a35fdf34b05f45e5675107d8f9) --- ffplay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffplay.c b/ffplay.c index 2337fe0d27..83bfd4e216 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1617,7 +1617,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d", codec->width, codec->height, codec->pix_fmt, is->video_st->time_base.num, is->video_st->time_base.den, - codec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den); + codec->sample_aspect_ratio.num, FFMAX(codec->sample_aspect_ratio.den, 1)); if ((ret = avfilter_graph_create_filter(&filt_src, avfilter_get_by_name("buffer"), From 59d765e30cdabbba174f3d764eecda39ebfc63c2 Mon Sep 17 00:00:00 2001 From: Michael Chinen Date: Sun, 14 Oct 2012 16:08:43 +0900 Subject: [PATCH 045/328] flac_parser.c: fix issue with looping output for small files. see trac 1345 https://ffmpeg.org/trac/ffmpeg/ticket/1345 Signed-off-by: Michael Niedermayer (cherry picked from commit c73b1a1d8010dac29653b41d39af9c18247179c3) --- libavcodec/flac_parser.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c index e37ca64be8..f38d7aae67 100644 --- a/libavcodec/flac_parser.c +++ b/libavcodec/flac_parser.c @@ -541,14 +541,18 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, av_freep(&fpc->best_header); } - /* Find and score new headers. */ - while ((buf && read_end < buf + buf_size && + /* Find and score new headers. */ + /* buf_size is to zero when padding, so check for this since we do */ + /* not want to try to read more input once we have found the end. */ + /* Note that as (non-modified) parameters, buf can be non-NULL, */ + /* while buf_size is 0. */ + while ((buf && buf_size && read_end < buf + buf_size && fpc->nb_headers_buffered < FLAC_MIN_HEADERS) - || (!buf && !fpc->end_padded)) { + || ((!buf || !buf_size) && !fpc->end_padded)) { int start_offset; /* Pad the end once if EOF, to check the final region for headers. */ - if (!buf) { + if (!buf || !buf_size) { fpc->end_padded = 1; buf_size = MAX_FRAME_HEADER_SIZE; read_end = read_start + MAX_FRAME_HEADER_SIZE; @@ -569,7 +573,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx, goto handle_error; } - if (buf) { + if (buf && buf_size) { av_fifo_generic_write(fpc->fifo_buf, (void*) read_start, read_end - read_start, NULL); } else { From f44c73f5bbeba178764b801b7b141c494e8753d3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Dec 2012 19:29:32 +0100 Subject: [PATCH 046/328] mpeg1video: support multi threaded slice encoding. Signed-off-by: Michael Niedermayer (cherry picked from commit 03df9720168335482f00898fc16b56ff4878d0e7) Conflicts: libavcodec/mpeg12enc.c --- libavcodec/mpeg12enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 5afa944cdb..ff839c028d 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -459,7 +459,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, } if (cbp == 0 && !first_mb && s->mv_type == MV_TYPE_16X16 && - (mb_x != s->mb_width - 1 || (mb_y != s->mb_height - 1 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)) && + (mb_x != s->mb_width - 1 || (mb_y != s->end_mb_y - 1 && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)) && ((s->pict_type == AV_PICTURE_TYPE_P && (motion_x | motion_y) == 0) || (s->pict_type == AV_PICTURE_TYPE_B && s->mv_dir == s->last_mv_dir && (((s->mv_dir & MV_DIR_FORWARD) ? ((s->mv[0][0][0] - s->last_mv[0][0][0])|(s->mv[0][0][1] - s->last_mv[0][0][1])) : 0) | ((s->mv_dir & MV_DIR_BACKWARD) ? ((s->mv[1][0][0] - s->last_mv[1][0][0])|(s->mv[1][0][1] - s->last_mv[1][0][1])) : 0)) == 0))) { @@ -972,7 +972,7 @@ AVCodec ff_mpeg1video_encoder = { .supported_framerates = avpriv_frame_rate_tab+1, .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV420P, PIX_FMT_NONE }, - .capabilities = CODEC_CAP_DELAY, + .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), .priv_class = &mpeg1_class, }; From 553c9c77ccd71a57732fc08c84b185f8e0d82cc7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Dec 2012 19:52:46 +0100 Subject: [PATCH 047/328] mpeg1video: fix regression with slices != threads Signed-off-by: Michael Niedermayer (cherry picked from commit a01679586cd9ac8470b81c0299fc7e13fd980d64) --- libavcodec/mpegvideo_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ab5f12a8dc..7d7672b7c4 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -632,7 +632,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) return -1; } - if (s->avctx->thread_count > 1) + if (s->avctx->slices > 1 || s->avctx->thread_count > 1) s->rtp_mode = 1; if (s->avctx->thread_count > 1 && s->codec_id == AV_CODEC_ID_H263P) From 97ec20a20aded201f1ef6b78559f58b984bdee39 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 17 Oct 2012 02:48:30 +0200 Subject: [PATCH 048/328] mov: fix time types related to mov_metadata_creation_time Fixes Ticket1817 Based on patch by: Przemyslaw Wesolek Signed-off-by: Michael Niedermayer (cherry picked from commit adbb75dbd8eabdaa7439633d26a79eb5b7387ef9) --- libavformat/mov.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 84565c8696..ad851579f4 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -778,14 +778,16 @@ static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom) return mov_read_default(c, pb, atom); } -static void mov_metadata_creation_time(AVDictionary **metadata, time_t time) +static void mov_metadata_creation_time(AVDictionary **metadata, int64_t time) { char buffer[32]; if (time) { struct tm *ptm; + time_t timet; if(time >= 2082844800) time -= 2082844800; /* seconds between 1904-01-01 and Epoch */ - ptm = gmtime(&time); + timet = time; + ptm = gmtime(&timet); if (!ptm) return; strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", ptm); av_dict_set(metadata, "creation_time", buffer, 0); @@ -799,7 +801,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) int version; char language[4] = {0}; unsigned lang; - time_t creation_time; + int64_t creation_time; if (c->fc->nb_streams < 1) return 0; @@ -834,7 +836,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - time_t creation_time; + int64_t creation_time; int version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ From 68e48ed72e0597ae61bc3e9e6e6d9edcb1a00073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Tue, 1 Jan 2013 16:41:37 +0100 Subject: [PATCH 049/328] lavc/movtextdec: keep the min size instead of max to fix overread. Fixes Ticket #2087. (cherry picked from commit 7d66bc7920240cc0e8df6c44b2d2cdbe4b228fbe) --- libavcodec/movtextdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index a65bbb83e3..05ff53afb4 100644 --- a/libavcodec/movtextdec.c +++ b/libavcodec/movtextdec.c @@ -83,7 +83,7 @@ static int mov_text_decode_frame(AVCodecContext *avctx, * In complex cases, there are style descriptors appended to the string * so we can't just assume the packet size is the string size. */ - end = ptr + FFMAX(2 + AV_RB16(ptr), avpkt->size); + end = ptr + FFMIN(2 + AV_RB16(ptr), avpkt->size); ptr += 2; ts_start = av_rescale_q(avpkt->pts, From 5f95b300c12169b7f44c9b8cd664cf79bed5c5b3 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sun, 15 Jul 2012 10:58:27 +0200 Subject: [PATCH 050/328] mov: fix parsing of the chap atom. This was broken in 0d96ec19ebc1577b27a889136364a906e1c627b1 under the assumption that there is only one tref leaf atom. Fixes Ticket #2081. (cherry picked from commit 765158dd82a2e985f4eb0b201a8256964403f623) --- libavformat/mov.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index ad851579f4..d3027f3d26 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2673,25 +2673,24 @@ static int mov_read_chan2(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } -static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom) +static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { - uint32_t i, size; + uint32_t i; MOVStreamContext *sc; if (c->fc->nb_streams < 1) return AVERROR_INVALIDDATA; sc = c->fc->streams[c->fc->nb_streams - 1]->priv_data; - size = avio_rb32(pb); - if (size < 12) + if (atom.size < 4) return 0; - sc->trefs_count = (size - 4) / 8; + sc->trefs_count = atom.size / 4; sc->trefs = av_malloc(sc->trefs_count * sizeof(*sc->trefs)); if (!sc->trefs) return AVERROR(ENOMEM); - sc->tref_type = avio_rl32(pb); + sc->tref_type = atom.type; for (i = 0; i < sc->trefs_count; i++) sc->trefs[i] = avio_rb32(pb); return 0; @@ -2744,7 +2743,8 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('t','f','h','d'), mov_read_tfhd }, /* track fragment header */ { MKTAG('t','r','a','k'), mov_read_trak }, { MKTAG('t','r','a','f'), mov_read_default }, -{ MKTAG('t','r','e','f'), mov_read_tref }, +{ MKTAG('t','r','e','f'), mov_read_default }, +{ MKTAG('t','m','c','d'), mov_read_tmcd }, { MKTAG('c','h','a','p'), mov_read_chap }, { MKTAG('t','r','e','x'), mov_read_trex }, { MKTAG('t','r','u','n'), mov_read_trun }, From 20c121c00747d6c3b0b0f98deeff021171b2ed74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 30 Dec 2012 06:53:48 +0100 Subject: [PATCH 051/328] lavc/ass_split: check for NULL pointer in ff_ass_split_override_codes(). This is consistent with the other ff_ass_split_* functions. It also fixes a crash when trying to split a dialog with text=NULL (which seems to happen when the text of the dialog is empty); basically, this commit fixes crashes when trying to encode an empty text subtitle dialog (see subrip and mov_text encoders). Fixes Ticket2048. (cherry picked from commit c83002a4f8042ccfa0688a9a18e8fa0369c1fda8) --- libavcodec/ass_split.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index 7ee48b4a5c..dc38341e14 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -368,7 +368,7 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, char new_line[2]; int text_len = 0; - while (*buf) { + while (buf && *buf) { if (text && callbacks->text && (sscanf(buf, "\\%1[nN]", new_line) == 1 || !strncmp(buf, "{\\", 2))) { From bc1e72c38ead1d3c71a99d714ef68894b8dffd0a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 2 Jan 2013 01:15:06 +0100 Subject: [PATCH 052/328] lavf: move force_codec_ids() up Signed-off-by: Michael Niedermayer (cherry picked from commit 3a6b6f425ee3f552eaaf6bde7480be5cb38aba1d) --- libavformat/utils.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index be73c4acb7..eab0792ea1 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -676,6 +676,21 @@ fail: /*******************************************************/ +static void force_codec_ids(AVFormatContext *s, AVStream *st) +{ + switch(st->codec->codec_type){ + case AVMEDIA_TYPE_VIDEO: + if(s->video_codec_id) st->codec->codec_id= s->video_codec_id; + break; + case AVMEDIA_TYPE_AUDIO: + if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id; + break; + case AVMEDIA_TYPE_SUBTITLE: + if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id; + break; + } +} + static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt) { if(st->request_probe>0){ @@ -720,21 +735,6 @@ no_packet: } } -static void force_codec_ids(AVFormatContext *s, AVStream *st) -{ - switch(st->codec->codec_type){ - case AVMEDIA_TYPE_VIDEO: - if(s->video_codec_id) st->codec->codec_id= s->video_codec_id; - break; - case AVMEDIA_TYPE_AUDIO: - if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id; - break; - case AVMEDIA_TYPE_SUBTITLE: - if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id; - break; - } -} - int ff_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, i; From ff08767817c2af07321ffc4fa35274da3d163d81 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 2 Jan 2013 01:15:58 +0100 Subject: [PATCH 053/328] lavf: Fix codec id forcing with probed codecs Fixes Ticket2088 Signed-off-by: Michael Niedermayer (cherry picked from commit 341e40f1e1eeba1a2952c26363630596193e887b) --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index eab0792ea1..38be37e779 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -731,6 +731,7 @@ no_packet: }else av_log(s, AV_LOG_WARNING, "probed stream %d failed\n", st->index); } + force_codec_ids(s, st); } } } From 7590a125f58050760263894c690f02dc2feb8d38 Mon Sep 17 00:00:00 2001 From: Piotr Bandurski Date: Sun, 6 Jan 2013 01:56:23 +0100 Subject: [PATCH 054/328] tiffdec: Use the correct height field. Fixes Ticket913 Signed-off-by: Michael Niedermayer (cherry picked from commit 4784a135b2b0fe4d1b4c6256bd37265fc45aed3d) --- libavcodec/tiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index d0b302a47d..e8f2a8d92e 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -737,7 +737,7 @@ static int tiff_decode_tag(TiffContext *s) break; case TIFF_ROWSPERSTRIP: if (type == TIFF_LONG && value == UINT_MAX) - value = s->avctx->height; + value = s->height; if (value < 1) { av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n"); From 10ac44198d83dc77d0078af78c0615441c9ce3c2 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Tue, 1 Jan 2013 01:23:19 +0100 Subject: [PATCH 055/328] ffmpeg: mark attachment streams finished. Fix trac ticket #2083. (cherry picked from commit 69a1667b064b11a2df4b4bdc136955f76d17f558) --- ffmpeg_opt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 2c5fbfb6b2..d86ef91a76 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1636,6 +1636,7 @@ loop_end: ost = new_attachment_stream(o, oc, -1); ost->stream_copy = 0; ost->attachment_filename = o->attachments[i]; + ost->finished = 1; ost->st->codec->extradata = attachment; ost->st->codec->extradata_size = len; From 302d2591dc6bab2561c7fe63e545c7909fecee5f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 6 Jan 2013 19:15:16 +0100 Subject: [PATCH 056/328] ff_get_audio_frame_size: try to fix wma in wav Fixes Ticket1905, Ticket2114 Signed-off-by: Michael Niedermayer (cherry picked from commit 2713e43ac85245805db95048493dde121a20aee7) --- libavformat/utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 38be37e779..21f2a0ebb8 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -846,6 +846,13 @@ static int get_audio_frame_size(AVCodecContext *enc, int size, int mux) if (enc->frame_size > 1) return enc->frame_size; + //For WMA we currently have no other means to calculate duration thus we + //do it here by assuming CBR, which is true for all known cases. + if(!mux && enc->bit_rate>0 && size>0 && enc->sample_rate>0 && enc->block_align>1) { + if (enc->codec_id == AV_CODEC_ID_WMAV1 || enc->codec_id == AV_CODEC_ID_WMAV2) + return ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate; + } + return -1; } From aa1af0d6cace02838b5843978fd51acdc163cae2 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 17 Jan 2013 02:11:12 +0100 Subject: [PATCH 057/328] Fix detection of struct v4l2_frmsize_discrete. It was always detected successfully. (cherry picked from commit c345100efc9baae0ea7c9fcc376725cae5d3df6e) --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5fdf7cfbaa..b67affdc5d 100755 --- a/configure +++ b/configure @@ -3732,7 +3732,7 @@ pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man check_header linux/fb.h check_header linux/videodev.h check_header linux/videodev2.h -check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete +check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete check_header sys/videoio.h From c287efcc447917ea89d908204df343e265f62d31 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 17 Jan 2013 17:19:08 +0100 Subject: [PATCH 058/328] Only skip MLP header in mpeg files if the codec actually is MLP. Fixes PCM audio in Kansas Pheasant Hunt 2000 mpg file. Reported-by: Mashiat Sarker Shakkhar (cherry picked from commit ad406f7e402977cb7dbc78ccb63e21c137f6699e) --- libavformat/mpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 54125ae9a2..38629c2749 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -497,7 +497,7 @@ static int mpegps_read_packet(AVFormatContext *s, if(st->discard >= AVDISCARD_ALL) goto skip; if (startcode >= 0xa0 && startcode <= 0xaf) { - if (lpcm_header_len == 6) { + if (lpcm_header_len == 6 && st->codec->codec_id == AV_CODEC_ID_MLP) { if (len < 6) goto skip; avio_skip(s->pb, 6); From bca27b0480b605a300b79881475b34f05a48ed62 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 13 Jan 2013 18:39:06 +0100 Subject: [PATCH 059/328] swr: fix handling of timestamps that cause multiple drops or silence injections Signed-off-by: Michael Niedermayer (cherry picked from commit d676598f879ba01ddb62f9abe8e17b2e94cb91cd) --- libswresample/swresample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswresample/swresample.c b/libswresample/swresample.c index 5d02aafb49..b8c646f154 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -770,7 +770,7 @@ int64_t swr_next_pts(struct SwrContext *s, int64_t pts){ if(s->min_compensation >= FLT_MAX) { return (s->outpts = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate)); } else { - int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts; + int64_t delta = pts - swr_get_delay(s, s->in_sample_rate * (int64_t)s->out_sample_rate) - s->outpts + s->drop_output*(int64_t)s->in_sample_rate; double fdelta = delta /(double)(s->in_sample_rate * (int64_t)s->out_sample_rate); if(fabs(fdelta) > s->min_compensation) { From ac6b2fecf4731ddaac546a38294918be39ff190a Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 13 Jan 2013 21:46:44 -0800 Subject: [PATCH 060/328] h264: don't clobber mmco opcode tables for non-first slice headers. Clobbering these tables will temporarily clobber the template used as a basis for other threads to start decoding from. If the other decoding thread updates from the template right at that moment, subsequent threads will get invalid (or, usually, none at all) mmco tables. This leads to invalid reference lists and subsequent decode failures. Therefore, instead, decode the mmco tables only for the first slice in a field or frame. For other slices, decode the bits and ensure they are identical to the mmco tables in the first slice, but don't ever clobber the context state. This prevents other threads from using a clobbered/invalid template as starting point for decoding, and thus fixes decoding in these cases. This fixes occasional (~1%) failures of h264-conformance-mr1_bt_a with frame-multithreading enabled. Signed-off-by: Michael Niedermayer (cherry picked from commit f6badba1859fb266a9c0bdaf006a04c73873cd90) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 12 +++- libavcodec/h264.h | 5 +- libavcodec/h264_refs.c | 144 +++++++++++++++++++++++++++++------------ 3 files changed, 114 insertions(+), 47 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 3b91039286..f2006ec633 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2794,7 +2794,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) s->current_picture_ptr->frame_num = h->prev_frame_num; ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0); ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 1); - ff_generate_sliding_window_mmcos(h); + ff_generate_sliding_window_mmcos(h, 1); if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 0 && (s->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; @@ -2971,7 +2971,15 @@ static int decode_slice_header(H264Context *h, H264Context *h0) } } - if (h->nal_ref_idc && ff_h264_decode_ref_pic_marking(h0, &s->gb) < 0 && + // If frame-mt is enabled, only update mmco tables for the first slice + // in a field. Subsequent slices can temporarily clobber h->mmco_index + // or h->mmco, which will cause ref list mix-ups and decoding errors + // further down the line. This may break decoding if the first slice is + // corrupt, thus we only do this if frame-mt is enabled. + if (h->nal_ref_idc && + ff_h264_decode_ref_pic_marking(h0, &s->gb, + !(s->avctx->active_thread_type & FF_THREAD_FRAME) || + h0->current_slice == 0) < 0 && (s->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 4d07a8ac4d..c3052bb9ed 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -668,9 +668,10 @@ void ff_h264_remove_all_refs(H264Context *h); */ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count); -int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb); +int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, + int first_slice); -void ff_generate_sliding_window_mmcos(H264Context *h); +void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice); /** * Check if the top & left blocks are available if needed & change the diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index d68a7d8b0f..46e11ebfc5 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -480,22 +480,49 @@ static void print_long_term(H264Context *h) { } } -void ff_generate_sliding_window_mmcos(H264Context *h) { - MpegEncContext * const s = &h->s; +static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos) +{ + int i; - h->mmco_index= 0; - if(h->short_ref_count && h->long_ref_count + h->short_ref_count >= h->sps.ref_frame_count && - !(FIELD_PICTURE && !s->first_field && s->current_picture_ptr->f.reference)) { - h->mmco[0].opcode= MMCO_SHORT2UNUSED; - h->mmco[0].short_pic_num= h->short_ref[ h->short_ref_count - 1 ]->frame_num; - h->mmco_index= 1; + for (i = 0; i < n_mmcos; i++) { + if (mmco1[i].opcode != mmco2[i].opcode) + return -1; + } + + return 0; +} + +void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) +{ + MpegEncContext * const s = &h->s; + MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp; + int mmco_index = 0, i; + + if (h->short_ref_count && + h->long_ref_count + h->short_ref_count >= h->sps.ref_frame_count && + !(FIELD_PICTURE && !s->first_field && + s->current_picture_ptr->f.reference)) { + mmco[0].opcode = MMCO_SHORT2UNUSED; + mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num; + mmco_index = 1; if (FIELD_PICTURE) { - h->mmco[0].short_pic_num *= 2; - h->mmco[1].opcode= MMCO_SHORT2UNUSED; - h->mmco[1].short_pic_num= h->mmco[0].short_pic_num + 1; - h->mmco_index= 2; + mmco[0].short_pic_num *= 2; + mmco[1].opcode = MMCO_SHORT2UNUSED; + mmco[1].short_pic_num = mmco[0].short_pic_num + 1; + mmco_index = 2; } } + + if (first_slice) { + h->mmco_index = mmco_index; + } else if (!first_slice && mmco_index >= 0 && + (mmco_index != h->mmco_index || + (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) { + av_log(h->s.avctx, AV_LOG_ERROR, + "Inconsistent MMCO state between slices [%d, %d, %d]\n", + mmco_index, h->mmco_index, i); + return AVERROR_INVALIDDATA; + } } int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ @@ -665,52 +692,83 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ return (h->s.avctx->err_recognition & AV_EF_EXPLODE) ? err : 0; } -int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){ +int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, + int first_slice) +{ MpegEncContext * const s = &h->s; int i; + MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp; + int mmco_index = 0; - h->mmco_index= 0; - if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields - s->broken_link= get_bits1(gb) -1; - if(get_bits1(gb)){ - h->mmco[0].opcode= MMCO_LONG; - h->mmco[0].long_arg= 0; - h->mmco_index= 1; + if (h->nal_unit_type == NAL_IDR_SLICE){ // FIXME fields + s->broken_link = get_bits1(gb) - 1; + if (get_bits1(gb)){ + mmco[0].opcode = MMCO_LONG; + mmco[0].long_arg = 0; + mmco_index = 1; } - }else{ - if(get_bits1(gb)){ // adaptive_ref_pic_marking_mode_flag - for(i= 0; immco[i].opcode= opcode; - if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){ - h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1); -/* if(h->mmco[i].short_pic_num >= h->short_ref_count || h->short_ref[ h->mmco[i].short_pic_num ] == NULL){ - av_log(s->avctx, AV_LOG_ERROR, "illegal short ref in memory management control operation %d\n", mmco); - return -1; - }*/ - } - if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){ - unsigned int long_arg= get_ue_golomb_31(gb); - if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG && long_arg == 16) && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){ - av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode); + mmco[i].opcode = opcode; + if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG){ + mmco[i].short_pic_num = + (h->curr_pic_num - get_ue_golomb(gb) - 1) & + (h->max_pic_num - 1); +#if 0 + if (mmco[i].short_pic_num >= h->short_ref_count || + h->short_ref[ mmco[i].short_pic_num ] == NULL){ + av_log(s->avctx, AV_LOG_ERROR, + "illegal short ref in memory management control " + "operation %d\n", mmco); return -1; } - h->mmco[i].long_arg= long_arg; +#endif + } + if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED || + opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) { + unsigned int long_arg = get_ue_golomb_31(gb); + if (long_arg >= 32 || + (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG && + long_arg == 16) && + !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){ + av_log(h->s.avctx, AV_LOG_ERROR, + "illegal long ref in memory management control " + "operation %d\n", opcode); + return -1; + } + mmco[i].long_arg = long_arg; } - if(opcode > (unsigned)MMCO_LONG){ - av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode); + if (opcode > (unsigned) MMCO_LONG){ + av_log(h->s.avctx, AV_LOG_ERROR, + "illegal memory management control operation %d\n", + opcode); return -1; } - if(opcode == MMCO_END) + if (opcode == MMCO_END) break; } - h->mmco_index= i; - }else{ - ff_generate_sliding_window_mmcos(h); + mmco_index = i; + } else { + if (first_slice) + ff_generate_sliding_window_mmcos(h, first_slice); + mmco_index = -1; } } + if (first_slice && mmco_index != -1) { + h->mmco_index = mmco_index; + } else if (!first_slice && mmco_index >= 0 && + (mmco_index != h->mmco_index || + (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) { + av_log(h->s.avctx, AV_LOG_ERROR, + "Inconsistent MMCO state between slices [%d, %d, %d]\n", + mmco_index, h->mmco_index, i); + return AVERROR_INVALIDDATA; + } + return 0; } From d369cc83aa763a780488c9b511507c8624d51c69 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 15 Jan 2013 08:38:54 -0800 Subject: [PATCH 061/328] h264: add 3 pixels below for subpixel filter wait position. If the motion vector is at a subpixel position, we need 3 pixels below the motion vector's wholepel position available, not 2, since the MC filter is a sixtap filter for the hpel position, and then a bilin filter for the qpel position. This patch fixes highly irreproducible (0.1%) fate failures in frame 2 and 4 of h264-conformance-cama2_vtc_b (e.g. first P-frame, first field, last line of MB x=40,y=2 and second field and last lines of MBs x=39-40, y=3). These used pre-loopfilter instead of post-loopfilter data because the await_progress() waited for one line too little in that field, and the motion vector of these particular MBs happened to align exactly to a position where that demonstrates the bug. Signed-off-by: Michael Niedermayer (cherry picked from commit 2c85d7c015489e169759e52c21499579dae5c2b1) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index f2006ec633..c8c3974ee7 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -310,10 +310,11 @@ static inline int get_lowest_part_list_y(H264Context *h, Picture *pic, int n, int height, int y_offset, int list) { int raw_my = h->mv_cache[list][scan8[n]][1]; - int filter_height = (raw_my & 3) ? 2 : 0; + int filter_height_up = (raw_my & 3) ? 2 : 0; + int filter_height_down = (raw_my & 3) ? 3 : 0; int full_my = (raw_my >> 2) + y_offset; - int top = full_my - filter_height; - int bottom = full_my + filter_height + height; + int top = full_my - filter_height_up; + int bottom = full_my + filter_height_down + height; return FFMAX(abs(top), bottom); } From 3e36cba430f787170a382855d190e3e360cace9c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 7 Jan 2013 15:31:00 +0100 Subject: [PATCH 062/328] mpeg12: Support decoding dimensions that are a multiple of 4096 Signed-off-by: Michael Niedermayer (cherry picked from commit 878e5bd6f555ad6167abacb30d66e47aabcdd745) Signed-off-by: Michael Niedermayer --- libavcodec/mpeg12.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 1e7ff9cf6f..29bee1d779 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1989,8 +1989,6 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx, width = get_bits(&s->gb, 12); height = get_bits(&s->gb, 12); - if (width <= 0 || height <= 0) - return -1; s->aspect_ratio_info = get_bits(&s->gb, 4); if (s->aspect_ratio_info == 0) { av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n"); @@ -2356,6 +2354,11 @@ static int decode_chunks(AVCodecContext *avctx, break; case PICTURE_START_CODE: + if (s2->width <= 0 || s2->height <= 0) { + av_log(avctx, AV_LOG_ERROR, "%dx%d is invalid\n", s2->width, s2->height); + return AVERROR_INVALIDDATA; + } + if(s->tmpgexs){ s2->intra_dc_precision= 3; s2->intra_matrix[0]= 1; From 5af41713046efed635d202a2d9b641c626561d71 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 7 Jan 2013 15:31:58 +0100 Subject: [PATCH 063/328] mpeg12enc: Correctly mask dimensions Signed-off-by: Michael Niedermayer (cherry picked from commit bcc4ef1a415c2ae646fdc4a8e22ebe0205f270e6) Signed-off-by: Michael Niedermayer --- libavcodec/mpeg12enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index ff839c028d..9726a30ae5 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -214,8 +214,8 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s) /* mpeg1 header repeated every gop */ put_header(s, SEQ_START_CODE); - put_sbits(&s->pb, 12, s->width ); - put_sbits(&s->pb, 12, s->height); + put_sbits(&s->pb, 12, s->width & 0xFFF); + put_sbits(&s->pb, 12, s->height & 0xFFF); for(i=1; i<15; i++){ float error= aspect_ratio; From 95f8701c32d8737afe5185e6b2f0fc54d976719f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 7 Jan 2013 15:47:21 +0100 Subject: [PATCH 064/328] mpeg12enc: check dimension validity Signed-off-by: Michael Niedermayer (cherry picked from commit 7fb87bc5f24b1be13269109506c05e4c54695b5e) Signed-off-by: Michael Niedermayer --- libavcodec/mpeg12enc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 9726a30ae5..9e31543995 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -167,6 +167,19 @@ static av_cold int encode_init(AVCodecContext *avctx) } } + if ((avctx->width & 0xFFF) == 0 && (avctx->height & 0xFFF) == 1) { + av_log(avctx, AV_LOG_ERROR, "Width / Height is invalid for MPEG2\n"); + return AVERROR(EINVAL); + } + + if (s->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) { + if ((avctx->width & 0xFFF) == 0 || (avctx->height & 0xFFF) == 0) { + av_log(avctx, AV_LOG_ERROR, "Width or Height are not allowed to be multiplies of 4096\n" + "add '-strict %d' if you want to use them anyway.\n", FF_COMPLIANCE_UNOFFICIAL); + return AVERROR(EINVAL); + } + } + s->drop_frame_timecode = s->drop_frame_timecode || !!(avctx->flags2 & CODEC_FLAG2_DROP_FRAME_TIMECODE); if (s->drop_frame_timecode) s->tc.flags |= AV_TIMECODE_FLAG_DROPFRAME; From ece68a0363ac64c48cc3a66f8c7ad83baac90add Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Jan 2013 04:14:09 +0100 Subject: [PATCH 065/328] mpeg1enc: Disable threads for resolutions too large for multi-threading Signed-off-by: Michael Niedermayer (cherry picked from commit 0c6b0409af070a3bfb02b55fde8ba18219edc76b) Signed-off-by: Michael Niedermayer --- libavcodec/mpeg12enc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 9e31543995..d4606a98cb 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -132,6 +132,9 @@ static av_cold int encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; + if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && avctx->height > 2800) + avctx->thread_count = 1; + if(ff_MPV_encode_init(avctx) < 0) return -1; From 04c74a339ff7ba6e535c9e197739da424cb0b3da Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Jan 2013 22:27:57 +0100 Subject: [PATCH 066/328] update for FFmpeg 1.0.2 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index eb9d764055..bcf57d0de9 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.1 +PROJECT_NUMBER = 1.0.2 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 7dea76edb3..6d7de6e6ab 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.1 +1.0.2 diff --git a/VERSION b/VERSION index 7dea76edb3..6d7de6e6ab 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.1 +1.0.2 From 3e57b37ddb259f0127cde6e5e322d652cc369b2b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:02:50 +0100 Subject: [PATCH 067/328] aacenc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 98fed59427cec17ce55ac137e7e250cff7db81cf) Signed-off-by: Michael Niedermayer --- libavcodec/aacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 383cb5a7c1..d09d3fd23c 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -522,7 +522,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, /* add current frame to queue */ if (frame) { - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } From 28ef8eaeefe3d12436126eb615cf1e8076790cb5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:03:09 +0100 Subject: [PATCH 068/328] libfaac: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 68a25c64cda16e12ef3a051ff8661c71ef574683) Signed-off-by: Michael Niedermayer --- libavcodec/libfaac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c index 0bfed1e0fc..685d14476f 100644 --- a/libavcodec/libfaac.c +++ b/libavcodec/libfaac.c @@ -201,7 +201,7 @@ static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, /* add current frame to the queue */ if (frame) { - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } From 6f2aa8adbf657bd7264d56f3b8f5a1feb111dc02 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:03:23 +0100 Subject: [PATCH 069/328] libfdk-aacenc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 9302ad1ac89d5443505cf0418f9d62786513032e) Signed-off-by: Michael Niedermayer --- libavcodec/libfdk-aacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index 2874e3797c..03744266f1 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -334,7 +334,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, in_buf.bufElSizes = &in_buffer_element_size; /* add current frame to the queue */ - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } From 3daa086b2eb41ab70075adae52ed1805422228fe Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:03:38 +0100 Subject: [PATCH 070/328] libmp3lame: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 871b6ec01d27a74702b7cf1d61446709de037948) Signed-off-by: Michael Niedermayer --- libavcodec/libmp3lame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 427cacdf8e..55657e4be2 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -234,7 +234,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, /* add current frame to the queue */ if (frame) { - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } From 57211d8a5f5db3d10d136a41e9f169ca291d369c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:04:13 +0100 Subject: [PATCH 071/328] libopencore-amr: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit d6180aa29741334cf69f691b27ffceb33f49d36a) Signed-off-by: Michael Niedermayer --- libavcodec/libopencore-amr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index aa6dfa62ec..9a096f3d09 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -258,7 +258,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (frame->nb_samples < avctx->frame_size - avctx->delay) s->enc_last_frame = -1; } - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) { + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) { av_freep(&flush_buf); return ret; } From d7826b8b9b479e1fac8df593a407b8cc522db580 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:04:25 +0100 Subject: [PATCH 072/328] libspeexenc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 3b8d66d5317d91288751869206b3acbb84dc44c7) Signed-off-by: Michael Niedermayer --- libavcodec/libspeexenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libspeexenc.c b/libavcodec/libspeexenc.c index cd32630a01..50d8607a47 100644 --- a/libavcodec/libspeexenc.c +++ b/libavcodec/libspeexenc.c @@ -254,7 +254,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, speex_encode_stereo_int(samples, s->header.frame_size, &s->bits); speex_encode_int(s->enc_state, samples, &s->bits); s->pkt_frame_count++; - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } else { /* handle end-of-stream */ From 461907760fdf7a9f1c61bef5cb394f4c9c4c26f7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:04:41 +0100 Subject: [PATCH 073/328] libvo-aacenc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 0ccb31dcad5a1543fbb284d66b0410b91ebd171d) Signed-off-by: Michael Niedermayer --- libavcodec/libvo-aacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libvo-aacenc.c b/libavcodec/libvo-aacenc.c index 3b7aca7386..531b40d24e 100644 --- a/libavcodec/libvo-aacenc.c +++ b/libavcodec/libvo-aacenc.c @@ -157,7 +157,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, samples = (VO_PBYTE)frame->data[0]; } /* add current frame to the queue */ - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } From 2ff4257e642a59fa97c149353a5bfbeb46567327 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:04:59 +0100 Subject: [PATCH 074/328] libvorbisenc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit bdd71abe5f34ca37612e17d912060f4dc9b94796) Signed-off-by: Michael Niedermayer --- libavcodec/libvorbisenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index b042e0cb4f..eaeaf04de3 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -307,7 +307,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote()\n"); return vorbis_error_to_averror(ret); } - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } else { if (!s->eof) From 1489e67072b7f276f9be3b1b71ffb239712fdf31 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:05:30 +0100 Subject: [PATCH 075/328] nellymoserenc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 795d2dc23b16a678d60a681e906aa87c14478597) Signed-off-by: Michael Niedermayer --- libavcodec/nellymoserenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index 2b96d47580..525ad8e1b0 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -397,7 +397,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, if (frame->nb_samples >= NELLY_BUF_LEN) s->last_frame = 1; } - if ((ret = ff_af_queue_add(&s->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } else { memset(s->buf + NELLY_BUF_LEN, 0, NELLY_SAMPLES * sizeof(*s->buf)); From f00a9f00034ca3e4b2e5a20a861df881982b0563 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:05:42 +0100 Subject: [PATCH 076/328] ra144enc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit e2704381e5f13f54506f69b7a05a05dc27ce1d7d) Signed-off-by: Michael Niedermayer --- libavcodec/ra144enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ra144enc.c b/libavcodec/ra144enc.c index e0fb827856..bdb1d9bfac 100644 --- a/libavcodec/ra144enc.c +++ b/libavcodec/ra144enc.c @@ -536,7 +536,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, for (; i < frame->nb_samples; i++) ractx->curr_block[i] = samples[i] >> 2; - if ((ret = ff_af_queue_add(&ractx->afq, frame) < 0)) + if ((ret = ff_af_queue_add(&ractx->afq, frame)) < 0) return ret; } else ractx->last_frame = 1; From ee8d38191fbfdc90ebd0c95f8793cc4cb11c1558 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:06:44 +0100 Subject: [PATCH 077/328] tiff: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 659546b42d6550e67fcdbb4937cd1982c60448aa) Signed-off-by: Michael Niedermayer --- libavcodec/tiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index e8f2a8d92e..5be154fbb2 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -843,7 +843,7 @@ static int tiff_decode_tag(TiffContext *s) s->fax_opts = value; break; #define ADD_METADATA(count, name, sep)\ - if (ret = add_metadata(count, type, name, sep, s) < 0) {\ + if ((ret = add_metadata(count, type, name, sep, s)) < 0) {\ av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\ return ret;\ } From dadf58908ceb08a75cce4e0a80dda4f08fdaa986 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:07:02 +0100 Subject: [PATCH 078/328] vsrc_testsrc: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit 6f88d2d786b87cbfec5ea16d1cb570ad30c80399) Signed-off-by: Michael Niedermayer --- libavfilter/vsrc_testsrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 85d3789cec..215379d5da 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -254,7 +254,7 @@ static int color_config_props(AVFilterLink *inlink) if (av_image_check_size(test->w, test->h, 0, ctx) < 0) return AVERROR(EINVAL); - if (ret = config_props(inlink) < 0) + if ((ret = config_props(inlink)) < 0) return ret; av_log(ctx, AV_LOG_VERBOSE, "color:0x%02x%02x%02x%02x\n", From b006b2f4f54a79e813be737f03fea9145fb5e548 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Jan 2013 00:07:51 +0100 Subject: [PATCH 079/328] rtmpproto: Fix assignments in if() Signed-off-by: Michael Niedermayer (cherry picked from commit a601eb9543ecab09aa69a6673e553318daf7ea57) Signed-off-by: Michael Niedermayer --- libavformat/rtmpproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 518e7b290a..e23dd2db41 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -1793,7 +1793,7 @@ static int handle_invoke(URLContext *s, RTMPPacket *pkt) !memcmp(pkt->data, "\002\000\007publish", 10) || !memcmp(pkt->data, "\002\000\010_checkbw", 11) || !memcmp(pkt->data, "\002\000\014createStream", 15)) { - if (ret = send_invoke_response(s, pkt) < 0) + if ((ret = send_invoke_response(s, pkt)) < 0) return ret; } From 5ee483ae62663361833d70263cd4d626ba280452 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 14 Jan 2013 20:07:53 +0100 Subject: [PATCH 080/328] h264: fix ff_generate_sliding_window_mmcos() prototype. It's been returning an error value since bad446e251405dc250c3cbee199072e083a1e4b9 Also check for the errors it returns. (cherry picked from commit ea382767ad2191acbe97e90624059723e15f0e4b) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 6 ++++-- libavcodec/h264.h | 2 +- libavcodec/h264_refs.c | 12 ++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index c8c3974ee7..e28cc636b4 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2360,7 +2360,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) MpegEncContext *const s0 = &h0->s; unsigned int first_mb_in_slice; unsigned int pps_id; - int num_ref_idx_active_override_flag; + int num_ref_idx_active_override_flag, ret; unsigned int slice_type, tmp, i, j; int default_ref_list_done = 0; int last_pic_structure, last_pic_dropable; @@ -2795,7 +2795,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0) s->current_picture_ptr->frame_num = h->prev_frame_num; ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0); ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 1); - ff_generate_sliding_window_mmcos(h, 1); + if ((ret = ff_generate_sliding_window_mmcos(h, 1)) < 0 && + s->avctx->err_recognition & AV_EF_EXPLODE) + return ret; if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 0 && (s->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; diff --git a/libavcodec/h264.h b/libavcodec/h264.h index c3052bb9ed..65d1fd8c15 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -671,7 +671,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count); int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, int first_slice); -void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice); +int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice); /** * Check if the top & left blocks are available if needed & change the diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 46e11ebfc5..20058c2e0c 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -492,7 +492,7 @@ static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos) return 0; } -void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) +int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) { MpegEncContext * const s = &h->s; MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp; @@ -523,6 +523,7 @@ void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) mmco_index, h->mmco_index, i); return AVERROR_INVALIDDATA; } + return 0; } int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ @@ -696,7 +697,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, int first_slice) { MpegEncContext * const s = &h->s; - int i; + int i, ret; MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp; int mmco_index = 0; @@ -753,8 +754,11 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, } mmco_index = i; } else { - if (first_slice) - ff_generate_sliding_window_mmcos(h, first_slice); + if (first_slice) { + ret = ff_generate_sliding_window_mmcos(h, first_slice); + if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE) + return ret; + } mmco_index = -1; } } From 78526c279fddc9f497e65ef937783e7c8519102e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 21 Jan 2013 23:00:20 +0100 Subject: [PATCH 081/328] avf_showwaves: fix null pointer dereference Found-by: durandal_1707 Signed-off-by: Michael Niedermayer (cherry picked from commit e4eebc2da9da886e1bdf87d29e9a4c5b55111036) Signed-off-by: Michael Niedermayer --- libavfilter/avf_showwaves.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c index dcbe8b8a61..81ee74d066 100644 --- a/libavfilter/avf_showwaves.c +++ b/libavfilter/avf_showwaves.c @@ -220,6 +220,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples) } if (showwaves->buf_idx == showwaves->w) push_frame(outlink); + outpicref = showwaves->outpicref; } avfilter_unref_buffer(insamples); From bec97981badcaf5f632ddd043bf016c4f3f18361 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Jan 2013 20:02:35 +0100 Subject: [PATCH 082/328] h264/ff_generate_sliding_window_mmcos: fix use of uninitialized variable Fixes CID968587 Signed-off-by: Michael Niedermayer (cherry picked from commit 3fba3e79a3e46d7611817f9051b33885eb1ff962) Signed-off-by: Michael Niedermayer --- libavcodec/h264_refs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 20058c2e0c..9e9f9e69d1 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -519,8 +519,8 @@ int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice) (mmco_index != h->mmco_index || (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) { av_log(h->s.avctx, AV_LOG_ERROR, - "Inconsistent MMCO state between slices [%d, %d, %d]\n", - mmco_index, h->mmco_index, i); + "Inconsistent MMCO state between slices [%d, %d]\n", + mmco_index, h->mmco_index); return AVERROR_INVALIDDATA; } return 0; From 75aa373bec58dd65cca6006a04c89c03d935ec83 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Jan 2013 20:01:39 +0100 Subject: [PATCH 083/328] h264: print mismatching opcode details in check_opcodes() Signed-off-by: Michael Niedermayer (cherry picked from commit dcbe15813ed09cf491e75a21cce0e751f5bc2b34) Signed-off-by: Michael Niedermayer --- libavcodec/h264_refs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 9e9f9e69d1..d5b9633c0c 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -485,8 +485,11 @@ static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos) int i; for (i = 0; i < n_mmcos; i++) { - if (mmco1[i].opcode != mmco2[i].opcode) + if (mmco1[i].opcode != mmco2[i].opcode) { + av_log(NULL, AV_LOG_ERROR, "MMCO opcode [%d, %d] at %d mismatches between slices\n", + mmco1[i].opcode, mmco2[i].opcode, i); return -1; + } } return 0; From 7ca4b918989c614de0e2dce1df45929aba5ab29d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Jan 2013 19:50:33 +0100 Subject: [PATCH 084/328] h264: fix use of uninitialized variable Fixed CID968588 Signed-off-by: Michael Niedermayer (cherry picked from commit fc86f88b32a288b252a088ee3c77b4f6219d54d5) Signed-off-by: Michael Niedermayer --- libavcodec/h264_refs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index d5b9633c0c..e5c008cdd8 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -772,8 +772,8 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb, (mmco_index != h->mmco_index || (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) { av_log(h->s.avctx, AV_LOG_ERROR, - "Inconsistent MMCO state between slices [%d, %d, %d]\n", - mmco_index, h->mmco_index, i); + "Inconsistent MMCO state between slices [%d, %d]\n", + mmco_index, h->mmco_index); return AVERROR_INVALIDDATA; } From f7bf3becf6792378e7d29cff140c4d19889bd5f5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 21 Jan 2013 23:27:18 +0100 Subject: [PATCH 085/328] Update for 1.0.3 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index bcf57d0de9..3834486db0 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.2 +PROJECT_NUMBER = 1.0.3 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 6d7de6e6ab..21e8796a09 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.2 +1.0.3 diff --git a/VERSION b/VERSION index 6d7de6e6ab..21e8796a09 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.2 +1.0.3 From d807022283204ef7a856020be64afdccc8d91f38 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 24 Jan 2013 02:30:40 +0100 Subject: [PATCH 086/328] matroskaenc: add codec_tag lists back. This reverts 312645e : "Do not set codec_tag property for matroska muxers." Also adds dummy codec_tag lists with codecs supported in mkv but not in wav / avi. Fixes ticket #2169. (cherry picked from commit df39c3ce385c02cbd8046298578ea7454c0a0f81) --- libavformat/matroska.c | 3 +++ libavformat/matroskaenc.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 64d0a459b4..9ea904ac8c 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -21,6 +21,9 @@ #include "matroska.h" +/* If you add a tag here that is not in ff_codec_bmp_tags[] + or ff_codec_wav_tags[], add it also to additional_audio_tags[] + or additional_video_tags[] in matroskaenc.c */ const CodecTags ff_mkv_codec_tags[]={ {"A_AAC" , AV_CODEC_ID_AAC}, {"A_AC3" , AV_CODEC_ID_AC3}, diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 4fd30b86fb..71236142dc 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1325,6 +1325,33 @@ static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance) return 0; } +const AVCodecTag additional_audio_tags[] = { + { AV_CODEC_ID_ALAC, 0XFFFFFFFF }, + { AV_CODEC_ID_EAC3, 0XFFFFFFFF }, + { AV_CODEC_ID_MLP, 0xFFFFFFFF }, + { AV_CODEC_ID_OPUS, 0xFFFFFFFF }, + { AV_CODEC_ID_PCM_S16BE, 0xFFFFFFFF }, + { AV_CODEC_ID_PCM_S24BE, 0xFFFFFFFF }, + { AV_CODEC_ID_PCM_S32BE, 0xFFFFFFFF }, + { AV_CODEC_ID_QDM2, 0xFFFFFFFF }, + { AV_CODEC_ID_RA_144, 0xFFFFFFFF }, + { AV_CODEC_ID_RA_288, 0xFFFFFFFF }, + { AV_CODEC_ID_COOK, 0xFFFFFFFF }, + { AV_CODEC_ID_TRUEHD, 0xFFFFFFFF }, + { AV_CODEC_ID_TTA, 0xFFFFFFFF }, + { AV_CODEC_ID_WAVPACK, 0xFFFFFFFF }, + { AV_CODEC_ID_NONE, 0xFFFFFFFF } +}; + +const AVCodecTag additional_video_tags[] = { + { AV_CODEC_ID_PRORES, 0xFFFFFFFF }, + { AV_CODEC_ID_RV10, 0xFFFFFFFF }, + { AV_CODEC_ID_RV20, 0xFFFFFFFF }, + { AV_CODEC_ID_RV30, 0xFFFFFFFF }, + { AV_CODEC_ID_RV40, 0xFFFFFFFF }, + { AV_CODEC_ID_NONE, 0xFFFFFFFF } +}; + #if CONFIG_MATROSKA_MUXER AVOutputFormat ff_matroska_muxer = { .name = "matroska", @@ -1341,6 +1368,10 @@ AVOutputFormat ff_matroska_muxer = { .write_trailer = mkv_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT, + .codec_tag = (const AVCodecTag* const []){ + ff_codec_bmp_tags, ff_codec_wav_tags, + additional_audio_tags, additional_video_tags, 0 + }, .subtitle_codec = AV_CODEC_ID_SSA, .query_codec = mkv_query_codec, }; @@ -1377,5 +1408,8 @@ AVOutputFormat ff_matroska_audio_muxer = { .write_packet = mkv_write_packet, .write_trailer = mkv_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT, + .codec_tag = (const AVCodecTag* const []){ + ff_codec_wav_tags, additional_audio_tags, 0 + }, }; #endif From 4f8b7eb87f6488eded6d13aa200cd70a5f33767b Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 6 Jan 2013 14:15:24 +1100 Subject: [PATCH 087/328] wtvdec: demux thumbnail picture to AVStream.attached_pic Fixes ticket #2133. (cherry picked from commit 508836932fcbc3c109fcc4df7a2f2b0bf21bbece) --- libavformat/wtvdec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 319b986ab4..28eba65f76 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -413,6 +413,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) char description[1024]; unsigned int filesize; AVStream *st; + int ret; int64_t pos = avio_tell(pb); avio_get_str16le(pb, INT_MAX, mime, sizeof(mime)); @@ -429,13 +430,14 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) if (!st) goto done; av_dict_set(&st->metadata, "title", description, 0); + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_MJPEG; - st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; - st->codec->extradata = av_mallocz(filesize); - if (!st->codec->extradata) + ret = av_get_packet(pb, &st->attached_pic, filesize); + if (ret < 0) goto done; - st->codec->extradata_size = filesize; - avio_read(pb, st->codec->extradata, filesize); + st->attached_pic.stream_index = st->index; + st->attached_pic.flags |= AV_PKT_FLAG_KEY; + st->disposition |= AV_DISPOSITION_ATTACHED_PIC; done: avio_seek(pb, pos + length, SEEK_SET); } From 5c1a1b47f378506132b26f893f2a78149582697a Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 1 Feb 2013 17:54:48 +0100 Subject: [PATCH 088/328] doc/muxers.texi: Fix mp3 picture attachment documentation. (cherry picked from commit 99eedfc40086972987aa27df8b1259c8bf15b20c) --- doc/muxers.texi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 83c21dba67..1685b12ceb 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -641,10 +641,11 @@ Write an mp3 with an ID3v2.3 header and an ID3v1 footer: ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3 @end example -Attach a picture to an mp3: +To attach a picture to an mp3 file select both the audio and the picture stream +with @code{map}: @example -ffmpeg -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover" --metadata:s:v comment="Cover (Front)" out.mp3 +ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1 +-metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3 @end example @c man end MUXERS From 299dc3baeaafa87389002acc5d6a9896fa0159be Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 1 Feb 2013 23:27:15 +0100 Subject: [PATCH 089/328] Do not change codec in flv streams if the user has forced a codec. Fixes ticket #2218. (cherry picked from commit 6a50e8a190bc1329fd3e76e8497bb7f870b6e69b) --- libavformat/flvdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 8c6807a260..d19cf240b1 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -712,13 +712,13 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[i]; if (stream_type == FLV_STREAM_TYPE_AUDIO) { if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && - flv_same_audio_codec(st->codec, flags)) { + (s->audio_codec_id || flv_same_audio_codec(st->codec, flags))) { break; } } else if (stream_type == FLV_STREAM_TYPE_VIDEO) { if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && - flv_same_video_codec(st->codec, flags)) { + (s->video_codec_id || flv_same_video_codec(st->codec, flags))) { break; } } else if (stream_type == FLV_STREAM_TYPE_DATA) { From 0c2a350762c398051797638a42ea07ce4baac80d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Feb 2013 21:54:02 +0100 Subject: [PATCH 090/328] movtextenc: fix pointer messup and out of array accesses Fixes Ticket2213 Signed-off-by: Michael Niedermayer (cherry picked from commit b0635e2fcf80717dd618ef75d3317d62ed85c300) --- libavcodec/movtextenc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 7f1b5b830f..9b0a6c5bce 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -21,6 +21,7 @@ #include #include "avcodec.h" +#include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "ass_split.h" @@ -87,15 +88,18 @@ static av_cold int mov_text_encode_init(AVCodecContext *avctx) static void mov_text_text_cb(void *priv, const char *text, int len) { MovTextContext *s = priv; + av_assert0(s->end >= s->ptr); av_strlcpy(s->ptr, text, FFMIN(s->end - s->ptr, len + 1)); - s->ptr += len; + s->ptr += FFMIN(s->end - s->ptr, len); } static void mov_text_new_line_cb(void *priv, int forced) { MovTextContext *s = priv; + av_assert0(s->end >= s->ptr); av_strlcpy(s->ptr, "\n", FFMIN(s->end - s->ptr, 2)); - s->ptr++; + if (s->end > s->ptr) + s->ptr++; } static const ASSCodesCallbacks mov_text_callbacks = { From 21185028b4fb505632f358121e4aca52b47cea0e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Feb 2013 22:57:35 +0100 Subject: [PATCH 091/328] dvenc: dont fail hard if the timecode is invalid Instead just dont store the timecode Fixes Ticket2187 Signed-off-by: Michael Niedermayer (cherry picked from commit f0eacbc760c8b27c2064cea5395e32971853c73c) --- libavformat/dvenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 604f4ce833..faeb8fdf8e 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -376,8 +376,8 @@ static int dv_write_header(AVFormatContext *s) break; } } - if (tcr) - return av_timecode_init_from_string(&dvc->tc, rate, tcr->value, s); + if (tcr && av_timecode_init_from_string(&dvc->tc, rate, tcr->value, s) >= 0) + return 0; return av_timecode_init(&dvc->tc, rate, 0, 0, s); } From 86f072ceb3e96b5f47b3c3fb3b96d76f140e7ce2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 6 Feb 2013 01:25:52 +0100 Subject: [PATCH 092/328] ffmpeg: dont allow -flags to override -pass Fixes Ticket2154 Signed-off-by: Michael Niedermayer (cherry picked from commit ccf9dd00da055e94117b56cead4af80ff331b00e) --- ffmpeg_opt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index d86ef91a76..6ccb3f480f 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1141,9 +1141,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in if (do_pass) { if (do_pass & 1) { video_enc->flags |= CODEC_FLAG_PASS1; + av_dict_set(&ost->opts, "flags", "+pass1", AV_DICT_APPEND); } if (do_pass & 2) { video_enc->flags |= CODEC_FLAG_PASS2; + av_dict_set(&ost->opts, "flags", "+pass2", AV_DICT_APPEND); } } From f3144b0cc69490fa81d1f499e24d4b0bc1c63c0e Mon Sep 17 00:00:00 2001 From: Matthieu Bouron Date: Mon, 4 Feb 2013 22:06:11 +0100 Subject: [PATCH 093/328] lavf/mov: skip version and flags attributes in mov_read_chan function Fixes ticket #1764. Signed-off-by: Michael Niedermayer (cherry picked from commit 59d40fc7e66e6ebb2d89e25115492bfe13b07d95) --- libavformat/mov.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index d3027f3d26..73c8be0246 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -676,6 +676,9 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size < 16) return 0; + /* skip version and flags */ + avio_skip(pb, 4); + ff_mov_read_chan(c->fc, pb, st, atom.size - 4); return 0; From 8eda88868399de00806cf21a966d9660db4ae9b4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 22 Jan 2013 21:30:20 +0100 Subject: [PATCH 094/328] sanm: check image dimensions before using them Avoids integer overflows and out of array accesses. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 49b729d3af8464de431362e6c5b3027102bc2f88) Signed-off-by: Michael Niedermayer --- libavcodec/sanm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 3736bd74ec..e2d8c0dd2d 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -25,6 +25,7 @@ #include "avcodec.h" #include "bytestream.h" #include "libavutil/bswap.h" +#include "libavutil/imgutils.h" #include "libavcodec/dsputil.h" #include "sanm_data.h" @@ -715,8 +716,11 @@ static int process_frame_obj(SANMVideoContext *ctx) h = bytestream2_get_le16u(&ctx->gb); if (ctx->width < left + w || ctx->height < top + h) { - ctx->avctx->width = FFMAX(left + w, ctx->width); - ctx->avctx->height = FFMAX(top + h, ctx->height); + if (av_image_check_size(FFMAX(left + w, ctx->width), + FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0) + return AVERROR_INVALIDDATA; + avcodec_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width), + FFMAX(top + h, ctx->height)); init_sizes(ctx, left + w, top + h); if (init_buffers(ctx)) { av_log(ctx->avctx, AV_LOG_ERROR, "error resizing buffers\n"); From bc58fe0309a075b6f75aeef948a55eede927591c Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Tue, 22 Jan 2013 20:58:07 -0500 Subject: [PATCH 095/328] rtpenc: fix overflow checking in avc_mp4_find_startcode() The check `start + res < start' is broken since pointer overflow is undefined behavior in C. Many compilers such as gcc/clang optimize away this check. Use `res > end - start' instead. Also change `res' to unsigned int to avoid signed left-shift overflow. Signed-off-by: Xi Wang Signed-off-by: Michael Niedermayer (cherry picked from commit 2f014567cfd63e58156f60666f1a61ba147276ab) Signed-off-by: Michael Niedermayer --- libavformat/rtpenc_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpenc_h264.c b/libavformat/rtpenc_h264.c index 68f497590b..b6c16e17d8 100644 --- a/libavformat/rtpenc_h264.c +++ b/libavformat/rtpenc_h264.c @@ -31,14 +31,14 @@ static const uint8_t *avc_mp4_find_startcode(const uint8_t *start, const uint8_t *end, int nal_length_size) { - int res = 0; + unsigned int res = 0; if (end - start < nal_length_size) return NULL; while (nal_length_size--) res = (res << 8) | *start++; - if (start + res > end || res < 0 || start + res < start) + if (res > end - start) return NULL; return start + res; From 7df878ac15077ccb1a4763fc285bd7e02b7b6a1f Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Tue, 22 Jan 2013 17:49:29 -0500 Subject: [PATCH 096/328] rtmp: fix multiple broken overflow checks Sanity checks like `data + size >= data_end || data + size < data' are broken, because `data + size < data' assumes pointer overflow, which is undefined behavior in C. Many compilers such as gcc/clang optimize such checks away. Use `size < 0 || size >= data_end - data' instead. Signed-off-by: Xi Wang Signed-off-by: Michael Niedermayer (cherry picked from commit 902cfe2f74d777a7dc20ac68f2393b9f84b790c1) Signed-off-by: Michael Niedermayer --- libavformat/rtmppkt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index b607d5b5e2..975ec8e2d1 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -343,11 +343,11 @@ int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end) data++; break; } - if (data + size >= data_end || data + size < data) + if (size < 0 || size >= data_end - data) return -1; data += size; t = ff_amf_tag_size(data, data_end); - if (t < 0 || data + t >= data_end) + if (t < 0 || t >= data_end - data) return -1; data += t; } @@ -376,7 +376,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end, int size = bytestream_get_be16(&data); if (!size) break; - if (data + size >= data_end || data + size < data) + if (size < 0 || size >= data_end - data) return -1; data += size; if (size == namelen && !memcmp(data-size, name, namelen)) { @@ -397,7 +397,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end, return 0; } len = ff_amf_tag_size(data, data_end); - if (len < 0 || data + len >= data_end || data + len < data) + if (len < 0 || len >= data_end - data) return -1; data += len; } @@ -468,13 +468,13 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d data++; break; } - if (data + size >= data_end || data + size < data) + if (size < 0 || size >= data_end - data) return; data += size; av_log(ctx, AV_LOG_DEBUG, " %s: ", buf); ff_amf_tag_contents(ctx, data, data_end); t = ff_amf_tag_size(data, data_end); - if (t < 0 || data + t >= data_end) + if (t < 0 || t >= data_end - data) return; data += t; } From c3744b415a97e8385e866613f5da23f6146f28b6 Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Tue, 22 Jan 2013 21:40:05 -0500 Subject: [PATCH 097/328] rtmp: fix buffer overflows in ff_amf_tag_contents() A negative `size' will bypass FFMIN(). In the subsequent memcpy() call, `size' will be considered as a large positive value, leading to a buffer overflow. Change the type of `size' to unsigned int to avoid buffer overflow, and simplify overflow checks accordingly. Signed-off-by: Xi Wang Signed-off-by: Michael Niedermayer (cherry picked from commit 4e692374f7962ea358c329de38c380103f8991b6) Signed-off-by: Michael Niedermayer --- libavformat/rtmppkt.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index 975ec8e2d1..52395961fc 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -427,7 +427,7 @@ static const char* rtmp_packet_type(int type) static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *data_end) { - int size; + unsigned int size; char buf[1024]; if (data >= data_end) @@ -446,7 +446,7 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d } else { size = bytestream_get_be32(&data); } - size = FFMIN(size, 1023); + size = FFMIN(size, sizeof(buf) - 1); memcpy(buf, data, size); buf[size] = 0; av_log(ctx, AV_LOG_DEBUG, " string '%s'\n", buf); @@ -459,16 +459,15 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d case AMF_DATA_TYPE_OBJECT: av_log(ctx, AV_LOG_DEBUG, " {\n"); for (;;) { - int size = bytestream_get_be16(&data); int t; - memcpy(buf, data, size); - buf[size] = 0; + size = bytestream_get_be16(&data); + av_strlcpy(buf, data, FFMIN(sizeof(buf), size + 1)); if (!size) { av_log(ctx, AV_LOG_DEBUG, " }\n"); data++; break; } - if (size < 0 || size >= data_end - data) + if (size >= data_end - data) return; data += size; av_log(ctx, AV_LOG_DEBUG, " %s: ", buf); From b666debffec1fcbb19ef377635a53b9a58bca8a4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 Jan 2013 18:29:41 +0100 Subject: [PATCH 098/328] huffyuvdec: Check init_vlc() return codes. Prevents out of array writes Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit f67a0d115254461649470452058fa3c28c0df294) Signed-off-by: Michael Niedermayer --- libavcodec/huffyuv.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 58da7894e4..993e524799 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -273,6 +273,7 @@ static void generate_joint_tables(HYuvContext *s) int len1 = s->len[p][u]; if (len1 > limit) continue; + av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1; bits[i] = (s->bits[0][y] << len1) + s->bits[p][u]; symbols[i] = (y << 8) + u; @@ -307,6 +308,7 @@ static void generate_joint_tables(HYuvContext *s) int len2 = s->len[2][r & 255]; if (len2 > limit1) continue; + av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1 + len2; bits[i] = (code << len2) + s->bits[2][r & 255]; if (s->decorrelate) { @@ -331,6 +333,7 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) { GetBitContext gb; int i; + int ret; init_get_bits(&gb, src, length * 8); @@ -341,8 +344,9 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length) return -1; } ff_free_vlc(&s->vlc[i]); - init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, - s->bits[i], 4, 4, 0); + if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, + s->bits[i], 4, 4, 0)) < 0) + return ret; } generate_joint_tables(s); @@ -354,6 +358,7 @@ static int read_old_huffman_tables(HYuvContext *s) { GetBitContext gb; int i; + int ret; init_get_bits(&gb, classic_shift_luma, classic_shift_luma_table_size * 8); @@ -377,8 +382,9 @@ static int read_old_huffman_tables(HYuvContext *s) for (i = 0; i < 3; i++) { ff_free_vlc(&s->vlc[i]); - init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, - s->bits[i], 4, 4, 0); + if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, + s->bits[i], 4, 4, 0)) < 0) + return ret; } generate_joint_tables(s); From db0f7f7394e1f994ed38db043f78ed0f10bde0da Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 Jan 2013 19:22:33 +0100 Subject: [PATCH 099/328] huffyuvdec: Skip len==0 cases Fixes vlc decoding for hypothetical files that would contain such cases. Signed-off-by: Michael Niedermayer (cherry picked from commit 0dfc01c2bbf4b71bb56201bc4a393321e15d1b31) Signed-off-by: Michael Niedermayer --- libavcodec/huffyuv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 993e524799..72ed3515bb 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -267,11 +267,11 @@ static void generate_joint_tables(HYuvContext *s) for (i = y = 0; y < 256; y++) { int len0 = s->len[0][y]; int limit = VLC_BITS - len0; - if(limit <= 0) + if(limit <= 0 || !len0) continue; for (u = 0; u < 256; u++) { int len1 = s->len[p][u]; - if (len1 > limit) + if (len1 > limit || !len1) continue; av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1; @@ -296,17 +296,17 @@ static void generate_joint_tables(HYuvContext *s) for (i = 0, g = -16; g < 16; g++) { int len0 = s->len[p0][g & 255]; int limit0 = VLC_BITS - len0; - if (limit0 < 2) + if (limit0 < 2 || !len0) continue; for (b = -16; b < 16; b++) { int len1 = s->len[p1][b & 255]; int limit1 = limit0 - len1; - if (limit1 < 1) + if (limit1 < 1 || !len1) continue; code = (s->bits[p0][g & 255] << len1) + s->bits[p1][b & 255]; for (r = -16; r < 16; r++) { int len2 = s->len[2][r & 255]; - if (len2 > limit1) + if (len2 > limit1 || !len2) continue; av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1 + len2; From 85a14dbd5dca34320f58b1ba11dd6dd0df4fb3be Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Dec 2012 17:14:32 +0100 Subject: [PATCH 100/328] adpcm: fix off by 1 error and out of array access in DK4 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit f18c873ab5ee3c78d00fdcc2582b39c133faecb4) Signed-off-by: Michael Niedermayer --- libavcodec/adpcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index c779f8b572..683a231f26 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -755,7 +755,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } } - for (n = nb_samples >> (1 - st); n > 0; n--) { + for (n = (nb_samples - 1) >> (1 - st); n > 0; n--) { int v = bytestream2_get_byteu(&gb); *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); From 6df0d3e2916c223dbe4262bf1b876dff1cb3f980 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Dec 2012 12:28:45 +0100 Subject: [PATCH 101/328] alsdec: check block length Fix writing over the end Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 0ceca269b66ec12a23bf0907bd2c220513cdbf16) Signed-off-by: Michael Niedermayer --- libavcodec/alsdec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 46dd0b45ae..1095b0118a 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -552,12 +552,15 @@ static void get_block_sizes(ALSDecContext *ctx, unsigned int *div_blocks, /** Read the block data for a constant block */ -static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) +static int read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; + if (bd->block_length <= 0) + return -1; + *bd->raw_samples = 0; *bd->const_block = get_bits1(gb); // 1 = constant value, 0 = zero block (silence) bd->js_blocks = get_bits1(gb); @@ -572,6 +575,8 @@ static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) // ensure constant block decoding by reusing this field *bd->const_block = 1; + + return 0; } @@ -971,7 +976,8 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd) if (read_var_block_data(ctx, bd)) return -1; } else { - read_const_block_data(ctx, bd); + if (read_const_block_data(ctx, bd) < 0) + return -1; } return 0; From 2502914c5f8eb77659d7c0868396862557a63245 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 9 Nov 2012 13:26:20 +0100 Subject: [PATCH 102/328] atrac3dec: Check coding mode against channels. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 13451f5520ce6b0afde861b2285dda659f8d4fb4) Conflicts: libavcodec/atrac3.c --- libavcodec/atrac3.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 7d076bed99..1da4c786eb 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -955,6 +955,11 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) } /* Check the extradata. */ + if (q->codingMode == JOINT_STEREO && avctx->channels < 2) { + av_log(avctx, AV_LOG_ERROR, "Invalid coding mode\n"); + return AVERROR_INVALIDDATA; + } + if (q->atrac3version != 4) { av_log(avctx,AV_LOG_ERROR,"Version %d != 4.\n",q->atrac3version); return AVERROR_INVALIDDATA; From 3e196e4def03c7a91423803402f84d638d316c33 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 11 Jan 2013 04:44:20 +0100 Subject: [PATCH 103/328] error_concealment: Check that the picture is not in a half setup state. Fixes state becoming inconsistent Fixes a null pointer dereference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 23318a57358358e7a4dc551e830e4503f0638cfe) Signed-off-by: Michael Niedermayer --- libavcodec/error_resilience.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 6ae06f2ad1..a166256a18 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -923,6 +923,12 @@ void ff_er_frame_end(MpegEncContext *s) return; }; + if ( s->picture_structure == PICT_FRAME + && s->current_picture.f.linesize[0] != s->current_picture_ptr->f.linesize[0]) { + av_log(s->avctx, AV_LOG_ERROR, "Error concealment not possible, frame not fully initialized\n"); + return; + } + if (s->current_picture.f.motion_val[0] == NULL) { av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); From 4cd1dad91ae97fe1f0dd534c3f5566787566f137 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 18 Jan 2013 01:28:44 +0100 Subject: [PATCH 104/328] avcodec_decode_audio: do not trust the channel layout, use the channel count. Fixes memory corruption Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit d270c3202539e8364c46410e15f7570800e33343) Conflicts: libavcodec/utils.c --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 00434c9114..384d457f61 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1744,7 +1744,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, * make sure it's set correctly; assume decoders that actually use * extended_data are doing it correctly */ planar = av_sample_fmt_is_planar(frame->format); - channels = av_get_channel_layout_nb_channels(frame->channel_layout); + channels = frame->channels; if (!(planar && channels > AV_NUM_DATA_POINTERS)) frame->extended_data = frame->data; From 89e16e675d3cbe76cf4581f98bf4ac300cab0286 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 24 Jan 2013 00:27:10 +0100 Subject: [PATCH 105/328] sanm: Check decoded_size. This prevents a buffer overflow in rle_decode() Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 7357ca900efcf829de4cce4cec6ddc286526d417) Signed-off-by: Michael Niedermayer --- libavcodec/sanm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index e2d8c0dd2d..21073e2344 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -638,6 +638,11 @@ static int old_codec47(SANMVideoContext *ctx, int top, decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 8); + if (decoded_size > height * stride - left - top * stride) { + decoded_size = height * stride - left - top * stride; + av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n"); + } + if (skip & 1) bytestream2_skip(&ctx->gb, 0x8080); if (!seq) { From 08e2c7a45f82b897a285548c257972eb1ad352c5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 25 Jan 2013 06:11:59 +0100 Subject: [PATCH 106/328] vqavideo: check chunk sizes before reading chunks Fixes out of array writes Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit ab6c9332bfa1e20127a16392a0b85a4aa4840889) Signed-off-by: Michael Niedermayer --- libavcodec/vqavideo.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index c814837049..33f7083b9c 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -536,6 +536,11 @@ static int vqa_decode_chunk(VqaContext *s) bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); + if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) { + av_log(s->avctx, AV_LOG_ERROR, "cbp0 chunk too large (0x%X bytes)\n", chunk_size); + return AVERROR_INVALIDDATA; + } + /* accumulate partial codebook */ bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index], chunk_size); @@ -559,6 +564,11 @@ static int vqa_decode_chunk(VqaContext *s) bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET); chunk_size = bytestream2_get_be32(&s->gb); + if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) { + av_log(s->avctx, AV_LOG_ERROR, "cbpz chunk too large (0x%X bytes)\n", chunk_size); + return AVERROR_INVALIDDATA; + } + /* accumulate partial codebook */ bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index], chunk_size); From c459c7b23efffab762560e41ad6a2c0dbbfd4915 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 Jan 2013 20:37:27 +0100 Subject: [PATCH 107/328] aacdec: check channel count Prevent out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 96f452ac647dae33c53c242ef3266b65a9beafb6) Signed-off-by: Michael Niedermayer --- libavcodec/aacdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 62df283b78..34cc18bda6 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -883,6 +883,11 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) } } + if (avctx->channels > MAX_CHANNELS) { + av_log(avctx, AV_LOG_ERROR, "Too many channels\n"); + return AVERROR_INVALIDDATA; + } + AAC_INIT_VLC_STATIC( 0, 304); AAC_INIT_VLC_STATIC( 1, 270); AAC_INIT_VLC_STATIC( 2, 550); From 3f2715804019a963bdd4e7fe7aafbd5e72aba0f5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Jan 2013 15:03:13 +0100 Subject: [PATCH 108/328] h264: Only apply error concealment if theres a frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without any correctly decoded slices, there can be no frame. Fixes out of array reads Found-by: Rafaël Carré Signed-off-by: Michael Niedermayer (cherry picked from commit 60af6c3138dc501a647bc69b374d5d33d5d86ab5) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index e28cc636b4..cd7dc5a814 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2280,7 +2280,7 @@ static int field_end(H264Context *h, int in_setup) * past end by one (callers fault) and resync_mb_y != 0 * causes problems for the first MB line, too. */ - if (!FIELD_PICTURE) + if (!FIELD_PICTURE && h->current_slice) ff_er_frame_end(s); ff_MPV_frame_end(s); From 1690c1fa88603c1cd31d66c12fb66d21db342d6c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 7 Feb 2013 01:24:35 +0100 Subject: [PATCH 109/328] update for 1.0.4 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index 3834486db0..1c8257199c 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.3 +PROJECT_NUMBER = 1.0.4 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 21e8796a09..ee90284c27 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.3 +1.0.4 diff --git a/VERSION b/VERSION index 21e8796a09..ee90284c27 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.3 +1.0.4 From 9c659b3a678fb5f1ed7136f3b7da9a4fc1f88288 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 11 Nov 2012 02:47:38 +0100 Subject: [PATCH 110/328] h264_refs: Print default in case we are missing a reference. Signed-off-by: Michael Niedermayer (cherry picked from commit a39d36146a40cb52b3560fd02c73eccf72603b8f) --- libavcodec/h264_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index e5c008cdd8..3e0f39dd5f 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -287,7 +287,7 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h){ for(list=0; listlist_count; list++){ for(index= 0; index < h->ref_count[list]; index++){ if (!h->ref_list[list][index].f.data[0]) { - av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture\n"); + av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref_list[list][0].poc); if (h->default_ref_list[list][0].f.data[0]) h->ref_list[list][index]= h->default_ref_list[list][0]; else From 169d84934423c91b321c83703bd0be660c0d25da Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 Feb 2013 22:36:07 +0100 Subject: [PATCH 111/328] h264: Reset last_pocs in case of reference or frame number inconsistencies This prevents faulty increasing of has_b_frames Should fix Ticket 2062 Signed-off-by: Michael Niedermayer (cherry picked from commit c230af9bccc3cadb373f9007ba14fffb6c2acc75) --- libavcodec/h264.c | 3 +++ libavcodec/h264_refs.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index cd7dc5a814..3249baabe9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2788,6 +2788,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0) Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num); + if (!h->sps.gaps_in_frame_num_allowed_flag) + for(i=0; ilast_pocs); i++) + h->last_pocs[i] = INT_MIN; if (ff_h264_frame_start(h) < 0) return -1; h->prev_frame_num++; diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 3e0f39dd5f..d72c498e7f 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -287,7 +287,10 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h){ for(list=0; listlist_count; list++){ for(index= 0; index < h->ref_count[list]; index++){ if (!h->ref_list[list][index].f.data[0]) { + int i; av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref_list[list][0].poc); + for (i=0; ilast_pocs); i++) + h->last_pocs[i] = INT_MIN; if (h->default_ref_list[list][0].f.data[0]) h->ref_list[list][index]= h->default_ref_list[list][0]; else From 140ca8f6c035bad8813db7896b88f709ddc23287 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 14 Feb 2013 14:39:21 +0100 Subject: [PATCH 112/328] sws: dont write out of array on bigendian Fixes Ticket2229 Signed-off-by: Michael Niedermayer (cherry picked from commit 4e2c63685e031e28d2296cff76473b963ee62ba1) --- libswscale/swscale_unscaled.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 9180f2eb5c..375bc559c4 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -631,6 +631,9 @@ static rgbConvFn findRgbConvFn(SwsContext *c) } } + if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) && !isRGBA32(srcFormat) && ALT32_CORR<0) + return NULL; + return conv; } From 397e769f74dd4460db571e5126271214e8895d2a Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 14 Feb 2013 15:23:51 +0100 Subject: [PATCH 113/328] Write the fiel atom to mov files independently of the used video coded. The QuickTime specification does not contain any hint that the atom must not be written in some cases and both the QuickTime and the AVID decoders do not fail if the atom is present. This change allows to signal (visually) interlaced streams with a codec different from uncompressed video. As a side-effect, this fixes ticket #2202 (cherry picked from commit 7d0e3b197c817b307d599a23704a44763ed0bbdd) Conflicts: tests/ref/fate/vsynth1-avui tests/ref/fate/vsynth1-dnxhd-1080i tests/ref/fate/vsynth1-mpeg4 tests/ref/fate/vsynth2-avui tests/ref/fate/vsynth2-dnxhd-1080i tests/ref/fate/vsynth2-mpeg4 tests/ref/lavf/mov tests/ref/seek/lavf_mov --- libavformat/movenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 7819f6ec35..9fe78b6691 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1097,13 +1097,14 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) mov_write_avcc_tag(pb, track); if(track->mode == MODE_IPOD) mov_write_uuid_tag_ipod(pb); - } else if (track->enc->field_order != AV_FIELD_UNKNOWN) - mov_write_fiel_tag(pb, track); - else if (track->enc->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0) + } else if (track->enc->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0) mov_write_dvc1_tag(pb, track); else if (track->vos_len > 0) mov_write_glbl_tag(pb, track); + if (track->enc->field_order != AV_FIELD_UNKNOWN) + mov_write_fiel_tag(pb, track); + if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { mov_write_pasp_tag(pb, track); From 98d06b046dfec1a61cfd04906aff213b6fcce7e4 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 17 Feb 2013 19:56:09 +0100 Subject: [PATCH 114/328] Revert "swfenc: use av_get_audio_frame_duration() instead of AVCodecContext.frame_size" This reverts commit 620b88a302d522f71a6a95aff500cf7bd8520043. Fixes ticket #2272. Conflicts: libavformat/swfenc.c (cherry picked from commit 8d0757e1079f588ed69f629e2d1a4d5f232dc298) --- libavformat/swfenc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 4a5be12783..86618d3968 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -188,6 +188,10 @@ static int swf_write_header(AVFormatContext *s) AVCodecContext *enc = s->streams[i]->codec; if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { if (enc->codec_id == AV_CODEC_ID_MP3) { + if (!enc->frame_size) { + av_log(s, AV_LOG_ERROR, "audio frame size not set\n"); + return -1; + } swf->audio_enc = enc; swf->audio_fifo= av_fifo_alloc(AUDIO_FIFO_SIZE); if (!swf->audio_fifo) @@ -449,7 +453,7 @@ static int swf_write_audio(AVFormatContext *s, } av_fifo_generic_write(swf->audio_fifo, buf, size, NULL); - swf->sound_samples += av_get_audio_frame_duration(enc, size); + swf->sound_samples += enc->frame_size; /* if audio only stream make sure we add swf frames */ if (!swf->video_enc) From 4c2b6ce26cf92f66d50dcd8335ebb78a54169015 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 20 Feb 2013 22:54:21 +0100 Subject: [PATCH 115/328] Fix bits_per_coded_sample when encoding png with frame-level multithreading. Fixes ticket #2290. (cherry picked from commit c4dc6c4c86a052b7ba53fa7ae0c1b0643ad70d0b) Conflicts: libavcodec/pngenc.c --- libavcodec/pngenc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 0d00a0866c..96511b3df3 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -244,12 +244,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, color_type = PNG_COLOR_TYPE_RGB; break; case PIX_FMT_RGBA: - avctx->bits_per_coded_sample = 32; bit_depth = 8; color_type = PNG_COLOR_TYPE_RGB_ALPHA; break; case PIX_FMT_RGB24: - avctx->bits_per_coded_sample = 24; bit_depth = 8; color_type = PNG_COLOR_TYPE_RGB; break; @@ -258,7 +256,6 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, color_type = PNG_COLOR_TYPE_GRAY; break; case PIX_FMT_GRAY8: - avctx->bits_per_coded_sample = 0x28; bit_depth = 8; color_type = PNG_COLOR_TYPE_GRAY; break; @@ -267,12 +264,10 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, color_type = PNG_COLOR_TYPE_GRAY_ALPHA; break; case PIX_FMT_MONOBLACK: - avctx->bits_per_coded_sample = bit_depth = 1; color_type = PNG_COLOR_TYPE_GRAY; break; case PIX_FMT_PAL8: - avctx->bits_per_coded_sample = bit_depth = 8; color_type = PNG_COLOR_TYPE_PALETTE; break; @@ -432,6 +427,23 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, static av_cold int png_enc_init(AVCodecContext *avctx){ PNGEncContext *s = avctx->priv_data; + switch(avctx->pix_fmt) { + case PIX_FMT_RGBA: + avctx->bits_per_coded_sample = 32; + break; + case PIX_FMT_RGB24: + avctx->bits_per_coded_sample = 24; + break; + case PIX_FMT_GRAY8: + avctx->bits_per_coded_sample = 0x28; + break; + case PIX_FMT_MONOBLACK: + avctx->bits_per_coded_sample = 1; + break; + case PIX_FMT_PAL8: + avctx->bits_per_coded_sample = 8; + } + avcodec_get_frame_defaults(&s->picture); avctx->coded_frame= &s->picture; ff_dsputil_init(&s->dsp, avctx); From fcd0e3235ad12251836d5b16921425224c8a3bc3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 22 Dec 2012 18:02:48 +0100 Subject: [PATCH 116/328] h264: Detect POC inconsistencies and try to handle them reasonably Improves the file from Ticket2050 Signed-off-by: Michael Niedermayer (cherry picked from commit 985aa0be828da073d765a8c1dbb38efad43891ed) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 3249baabe9..39a2764c70 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1466,7 +1466,13 @@ static void decode_postinit(H264Context *h, int setup_finished) if( cur->f.pict_type == AV_PICTURE_TYPE_B || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2)) out_of_order = FFMAX(out_of_order, 1); - if(s->avctx->has_b_frames < out_of_order && !h->sps.bitstream_restriction_flag){ + if (out_of_order == MAX_DELAYED_PIC_COUNT) { + av_log(s->avctx, AV_LOG_VERBOSE, "Invalid POC %d<%d\n", cur->poc, h->last_pocs[0]); + for (i = 1; i < MAX_DELAYED_PIC_COUNT; i++) + h->last_pocs[i] = INT_MIN; + h->last_pocs[0] = cur->poc; + cur->mmco_reset = 1; + } else if(s->avctx->has_b_frames < out_of_order && !h->sps.bitstream_restriction_flag){ av_log(s->avctx, AV_LOG_VERBOSE, "Increasing reorder buffer to %d\n", out_of_order); s->avctx->has_b_frames = out_of_order; s->low_delay = 0; From cc64871bd86b027813e5da97fdf4556e9534b1e2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 17:11:34 +0100 Subject: [PATCH 117/328] movenc: hotfix, dont store fiel for h264 / mpeg4-asp / dnxhd Other software does not store it in this case, and the information is provided by the codec stream Signed-off-by: Michael Niedermayer (cherry picked from commit 405cc0d9052079307b2b4188c396ae30c8e9108b) Conflicts: tests/ref/fate/vsynth1-mpeg4 tests/ref/fate/vsynth2-mpeg4 tests/ref/lavf/mov tests/ref/seek/lavf_mov tests/ref/vsynth/vsynth1-dnxhd-1080i tests/ref/vsynth/vsynth2-dnxhd-1080i --- libavformat/movenc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 9fe78b6691..5bf5a7408f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1102,8 +1102,11 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) else if (track->vos_len > 0) mov_write_glbl_tag(pb, track); - if (track->enc->field_order != AV_FIELD_UNKNOWN) - mov_write_fiel_tag(pb, track); + if (track->enc->codec_id != AV_CODEC_ID_H264 && + track->enc->codec_id != AV_CODEC_ID_MPEG4 && + track->enc->codec_id != AV_CODEC_ID_DNXHD) + if (track->enc->field_order != AV_FIELD_UNKNOWN) + mov_write_fiel_tag(pb, track); if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { From 02f241d1ed10cdd2c8d304d306e71a1a0d79cec3 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 14 Jan 2013 20:38:33 +0100 Subject: [PATCH 118/328] configure: Make warnings from -Wreturn-type fatal errors These warnings have no false positives and point to serious bugs. (cherry picked from commit 99853cb8d4237b810b2fffb4a34f66fd0064ef72) Conflicts: configure Signed-off-by: Michael Niedermayer --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index b67affdc5d..71396b2e72 100755 --- a/configure +++ b/configure @@ -3893,11 +3893,13 @@ elif enabled gcc; then check_cflags -fno-tree-vectorize check_cflags -Werror=implicit-function-declaration check_cflags -Werror=missing-prototypes + check_cflags -Werror=return-type elif enabled llvm_gcc; then check_cflags -mllvm -stack-alignment=16 elif enabled clang; then check_cflags -mllvm -stack-alignment=16 check_cflags -Qunused-arguments + check_cflags -Werror=return-type elif enabled armcc; then # 2523: use of inline assembler is deprecated add_cflags -W${armcc_opt},--diag_suppress=2523 From 97a740acc58792bf296f7f8b5ee3253fa8a48f0c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 22 Feb 2013 17:33:22 +0100 Subject: [PATCH 119/328] aac: reconfigure output on pop Fixes Ticket1918 Signed-off-by: Michael Niedermayer (cherry picked from commit 6f77122bf5712da1d860a0ad7174181fd0bcffd9) Signed-off-by: Michael Niedermayer --- libavcodec/aacdec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 34cc18bda6..4f0cf4b418 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -112,6 +112,10 @@ static VLC vlc_scalefactors; static VLC vlc_spectral[11]; +static int output_configure(AACContext *ac, + uint8_t layout_map[MAX_ELEM_ID*4][3], int tags, + int channel_config, enum OCStatus oc_type); + #define overread_err "Input buffer exhausted before END element found\n" static int count_channels(uint8_t (*layout)[3], int tags) @@ -373,6 +377,8 @@ static void pop_output_configuration(AACContext *ac) { ac->oc[1] = ac->oc[0]; ac->avctx->channels = ac->oc[1].channels; ac->avctx->channel_layout = ac->oc[1].channel_layout; + output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags, + ac->oc[1].m4ac.chan_config, ac->oc[1].status); } } From c69709571af268a607f6f96c5d126f49626d7426 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 03:31:31 +0100 Subject: [PATCH 120/328] doc/APIchanges: fix odd .01 versions Signed-off-by: Michael Niedermayer (cherry picked from commit 9f16cb9e50a5a196af9244dc7d33ed193227528a) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 6584e1950f..9c96e5787f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -255,19 +255,19 @@ API changes, most recent first: 2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h Add PIX_FMT_PSEUDOPAL flag. -2012-02-08 - 52f82a1 - lavc 54.01.0 +2012-02-08 - 52f82a1 - lavc 54.1.0 Add avcodec_encode_video2() and deprecate avcodec_encode_video(). -2012-02-01 - 316fc74 - lavc 54.01.0 +2012-02-01 - 316fc74 - lavc 54.1.0 Add av_fast_padded_malloc() as alternative for av_realloc() when aligned memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE zero-padded bytes at the end. -2012-01-31 - dd6d3b0 - lavf 54.01.0 +2012-01-31 - dd6d3b0 - lavf 54.1.0 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). NOTE: this was backported to 0.8 -2012-01-31 - af08d9a - lavc 54.01.0 +2012-01-31 - af08d9a - lavc 54.1.0 Add avcodec_is_open() function. NOTE: this was backported to 0.8 From 5877811b0f13a3ad82abe82b2f2cfa3e5eddfbd8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 20:32:24 +0100 Subject: [PATCH 121/328] apichanges: fix date Signed-off-by: Michael Niedermayer (cherry picked from commit ad6802f975a91bf6757fe3729ef8c6f10e6796b7) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9c96e5787f..e473404525 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -311,7 +311,7 @@ API changes, most recent first: 2011-10-20 - b35e9e1 - lavu 51.22.0 Add av_strtok() to avstring.h. -2011-01-03 - b73ec05 - lavu 51.21.0 +2012-01-03 - b73ec05 - lavu 51.21.0 Add av_popcount64 2011-12-18 - 8400b12 - lavc 53.28.1 From 3a21007e470625e75616ced6534d7f3020ee476e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 20:34:10 +0100 Subject: [PATCH 122/328] apichanges: Use , instead of / to seperate multiple hashes Signed-off-by: Michael Niedermayer (cherry picked from commit 33d6330652c088dadde163da569b1a2f6c7603c0) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index e473404525..ffa53eac2e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -155,7 +155,7 @@ API changes, most recent first: 2012-05-15 - lavfi 2.17.0 Add support for audio filters - ac71230/a2cd9be - add video/audio buffer sink in a new installed + ac71230, a2cd9be - add video/audio buffer sink in a new installed header buffersink.h 720c6b7 - add av_buffersrc_write_frame(), deprecate av_vsrc_buffer_add_frame() From ab70fa28f665505c4f429d058c5f8307c10500c8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 21:13:32 +0100 Subject: [PATCH 123/328] apichanges: fix 2 wrong hashes Signed-off-by: Michael Niedermayer (cherry picked from commit 2f3bc5122822687dc388f7352c92cf6db456cf7c) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index ffa53eac2e..49e0015249 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -765,11 +765,11 @@ API changes, most recent first: 2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED. -2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() +2011-02-09 - c0b102c - lavc 52.112.0 - avcodec_thread_init() Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead set thread_count before calling avcodec_open. -2011-02-09 - 778b08a - lavc 52.111.0 - threading API +2011-02-09 - 37b00b4 - lavc 52.111.0 - threading API Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ release_buffer()/draw_horiz_band() callbacks for appropriate codecs. Add thread_type and active_thread_type fields to AVCodecContext. From 8cfd33fd3504e54b040d24745f01c9a16cd6ee4f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 Feb 2013 03:32:23 +0100 Subject: [PATCH 124/328] doc/APIchanges: List merge commit hashes and version numbers Signed-off-by: Michael Niedermayer --- doc/APIchanges | 300 ++++++++++++++++++++++++------------------------- 1 file changed, 150 insertions(+), 150 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 49e0015249..092d1b6706 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -102,90 +102,90 @@ API changes, most recent first: Add codec descriptors for accessing codec properties without having to refer to a specific decoder or encoder. - c223d79 - Add an AVCodecDescriptor struct and functions + f5f3684 / c223d79 - Add an AVCodecDescriptor struct and functions avcodec_descriptor_get() and avcodec_descriptor_next(). - 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY. - 91e59fe - Add avcodec_descriptor_get_by_name(). + f5f3684 / 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY. + 6c180b3 / 91e59fe - Add avcodec_descriptor_get_by_name(). -2012-08-08 - 987170c - lavu 51.38 - dict.h +2012-08-08 - f5f3684 / 987170c - lavu 51.68.100 / 51.38.0 - dict.h Add av_dict_count(). -2012-08-07 - 104e10f - lavc 54.25 - avcodec.h +2012-08-07 - 7a72695 / 104e10f - lavc 54.51.100 / 54.25.0 - avcodec.h Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*. To provide backwards compatibility, CodecID is now #defined as AVCodecID. Note that this can break user code that includes avcodec.h and uses the 'CodecID' identifier. Such code should either #undef CodecID or stop using the CodecID name. -2012-08-03 - 239fdf1 - lavu 51.37.1 - cpu.h +2012-08-03 - e776ee8 / 239fdf1 - lavu 51.66.101 / 51.37.1 - cpu.h lsws 2.1.1 - swscale.h Rename AV_CPU_FLAG_MMX2 ---> AV_CPU_FLAG_MMXEXT. Rename SWS_CPU_CAPS_MMX2 ---> SWS_CPU_CAPS_MMXEXT. -2012-07-29 - 681ed00 - lavf 54.13.0 - avformat.h +2012-07-29 - 7c26761 / 681ed00 - lavf 54.22.100 / 54.13.0 - avformat.h Add AVFMT_FLAG_NOBUFFER for low latency use cases. 2012-07-10 - 5fade8a - lavu 51.37.0 Add av_malloc_array() and av_mallocz_array() -2012-06-22 - d3d3a32 - lavu 51.34.0 +2012-06-22 - e847f41 / d3d3a32 - lavu 51.61.100 / 51.34.0 Add av_usleep() -2012-06-20 - ae0a301 - lavu 51.33.0 +2012-06-20 - 4da42eb / ae0a301 - lavu 51.60.100 / 51.33.0 Move av_gettime() to libavutil, add libavutil/time.h -2012-06-09 - 3971be0 - lavr 0.0.3 +2012-06-09 - 82edf67 / 3971be0 - lavr 0.0.3 Add a parameter to avresample_build_matrix() for Dolby/DPLII downmixing. -2012-06-12 - 9baeff9 - lavfi 2.23.0 - avfilter.h +2012-06-12 - c7b9eab / 9baeff9 - lavfi 2.79.100 / 2.23.0 - avfilter.h Add AVFilterContext.nb_inputs/outputs. Deprecate AVFilterContext.input/output_count. -2012-06-12 - 84b9fbe - lavfi 2.22.0 - avfilter.h +2012-06-12 - c7b9eab / 84b9fbe - lavfi 2.79.100 / 2.22.0 - avfilter.h Add avfilter_pad_get_type() and avfilter_pad_get_name(). Those should now be used instead of accessing AVFilterPad members directly. -2012-06-12 - b0f0dfc - lavu 51.32.0 - audioconvert.h +2012-06-12 - 3630a07 / b0f0dfc - lavu 51.57.100 / 51.32.0 - audioconvert.h Add av_get_channel_layout_channel_index(), av_get_channel_name() and av_channel_layout_extract_channel(). -2012-05-25 - 154486f - lavu 51.31.0 - opt.h +2012-05-25 - 53ce990 / 154486f - lavu 51.55.100 / 51.31.0 - opt.h Add av_opt_set_bin() -2012-05-15 - lavfi 2.17.0 +2012-05-15 - lavfi 2.74.100 / 2.17.0 Add support for audio filters - ac71230, a2cd9be - add video/audio buffer sink in a new installed + 61930bd / ac71230, 1cbf7fb / a2cd9be - add video/audio buffer sink in a new installed header buffersink.h - 720c6b7 - add av_buffersrc_write_frame(), deprecate + 1cbf7fb / 720c6b7 - add av_buffersrc_write_frame(), deprecate av_vsrc_buffer_add_frame() - ab16504 - add avfilter_copy_buf_props() - 9453c9e - add extended_data to AVFilterBuffer - 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays() + 61930bd / ab16504 - add avfilter_copy_buf_props() + 61930bd / 9453c9e - add extended_data to AVFilterBuffer + 61930bd / 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays() -2012-05-09 - lavu 51.30.0 - samplefmt.h - 142e740 - add av_samples_copy() - 6d7f617 - add av_samples_set_silence() +2012-05-09 - lavu 51.53.100 / 51.30.0 - samplefmt.h + 61930bd / 142e740 - add av_samples_copy() + 61930bd / 6d7f617 - add av_samples_set_silence() -2012-05-09 - a5117a2 - lavc 54.13.1 +2012-05-09 - 61930bd / a5117a2 - lavc 54.21.101 / 54.13.1 For audio formats with fixed frame size, the last frame no longer needs to be padded with silence, libavcodec will handle this internally (effectively all encoders behave as if they had CODEC_CAP_SMALL_LAST_FRAME set). -2012-05-07 - 828bd08 - lavc 54.13.0 - avcodec.h +2012-05-07 - 653d117 / 828bd08 - lavc 54.20.100 / 54.13.0 - avcodec.h Add sample_rate and channel_layout fields to AVFrame. -2012-05-01 - 4010d72 - lavr 0.0.1 +2012-05-01 - 2330eb1 / 4010d72 - lavr 0.0.1 Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8. -2012-04-25 - 3527a73 - lavu 51.29.0 - cpu.h +2012-04-25 - e890b68 / 3527a73 - lavu 51.48.100 / 51.29.0 - cpu.h Add av_parse_cpu_flags() -2012-04-24 - c8af852 - lavr 0.0.0 +2012-04-24 - 3ead79e / c8af852 - lavr 0.0.0 Add libavresample audio conversion library -2012-04-20 - 0c0d1bc - lavu 51.28.0 - audio_fifo.h +2012-04-20 - 3194ab7 / 0c0d1bc - lavu 51.47.100 / 51.28.0 - audio_fifo.h Add audio FIFO functions: av_audio_fifo_free() av_audio_fifo_alloc() @@ -197,10 +197,10 @@ API changes, most recent first: av_audio_fifo_size() av_audio_fifo_space() -2012-04-14 - lavfi 2.16.0 - avfiltergraph.h - d7bcc71 Add avfilter_graph_parse2(). +2012-04-14 - lavfi 2.70.100 / 2.16.0 - avfiltergraph.h + 7432bcf / d7bcc71 Add avfilter_graph_parse2(). -2012-04-08 - 4d693b0 - lavu 51.27.0 - samplefmt.h +2012-04-08 - 6bfb304 / 4d693b0 - lavu 51.46.100 / 51.27.0 - samplefmt.h Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt() 2012-03-21 - b75c67d - lavu 51.43.100 @@ -228,69 +228,69 @@ API changes, most recent first: 2012-01-24 - 0c3577b - lavfi 2.60.100 Add avfilter_graph_dump. -2012-03-05 - lavc 54.8.0 - 6699d07 Add av_get_exact_bits_per_sample() - 9524cf7 Add av_get_audio_frame_duration() +2012-03-05 - lavc 54.10.100 / 54.8.0 + f095391 / 6699d07 Add av_get_exact_bits_per_sample() + f095391 / 9524cf7 Add av_get_audio_frame_duration() -2012-03-04 - 44fe77b - lavc 54.7.0 - avcodec.h +2012-03-04 - 2af8f2c / 44fe77b - lavc 54.8.100 / 54.7.0 - avcodec.h Add av_codec_is_encoder/decoder(). -2012-03-01 - 442c132 - lavc 54.3.0 - avcodec.h +2012-03-01 - 1eb7f39 / 442c132 - lavc 54.5.100 / 54.3.0 - avcodec.h Add av_packet_shrink_side_data. -2012-02-29 - dd2a4bc - lavf 54.2.0 - avformat.h +2012-02-29 - 79ae084 / dd2a4bc - lavf 54.2.100 / 54.2.0 - avformat.h Add AVStream.attached_pic and AV_DISPOSITION_ATTACHED_PIC, used for dealing with attached pictures/cover art. -2012-02-25 - c9bca80 - lavu 51.24.0 - error.h +2012-02-25 - 305e4b3 / c9bca80 - lavu 51.41.100 / 51.24.0 - error.h Add AVERROR_UNKNOWN NOTE: this was backported to 0.8 -2012-02-20 - e9cda85 - lavc 54.2.0 +2012-02-20 - eadd426 / e9cda85 - lavc 54.2.100 / 54.2.0 Add duration field to AVCodecParserContext -2012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h +2012-02-20 - eadd426 / 0b42a93 - lavu 51.40.100 / 51.23.1 - mathematics.h Add av_rescale_q_rnd() -2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h +2012-02-08 - f2b20b7 / 38d5533 - lavu 51.38.101 / 51.22.1 - pixdesc.h Add PIX_FMT_PSEUDOPAL flag. -2012-02-08 - 52f82a1 - lavc 54.1.0 +2012-02-08 - f2b20b7 / 52f82a1 - lavc 54.2.100 / 54.1.0 Add avcodec_encode_video2() and deprecate avcodec_encode_video(). -2012-02-01 - 316fc74 - lavc 54.1.0 +2012-02-01 - 4c677df / 316fc74 - lavc 54.1.0 Add av_fast_padded_malloc() as alternative for av_realloc() when aligned memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE zero-padded bytes at the end. -2012-01-31 - dd6d3b0 - lavf 54.1.0 +2012-01-31 - a369a6b / dd6d3b0 - lavf 54.1.0 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). NOTE: this was backported to 0.8 -2012-01-31 - af08d9a - lavc 54.1.0 +2012-01-31 - a369a6b / af08d9a - lavc 54.1.0 Add avcodec_is_open() function. NOTE: this was backported to 0.8 -2012-01-30 - 8b93312 - lavu 51.22.0 - intfloat.h +2012-01-30 - 151ecc2 / 8b93312 - lavu 51.36.100 / 51.22.0 - intfloat.h Add a new installed header libavutil/intfloat.h with int/float punning functions. NOTE: this was backported to 0.8 -2012-01-25 - lavf 53.22.0 - f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible +2012-01-25 - lavf 53.31.100 / 53.22.0 + 3c5fe5b / f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for muxers supporting it (av_write_frame makes sure it is called only for muxers with this flag). -2012-01-15 - lavc 53.34.0 +2012-01-15 - lavc 53.56.105 / 53.34.0 New audio encoding API: - b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio + 67f5650 / b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio encoders. - 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function. - b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio(). + 67f5650 / 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function. + 67f5650 / b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio(). Add AVCodec.encode2(). -2012-01-12 - 3167dc9 - lavfi 2.15.0 +2012-01-12 - b18e17e / 3167dc9 - lavfi 2.59.100 / 2.15.0 Add a new installed header -- libavfilter/version.h -- with version macros. 2011-12-08 - a502939 - lavfi 2.52.0 @@ -311,37 +311,37 @@ API changes, most recent first: 2011-10-20 - b35e9e1 - lavu 51.22.0 Add av_strtok() to avstring.h. -2012-01-03 - b73ec05 - lavu 51.21.0 +2012-01-03 - ad1c8dd / b73ec05 - lavu 51.34.100 / 51.21.0 Add av_popcount64 -2011-12-18 - 8400b12 - lavc 53.28.1 +2011-12-18 - 7c29313 / 8400b12 - lavc 53.46.1 / 53.28.1 Deprecate AVFrame.age. The field is unused. -2011-12-12 - 5266045 - lavf 53.17.0 +2011-12-12 - 8bc7fe4 / 5266045 - lavf 53.25.0 / 53.17.0 Add avformat_close_input(). Deprecate av_close_input_file() and av_close_input_stream(). -2011-12-02 - 0eea212 - lavc 53.25.0 +2011-12-02 - e4de716 / 0eea212 - lavc 53.40.0 / 53.25.0 Add nb_samples and extended_data fields to AVFrame. Deprecate AVCODEC_MAX_AUDIO_FRAME_SIZE. Deprecate avcodec_decode_audio3() in favor of avcodec_decode_audio4(). avcodec_decode_audio4() writes output samples to an AVFrame, which allows audio decoders to use get_buffer(). -2011-12-04 - 560f773 - lavc 53.24.0 +2011-12-04 - e4de716 / 560f773 - lavc 53.40.0 / 53.24.0 Change AVFrame.data[4]/base[4]/linesize[4]/error[4] to [8] at next major bump. Change AVPicture.data[4]/linesize[4] to [8] at next major bump. Change AVCodecContext.error[4] to [8] at next major bump. Add AV_NUM_DATA_POINTERS to simplify the bump transition. -2011-11-23 - bbb46f3 - lavu 51.18.0 +2011-11-23 - 8e576d5 / bbb46f3 - lavu 51.27.0 / 51.18.0 Add av_samples_get_buffer_size(), av_samples_fill_arrays(), and av_samples_alloc(), to samplefmt.h. -2011-11-23 - 8889cc4 - lavu 51.17.0 +2011-11-23 - 8e576d5 / 8889cc4 - lavu 51.27.0 / 51.17.0 Add planar sample formats and av_sample_fmt_is_planar() to samplefmt.h. -2011-11-19 - f3a29b7 - lavc 53.21.0 +2011-11-19 - dbb38bc / f3a29b7 - lavc 53.36.0 / 53.21.0 Move some AVCodecContext fields to a new private struct, AVCodecInternal, which is accessed from a new field, AVCodecContext.internal. - fields moved: @@ -349,55 +349,55 @@ API changes, most recent first: AVCodecContext.internal_buffer_count --> AVCodecInternal.buffer_count AVCodecContext.is_copy --> AVCodecInternal.is_copy -2011-11-16 - 6270671 - lavu 51.16.0 +2011-11-16 - 8709ba9 / 6270671 - lavu 51.26.0 / 51.16.0 Add av_timegm() -2011-11-13 - lavf 53.15.0 +2011-11-13 - lavf 53.21.0 / 53.15.0 New interrupt callback API, allowing per-AVFormatContext/AVIOContext interrupt callbacks. - 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to + 5f268ca / 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to AVFormatContext. - 1dee0ac Add avio_open2() with additional parameters. Those are + 5f268ca / 1dee0ac Add avio_open2() with additional parameters. Those are an interrupt callback and an options AVDictionary. This will allow passing AVOptions to protocols after lavf 54.0. -2011-11-06 - ba04ecf - lavu 51.14.0 +2011-11-06 - 13b7781 / ba04ecf - lavu 51.24.0 / 51.14.0 Add av_strcasecmp() and av_strncasecmp() to avstring.h. -2011-11-06 - 07b172f - lavu 51.13.0 +2011-11-06 - 13b7781 / 07b172f - lavu 51.24.0 / 51.13.0 Add av_toupper()/av_tolower() -2011-11-05 - b6d08f4 - lavf 53.13.0 +2011-11-05 - d8cab5c / b6d08f4 - lavf 53.19.0 / 53.13.0 Add avformat_network_init()/avformat_network_deinit() -2011-10-27 - 512557b - lavc 53.15.0 +2011-10-27 - 6faf0a2 / 512557b - lavc 53.24.0 / 53.15.0 Remove avcodec_parse_frame. Deprecate AVCodecContext.parse_only and CODEC_CAP_PARSE_ONLY. -2011-10-19 - 569129a - lavf 53.10.0 +2011-10-19 - d049257 / 569129a - lavf 53.17.0 / 53.10.0 Add avformat_new_stream(). Deprecate av_new_stream(). -2011-10-13 - b631fba - lavf 53.9.0 +2011-10-13 - 91eb1b1 / b631fba - lavf 53.16.0 / 53.9.0 Add AVFMT_NO_BYTE_SEEK AVInputFormat flag. -2011-10-12 - lavu 51.12.0 +2011-10-12 - lavu 51.21.0 / 51.12.0 AVOptions API rewrite. - - 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* + - f884ef0 / 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* - new setting/getting functions with slightly different semantics: - dac66da av_set_string3 -> av_opt_set + f884ef0 / dac66da av_set_string3 -> av_opt_set av_set_double -> av_opt_set_double av_set_q -> av_opt_set_q av_set_int -> av_opt_set_int - 41d9d51 av_get_string -> av_opt_get + f884ef0 / 41d9d51 av_get_string -> av_opt_get av_get_double -> av_opt_get_double av_get_q -> av_opt_get_q av_get_int -> av_opt_get_int - - 8c5dcaa trivial rename av_next_option -> av_opt_next - - 641c7af new functions - av_opt_child_next, av_opt_child_class_next + - f884ef0 / 8c5dcaa trivial rename av_next_option -> av_opt_next + - f884ef0 / 641c7af new functions - av_opt_child_next, av_opt_child_class_next and av_opt_find2() 2011-09-22 - a70e787 - lavu 51.17.0 @@ -443,31 +443,31 @@ API changes, most recent first: 2011-08-20 - 69e2c1a - lavu 51.13.0 Add av_get_media_type_string(). -2011-09-03 - fb4ca26 - lavc 53.13.0 +2011-09-03 - 1889c67 / fb4ca26 - lavc 53.13.0 lavf 53.11.0 lsws 2.1.0 Add {avcodec,avformat,sws}_get_class(). -2011-08-03 - c11fb82 - lavu 51.15.0 +2011-08-03 - 1889c67 / c11fb82 - lavu 51.15.0 Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function. 2011-08-14 - 323b930 - lavu 51.12.0 Add av_fifo_peek2(), deprecate av_fifo_peek(). -2011-08-26 - lavu 51.9.0 - - add41de..abc78a5 Do not include intfloat_readwrite.h, +2011-08-26 - lavu 51.14.0 / 51.9.0 + - 976a8b2 / add41de..976a8b2 / abc78a5 Do not include intfloat_readwrite.h, mathematics.h, rational.h, pixfmt.h, or log.h from avutil.h. -2011-08-16 - 48f9e45 - lavf 53.8.0 +2011-08-16 - 27fbe31 / 48f9e45 - lavf 53.11.0 / 53.8.0 Add avformat_query_codec(). -2011-08-16 - bca06e7 - lavc 53.11.0 +2011-08-16 - 27fbe31 / bca06e7 - lavc 53.11.0 Add avcodec_get_type(). -2011-08-06 - 2f63440 - lavf 53.7.0 +2011-08-06 - 0cb233c / 2f63440 - lavf 53.7.0 Add error_recognition to AVFormatContext. -2011-08-02 - 9d39cbf - lavc 53.9.1 +2011-08-02 - 1d186e9 / 9d39cbf - lavc 53.9.1 Add AV_PKT_FLAG_CORRUPT AVPacket flag. 2011-07-16 - b57df29 - lavfi 2.27.0 @@ -478,11 +478,11 @@ API changes, most recent first: avfilter_set_common_packing_formats() avfilter_all_packing_formats() -2011-07-10 - a67c061 - lavf 53.6.0 +2011-07-10 - 3602ad7 / a67c061 - lavf 53.6.0 Add avformat_find_stream_info(), deprecate av_find_stream_info(). NOTE: this was backported to 0.7 -2011-07-10 - 0b950fe - lavc 53.8.0 +2011-07-10 - 3602ad7 / 0b950fe - lavc 53.8.0 Add avcodec_open2(), deprecate avcodec_open(). NOTE: this was backported to 0.7 @@ -525,35 +525,35 @@ API changes, most recent first: 2011-06-12 - 6119b23 - lavfi 2.16.0 - avfilter_graph_parse() Change avfilter_graph_parse() signature. -2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h +2011-06-23 - 686959e / 67e9ae1 - lavu 51.10.0 / 51.8.0 - attributes.h Add av_printf_format(). -2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h +2011-06-16 - 2905e3f / 05e84c9, 2905e3f / 25de595 - lavf 53.4.0 / 53.2.0 - avformat.h Add avformat_open_input and avformat_write_header(). Deprecate av_open_input_stream, av_open_input_file, AVFormatParameters and av_write_header. -2011-06-16 - 7e83e1c, dc59ec5 - lavu 51.7.0 - opt.h +2011-06-16 - 2905e3f / 7e83e1c, 2905e3f / dc59ec5 - lavu 51.9.0 / 51.7.0 - opt.h Add av_opt_set_dict() and av_opt_find(). Deprecate av_find_opt(). Add AV_DICT_APPEND flag. -2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h +2011-06-10 - 45fb647 / cb7c11c - lavu 51.6.0 - opt.h Add av_opt_flag_is_set(). 2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h. -2011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata +2011-06-09 - f9ecb84 / d9f80ea - lavu 51.8.0 - AVMetadata Move AVMetadata from lavf to lavu and rename it to AVDictionary -- new installed header dict.h. All av_metadata_* functions renamed to av_dict_*. -2011-06-07 - a6703fa - lavu 51.8.0 - av_get_bytes_per_sample() +2011-06-07 - d552f61 / a6703fa - lavu 51.8.0 - av_get_bytes_per_sample() Add av_get_bytes_per_sample() in libavutil/samplefmt.h. Deprecate av_get_bits_per_sample_fmt(). -2011-06-05 - b39b062 - lavu 51.8.0 - opt.h +2011-06-05 - f956924 / b39b062 - lavu 51.8.0 - opt.h Add av_opt_free convenience function. 2011-06-06 - 95a0242 - lavfi 2.14.0 - AVFilterBufferRefAudioProps @@ -583,7 +583,7 @@ API changes, most recent first: Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor. -2011-05-25 - 30315a8 - lavf 53.3.0 - avformat.h +2011-05-25 - 39e4206 / 30315a8 - lavf 53.3.0 - avformat.h Add fps_probe_size to AVFormatContext. 2011-05-22 - 5ecdfd0 - lavf 53.2.0 - avformat.h @@ -599,10 +599,10 @@ API changes, most recent first: 2011-05-14 - 9fdf772 - lavfi 2.6.0 - avcodec.h Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h. -2011-05-18 - 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt +2011-05-18 - 75a37b5 / 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt Add request_sample_fmt field to AVCodecContext. -2011-05-10 - 188dea1 - lavc 53.6.0 - avcodec.h +2011-05-10 - 59eb12f / 188dea1 - lavc 53.6.0 - avcodec.h Deprecate AVLPCType and the following fields in AVCodecContext: lpc_coeff_precision, prediction_order_method, min_partition_order, max_partition_order, lpc_type, lpc_passes. @@ -632,81 +632,81 @@ API changes, most recent first: Add av_dynarray_add function for adding an element to a dynamic array. -2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h +2011-04-26 - d7e5aeb / bebe72f - lavu 51.1.0 - avutil.h Add AVPictureType enum and av_get_picture_type_char(), deprecate FF_*_TYPE defines and av_get_pict_type_char() defined in libavcodec/avcodec.h. -2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h +2011-04-26 - d7e5aeb / 10d3940 - lavfi 2.3.0 - avfilter.h Add pict_type and key_frame fields to AVFilterBufferRefVideo. -2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer +2011-04-26 - d7e5aeb / 7a11c82 - lavfi 2.2.0 - vsrc_buffer Add sample_aspect_ratio fields to vsrc_buffer arguments -2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h +2011-04-21 - 8772156 / 94f7451 - lavc 53.1.0 - avcodec.h Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading. 2011-04-15 - lavc 52.120.0 - avcodec.h AVPacket structure got additional members for passing side information: - 4de339e introduce side information for AVPacket - 2d8591c make containers pass palette change in AVPacket + c407984 / 4de339e introduce side information for AVPacket + c407984 / 2d8591c make containers pass palette change in AVPacket 2011-04-12 - lavf 52.107.0 - avio.h Avio cleanup, part II - deprecate the entire URLContext API: - 175389c add avio_check as a replacement for url_exist - ff1ec0c add avio_pause and avio_seek_time as replacements + c55780d / 175389c add avio_check as a replacement for url_exist + 9891004 / ff1ec0c add avio_pause and avio_seek_time as replacements for _av_url_read_fseek/fpause - cdc6a87 deprecate av_protocol_next(), avio_enum_protocols + d4d0932 / cdc6a87 deprecate av_protocol_next(), avio_enum_protocols should be used instead. - 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. - f87b1b3 rename open flags: URL_* -> AVIO_* - f8270bb add avio_enum_protocols. - 5593f03 deprecate URLProtocol. - c486dad deprecate URLContext. - 026e175 deprecate the typedef for URLInterruptCB - 8e76a19 deprecate av_register_protocol2. - b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME - 1305d93 deprecate av_url_read_seek - fa104e1 deprecate av_url_read_pause - 727c7aa deprecate url_get_filename(). - 5958df3 deprecate url_max_packet_size(). - 1869ea0 deprecate url_get_file_handle(). - 32a97d4 deprecate url_filesize(). - e52a914 deprecate url_close(). - 58a48c6 deprecate url_seek(). - 925e908 deprecate url_write(). - dce3756 deprecate url_read_complete(). - bc371ac deprecate url_read(). - 0589da0 deprecate url_open(). - 62eaaea deprecate url_connect. - 5652bb9 deprecate url_alloc. - 333e894 deprecate url_open_protocol - e230705 deprecate url_poll and URLPollEntry + c88caa5 / 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. + c88caa5 / f87b1b3 rename open flags: URL_* -> AVIO_* + d4d0932 / f8270bb add avio_enum_protocols. + d4d0932 / 5593f03 deprecate URLProtocol. + d4d0932 / c486dad deprecate URLContext. + d4d0932 / 026e175 deprecate the typedef for URLInterruptCB + c88caa5 / 8e76a19 deprecate av_register_protocol2. + 11d7841 / b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME + 11d7841 / 1305d93 deprecate av_url_read_seek + 11d7841 / fa104e1 deprecate av_url_read_pause + 434f248 / 727c7aa deprecate url_get_filename(). + 434f248 / 5958df3 deprecate url_max_packet_size(). + 434f248 / 1869ea0 deprecate url_get_file_handle(). + 434f248 / 32a97d4 deprecate url_filesize(). + 434f248 / e52a914 deprecate url_close(). + 434f248 / 58a48c6 deprecate url_seek(). + 434f248 / 925e908 deprecate url_write(). + 434f248 / dce3756 deprecate url_read_complete(). + 434f248 / bc371ac deprecate url_read(). + 434f248 / 0589da0 deprecate url_open(). + 434f248 / 62eaaea deprecate url_connect. + 434f248 / 5652bb9 deprecate url_alloc. + 434f248 / 333e894 deprecate url_open_protocol + 434f248 / e230705 deprecate url_poll and URLPollEntry 2011-04-08 - lavf 52.106.0 - avformat.h Minor avformat.h cleanup: - a9bf9d8 deprecate av_guess_image2_codec - c3675df rename avf_sdp_create->av_sdp_create + d4d0932 / a9bf9d8 deprecate av_guess_image2_codec + d4d0932 / c3675df rename avf_sdp_create->av_sdp_create 2011-04-03 - lavf 52.105.0 - avio.h Large-scale renaming/deprecating of AVIOContext-related functions: - 724f6a0 deprecate url_fdopen - 403ee83 deprecate url_open_dyn_packet_buf - 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf - b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf - 8978fed introduce an AVIOContext.seekable field as a replacement for + 2cae980 / 724f6a0 deprecate url_fdopen + 2cae980 / 403ee83 deprecate url_open_dyn_packet_buf + 2cae980 / 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf + 2cae980 / b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf + 2cae980 / 8978fed introduce an AVIOContext.seekable field as a replacement for AVIOContext.is_streamed and url_is_streamed() - b64030f deprecate get_checksum() - 4c4427a deprecate init_checksum() - 4ec153b deprecate udp_set_remote_url/get_local_port - 933e90a deprecate av_url_read_fseek/fpause - 8d9769a deprecate url_fileno - b7f2fdd rename put_flush_packet -> avio_flush - 35f1023 deprecate url_close_buf - 83fddae deprecate url_open_buf - d9d86e0 rename url_fprintf -> avio_printf - 59f65d9 deprecate url_setbufsize - 3e68b3b deprecate url_ferror + 1caa412 / b64030f deprecate get_checksum() + 1caa412 / 4c4427a deprecate init_checksum() + 2fd41c9 / 4ec153b deprecate udp_set_remote_url/get_local_port + 4fa0e24 / 933e90a deprecate av_url_read_fseek/fpause + 4fa0e24 / 8d9769a deprecate url_fileno + 0fecf26 / b7f2fdd rename put_flush_packet -> avio_flush + 0fecf26 / 35f1023 deprecate url_close_buf + 0fecf26 / 83fddae deprecate url_open_buf + 0fecf26 / d9d86e0 rename url_fprintf -> avio_printf + 0fecf26 / 59f65d9 deprecate url_setbufsize + 6947b0c / 3e68b3b deprecate url_ferror e8bb2e2 deprecate url_fget_max_packet_size 76aa876 rename url_fsize -> avio_size e519753 deprecate url_fgetc @@ -727,7 +727,7 @@ API changes, most recent first: b3db9ce deprecate get_partial_buffer 8d9ac96 rename av_alloc_put_byte -> avio_alloc_context -2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type +2011-03-25 - 27ef7b1 / 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type Add audio_service_type field to AVCodecContext. 2011-03-17 - e309fdc - lavu 50.40.0 - pixfmt.h From e6324ccfbd8e3607350df7f46fdeec89ec613ea3 Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 16 Jan 2013 18:27:14 -0300 Subject: [PATCH 125/328] latmenc: Check for LOAS sync word Write the packet unaltered if found. Fixes ticket #1917 Signed-off-by: James Almer Signed-off-by: Michael Niedermayer (cherry picked from commit b454c64e0311d813fef9c22cf34f83c2ce77ab23) --- libavformat/latmenc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 233eab8382..9dfb4e4fab 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -156,6 +156,15 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "ADTS header detected - ADTS will not be incorrectly muxed into LATM\n"); return AVERROR_INVALIDDATA; } + + if (!s->streams[0]->codec->extradata) { + if(pkt->size > 2 && pkt->data[0] == 0x56 && (pkt->data[1] >> 4) == 0xe && + (AV_RB16(pkt->data + 1) & 0x1FFF) + 3 == pkt->size) + return ff_raw_write_packet(s, pkt); + else + return AVERROR_INVALIDDATA; + } + if (pkt->size > 0x1fff) goto too_large; From 62e55034077d60ed84e962a287069a60aecbaab6 Mon Sep 17 00:00:00 2001 From: James Almer Date: Tue, 5 Feb 2013 22:34:29 -0300 Subject: [PATCH 126/328] lavc/bink: Chech for malloc failure Based on commit 8ab2173ed141aa2c3336be7f9880340dfb8dcf5e --- libavcodec/bink.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 9990700797..c06348a753 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -169,7 +169,7 @@ static void init_lengths(BinkContext *c, int width, int bw) * * @param c decoder context */ -static av_cold void init_bundles(BinkContext *c) +static av_cold int init_bundles(BinkContext *c) { int bw, bh, blocks; int i; @@ -180,8 +180,12 @@ static av_cold void init_bundles(BinkContext *c) for (i = 0; i < BINKB_NB_SRC; i++) { c->bundle[i].data = av_malloc(blocks * 64); + if (!c->bundle[i].data) + return AVERROR(ENOMEM); c->bundle[i].data_end = c->bundle[i].data + blocks * 64; } + + return 0; } /** @@ -1272,7 +1276,7 @@ static av_cold int decode_init(AVCodecContext *avctx) BinkContext * const c = avctx->priv_data; static VLC_TYPE table[16 * 128][2]; static int binkb_initialised = 0; - int i; + int i, ret; int flags; c->version = avctx->codec_tag >> 24; @@ -1307,7 +1311,10 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_dsputil_init(&c->dsp, avctx); ff_binkdsp_init(&c->bdsp); - init_bundles(c); + if ((ret = init_bundles(c)) < 0) { + free_bundles(c); + return ret; + } if (c->version == 'b') { if (!binkb_initialised) { From 8ffe243c85e542a77f9bda8d6a79005ada7dff27 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 27 Feb 2013 19:19:15 +0100 Subject: [PATCH 127/328] lavf/avio: check for : in filenames for protocols. If the first "special" character in a filename is a comma, it can introduce protocol options, but only if there is a colon at the end. Otherwise, it is just a filename with a comma. Fix trac ticket #2303. (cherry picked from commit d9fad53f4b447db1e436dcf3fc4a57e604616e6c) --- libavformat/avio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index abc70723ef..d7240f34de 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -209,7 +209,9 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, "Missing call to av_register_all()?\n"); } - if (filename[proto_len] != ':' && filename[proto_len] != ',' || is_dos_path(filename)) + if (filename[proto_len] != ':' && + (filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) || + is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str))); From 857a0379457ef79c1dc15d15b672e374d74dd6dc Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 2 Feb 2013 22:36:25 +0100 Subject: [PATCH 128/328] Require at least three frames to autodetect loas. (cherry picked from commit a60530e3ee1d9532c026a52b03661f88e163d647) --- libavformat/loasdec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c index ccb9464c33..39eba00720 100644 --- a/libavformat/loasdec.c +++ b/libavformat/loasdec.c @@ -55,7 +55,6 @@ static int loas_probe(AVProbeData *p) if (first_frames>=3) return AVPROBE_SCORE_MAX/2+1; else if(max_frames>100)return AVPROBE_SCORE_MAX/2; else if(max_frames>=3) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; else return 0; } From 4f873341b4d522b1bfa385a1f6fc86bb8b6dc879 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 12 Feb 2013 01:09:03 +0100 Subject: [PATCH 129/328] sanm: add forgotten check for decoded_size in old_codec37() Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 365270aec5c2b9284230abc702b11168818f14cf) Signed-off-by: Michael Niedermayer --- libavcodec/sanm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 21073e2344..1d5d064976 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -415,6 +415,11 @@ static int old_codec37(SANMVideoContext *ctx, int top, flags = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 3); + if (decoded_size > height * stride - left - top * stride) { + decoded_size = height * stride - left - top * stride; + av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n"); + } + ctx->rotate_code = 0; if (((seq & 1) || !(flags & 1)) && (compr && compr != 2)) From f62537d9f1b43b04e64e7dec79049556f7bc31a7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 12 Feb 2013 02:03:28 +0100 Subject: [PATCH 130/328] sanm: Use the correct height variable in the decoded_size checks Fixes integer overflow and out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 5260edee7e5bd975837696c8c8c1a80eb2fbd7c1) Signed-off-by: Michael Niedermayer --- libavcodec/sanm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 1d5d064976..aaf7434605 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -415,8 +415,8 @@ static int old_codec37(SANMVideoContext *ctx, int top, flags = bytestream2_get_byte(&ctx->gb); bytestream2_skip(&ctx->gb, 3); - if (decoded_size > height * stride - left - top * stride) { - decoded_size = height * stride - left - top * stride; + if (decoded_size > ctx->height * stride - left - top * stride) { + decoded_size = ctx->height * stride - left - top * stride; av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n"); } @@ -643,8 +643,8 @@ static int old_codec47(SANMVideoContext *ctx, int top, decoded_size = bytestream2_get_le32(&ctx->gb); bytestream2_skip(&ctx->gb, 8); - if (decoded_size > height * stride - left - top * stride) { - decoded_size = height * stride - left - top * stride; + if (decoded_size > ctx->height * stride - left - top * stride) { + decoded_size = ctx->height * stride - left - top * stride; av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n"); } From 534c0df6e0ed9f26012d77e990d4da9b73d45e48 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 12 Feb 2013 19:53:40 +0100 Subject: [PATCH 131/328] pngdec/filter: dont access out of array elements at the end Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 1ac0fa50eff30d413206cffa5f47f7fe6d4849b1) Signed-off-by: Michael Niedermayer --- libavcodec/pngdec.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index a5faeba42a..34557248b2 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -187,7 +187,7 @@ void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w if(bpp >= 2) g = dst[1];\ if(bpp >= 3) b = dst[2];\ if(bpp >= 4) a = dst[3];\ - for(; i < size; i+=bpp) {\ + for(; i <= size - bpp; i+=bpp) {\ dst[i+0] = r = op(r, src[i+0], last[i+0]);\ if(bpp == 1) continue;\ dst[i+1] = g = op(g, src[i+1], last[i+1]);\ @@ -203,13 +203,9 @@ void ff_add_png_paeth_prediction(uint8_t *dst, uint8_t *src, uint8_t *top, int w else if(bpp == 2) UNROLL1(2, op)\ else if(bpp == 3) UNROLL1(3, op)\ else if(bpp == 4) UNROLL1(4, op)\ - else {\ - for (; i < size; i += bpp) {\ - int j;\ - for (j = 0; j < bpp; j++)\ - dst[i+j] = op(dst[i+j-bpp], src[i+j], last[i+j]);\ - }\ - } + for (; i < size; i++) {\ + dst[i] = op(dst[i-bpp], src[i], last[i]);\ + }\ /* NOTE: 'dst' can be equal to 'last' */ static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, From d17b9469c940f056d87fefc79d80fac47c69c1d8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 12 Feb 2013 23:40:24 +0100 Subject: [PATCH 132/328] tiff: Check buffer allocation and pointer increment more carefully in shorts2str() and double2str() Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit e1219cdaf9fb4bc8cea410e1caf802373c1bfe51) Conflicts: libavcodec/tiff.c --- libavcodec/tiff.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 5be154fbb2..0d2aee70fd 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -207,9 +207,11 @@ static char *doubles2str(double *dp, int count, const char *sep) { int i; char *ap, *ap0; - int component_len = 15 + strlen(sep); + uint64_t component_len = 15LL + strlen(sep); if (!sep) sep = ", "; - ap = av_malloc(component_len * count); + if (count >= (INT_MAX - 1)/component_len) + return NULL; + ap = av_malloc(component_len * count + 1); if (!ap) return NULL; ap0 = ap; @@ -228,14 +230,22 @@ static char *shorts2str(int16_t *sp, int count, const char *sep) { int i; char *ap, *ap0; + uint64_t component_len; if (!sep) sep = ", "; - ap = av_malloc((5 + strlen(sep)) * count); + component_len = 7LL + strlen(sep); + if (count >= (INT_MAX - 1)/component_len) + return NULL; + ap = av_malloc(component_len * count + 1); if (!ap) return NULL; ap0 = ap; ap[0] = '\0'; for (i = 0; i < count; i++) { - int l = snprintf(ap, 5 + strlen(sep), "%d%s", sp[i], sep); + unsigned l = snprintf(ap, component_len, "%d%s", sp[i], sep); + if (l >= component_len) { + av_free(ap0); + return NULL; + } ap += l; } ap0[strlen(ap0) - strlen(sep)] = '\0'; From 82213d67bad8785aef8806855fd0d291954193df Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 Feb 2013 01:03:30 +0100 Subject: [PATCH 133/328] shorten: dont leave invalid channel counts in the context. Fixes freeing invalid addresses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 4f1279154ee9baf2078241bf5619774970d18b25) Conflicts: libavcodec/shorten.c --- libavcodec/shorten.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index d04011e468..470b467b8c 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -342,6 +342,7 @@ static int read_header(ShortenContext *s) s->channels = get_uint(s, CHANSIZE); if (s->channels > MAX_CHANNELS) { av_log(s->avctx, AV_LOG_ERROR, "too many channels: %d\n", s->channels); + s->channels = 0; return -1; } s->avctx->channels = s->channels; From e35da91b52cc09d6e4f2a7191cfbc8127e2eda51 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 Feb 2013 17:49:16 +0100 Subject: [PATCH 134/328] swr: check channel layouts before using them. Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 21cd905cd44a4bbafe8631bbaa6021d328413ce5) Conflicts: libswresample/swresample.c --- libswresample/swresample.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libswresample/swresample.c b/libswresample/swresample.c index b8c646f154..4becb0724d 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -223,6 +223,16 @@ av_cold int swr_init(struct SwrContext *s){ s->flushed = 0; + if(av_get_channel_layout_nb_channels(s-> in_ch_layout) > SWR_CH_MAX) { + av_log(s, AV_LOG_WARNING, "Input channel layout 0x%"PRIx64" is invalid or unsupported.\n", s-> in_ch_layout); + s->in_ch_layout = 0; + } + + if(av_get_channel_layout_nb_channels(s->out_ch_layout) > SWR_CH_MAX) { + av_log(s, AV_LOG_WARNING, "Output channel layout 0x%"PRIx64" is invalid or unsupported.\n", s->out_ch_layout); + s->out_ch_layout = 0; + } + if(s-> in_sample_fmt >= AV_SAMPLE_FMT_NB){ av_log(s, AV_LOG_ERROR, "Requested input sample format %d is invalid\n", s->in_sample_fmt); return AVERROR(EINVAL); From 1ddb0b6fa0bd46b730dc60240f738597cadfe1e0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 21 Feb 2013 22:00:19 +0100 Subject: [PATCH 135/328] avcodec_decode_audio4: check got_frame_ptr before handling initial skip Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 8a6449167a6da8cb747cfe3502ae86ffaac2ed48) Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 384d457f61..8cce59bbf4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1703,7 +1703,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "skip %d samples due to side data\n", avctx->internal->skip_samples); } - if (avctx->internal->skip_samples) { + if (avctx->internal->skip_samples && *got_frame_ptr) { if(frame->nb_samples <= avctx->internal->skip_samples){ *got_frame_ptr = 0; avctx->internal->skip_samples -= frame->nb_samples; From 676df8c4c70c67f8f31a439f8ab301f7de3fe977 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 21 Feb 2013 15:00:59 +0100 Subject: [PATCH 136/328] h264: check that luma and chroma depth match Fixes out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit bdeb61ccc67911cfc5e20c7cfb1312d0501ca90a) Conflicts: libavcodec/h264_ps.c --- libavcodec/h264_ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index cdc6b079b6..02654c139a 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -381,7 +381,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ } sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8; sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8; - if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U) { + if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U || sps->bit_depth_luma != sps->bit_depth_chroma) { av_log(h->s.avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n", sps->bit_depth_luma, sps->bit_depth_chroma); goto fail; From d034ddcd1f6cdd5528f02db38cf3552301bef1a4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 23 Feb 2013 16:58:01 +0100 Subject: [PATCH 137/328] rtmpproto: Check APP_MAX_LENGTH Fixes Ticket2292 Signed-off-by: Michael Niedermayer (cherry picked from commit 02ac3398eb52679301028c2fd3ebad1b6261b4da) Signed-off-by: Michael Niedermayer --- libavformat/rtmpproto.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index e23dd2db41..090d8ec5bb 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2156,16 +2156,20 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) fname = strchr(p + 1, '/'); if (!fname || (c && c < fname)) { fname = p + 1; - av_strlcpy(rt->app, path + 1, p - path); + av_strlcpy(rt->app, path + 1, FFMIN(p - path, APP_MAX_LENGTH)); } else { fname++; - av_strlcpy(rt->app, path + 1, fname - path - 1); + av_strlcpy(rt->app, path + 1, FFMIN(fname - path - 1, APP_MAX_LENGTH)); } } } if (old_app) { // The name of application has been defined by the user, override it. + if (strlen(old_app) >= APP_MAX_LENGTH) { + ret = AVERROR(EINVAL); + goto fail; + } av_free(rt->app); rt->app = old_app; } From 044177215e827c6b8555f8cff2450023b8c84acf Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 4 Mar 2013 00:01:57 +0100 Subject: [PATCH 138/328] update for 1.0.5 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index 1c8257199c..ade86e3966 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.4 +PROJECT_NUMBER = 1.0.5 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index ee90284c27..90a27f9cea 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.4 +1.0.5 diff --git a/VERSION b/VERSION index ee90284c27..90a27f9cea 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.4 +1.0.5 From 164628e2f7e41947f821fcf0342b97c10b87e6b1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 23 Feb 2013 17:24:15 +0100 Subject: [PATCH 139/328] rtmpproto: increase APP_MAX_LENGTH Fixes second part of Ticket2292 Signed-off-by: Michael Niedermayer (cherry picked from commit da8ef5ac2f1b14f4fe34db72af5d5f8b3c8e2ff9) Signed-off-by: Michael Niedermayer --- libavformat/rtmpproto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 090d8ec5bb..f2b3d5fd1c 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -48,7 +48,7 @@ //#define DEBUG -#define APP_MAX_LENGTH 128 +#define APP_MAX_LENGTH 1024 #define PLAYPATH_MAX_LENGTH 256 #define TCURL_MAX_LENGTH 512 #define FLASHVER_MAX_LENGTH 64 @@ -305,7 +305,7 @@ static int gen_connect(URLContext *s, RTMPContext *rt) int ret; if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SYSTEM_CHANNEL, RTMP_PT_INVOKE, - 0, 4096)) < 0) + 0, 4096 + APP_MAX_LENGTH)) < 0) return ret; p = pkt.data; From 16ac9edc2f0e9b1e5eaaeb39290d93b4501541b1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 7 Mar 2013 13:42:12 +0100 Subject: [PATCH 140/328] hls: fix timebase Fixes Ticket1733 Signed-off-by: Michael Niedermayer (cherry picked from commit a12a618aa9c6d84ec3c01695fb5aec9796453a6d) --- libavformat/hls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/hls.c b/libavformat/hls.c index 00c3cf01fb..065a759157 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -536,11 +536,13 @@ static int hls_read_header(AVFormatContext *s) /* Create new AVStreams for each stream in this variant */ for (j = 0; j < v->ctx->nb_streams; j++) { AVStream *st = avformat_new_stream(s, NULL); + AVStream *ist = v->ctx->streams[j]; if (!st) { ret = AVERROR(ENOMEM); goto fail; } st->id = i; + avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, ist->time_base.den); avcodec_copy_context(st->codec, v->ctx->streams[j]->codec); if (v->bandwidth) av_dict_set(&st->metadata, "variant_bitrate", bitrate_str, From e20a019c9171cccd9b0e13576eee5106929ca2b4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 7 Mar 2013 13:55:43 +0100 Subject: [PATCH 141/328] avformat: Fix apics with aac Fixes Ticket2318 Signed-off-by: Michael Niedermayer (cherry picked from commit cada996528422907b8b818e99029a8e3b97cf08d) --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 21f2a0ebb8..733858ea3f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -642,7 +642,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma goto fail; if (id3v2_extra_meta) { - if (!strcmp(s->iformat->name, "mp3")) { + if (!strcmp(s->iformat->name, "mp3") || !strcmp(s->iformat->name, "aac")) { if((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) goto fail; } else From 08be125dde5fd1275cd04d3e534d5a92b9618899 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 7 Mar 2013 19:28:30 +0100 Subject: [PATCH 142/328] psymodel: dont apply lowpass filters with a cutoff close to the nyquist The IIR filter numerically diverges in such cases, this could easily be fixed but would make the filter slower on some platforms Fixes Ticket2246 Signed-off-by: Michael Niedermayer (cherry picked from commit fee5da6b0a79bed9dc849f216b6da1e03132b668) --- libavcodec/psymodel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/psymodel.c b/libavcodec/psymodel.c index a4a7cbb683..09dd83d315 100644 --- a/libavcodec/psymodel.c +++ b/libavcodec/psymodel.c @@ -106,7 +106,7 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av if (!cutoff_coeff && avctx->codec_id == AV_CODEC_ID_AAC) cutoff_coeff = 2.0 * AAC_CUTOFF(avctx) / avctx->sample_rate; - if (cutoff_coeff) + if (cutoff_coeff && cutoff_coeff < 0.98) ctx->fcoeffs = ff_iir_filter_init_coeffs(avctx, FF_FILTER_TYPE_BUTTERWORTH, FF_FILTER_MODE_LOWPASS, FILT_ORDER, cutoff_coeff, 0.0, 0.0); From 98dfe0d8bd1f47fa548f67ca6165e19c10d770b6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 8 Mar 2013 14:00:22 +0100 Subject: [PATCH 143/328] aacsbr: Check for envelope scalefactors overflowing This prevents various values from becoming stuck at NAN and output to become silent If someone knows a cleaner solution, thats welcome! Fixes Ticket2335 Signed-off-by: Michael Niedermayer (cherry picked from commit 8978c743fb1d1f5a0d6dbdd83ff05817f8a41230) --- libavcodec/aacsbr.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index b4fc761fa1..c982ba5a50 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -1124,7 +1124,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) { float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f); float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha); - float fac = temp1 / (1.0f + temp2); + float fac; + if (temp1 > 1E20) { + av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); + temp1 = 1; + } + fac = temp1 / (1.0f + temp2); sbr->data[0].env_facs[e][k] = fac; sbr->data[1].env_facs[e][k] = fac * temp2; } @@ -1133,7 +1138,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (k = 0; k < sbr->n_q; k++) { float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1); float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]); - float fac = temp1 / (1.0f + temp2); + float fac; + if (temp1 > 1E20) { + av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); + temp1 = 1; + } + fac = temp1 / (1.0f + temp2); sbr->data[0].noise_facs[e][k] = fac; sbr->data[1].noise_facs[e][k] = fac * temp2; } @@ -1142,9 +1152,15 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) { float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f; for (e = 1; e <= sbr->data[ch].bs_num_env; e++) - for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++) + for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){ sbr->data[ch].env_facs[e][k] = exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f); + if (sbr->data[ch].env_facs[e][k] > 1E20) { + av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); + sbr->data[ch].env_facs[e][k] = 1; + } + } + for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (k = 0; k < sbr->n_q; k++) sbr->data[ch].noise_facs[e][k] = From f49b2a9d088e0ccf7f86abe61306956d09d8217c Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 16 Mar 2013 20:13:44 +0100 Subject: [PATCH 144/328] Do not (re-)set libx264 parameter b_tff if interlaced encoding was not requested. Reconfiguring can break x264 lossless encoding. Fixes ticket #2165. (cherry picked from commit 75c7e4583f4fd727d236a12763a265502fe00988) --- libavcodec/libx264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index a2d64d1977..691f5d2c78 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -174,7 +174,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P : frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B : X264_TYPE_AUTO; - if (x4->params.b_tff != frame->top_field_first) { + if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) { x4->params.b_tff = frame->top_field_first; x264_encoder_reconfig(x4->enc, &x4->params); } From 7fc39f51cd00b4e8fafe09db919bf718cd904262 Mon Sep 17 00:00:00 2001 From: Alexander Kojevnikov Date: Tue, 26 Feb 2013 21:47:11 -0800 Subject: [PATCH 145/328] mp3dec: Fix VBR bit rate parsing When parsing the Xing/Info tag, don't set the bit rate if it's an Info tag. When parsing the stream, don't override the bit rate if it's already set, otherwise calculate the mean bit rate from parsed frames. This way, the bit rate will be set correctly both for CBR and VBR streams. Signed-off-by: Alexander Kojevnikov Signed-off-by: Michael Niedermayer (cherry picked from commit 29d8cd265a536063420afe78375b2176a9e1abc5) Signed-off-by: Michael Niedermayer --- libavcodec/mpegaudio_parser.c | 10 +++++++--- libavformat/mp3dec.c | 6 ++++-- tests/ref/lavf-fate/mp3 | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index 5f97d711c6..bb4d75c066 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -30,6 +30,7 @@ typedef struct MpegAudioParseContext { int frame_size; uint32_t header; int header_count; + int no_bitrate; } MpegAudioParseContext; #define MPA_HEADER_SIZE 4 @@ -74,15 +75,18 @@ static int mpegaudio_parse(AVCodecParserContext *s1, if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header) s->header_count= -3; s->header= state; - s->header_count++; s->frame_size = ret-4; - if (s->header_count > 1) { + if (s->header_count > 0) { avctx->sample_rate= sr; avctx->channels = channels; s1->duration = frame_size; - avctx->bit_rate = bit_rate; + if (s->no_bitrate || !avctx->bit_rate) { + s->no_bitrate = 1; + avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count; + } } + s->header_count++; break; } } diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index ae549751e7..1d41c86789 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -120,6 +120,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; MPADecodeHeader c; int vbrtag_size = 0; + int is_cbr; v = avio_rb32(s->pb); if(ff_mpa_check_header(v) < 0) @@ -135,7 +136,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) /* Check for Xing / Info tag */ avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]); v = avio_rb32(s->pb); - if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { + is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); + if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) { v = avio_rb32(s->pb); if(v & XING_FLAG_FRAMES) frames = avio_rb32(s->pb); @@ -180,7 +182,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) if(frames) st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate}, st->time_base); - if(size && frames) + if (size && frames && !is_cbr) st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf); return 0; diff --git a/tests/ref/lavf-fate/mp3 b/tests/ref/lavf-fate/mp3 index 91e2b48c03..361314b2ca 100644 --- a/tests/ref/lavf-fate/mp3 +++ b/tests/ref/lavf-fate/mp3 @@ -1,3 +1,3 @@ -40a4e41ae74ec8dacdf02402831a6a58 *./tests/data/lavf-fate/lavf.mp3 -97230 ./tests/data/lavf-fate/lavf.mp3 +7fcf80c2059b5c058a6cdd2e2f798b6c *./tests/data/lavf-fate/lavf.mp3 +96366 ./tests/data/lavf-fate/lavf.mp3 ./tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe From 10d59d29bc931ae9849611fdb17af8b12a692eab Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 Jan 2013 16:33:45 +0100 Subject: [PATCH 146/328] msrledec: move output pointer test up Signed-off-by: Michael Niedermayer (cherry picked from commit c2992b705381e082e33633e62e151887da67b285) Signed-off-by: Michael Niedermayer --- libavcodec/msrledec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index 36a46b5978..6596cecf4c 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -203,6 +203,9 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, pos += p2; } else { //run of pixels uint8_t pix[3]; //original pixel + if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) || + (pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end)) + continue; switch(depth){ case 8: pix[0] = bytestream2_get_byte(gb); break; @@ -215,9 +218,6 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, case 32: pix32 = bytestream2_get_le32(gb); break; } - if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) || - (pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end)) - continue; for(i = 0; i < p1; i++) { switch(depth){ case 8: *output++ = pix[0]; From cc0662daefbac7209b748741d18edd942e633c06 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 Jan 2013 16:39:35 +0100 Subject: [PATCH 147/328] msrledec: move loop into switch speeds up code and allows more simplifications Signed-off-by: Michael Niedermayer (cherry picked from commit dbaae33c2c71862b8eaea978ed6dccc5ec03db89) Signed-off-by: Michael Niedermayer --- libavcodec/msrledec.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index 6596cecf4c..cc69af8ec1 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -218,21 +218,30 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, case 32: pix32 = bytestream2_get_le32(gb); break; } - for(i = 0; i < p1; i++) { - switch(depth){ - case 8: *output++ = pix[0]; - break; - case 16: *(uint16_t*)output = pix16; - output += 2; - break; - case 24: *output++ = pix[0]; - *output++ = pix[1]; - *output++ = pix[2]; - break; - case 32: *(uint32_t*)output = pix32; - output += 4; - break; + switch(depth){ + case 8: + for(i = 0; i < p1; i++) + *output++ = pix[0]; + break; + case 16: + for(i = 0; i < p1; i++) { + *(uint16_t*)output = pix16; + output += 2; } + break; + case 24: + for(i = 0; i < p1; i++) { + *output++ = pix[0]; + *output++ = pix[1]; + *output++ = pix[2]; + } + break; + case 32: + for(i = 0; i < p1; i++) { + *(uint32_t*)output = pix32; + output += 4; + } + break; } pos += p1; } From bbefdb39386153f8103d9a2fc47765422f7eb177 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 Jan 2013 16:41:33 +0100 Subject: [PATCH 148/328] msrledec: merge switches More speedup and fixes 'may be used uninitialized in this function' warnings Signed-off-by: Michael Niedermayer (cherry picked from commit d2e0a276d593ded94401e687f60bee266f3e725e) Signed-off-by: Michael Niedermayer --- libavcodec/msrledec.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index cc69af8ec1..e969994875 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -206,30 +206,24 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) || (pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end)) continue; - switch(depth){ - case 8: pix[0] = bytestream2_get_byte(gb); - break; - case 16: pix16 = bytestream2_get_le16(gb); - break; - case 24: pix[0] = bytestream2_get_byte(gb); - pix[1] = bytestream2_get_byte(gb); - pix[2] = bytestream2_get_byte(gb); - break; - case 32: pix32 = bytestream2_get_le32(gb); - break; - } + switch(depth){ case 8: + pix[0] = bytestream2_get_byte(gb); for(i = 0; i < p1; i++) *output++ = pix[0]; break; case 16: + pix16 = bytestream2_get_le16(gb); for(i = 0; i < p1; i++) { *(uint16_t*)output = pix16; output += 2; } break; case 24: + pix[0] = bytestream2_get_byte(gb); + pix[1] = bytestream2_get_byte(gb); + pix[2] = bytestream2_get_byte(gb); for(i = 0; i < p1; i++) { *output++ = pix[0]; *output++ = pix[1]; @@ -237,6 +231,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, } break; case 32: + pix32 = bytestream2_get_le32(gb); for(i = 0; i < p1; i++) { *(uint32_t*)output = pix32; output += 4; From f84ddb0c0fbb7f1c0ff34418426840f6ea79448e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Mar 2013 02:19:12 +0100 Subject: [PATCH 149/328] msrledec: fix output_end checks Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit e398990eb87785e20e065cd3f14d1dbb69df4392) Conflicts: libavcodec/msrledec.c --- libavcodec/msrledec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index e969994875..b0b8ef1c7f 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -138,7 +138,8 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, unsigned int width= FFABS(pic->linesize[0]) / (depth >> 3); output = pic->data[0] + (avctx->height - 1) * pic->linesize[0]; - output_end = pic->data[0] + avctx->height * pic->linesize[0]; + output_end = output + FFABS(pic->linesize[0]); + while (bytestream2_get_bytes_left(gb) > 0) { p1 = bytestream2_get_byteu(gb); if(p1 == 0) { //Escape code @@ -155,6 +156,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, return AVERROR_INVALIDDATA; } } + output_end = output + FFABS(pic->linesize[0]); pos = 0; continue; } else if(p2 == 1) { //End-of-picture @@ -169,11 +171,11 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, return -1; } output = pic->data[0] + line * pic->linesize[0] + pos * (depth >> 3); + output_end = pic->data[0] + line * pic->linesize[0] + FFABS(pic->linesize[0]); continue; } // Copy data - if ((pic->linesize[0] > 0 && output + p2 * (depth >> 3) > output_end) || - (pic->linesize[0] < 0 && output + p2 * (depth >> 3) < output_end)) { + if (output + p2 * (depth >> 3) > output_end) { bytestream2_skip(gb, 2 * (depth >> 3)); continue; } else if (bytestream2_get_bytes_left(gb) < p2 * (depth >> 3)) { @@ -203,8 +205,7 @@ static int msrle_decode_8_16_24_32(AVCodecContext *avctx, AVPicture *pic, pos += p2; } else { //run of pixels uint8_t pix[3]; //original pixel - if ((pic->linesize[0] > 0 && output + p1 * (depth >> 3) > output_end) || - (pic->linesize[0] < 0 && output + p1 * (depth >> 3) < output_end)) + if (output + p1 * (depth >> 3) > output_end) continue; switch(depth){ From 31f337c1e44ebe53e4e23b24aa6c2a62f6862236 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Mar 2013 01:35:28 +0100 Subject: [PATCH 150/328] iff: fix integer overflow Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 3dbc0ff9c3e6f6e0d08ea3d42cb33761bae084ba) Signed-off-by: Michael Niedermayer --- libavformat/iff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/iff.c b/libavformat/iff.c index 0055283b0e..b207990fc6 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -201,6 +201,8 @@ static int iff_read_header(AVFormatContext *s) break; case ID_CMAP: + if (data_size > INT_MAX - IFF_EXTRA_VIDEO_SIZE - FF_INPUT_BUFFER_PADDING_SIZE) + return AVERROR_INVALIDDATA; st->codec->extradata_size = data_size + IFF_EXTRA_VIDEO_SIZE; st->codec->extradata = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) @@ -323,6 +325,7 @@ static int iff_read_header(AVFormatContext *s) if (!st->codec->extradata) return AVERROR(ENOMEM); } + av_assert0(st->codec->extradata_size >= IFF_EXTRA_VIDEO_SIZE); buf = st->codec->extradata; bytestream_put_be16(&buf, IFF_EXTRA_VIDEO_SIZE); bytestream_put_byte(&buf, iff->bitmap_compression); From 2440424f1dcfb34a73b2c23117470eea31f154d3 Mon Sep 17 00:00:00 2001 From: David Favor Date: Wed, 27 Feb 2013 08:19:14 -0600 Subject: [PATCH 151/328] Slight bug building ffmpeg-1.1.3 on OSX + patch to fix Two instances of non-ascii characters have crept into file doc/filters.texi which causes pod2man to error out and break the build. Signed-off-by: Michael Niedermayer (cherry picked from commit d4d1f32e48d92edc69c69b14f8e642e519f7c9af) Signed-off-by: Michael Niedermayer --- doc/filters.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 916aa6f8b9..56e090f830 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -3458,7 +3458,7 @@ Tile several successive frames together. It accepts as argument the tile size (i.e. the number of lines and columns) in the form "@var{w}x@var{h}". -For example, produce 8×8 PNG tiles of all keyframes (@option{-skip_frame +For example, produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie: @example ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png @@ -4554,7 +4554,7 @@ streams in each segment. Default is 0. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then @var{a} audio outputs. -There are @var{n}×(@var{v}+@var{a}) inputs: first the inputs for the first +There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first segment, in the same order as the outputs, then the inputs for the second segment, etc. From 4bee3eba7535e12dd62f0a81cbacfca520ef169a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 27 Feb 2013 16:08:41 +0100 Subject: [PATCH 152/328] doc/ffmpeg: remove non ascii char Signed-off-by: Michael Niedermayer (cherry picked from commit cdbaaa4f001ef8043760c44c2062fbc27facffd2) Signed-off-by: Michael Niedermayer --- doc/ffmpeg.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 121fbc10ae..d125acde2a 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1013,7 +1013,7 @@ ffmpeg -filter_complex 'color=red' -t 5 out.mkv As a special exception, you can use a bitmap subtitle stream as input: it will be converted into a video with the same size as the largest video in -the file, or 720×576 if no video is present. Note that this is an +the file, or 720x576 if no video is present. Note that this is an experimental and temporary solution. It will be removed once libavfilter has proper support for subtitles. From dbe57f7e9f08a45cbdb51327fdf3cd892febdac2 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 17 Oct 2012 19:54:22 +0200 Subject: [PATCH 153/328] lavfi/avf_concat: fix invalid exclusive test. The invalid test did not cause any actual problem since the first branch is only possible with bogus filters. Fix coverity issue CID 733850. (cherry picked from commit 709628aa71f24520553eb10b0cf6d56784e6c3ec) Signed-off-by: Michael Niedermayer --- libavfilter/avf_concat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c index c0bd621cb4..b3aed3ccde 100644 --- a/libavfilter/avf_concat.c +++ b/libavfilter/avf_concat.c @@ -195,7 +195,7 @@ static void process_frame(AVFilterLink *inlink, AVFilterBufferRef *buf) av_log(ctx, AV_LOG_ERROR, "Frame after EOF on input %s\n", ctx->input_pads[in_no].name); avfilter_unref_buffer(buf); - } if (in_no >= cat->cur_idx + ctx->nb_outputs) { + } else if (in_no >= cat->cur_idx + ctx->nb_outputs) { ff_bufqueue_add(ctx, &cat->in[in_no].queue, buf); } else { push_frame(ctx, in_no, buf); From 2f00d28aa01352c46c0f2b1e17749adb1da95ab0 Mon Sep 17 00:00:00 2001 From: Andrea3000 Date: Thu, 21 Feb 2013 22:24:26 +0100 Subject: [PATCH 154/328] matroska: fix missing , Signed-off-by: Michael Niedermayer (cherry picked from commit 8d8c59480e1bbffb290b0790a7af378447c7f1fd) Signed-off-by: Michael Niedermayer (cherry picked from commit ef688e742557863152e76c7a1f5735fa6e4b0332) Signed-off-by: Michael Niedermayer --- libavformat/matroska.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 9ea904ac8c..1e92073921 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -114,7 +114,7 @@ const char * const ff_matroska_video_stereo_mode[MATROSKA_VIDEO_STEREO_MODE_COUN "bottom_top", "top_bottom", "checkerboard_rl", - "checkerboard_lr" + "checkerboard_lr", "row_interleaved_rl", "row_interleaved_lr", "col_interleaved_rl", From 94576cec549ed34acca9d7098bdfc86e25946e13 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 20 Mar 2013 20:53:30 +0100 Subject: [PATCH 155/328] update for 1.0.6 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index ade86e3966..ea1ea7bb24 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.5 +PROJECT_NUMBER = 1.0.6 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 90a27f9cea..af0b7ddbff 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.5 +1.0.6 diff --git a/VERSION b/VERSION index 90a27f9cea..af0b7ddbff 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.5 +1.0.6 From eeb8dabd29d37f8f179281da74326e3868f1bb1b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 18 Mar 2013 00:00:02 +0100 Subject: [PATCH 156/328] rmdec: flush audio packet on seeking Fixes Ticket1605 Signed-off-by: Michael Niedermayer (cherry picked from commit 519ebb5ee5b89b8ecc80b4a4540fcbeb65cda172) Signed-off-by: Michael Niedermayer --- libavformat/rmdec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 3cbf3f590f..3af016fdcd 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -1014,6 +1014,18 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, return dts; } +static int rm_read_seek(AVFormatContext *s, int stream_index, + int64_t pts, int flags) +{ + RMDemuxContext *rm = s->priv_data; + + if (ff_seek_frame_binary(s, stream_index, pts, flags) < 0) + return -1; + rm->audio_pkt_cnt = 0; + return 0; +} + + AVInputFormat ff_rm_demuxer = { .name = "rm", .long_name = NULL_IF_CONFIG_SMALL("RealMedia"), @@ -1023,6 +1035,7 @@ AVInputFormat ff_rm_demuxer = { .read_packet = rm_read_packet, .read_close = rm_read_close, .read_timestamp = rm_read_dts, + .read_seek = rm_read_seek, }; AVInputFormat ff_rdt_demuxer = { From becde6ab1c383e6774285e635b41dc21177a4b16 Mon Sep 17 00:00:00 2001 From: ArnoB Date: Thu, 14 Mar 2013 18:35:55 +0100 Subject: [PATCH 157/328] dpxenc: fix data offset Signed-off-by: Michael Niedermayer (cherry picked from commit 361319d0f49475bc14c744194870f9bab78a8a83) Conflicts: tests/ref/lavf/dpx --- libavcodec/dpxenc.c | 1 + tests/ref/lavf/dpx | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/dpxenc.c b/libavcodec/dpxenc.c index 451b7b976e..cc9457ab1b 100644 --- a/libavcodec/dpxenc.c +++ b/libavcodec/dpxenc.c @@ -201,6 +201,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, buf[803] = s->bits_per_component; write16(buf + 804, (s->bits_per_component == 10 || s->bits_per_component == 12) ? 1 : 0); /* packing method */ + write32(buf + 808, HEADER_SIZE); /* data offset */ /* Image source information header */ write32(buf + 1628, avctx->sample_aspect_ratio.num); diff --git a/tests/ref/lavf/dpx b/tests/ref/lavf/dpx index 1196934836..70371d8115 100644 --- a/tests/ref/lavf/dpx +++ b/tests/ref/lavf/dpx @@ -1,9 +1,9 @@ -808ea110635774252439722a48329d61 *./tests/data/images/dpx/02.dpx +d2f0b4e854fda2d3b3bee84cef80593c *./tests/data/images/dpx/02.dpx ./tests/data/images/dpx/%02d.dpx CRC=0x6da01946 305792 ./tests/data/images/dpx/02.dpx -5e1a777fa3f4094c9c4dd989cf9e8e8b *./tests/data/images/dpx/02.dpx +075963c3c08978b6a20555ba09161434 *./tests/data/images/dpx/02.dpx ./tests/data/images/dpx/%02d.dpx CRC=0xe5b9c023 609920 ./tests/data/images/dpx/02.dpx -13dc41b1e1e36399a5e1f8b7e3344a81 *./tests/data/images/dpx/02.dpx +b9f22728f8ff393bf30cf6cbd624fa95 *./tests/data/images/dpx/02.dpx ./tests/data/images/dpx/%02d.dpx CRC=0xf0a1c097 407168 ./tests/data/images/dpx/02.dpx From e45f0f0f667b8f779f3ded068f773676a095bcb5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 8 Mar 2013 14:45:26 +0100 Subject: [PATCH 158/328] MAINTAINERS: update for 1.2 Signed-off-by: Michael Niedermayer (cherry picked from commit 80f91a70be5f03fc95eb89d222d760eeaf91b135) Conflicts: MAINTAINERS --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index b361543c0c..7648edc204 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -408,9 +408,9 @@ x86 Michael Niedermayer Releases ======== +1.2 Michael Niedermayer +1.1 Michael Niedermayer 1.0 Michael Niedermayer -0.11 Michael Niedermayer -0.10 Michael Niedermayer From 125fe08492dded005d369c9de77cf093688adcf8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Mar 2013 14:50:42 +0100 Subject: [PATCH 159/328] MAINTAINERS: mention that people are welcome to pick up and maintain older releases Signed-off-by: Michael Niedermayer (cherry picked from commit 7e1efeb5707ec0fec000d42fa9f2861bab97bd8f) Signed-off-by: Michael Niedermayer --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 7648edc204..0c8a5ff9fc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -412,6 +412,7 @@ Releases 1.1 Michael Niedermayer 1.0 Michael Niedermayer +If you want to maintain an older release, please contact us GnuPG Fingerprints of maintainers and contributors From f2310fff5c7bf1ec815ba7ae6a87fc872a0d82aa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 21 Mar 2013 01:10:47 +0100 Subject: [PATCH 160/328] update the current year Signed-off-by: Michael Niedermayer --- cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index 5639751e3a..343914b4af 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -61,7 +61,7 @@ struct SwsContext *sws_opts; SwrContext *swr_opts; AVDictionary *format_opts, *codec_opts; -const int this_year = 2012; +const int this_year = 2013; static FILE *report_file; From 9b481654e1513475b133b45677d85516080d64fb Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sun, 14 Oct 2012 10:03:07 +0200 Subject: [PATCH 161/328] h264: fix parsing of old lossless profile (profile_idc == 144) Signed-off-by: Michael Niedermayer (cherry picked from commit 572781b25f98f99f2255404810ac33168bf28482) --- libavcodec/h264_ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 02654c139a..8df7f70265 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -367,7 +367,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ if(sps->profile_idc == 100 || sps->profile_idc == 110 || sps->profile_idc == 122 || sps->profile_idc == 244 || sps->profile_idc == 44 || sps->profile_idc == 83 || sps->profile_idc == 86 || sps->profile_idc == 118 || - sps->profile_idc == 128 ) { + sps->profile_idc == 128 || sps->profile_idc == 144) { sps->chroma_format_idc= get_ue_golomb_31(&s->gb); if (sps->chroma_format_idc > 3U) { av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc %d is illegal\n", sps->chroma_format_idc); From fe995dcd84c6e2aca3216a10a996ecfbba964b6c Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 26 Mar 2013 15:16:07 +0100 Subject: [PATCH 162/328] Only test the first frame for missing aac_adtstoasc bistream filter. Many players ignore broken aac frames, so don't abort mov or flv muxing when encountering one, just print a warning instead. Fixes ticket #2380. (cherry picked from commit 1741fece7073f51efdd837a4f307ea2cdf3d1cfb) --- libavformat/flvenc.c | 3 +++ libavformat/movenc.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 97c00bf79e..5447840b2a 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -492,10 +492,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) return ret; } else if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: " "use audio bistream filter 'aac_adtstoasc' to fix it " "('-bsf:a aac_adtstoasc' option with ffmpeg)\n"); return AVERROR_INVALIDDATA; + } + av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } if (flv->delay == AV_NOPTS_VALUE) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5bf5a7408f..18dbffa8cc 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3097,8 +3097,11 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } else if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; + } + av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } else { avio_write(pb, pkt->data, size); } From bd6e58d5cadd5e5871d930f21f51224b3120cf8f Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 30 Mar 2013 08:41:46 +0100 Subject: [PATCH 163/328] Write broken aac frames to mov files instead of skipping them. Fixes decoding with picky media players. Signed-off-by: Michael Niedermayer (cherry picked from commit b448c0a68d0cc7dfef736267dfdaed0e213c020b) --- libavformat/movenc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 18dbffa8cc..af0a27e379 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3085,6 +3085,14 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) memcpy(trk->vos_data, enc->extradata, trk->vos_len); } + if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && + (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { + av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); + return -1; + } + av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); + } if (enc->codec_id == AV_CODEC_ID_H264 && trk->vos_len > 0 && *(uint8_t *)trk->vos_data != 1) { /* from x264 or from bytestream h264 */ /* nal reformating needed */ @@ -3095,13 +3103,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size); } - } else if (enc->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 && - (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { - if (!s->streams[pkt->stream_index]->nb_frames) { - av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); - return -1; - } - av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } else { avio_write(pb, pkt->data, size); } From 83d5871cf100b4e08ea0e4f5f191e87702561bf3 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 3 Apr 2013 12:57:58 +0000 Subject: [PATCH 164/328] smacker: fix off by one error Regression since a93b572ae4f517ce0c35cf085167c318e9215908. Fixes #2426. Signed-off-by: Paul B Mahol (cherry picked from commit e3cc92a623a6ece42816c7a692c8815688a99ab0) --- libavformat/smacker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index cf1ab858d8..7d2cccdaeb 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -269,7 +269,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) } else if(t & 0x40){ /* copy with offset */ off = avio_r8(s->pb); j = (t & 0x3F) + 1; - if (off + j > 0xff) { + if (off + j - 1 > 0xff) { av_log(s, AV_LOG_ERROR, "Invalid palette update, offset=%d length=%d extends beyond palette size\n", off, j); From 13cf445358a19d188a745e3d217297857021e406 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 3 Apr 2013 15:45:46 +0200 Subject: [PATCH 165/328] Skip padding in an id3 tag in aiff files. Fixes ticket #2430. Reviewed-by: Matthieu Bouron (cherry picked from commit db2d3a90825025b2f5da85792e1df33280c61391) Conflicts: libavformat/aiffdec.c --- libavformat/aiffdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 41fe0d2994..f5c752005f 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -191,7 +191,7 @@ static int aiff_probe(AVProbeData *p) static int aiff_read_header(AVFormatContext *s) { int size, filesize; - int64_t offset = 0; + int64_t offset = 0, position; uint32_t tag; unsigned version = AIFF_C_VERSION1; AVIOContext *pb = s->pb; @@ -235,8 +235,11 @@ static int aiff_read_header(AVFormatContext *s) goto got_sound; break; case MKTAG('I', 'D', '3', ' '): + position = avio_tell(pb); ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); ff_id3v2_free_extra_meta(&id3v2_extra_meta); + if (position + size > avio_tell(pb)) + avio_skip(pb, position + size - avio_tell(pb)); break; case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */ version = avio_rb32(pb); From aef81fa75df2f25655bd762a044cac992e98a40e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 11 Oct 2012 00:47:15 +0200 Subject: [PATCH 166/328] vf_idet: fix free after use Fixes ticket #2449 Signed-off-by: Michael Niedermayer (cherry picked from commit cac749a551b2a068ff4636b3d42ccb8cce46c256) --- libavfilter/vf_idet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c index 8942ced4f3..56a3c20a54 100644 --- a/libavfilter/vf_idet.c +++ b/libavfilter/vf_idet.c @@ -176,6 +176,7 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref) idet->prev = idet->cur; idet->cur = idet->next; idet->next = picref; + link->cur_buf = NULL; if (!idet->cur) return 0; From 6e2fb5cd73ed92e87e05dc7578569a31db2c90f4 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 5 May 2013 19:29:00 +0200 Subject: [PATCH 167/328] Fix type of shared flac table ff_flac_blocksize_table[]. Fixes ticket #2533. (cherry picked from commit a07ac1f7888fd08e42da2bed0421e74f1cfac177) --- libavcodec/flacdata.c | 2 +- libavcodec/flacdata.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/flacdata.c b/libavcodec/flacdata.c index 6fcbe3955a..1954f32d32 100644 --- a/libavcodec/flacdata.c +++ b/libavcodec/flacdata.c @@ -27,7 +27,7 @@ const int ff_flac_sample_rate_table[16] = 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, 0, 0, 0, 0 }; -const int16_t ff_flac_blocksize_table[16] = { +const int32_t ff_flac_blocksize_table[16] = { 0, 192, 576<<0, 576<<1, 576<<2, 576<<3, 0, 0, 256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7 }; diff --git a/libavcodec/flacdata.h b/libavcodec/flacdata.h index 96a50b9183..e2c1e5d7f2 100644 --- a/libavcodec/flacdata.h +++ b/libavcodec/flacdata.h @@ -26,6 +26,6 @@ extern const int ff_flac_sample_rate_table[16]; -extern const int16_t ff_flac_blocksize_table[16]; +extern const int32_t ff_flac_blocksize_table[16]; #endif /* AVCODEC_FLACDATA_H */ From 9fef5d55538ca5df06b26268fafc0559b8f9d219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 5 May 2013 09:46:37 +0200 Subject: [PATCH 168/328] matroska: set "done" only during resync fail. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes playback of test7.mkv validation test file. Signed-off-by: Reimar Döffinger (cherry picked from commit 762d4335aec2e5299a06bfbce15d21336af19464) --- libavformat/matroskadec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index a270f0dfc7..19ebe78907 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2307,7 +2307,6 @@ static int matroska_parse_cluster_incremental(MatroskaDemuxContext *matroska) } } - if (res < 0) matroska->done = 1; return res; } From 5888e656ceaf81dfd523bb5f9f2a8afbf58485fe Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 13 May 2013 12:39:44 +0200 Subject: [PATCH 169/328] Do not read strd chunk in avi files as H264 extradata. Fixes ticket #2561. (cherry picked from commit 231b3317184790b6be4b4619d96fd328f13aeabb) --- libavformat/avidec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 1e71522915..01813e48a7 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -695,7 +695,9 @@ static int avi_read_header(AVFormatContext *s) } break; case MKTAG('s', 't', 'r', 'd'): - if (stream_index >= (unsigned)s->nb_streams || s->streams[stream_index]->codec->extradata_size) { + if (stream_index >= (unsigned)s->nb_streams + || s->streams[stream_index]->codec->extradata_size + || s->streams[stream_index]->codec->codec_tag == MKTAG('H','2','6','4')) { avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); From e489d5c54d3f45f18cac3f73345e4206ef1a9302 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Tue, 26 Mar 2013 14:12:30 -0700 Subject: [PATCH 170/328] Fix heap-buffer-overflow in matroska_parse_block Signed-off-by: Michael Niedermayer (cherry picked from commit 81e85bc95cb1e4f8cc7b1ba71ec027c8791b55d1) Signed-off-by: Michael Niedermayer --- libavformat/matroskadec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 19ebe78907..f562fa4889 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1885,10 +1885,10 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska) } static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, - int size, int type, + int* buf_size, int type, uint32_t **lace_buf, int *laces) { - int res = 0, n; + int res = 0, n, size = *buf_size; uint8_t *data = *buf; uint32_t *lace_size; @@ -1986,6 +1986,7 @@ static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, *buf = data; *lace_buf = lace_size; + *buf_size = size; return res; } @@ -2205,7 +2206,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, matroska->skip_to_keyframe = 0; } - res = matroska_parse_laces(matroska, &data, size, (flags & 0x06) >> 1, + res = matroska_parse_laces(matroska, &data, &size, (flags & 0x06) >> 1, &lace_size, &laces); if (res) From f072b69f39a3237869d86e507bf354df0d688434 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 5 May 2013 00:23:13 +0200 Subject: [PATCH 171/328] xbmdec: fix off by one error in scanf() Fixes out of array access Signed-off-by: Michael Niedermayer --- libavcodec/xbmdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c index 626e8de040..871704e972 100644 --- a/libavcodec/xbmdec.c +++ b/libavcodec/xbmdec.c @@ -57,7 +57,7 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data, int number, len; ptr += strcspn(ptr, "#"); - if (sscanf(ptr, "#define %256s %u", name, &number) != 2) { + if (sscanf(ptr, "#define %255s %u", name, &number) != 2) { av_log(avctx, AV_LOG_ERROR, "Unexpected preprocessor directive\n"); return AVERROR_INVALIDDATA; } From 6f2f754d97d9e98fa660cfab5f172983fb9b4730 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 5 May 2013 00:56:39 +0200 Subject: [PATCH 172/328] src_movie: fix scanf string Fixes out of array accesses Signed-off-by: Michael Niedermayer (cherry picked from commit adaa7743f5fdca0c0aca0b7ffdebf61c7d868571) Signed-off-by: Michael Niedermayer --- libavfilter/src_movie.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 8ebad6d8ca..156e6d1b88 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -91,13 +91,13 @@ static int movie_request_frame(AVFilterLink *outlink); static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) { int i, ret, already = 0, stream_id = -1; - char type_char, dummy; + char type_char[2], dummy; AVStream *found = NULL; enum AVMediaType type; - ret = sscanf(spec, "d%[av]%d%c", &type_char, &stream_id, &dummy); + ret = sscanf(spec, "d%1[av]%d%c", type_char, &stream_id, &dummy); if (ret >= 1 && ret <= 2) { - type = type_char == 'v' ? AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO; + type = type_char[0] == 'v' ? AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO; ret = av_find_best_stream(avf, type, stream_id, -1, NULL, 0); if (ret < 0) { av_log(log, AV_LOG_ERROR, "No %s stream with index '%d' found\n", From e32acc455db2e45e638a45b68984931321864956 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 13 May 2013 18:09:04 +0200 Subject: [PATCH 173/328] avcodec/lcldec: Check that dimensions are a multiple of the subsample factors Other dimensions would not work correctly currently, also ask for a sample for files that fail this check. This fixes an integer overflow leading to out of array accesses. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 1e00bbb10cbde3da03a1e744265ce6def9ae4c56) Conflicts: libavcodec/lcldec.c Signed-off-by: Michael Niedermayer --- libavcodec/lcldec.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index f180373eae..2a4d61d180 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -41,6 +41,7 @@ #include #include +#include "libavutil/pixdesc.h" #include "avcodec.h" #include "bytestream.h" #include "lcl.h" @@ -484,6 +485,7 @@ static av_cold int decode_init(AVCodecContext *avctx) unsigned int basesize = avctx->width * avctx->height; unsigned int max_basesize = FFALIGN(avctx->width, 4) * FFALIGN(avctx->height, 4) + AV_LZO_OUTPUT_PADDING; unsigned int max_decomp_size; + int subsample_h, subsample_v; avcodec_get_frame_defaults(&c->pic); if (avctx->extradata_size < 8) { @@ -510,6 +512,10 @@ static av_cold int decode_init(AVCodecContext *avctx) max_decomp_size = max_basesize * 2; avctx->pix_fmt = PIX_FMT_YUV422P; av_log(avctx, AV_LOG_DEBUG, "Image type is YUV 4:2:2.\n"); + if (avctx->width % 4) { + av_log_ask_for_sample(avctx, "Unsupported dimensions\n"); + return AVERROR_INVALIDDATA; + } break; case IMGTYPE_RGB24: c->decomp_size = basesize * 3; @@ -540,6 +546,12 @@ static av_cold int decode_init(AVCodecContext *avctx) return AVERROR_INVALIDDATA; } + avcodec_get_chroma_sub_sample(avctx->pix_fmt, &subsample_h, &subsample_v); + if (avctx->width % (1<height % (1<compression = (int8_t)avctx->extradata[5]; switch (avctx->codec_id) { From d8c4ee6feaef4cb6843a45301c07c72001ca1572 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 8 May 2013 01:17:45 +0200 Subject: [PATCH 174/328] avcodec/mpegvideo: Fix block height for lowres 3 interlaced blocks Fixes green trash Fixes part of Ticket2535 Signed-off-by: Michael Niedermayer (cherry picked from commit bca50e5cd52240d885afeb3edb0fa2c74b352add) Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 9e1f67c016..2317f64d49 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2125,11 +2125,12 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy); if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) { + int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h; uvsx = (uvsx << 2) >> lowres; uvsy = (uvsy << 2) >> lowres; - if (h >> s->chroma_y_shift) { - pix_op[op_index](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); - pix_op[op_index](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy); + if (hc) { + pix_op[op_index](dest_cb, ptr_cb, uvlinesize, hc, uvsx, uvsy); + pix_op[op_index](dest_cr, ptr_cr, uvlinesize, hc, uvsx, uvsy); } } // FIXME h261 lowres loop filter From 4a442ac117c47c8d05e5c385ced93d951fa3e9bf Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 8 May 2013 01:18:56 +0200 Subject: [PATCH 175/328] avcodec/mpegvideo: Fix edge emu with lowres Fixes a few green artifacts at the top Fixes rest of Ticket 2535 Signed-off-by: Michael Niedermayer (cherry picked from commit c67bca2b5a94efb8fb3c2ba2c7d9b1b413468838) Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 2317f64d49..d5e018af1a 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2085,7 +2085,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x; ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x; - if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || + if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 || (unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) { s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17 + field_based, From ee57bfc47a9867fbd59cea33430caa42006116d8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 16 Apr 2013 19:53:24 +0200 Subject: [PATCH 176/328] mjpegdec: fix overlapping memcpy with upscale_v Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit b39fd7d63648442c20671c3e4b357268ec5c49f2) Conflicts: libavcodec/mjpegdec.c Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 0fca3721af..814571f3bc 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1602,6 +1602,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size, MJpegDecodeContext *s = avctx->priv_data; const uint8_t *buf_end, *buf_ptr; const uint8_t *unescaped_buf_ptr; + int hshift, vshift; int unescaped_buf_size; int start_code; int i, index; @@ -1779,6 +1780,9 @@ the_end: } if (s->upscale_v) { uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]]; + int w; + avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); + w = s->width >> hshift; av_assert0(avctx->pix_fmt == PIX_FMT_YUVJ444P || avctx->pix_fmt == PIX_FMT_YUV444P || avctx->pix_fmt == PIX_FMT_YUVJ422P || @@ -1787,16 +1791,16 @@ the_end: uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]]; uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]]; if (src1 == src2) { - memcpy(dst, src1, s->width); + memcpy(dst, src1, w); } else { - for (index = 0; index < s->width; index++) + for (index = 0; index < w; index++) dst[index] = (src1[index] + src2[index]) >> 1; } dst -= s->linesize[s->upscale_v]; } } if (s->flipped && (s->avctx->flags & CODEC_FLAG_EMU_EDGE)) { - int hshift, vshift, j; + int j; avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); for (index=0; index<4; index++) { uint8_t *dst = s->picture_ptr->data[index]; From cd24fdad470724651f6d5506ef94da92106ac6d3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 2 May 2013 21:52:08 +0200 Subject: [PATCH 177/328] mmvideo/mm_decode_inter: check horizontal coordinate too Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 8d3c99e825317b7efda5fd12e69896b47c700303) Signed-off-by: Michael Niedermayer --- libavcodec/mmvideo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index ff8908a7b6..aebfe265e3 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -151,6 +151,8 @@ static int mm_decode_inter(MmContext * s, int half_horiz, int half_vert) int replace_array = bytestream2_get_byte(&s->gb); for(j=0; j<8; j++) { int replace = (replace_array >> (7-j)) & 1; + if (x + half_horiz >= s->avctx->width) + return AVERROR_INVALIDDATA; if (replace) { int color = bytestream2_get_byte(&data_ptr); s->frame.data[0][y*s->frame.linesize[0] + x] = color; From 1d285db8a3a85fb5eadd28640eb121684d7f6463 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 2 May 2013 22:06:03 +0200 Subject: [PATCH 178/328] mmvideo/mm_decode_intra: check horizontal coordinate too Signed-off-by: Michael Niedermayer (cherry picked from commit ae2132ac90f02330b0988e6e26ee0d53e41cd196) Signed-off-by: Michael Niedermayer --- libavcodec/mmvideo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index aebfe265e3..40892a7c4c 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -104,6 +104,9 @@ static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) if (half_horiz) run_length *=2; + if (run_length > s->avctx->width - x) + return AVERROR_INVALIDDATA; + if (color) { memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length); if (half_vert) From d814b9b51ddd3764e809c1d0f82b770e0bc085fd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 1 May 2013 23:46:38 +0200 Subject: [PATCH 179/328] vmdav: Try to fix unpack_rle() This fixes out of array accesses The code prior to this commit could not have worked, thus obviously was untested. I was also not able to find a valid sample that uses this code. This fix is thus only based on the description of the format If someone has a sample that uses unpack_rle(), please mail me. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit c1f2c4c3b49277d65b71ccdd3b6b2878f1b593eb) Conflicts: libavcodec/vmdav.c Signed-off-by: Michael Niedermayer (cherry picked from commit 0baa0a5a02e16ef097ed9f72bc8a7d7b585c7652) Signed-off-by: Michael Niedermayer --- libavcodec/vmdav.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index 3834416857..b838781345 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -160,7 +160,7 @@ static int rle_unpack(const unsigned char *src, int src_len, int src_count, const unsigned char *ps; const unsigned char *ps_end; unsigned char *pd; - int i, l; + int i, j, l; unsigned char *dest_end = dest + dest_len; ps = src; @@ -186,9 +186,9 @@ static int rle_unpack(const unsigned char *src, int src_len, int src_count, ps += l; pd += l; } else { - if (dest_end - pd < i || ps_end - ps < 2) + if (dest_end - pd < 2*l || ps_end - ps < 2) return ps - src; - for (i = 0; i < l; i++) { + for (j = 0; j < l; j++) { *pd++ = ps[0]; *pd++ = ps[1]; } From 52fa7a860318aa871624c7938801492983c24456 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 30 Apr 2013 20:05:31 +0200 Subject: [PATCH 180/328] avutil/log: Fix context pointer used for get_category() Fixes calling a random pointer Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 7edb984dd051b6919d7d8471c70499273f31b0fa) Signed-off-by: Michael Niedermayer --- libavutil/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/log.c b/libavutil/log.c index 1bae1b2165..90a46b0650 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -177,7 +177,7 @@ static void format_line(void *ptr, int level, const char *fmt, va_list vl, if (parent && *parent) { snprintf(part[0], part_size, "[%s @ %p] ", (*parent)->item_name(parent), parent); - if(type) type[0] = get_category(((uint8_t *) ptr) + avc->parent_log_context_offset); + if(type) type[0] = get_category(parent); } } snprintf(part[1], part_size, "[%s @ %p] ", From c446bc31f50182a2537c1084d01a3c5094c3c2e6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 17 Apr 2013 20:40:56 +0200 Subject: [PATCH 181/328] avutil/intfloat_readwrite: avoid comparission with INFINITY, use isinf() Should fix pgc warning Signed-off-by: Michael Niedermayer (cherry picked from commit cc6f848dba89a6dc89b840cc2e1942cc3007c2a3) Signed-off-by: Michael Niedermayer --- libavutil/intfloat_readwrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/intfloat_readwrite.c b/libavutil/intfloat_readwrite.c index 2998229e49..9574532116 100644 --- a/libavutil/intfloat_readwrite.c +++ b/libavutil/intfloat_readwrite.c @@ -88,7 +88,7 @@ AVExtFloat av_dbl2ext(double d){ ext.mantissa[i] = m>>(56-(i<<3)); } else if (f != 0.0) { ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff; - if (f != INFINITY) + if (!isinf(f)) ext.mantissa[0] = ~0; } if (d < 0) From f504049b22dbf9ed265e8ff941e92e3458b2700d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 17 Apr 2013 23:16:05 +0200 Subject: [PATCH 182/328] avutil/intfloat_readwrite: include common.h for isinf() Solution based on rational.c, which uses isinf() too This should fix compilation with msvc Signed-off-by: Michael Niedermayer (cherry picked from commit c25224737cba4079602c447c344cb54b81430ce4) Signed-off-by: Michael Niedermayer --- libavutil/intfloat_readwrite.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/intfloat_readwrite.c b/libavutil/intfloat_readwrite.c index 9574532116..142331dac1 100644 --- a/libavutil/intfloat_readwrite.c +++ b/libavutil/intfloat_readwrite.c @@ -26,6 +26,7 @@ */ #include +#include "common.h" #include "mathematics.h" #include "intfloat_readwrite.h" From 29ff1a5f1a013cd25f34fe8987877c55ad82cac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 31 Mar 2013 14:49:14 +0200 Subject: [PATCH 183/328] cmdutils: avtool -> fftool (cherry picked from commit 7d8ad6c1fa11ec548fc63427656989e0e7c6af8b) Signed-off-by: Michael Niedermayer --- cmdutils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmdutils.h b/cmdutils.h index d78eb55b44..ed808ed83a 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -190,13 +190,13 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, void show_help_children(const AVClass *class, int flags); /** - * Per-avtool specific help handler. Implemented in each - * avtool, called by show_help(). + * Per-fftool specific help handler. Implemented in each + * fftool, called by show_help(). */ void show_help_default(const char *opt, const char *arg); /** - * Generic -h handler common to all avtools. + * Generic -h handler common to all fftools. */ int show_help(void *optctx, const char *opt, const char *arg); From 813b3d11e0286b1d656633cd5717f3f43db5d1ac Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 7 May 2013 21:58:27 +0200 Subject: [PATCH 184/328] sanm: Check dimensions before use Fixes integer overflow and out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 9dd04f6d8cdd1c10c28b2cb4252c1a41df581915) Signed-off-by: Michael Niedermayer --- libavcodec/sanm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index aaf7434605..77811af92f 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -725,6 +725,11 @@ static int process_frame_obj(SANMVideoContext *ctx) w = bytestream2_get_le16u(&ctx->gb); h = bytestream2_get_le16u(&ctx->gb); + if (!w || !h) { + av_log(ctx->avctx, AV_LOG_ERROR, "dimensions are invalid\n"); + return AVERROR_INVALIDDATA; + } + if (ctx->width < left + w || ctx->height < top + h) { if (av_image_check_size(FFMAX(left + w, ctx->width), FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0) From 2c66058737e254756118b7f7be0be7d3bfbb4fe3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 7 May 2013 21:04:33 +0200 Subject: [PATCH 185/328] avcodec/cdgraphics: check buffer size before use Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit ad002e1a13a8df934bd6cb2c84175a4780ab8942) Signed-off-by: Michael Niedermayer --- libavcodec/cdgraphics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index 8638dca931..72e569f10c 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -295,7 +295,9 @@ static int cdg_decode_frame(AVCodecContext *avctx, inst = bytestream_get_byte(&buf); inst &= CDG_MASK; buf += 2; /// skipping 2 unneeded bytes - bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE); + + if (buf_size > CDG_HEADER_SIZE) + bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE); if ((command & CDG_MASK) == CDG_COMMAND) { switch (inst) { From ae668a283d5f8116fe47cde9737083cd7c7499e1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 14 May 2013 01:37:16 +0200 Subject: [PATCH 186/328] update for 1.0.7 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index ea1ea7bb24..fe6b15c332 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.6 +PROJECT_NUMBER = 1.0.7 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index af0b7ddbff..238d6e882a 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.6 +1.0.7 diff --git a/VERSION b/VERSION index af0b7ddbff..238d6e882a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.6 +1.0.7 From 12cb64e8d97ad0ea33ab9252771750677f1a1eef Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 29 Oct 2012 22:21:25 +0100 Subject: [PATCH 187/328] tree: fix type used for testing the tree Signed-off-by: Michael Niedermayer (cherry picked from commit 977cb54f941c423eddbdc95c76fb41fde31f8afc) Signed-off-by: Michael Niedermayer --- libavutil/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/tree.c b/libavutil/tree.c index 4206539c37..745dd8ae02 100644 --- a/libavutil/tree.c +++ b/libavutil/tree.c @@ -205,7 +205,7 @@ int main (void) av_lfg_init(&prng, 1); for (i = 0; i < 10000; i++) { - int j = av_lfg_get(&prng) % 86294; + intptr_t j = av_lfg_get(&prng) % 86294; if (check(root) > 999) { av_log(NULL, AV_LOG_ERROR, "FATAL error %d\n", i); print(root, 0); From 25881786697d721bd5b112c4f375c7e68d3c9c4b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 30 Oct 2012 22:34:36 +0100 Subject: [PATCH 188/328] tree-test: fix printf() types Signed-off-by: Michael Niedermayer (cherry picked from commit 6c49562d790e9068ddcbb36197d7b24ab10c6274) Signed-off-by: Michael Niedermayer --- libavutil/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/tree.c b/libavutil/tree.c index 745dd8ae02..207b6a15f8 100644 --- a/libavutil/tree.c +++ b/libavutil/tree.c @@ -211,7 +211,7 @@ int main (void) print(root, 0); return -1; } - av_log(NULL, AV_LOG_ERROR, "inserting %4d\n", j); + av_log(NULL, AV_LOG_ERROR, "inserting %4d\n", (int)j); if (!node) node = av_mallocz(av_tree_node_size); av_tree_insert(&root, (void *) (j + 1), cmp, &node); @@ -219,7 +219,7 @@ int main (void) j = av_lfg_get(&prng) % 86294; { AVTreeNode *node2 = NULL; - av_log(NULL, AV_LOG_ERROR, "removing %4d\n", j); + av_log(NULL, AV_LOG_ERROR, "removing %4d\n", (int)j); av_tree_insert(&root, (void *) (j + 1), cmp, &node2); k = av_tree_find(root, (void *) (j + 1), cmp, NULL); if (k) From 663b22325891c77efd76779f37d34621d68b6930 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 17 May 2013 22:03:14 +0200 Subject: [PATCH 189/328] avidec: dont randomly skip packets for offseting the index Fixes Ticket2490 Signed-off-by: Michael Niedermayer (cherry picked from commit 6c593f1b671b7725b8c36f92f7c0a23ccf8e7628) --- libavformat/avidec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 01813e48a7..cf5f86fba8 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -990,9 +990,9 @@ start_sync: || st->discard >= AVDISCARD_ALL){ if (!exit_early) { ast->frame_offset += get_duration(ast, size); + avio_skip(pb, size); + goto start_sync; } - avio_skip(pb, size); - goto start_sync; } if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { From 14634f5b698d157b74290629305049970fe60177 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 15 May 2013 01:08:18 +0200 Subject: [PATCH 190/328] ffmpeg: free threads on error conditions. Fixes Ticket2562 Signed-off-by: Michael Niedermayer (cherry picked from commit 1a36c756d8959207d3386f03e11c15216abc50b7) --- ffmpeg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ffmpeg.c b/ffmpeg.c index 3eb15a6494..04adc548d4 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -151,6 +151,8 @@ static struct termios oldtty; static int restore_tty; #endif +static void free_input_threads(void); + /* sub2video hack: Convert subtitles to video with alpha to insert them in filter graphs. @@ -424,6 +426,9 @@ void av_noreturn exit_program(int ret) av_freep(&output_streams[i]->logfile_prefix); av_freep(&output_streams[i]); } +#if HAVE_PTHREADS + free_input_threads(); +#endif for (i = 0; i < nb_input_files; i++) { avformat_close_input(&input_files[i]->ctx); av_freep(&input_files[i]); From 0428594f47886d2590621c892144e87915426d02 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 May 2013 21:42:06 +0200 Subject: [PATCH 191/328] smacker: remove av_clip_int16() Fixes Ticket2425 Signed-off-by: Michael Niedermayer (cherry picked from commit 2211c76287e073a9e176fde7dbb9a63ceb2af8d1) --- libavcodec/smacker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 4913625e37..f2bfdd2346 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -687,7 +687,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, } val |= h[3].values[res] << 8; pred[1] += sign_extend(val, 16); - *samples++ = av_clip_int16(pred[1]); + *samples++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); @@ -708,7 +708,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, } val |= h[1].values[res] << 8; pred[0] += sign_extend(val, 16); - *samples++ = av_clip_int16(pred[0]); + *samples++ = pred[0]; } } } else { //8-bit data From 71e32a5ea4dd43d9e7469ef3dc179290821f0310 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 May 2013 18:58:39 +0200 Subject: [PATCH 192/328] avienc: Disallow the first frame to be skiped Fixes Ticket2386 Signed-off-by: Michael Niedermayer (cherry picked from commit cc0db8cf3042186d8355dcf10be67071cfbbcc5d) Conflicts: libavformat/avienc.c --- libavformat/avienc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 0352f8bd66..ea7bc3fdb6 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -525,7 +525,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) int size= pkt->size; // av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avist->packet_count, stream_index); - while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != AV_CODEC_ID_XSUB){ + while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != AV_CODEC_ID_XSUB && avist->packet_count){ AVPacket empty_packet; if(pkt->dts - avist->packet_count > 60000){ From d70043ea0f47cd83244118c0e5b8338e39829178 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 30 May 2013 18:30:42 +0200 Subject: [PATCH 193/328] h264_cavlc: fix reading skip run Fixes Ticket2606 Signed-off-by: Michael Niedermayer (cherry picked from commit 826b3a75cd295c03720e00d3de83e1abcbedd4b9) Conflicts: libavcodec/h264_cavlc.c --- libavcodec/h264_cavlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index f5d403b762..77ea194ccd 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -708,7 +708,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h){ down the code */ if(h->slice_type_nos != AV_PICTURE_TYPE_I){ if(s->mb_skip_run==-1) - s->mb_skip_run= get_ue_golomb(&s->gb); + s->mb_skip_run= get_ue_golomb_long(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ From be66531ee27cce11b3baa9c7be3e3fb2f89fe6af Mon Sep 17 00:00:00 2001 From: Claudio Freire Date: Sat, 4 May 2013 18:36:37 -0300 Subject: [PATCH 194/328] AAC encoder: Fix rate control on twoloop. Fixes a case where multichannel bitrate isn't accurately targetted by psy model alone, never achieving the target bitrate. Now fixed. Fixes ticket #2625. Signed-off-by: Michael Niedermayer Signed-off-by: Carl Eugen Hoyos --- libavcodec/aaccoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index e66dcb8405..417c457cc6 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -713,7 +713,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, const float lambda) { int start = 0, i, w, w2, g; - int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels; + int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f); float dists[128] = { 0 }, uplims[128]; float maxvals[128]; int fflag, minscaler; From 194590dc56c4524f602ee5fd592374495627018d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 13 Jun 2013 00:01:13 +0200 Subject: [PATCH 195/328] alacenc: Fix missing sign_extend() Fixes ticket #2497 Signed-off-by: Michael Niedermayer (cherry picked from commit 8aea2f05dc56f7e7d60767dd27ba8e846a05e8ae) --- libavcodec/alacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index 79b6ba8dd8..c472ad95af 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -262,7 +262,7 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch) // generate warm-up samples residual[0] = samples[0]; for (i = 1; i <= lpc.lpc_order; i++) - residual[i] = samples[i] - samples[i-1]; + residual[i] = sign_extend(samples[i] - samples[i-1], s->write_sample_size); // perform lpc on remaining samples for (i = lpc.lpc_order + 1; i < s->frame_size; i++) { From 2ad70f57a88ba5fccd37c73cc63286a1d2e2a274 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 18 Jun 2013 02:09:46 +0200 Subject: [PATCH 196/328] swresample/x86/audio_convert: add emms to CONV Fixes ticket #1874 Signed-off-by: Michael Niedermayer (cherry picked from commit ca2818b88155029bb6f989ee522e7f8e9e9f5927) --- libswresample/x86/audio_convert.asm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libswresample/x86/audio_convert.asm b/libswresample/x86/audio_convert.asm index 29701a594c..854f8e4e56 100644 --- a/libswresample/x86/audio_convert.asm +++ b/libswresample/x86/audio_convert.asm @@ -196,7 +196,12 @@ cglobal %2_to_%1_%3, 3, 3, 6, dst, src, len add lenq, 2*mmsize/(1<<%4) %endif jl .next +%if mmsize == 8 + emms + RET +%else REP_RET +%endif %endmacro %macro PACK_6CH 5-7 From dc3ec51601b96b385c188d0613fc97ed08a4ec20 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 19 Jun 2013 16:31:10 +0200 Subject: [PATCH 197/328] Autodetect idcin only if audio properties allow decoding. Fixes ticket #2688. (cherry picked from commit 06bede95fcea47d2e51e8ff248c15311f335b898) --- libavformat/idcin.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/idcin.c b/libavformat/idcin.c index f1df00244f..c20c5f82a9 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -91,7 +91,7 @@ typedef struct IdcinDemuxContext { static int idcin_probe(AVProbeData *p) { - unsigned int number; + unsigned int number, sample_rate; /* * This is what you could call a "probabilistic" file check: id CIN @@ -120,18 +120,18 @@ static int idcin_probe(AVProbeData *p) return 0; /* check the audio sample rate */ - number = AV_RL32(&p->buf[8]); - if ((number != 0) && ((number < 8000) | (number > 48000))) + sample_rate = AV_RL32(&p->buf[8]); + if (sample_rate && (sample_rate < 8000 || sample_rate > 48000)) return 0; /* check the audio bytes/sample */ number = AV_RL32(&p->buf[12]); - if (number > 2) + if (number > 2 || sample_rate && !number) return 0; /* check the audio channels */ number = AV_RL32(&p->buf[16]); - if (number > 2) + if (number > 2 || sample_rate && !number) return 0; /* return half certainly since this check is a bit sketchy */ From 8d18dbda1e452cfb90ced18dcc44dd89dff687d1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 21 Jun 2013 01:11:45 +0200 Subject: [PATCH 198/328] avformat/libmodplug: Reduce the probe score for small input This ensures that theres enough data for mpeg_probe() to recognize mpeg-ps Fixes Ticket2583 Based on code by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit c605adbf562fbf535e83ae427bb681bc45e440c8) --- libavformat/libmodplug.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libavformat/libmodplug.c b/libavformat/libmodplug.c index aa8edccb59..4ba9392aa0 100644 --- a/libavformat/libmodplug.c +++ b/libavformat/libmodplug.c @@ -347,6 +347,19 @@ static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int return 0; } +static const char modplug_extensions[] = "669,abc,amf,ams,dbm,dmf,dsm,far,it,mdl,med,mid,mod,mt2,mtm,okt,psm,ptm,s3m,stm,ult,umx,xm,itgz,itr,itz,mdgz,mdr,mdz,s3gz,s3r,s3z,xmgz,xmr,xmz"; + +static int modplug_probe(AVProbeData *p) +{ + if (av_match_ext(p->filename, modplug_extensions)) { + if (p->buf_size < 16384) + return AVPROBE_SCORE_MAX/4-1; + else + return AVPROBE_SCORE_MAX/2; + } + return 0; +} + static const AVClass modplug_class = { .class_name = "ModPlug demuxer", .item_name = av_default_item_name, @@ -358,11 +371,11 @@ AVInputFormat ff_libmodplug_demuxer = { .name = "libmodplug", .long_name = NULL_IF_CONFIG_SMALL("ModPlug demuxer"), .priv_data_size = sizeof(ModPlugContext), + .read_probe = modplug_probe, .read_header = modplug_read_header, .read_packet = modplug_read_packet, .read_close = modplug_read_close, .read_seek = modplug_read_seek, - .extensions = "669,abc,amf,ams,dbm,dmf,dsm,far,it,mdl,med,mid,mod,mt2,mtm,okt,psm,ptm,s3m,stm,ult,umx,xm" - ",itgz,itr,itz,mdgz,mdr,mdz,s3gz,s3r,s3z,xmgz,xmr,xmz", // compressed mods + .extensions = modplug_extensions, .priv_class = &modplug_class, }; From 491f2e517d9200e93a702cd1ad36d83189117241 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 15 Jun 2013 22:46:01 +0200 Subject: [PATCH 199/328] mathops/x86: work around inline asm miscompilation with GCC 4.8.1 The volatile is not required here, and prevents a miscompilation with GCC 4.8.1 when building on x86 with --cpu=i686 Signed-off-by: Michael Niedermayer (cherry picked from commit 659df32a9d8984081ccd54adc3aee7daeb33388d) --- libavcodec/x86/mathops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 79e29e6232..76ea1315c2 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -74,7 +74,7 @@ static av_always_inline av_const int64_t MUL64(int a, int b) static inline av_const int mid_pred(int a, int b, int c) { int i=b; - __asm__ volatile( + __asm__ ( "cmp %2, %1 \n\t" "cmovg %1, %0 \n\t" "cmovg %2, %1 \n\t" From 5fa940d9c71e40bb8b1e3f73b46207dbad85788f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 1 Jul 2013 23:38:08 +0200 Subject: [PATCH 200/328] rmdec: Pass AVIOContext to rm_read_metadata() Fix null pointer dereference Fixes Ticket2588 Signed-off-by: Michael Niedermayer (cherry picked from commit bf87908cd8da31e8f8fe75c06577170928ea70a8) Conflicts: libavformat/rmdec.c --- libavformat/rmdec.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 3af016fdcd..238c74bfc0 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -107,13 +107,14 @@ static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned si return 0; } -static void rm_read_metadata(AVFormatContext *s, int wide) +static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide) { char buf[1024]; int i; + for (i=0; ipb) : avio_r8(s->pb); - get_strl(s->pb, buf, sizeof(buf), len); + int len = wide ? avio_rb16(pb) : avio_r8(pb); + get_strl(pb, buf, sizeof(buf), len); av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0); } } @@ -143,7 +144,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, int header_size = avio_rb16(pb); int64_t startpos = avio_tell(pb); avio_skip(pb, 14); - rm_read_metadata(s, 0); + rm_read_metadata(s, pb, 0); if ((startpos + header_size) >= avio_tell(pb) + 2) { // fourcc (should always be "lpcJ") avio_r8(pb); @@ -290,7 +291,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, avio_r8(pb); avio_r8(pb); avio_r8(pb); - rm_read_metadata(s, 0); + rm_read_metadata(s, pb, 0); } } return 0; @@ -513,7 +514,7 @@ static int rm_read_header(AVFormatContext *s) flags = avio_rb16(pb); /* flags */ break; case MKTAG('C', 'O', 'N', 'T'): - rm_read_metadata(s, 1); + rm_read_metadata(s, pb, 1); break; case MKTAG('M', 'D', 'P', 'R'): st = avformat_new_stream(s, NULL); From ee829bacdeb5b5ed6063d84419081ddd93948939 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 5 Jul 2013 03:27:07 +0200 Subject: [PATCH 201/328] mpegts: only reopen pmt_cb filter if its different from the previous. Fixes Ticket2632 Signed-off-by: Michael Niedermayer (cherry picked from commit b009267910df10c004b5f340a090d45da29089a0) --- libavformat/mpegts.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index c39cf45d7b..74de2c72fd 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1578,12 +1578,18 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (sid == 0x0000) { /* NIT info */ } else { + MpegTSFilter *fil = ts->pids[pmt_pid]; program = av_new_program(ts->stream, sid); program->program_num = sid; program->pmt_pid = pmt_pid; - if (ts->pids[pmt_pid]) - mpegts_close_filter(ts, ts->pids[pmt_pid]); - mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); + if (fil) + if ( fil->type != MPEGTS_SECTION + || fil->pid != pmt_pid + || fil->u.section_filter.section_cb != pmt_cb) + mpegts_close_filter(ts, ts->pids[pmt_pid]); + + if (!ts->pids[pmt_pid]) + mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); add_pat_entry(ts, sid); add_pid_to_pmt(ts, sid, 0); //add pat pid to program add_pid_to_pmt(ts, sid, pmt_pid); From 8c5c4adebbf6b81c505b04414f7466d4e2b0dcbb Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 7 Jul 2013 01:29:48 +0200 Subject: [PATCH 202/328] libavcodec/x86/mpegvideo: Move mmx functions under HAVE_MMX_INLINE should fix ticket2755 Signed-off-by: Michael Niedermayer (cherry picked from commit 707b2135fda3687a6eeb91411f801e437f633f30) --- libavcodec/x86/mpegvideo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/x86/mpegvideo.c b/libavcodec/x86/mpegvideo.c index 2d475abe01..227fbc070c 100644 --- a/libavcodec/x86/mpegvideo.c +++ b/libavcodec/x86/mpegvideo.c @@ -26,7 +26,7 @@ #include "libavcodec/mpegvideo.h" #include "dsputil_mmx.h" -#if HAVE_INLINE_ASM +#if HAVE_MMX_INLINE static void dct_unquantize_h263_intra_mmx(MpegEncContext *s, DCTELEM *block, int n, int qscale) @@ -582,11 +582,11 @@ static void denoise_dct_sse2(MpegEncContext *s, DCTELEM *block){ ); } -#endif /* HAVE_INLINE_ASM */ +#endif /* HAVE_MMX_INLINE */ void ff_MPV_common_init_x86(MpegEncContext *s) { -#if HAVE_INLINE_ASM +#if HAVE_MMX_INLINE int mm_flags = av_get_cpu_flags(); if (mm_flags & AV_CPU_FLAG_MMX) { @@ -604,5 +604,5 @@ void ff_MPV_common_init_x86(MpegEncContext *s) s->denoise_dct= denoise_dct_mmx; } } -#endif /* HAVE_INLINE_ASM */ +#endif /* HAVE_MMX_INLINE */ } From e68b62a014b680d32fe9e2aee5c3bc4246a70ee9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 7 Jul 2013 02:42:40 +0200 Subject: [PATCH 203/328] avformat/mov: Fix duration of fragmented mov Fixes Ticket2757 Signed-off-by: Michael Niedermayer (cherry picked from commit dc2a13aa802fc691c25d5e0194818831058316ee) --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 73c8be0246..4c6155895e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -858,7 +858,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ // set the AVCodecContext duration because the duration of individual tracks // may be inaccurate - if (c->time_scale > 0) + if (c->time_scale > 0 && !c->trex_data) c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale); avio_rb32(pb); /* preferred scale */ From 40c521aec0edb47f6d6cd59f96812248e152dfdc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 17 Jun 2013 22:03:36 +0200 Subject: [PATCH 204/328] mmsh: dont close context on seeking failure Fixes Ticket2581 Signed-off-by: Michael Niedermayer (cherry picked from commit b4579a29c75e2968ede2ad002dd4a495dbfc883d) --- libavformat/mmsh.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index d6e398200f..c71ecd67ef 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -309,14 +309,16 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim return 0; fail: av_freep(&stream_selection); - mmsh_close(h); av_dlog(NULL, "Connection failed with error %d\n", err); return err; } static int mmsh_open(URLContext *h, const char *uri, int flags) { - return mmsh_open_internal(h, uri, flags, 0, 0); + int ret = mmsh_open_internal(h, uri, flags, 0, 0); + if (ret < 0) + mmsh_close(h); + return ret; } static int handle_chunk_type(MMSHContext *mmsh) From ddfff763978dd6a79e6e8e560291e76fc98a667c Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 6 Jul 2013 04:34:13 -0300 Subject: [PATCH 205/328] oggparseskeleton: Fix fisbone header parsing start_granule should be applied to the stream referenced in the fisbone packet, not to the Skeleton stream. This was broken in d1f05dd18375f2f8e68372edee11436927e43ba8 and produced bogus warnings about multiple fisbone in the same stream on files with more than one stream. Signed-off-by: Michael Niedermayer (cherry picked from commit 3960992f0abf8e28acada220c79fb754d67298ba) --- libavformat/oggparseskeleton.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c index 4b02c838f2..01032b2288 100644 --- a/libavformat/oggparseskeleton.c +++ b/libavformat/oggparseskeleton.c @@ -74,12 +74,17 @@ static int skeleton_header(AVFormatContext *s, int idx) target_idx = ogg_find_stream(ogg, AV_RL32(buf+12)); start_granule = AV_RL64(buf+36); + if (target_idx < 0) { + av_log(s, AV_LOG_WARNING, "Serial number in fisbone doesn't match any stream\n"); + return 1; + } + os = ogg->streams + target_idx; if (os->start_granule != OGG_NOGRANULE_VALUE) { av_log_missing_feature(s, "multiple fisbone for the " "same stream\n", 0); return 1; } - if (target_idx >= 0 && start_granule != OGG_NOGRANULE_VALUE) { + if (start_granule != OGG_NOGRANULE_VALUE) { os->start_granule = start_granule; } } From 2d66486b8eab6f89311bd0832c5f326a5d80e276 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 6 Jul 2013 04:34:13 -0300 Subject: [PATCH 206/328] oggparseskeleton: Replace avpriv_report_missing_feature() with a normal av_log() call since there should not be more than one fisbone for a given stream. Signed-off-by: Michael Niedermayer (cherry picked from commit 63d7684fefcfa9de1a04b43471f876e882ba7aac) Conflicts: libavformat/oggparseskeleton.c --- libavformat/oggparseskeleton.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c index 01032b2288..415a4235dc 100644 --- a/libavformat/oggparseskeleton.c +++ b/libavformat/oggparseskeleton.c @@ -80,8 +80,7 @@ static int skeleton_header(AVFormatContext *s, int idx) } os = ogg->streams + target_idx; if (os->start_granule != OGG_NOGRANULE_VALUE) { - av_log_missing_feature(s, "multiple fisbone for the " - "same stream\n", 0); + av_log(s, AV_LOG_WARNING, "Multiple fisbone for the same stream\n"); return 1; } if (start_granule != OGG_NOGRANULE_VALUE) { From be23cee317f52f3dffa49812f412c0041d8b0de3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 6 Jul 2013 23:53:19 +0200 Subject: [PATCH 207/328] oggparseskeleton: avoid header parsing failure Based on description by James Almer and the xiph wiki Signed-off-by: Michael Niedermayer (cherry picked from commit 9a6e814be7c052deb34a8f585176d053f4c187c1) --- libavformat/oggparseskeleton.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/oggparseskeleton.c b/libavformat/oggparseskeleton.c index 415a4235dc..79c018da66 100644 --- a/libavformat/oggparseskeleton.c +++ b/libavformat/oggparseskeleton.c @@ -37,6 +37,9 @@ static int skeleton_header(AVFormatContext *s, int idx) strcpy(st->codec->codec_name, "skeleton"); st->codec->codec_type = AVMEDIA_TYPE_DATA; + if ((os->flags & OGG_FLAG_EOS) && os->psize == 0) + return 1; + if (os->psize < 8) return -1; From ec268c24a77ecfded355849f79107498e71627db Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 8 Jul 2013 21:46:20 +0200 Subject: [PATCH 208/328] mpeg12dec: avoid reinitialization on PS changes when possible. Fixes Ticket2574 Signed-off-by: Michael Niedermayer (cherry picked from commit 970c8df73528659925819dec31c4c8c0887f0321) Conflicts: libavcodec/mpeg12dec.c --- libavcodec/mpeg12.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 29bee1d779..07c5016682 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1263,7 +1263,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) s1->save_width != s->width || s1->save_height != s->height || s1->save_aspect_info != s->aspect_ratio_info || - s1->save_progressive_seq != s->progressive_sequence || + (s1->save_progressive_seq != s->progressive_sequence && (s->height&31)) || 0) { From 03983c3650b52fdb7f478e0ae41950f540127b09 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 15 Jul 2013 17:13:45 +0200 Subject: [PATCH 209/328] avformat/matroskadec: Detect conflicting sample rate/default_duration Fixes Ticket2508 Thanks-to: Moritz Bunkus Signed-off-by: Michael Niedermayer (cherry picked from commit 6158a3bcdf52fafc1d9ae9eb358a56c614b23aa3) --- libavformat/matroskadec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index f562fa4889..5783acacfb 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2158,6 +2158,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, uint32_t *lace_size = NULL; int n, flags, laces = 0; uint64_t num; + int trust_default_duration = 1; if ((n = matroska_ebmlnum_uint(matroska, data, size, &num)) < 0) { av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n"); @@ -2212,7 +2213,15 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, if (res) goto end; - if (!block_duration) + if (track->audio.samplerate == 8000) { + // If this is needed for more codecs, then add them here + if (st->codec->codec_id == AV_CODEC_ID_AC3) { + if(track->audio.samplerate != st->codec->sample_rate || !st->codec->frame_size) + trust_default_duration = 0; + } + } + + if (!block_duration && trust_default_duration) block_duration = track->default_duration * laces / matroska->time_scale; if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time)) From 858e06aabe127fc71956d8b4ee9e718eb3a1a509 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Wed, 22 May 2013 15:17:08 -0700 Subject: [PATCH 210/328] avformat/utils: Keep internal and external av_read_frame() packets in sync. Otherwise, during error conditions, the caller will be left with dangling pointers to a destructed packet => boom. BUG=242786 TEST=ffmpeg_regression_tests Commit slightly simplified by commiter Signed-off-by: Michael Niedermayer (cherry picked from commit c54a1565f512858ccfa70392f40f11c098bc1b63) Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 733858ea3f..b4a8a1fbf2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1412,6 +1412,9 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) st->skip_to_keyframe = 0; if (st->skip_to_keyframe) { av_free_packet(&cur_pkt); + if (got_packet) { + *pkt = cur_pkt; + } got_packet = 0; } } From b896c1c98e067040932573c40b1f1879962ebff2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 29 Jun 2013 19:47:12 +0200 Subject: [PATCH 211/328] update all trac links to use the trac subdomain Signed-off-by: Michael Niedermayer --- doc/issue_tracker.txt | 2 +- libavcodec/qtrle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/issue_tracker.txt b/doc/issue_tracker.txt index d487f66830..27b0009b58 100644 --- a/doc/issue_tracker.txt +++ b/doc/issue_tracker.txt @@ -24,7 +24,7 @@ a mail for every change to every issue. The subscription URL for the ffmpeg-trac list is: http(s)://ffmpeg.org/mailman/listinfo/ffmpeg-trac The URL of the webinterface of the tracker is: -http(s)://ffmpeg.org/trac/ffmpeg +http(s)://trac.ffmpeg.org Type: ----- diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index a8fe38a7e8..2933d6dbfe 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -67,7 +67,7 @@ static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) * line' at the beginning. Since we always interpret it as 'go to next line' * in the decoding loop (which makes code simpler/faster), the first line * would not be counted, so we count one more. - * See: https://ffmpeg.org/trac/ffmpeg/ticket/226 + * See: https://trac.ffmpeg.org/ticket/226 * In the following decoding loop, row_ptr will be the position of the * _next_ row. */ lines_to_change++; From 9c7c2abad4a8eb56472dd5651522530855a62f3f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 10 Dec 2012 17:20:32 +0100 Subject: [PATCH 212/328] swfdec: check lens validity Signed-off-by: Michael Niedermayer (cherry picked from commit c73685398dee3290dd9f67013f1cd310b7f9fb33) Signed-off-by: Michael Niedermayer --- libavformat/swfdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 6136b54b05..9a8ef53738 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -153,6 +153,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) tag = get_swf_tag(pb, &len); if (tag < 0) return tag; + if (len < 0) { + av_log(s, AV_LOG_ERROR, "len %d is invalid\n", len); + return AVERROR_INVALIDDATA; + } if (tag == TAG_VIDEOSTREAM) { int ch_id = avio_rl16(pb); len -= 2; From d46713cc7e7dfd88b813078a71ed1c29e42011ca Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Mon, 10 Dec 2012 12:44:09 -0500 Subject: [PATCH 213/328] swfdec: do better validation of tag length Avoids trying to read a packet with 0 or negative size. Avoids a potential infinite loop due to seeking backwards. Partially based on a patch by Michael Niedermayer. (cherry picked from commit e70c5b034c4787377e82cab2d5565486baec0c2a) Conflicts: libavformat/swfdec.c --- libavformat/swfdec.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 9a8ef53738..ee1b5960aa 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -154,7 +154,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) if (tag < 0) return tag; if (len < 0) { - av_log(s, AV_LOG_ERROR, "len %d is invalid\n", len); + av_log(s, AV_LOG_ERROR, "invalid tag length: %d\n", len); return AVERROR_INVALIDDATA; } if (tag == TAG_VIDEOSTREAM) { @@ -212,7 +212,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) { frame = avio_rl16(pb); - if ((res = av_get_packet(pb, pkt, len-2)) < 0) + len -= 2; + if (len <= 0) + goto skip; + if ((res = av_get_packet(pb, pkt, len)) < 0) return res; pkt->pos = pos; pkt->pts = frame; @@ -226,9 +229,14 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { if (st->codec->codec_id == AV_CODEC_ID_MP3) { avio_skip(pb, 4); - if ((res = av_get_packet(pb, pkt, len-4)) < 0) + len -= 4; + if (len <= 0) + goto skip; + if ((res = av_get_packet(pb, pkt, len)) < 0) return res; } else { // ADPCM, PCM + if (len <= 0) + goto skip; if ((res = av_get_packet(pb, pkt, len)) < 0) return res; } @@ -254,7 +262,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) st = vst; } avio_rl16(pb); /* BITMAP_ID */ - if ((res = av_new_packet(pkt, len-2)) < 0) + len -= 2; + if (len < 4) + goto skip; + if ((res = av_new_packet(pkt, len)) < 0) return res; avio_read(pb, pkt->data, 4); if (AV_RB32(pkt->data) == 0xffd8ffd9 || @@ -271,6 +282,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) return pkt->size; } skip: + len = FFMAX(0, len); avio_skip(pb, len); } } From 34dfb907b222edb64bd9472a635cd29a98762392 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 26 Jul 2013 04:09:30 +0200 Subject: [PATCH 214/328] avformat/dtsdec: Improve probe, reject things looking like analog signals Fixes Ticket2810 Signed-off-by: Michael Niedermayer (cherry picked from commit 6663205338f57eedb2392263dde48e2717c6e980) Conflicts: libavformat/dtsdec.c --- libavformat/dtsdec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/dtsdec.c b/libavformat/dtsdec.c index 5c05758327..009dd5c456 100644 --- a/libavformat/dtsdec.c +++ b/libavformat/dtsdec.c @@ -34,6 +34,7 @@ static int dts_probe(AVProbeData *p) uint32_t state = -1; int markers[3] = {0}; int sum, max; + int64_t diff = 0; buf = p->buf; @@ -54,12 +55,16 @@ static int dts_probe(AVProbeData *p) if (state == DCA_MARKER_14B_LE) if ((bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007) markers[2]++; + + if (buf - p->buf >= 4) + diff += FFABS(AV_RL16(buf) - AV_RL16(buf-4)); } sum = markers[0] + markers[1] + markers[2]; max = markers[1] > markers[0]; max = markers[2] > markers[max] ? 2 : max; if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 && - markers[max] * 4 > sum * 3) + markers[max] * 4 > sum * 3 && + diff / p->buf_size > 200) return AVPROBE_SCORE_MAX/2+1; return 0; From 24cff71d029ca87be17b04eea89e04a37523f995 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 29 Jul 2013 20:43:45 +0200 Subject: [PATCH 215/328] avcodec/kmvc: fix MV checks Fixes Ticket2813 Fixes regression since 70b5583 Signed-off-by: Michael Niedermayer (cherry picked from commit 3cd8aaa2b2e78faf039691e1c31ff4f8d94e3bc6) --- libavcodec/kmvc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index cde410e5e1..3cdae68f39 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -106,7 +106,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = val & 0xF; my = val >> 4; - if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 316*196) { + if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 320*197 - 4) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } @@ -131,7 +131,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = val & 0xF; my = val >> 4; - if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 318*198) { + if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 320*199 - 2) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } @@ -206,7 +206,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = (val & 0xF) - 8; my = (val >> 4) - 8; - if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 318*198) { + if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 320*197 - 4) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } @@ -231,7 +231,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = (val & 0xF) - 8; my = (val >> 4) - 8; - if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 318*198) { + if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 320*199 - 2) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } From b416cb979d5db746f97e802052a34da09af0428f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 20 Aug 2013 13:45:20 +0200 Subject: [PATCH 216/328] movenc: ilbc needs audio_vbr set. Without this the block_align or bitrate value is not available to the decoder Fixes Ticket2858 Signed-off-by: Michael Niedermayer (cherry picked from commit 3d64845600c6486a2706b118a81805f3bf4d3db5) --- libavformat/movenc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index af0a27e379..69400098f0 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3551,6 +3551,9 @@ static int mov_write_header(AVFormatContext *s) }else{ track->sample_size = (av_get_bits_per_sample(st->codec->codec_id) >> 3) * st->codec->channels; } + if (st->codec->codec_id == AV_CODEC_ID_ILBC) { + track->audio_vbr = 1; + } if (track->mode != MODE_MOV && track->enc->codec_id == AV_CODEC_ID_MP3 && track->timescale < 16000) { av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not supported\n", From 3f3993ac0aef49b0b27f52d889d5a3d09ad1b0b4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 20 Aug 2013 16:49:31 +0200 Subject: [PATCH 217/328] swr: clean layouts before checking sanity Signed-off-by: Michael Niedermayer (cherry picked from commit 6dfffe92004dfd8c79d18791f28a2b1c7e387845) --- libswresample/rematrix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index 72da438e6c..c53129b41b 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -143,13 +143,14 @@ av_cold static int auto_matrix(SwrContext *s) const int matrix_encoding = s->matrix_encoding; in_ch_layout = clean_layout(s, s->in_ch_layout); + out_ch_layout = clean_layout(s, s->out_ch_layout); + if(!sane_layout(in_ch_layout)){ av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout); av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf); return AVERROR(EINVAL); } - out_ch_layout = clean_layout(s, s->out_ch_layout); if(!sane_layout(out_ch_layout)){ av_get_channel_layout_string(buf, sizeof(buf), -1, s->out_ch_layout); av_log(s, AV_LOG_ERROR, "Output channel layout '%s' is not supported\n", buf); From 739e236aed8f39fefe2126a5f7aab01c340bdbc4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 20 Aug 2013 16:56:51 +0200 Subject: [PATCH 218/328] swr/rematrix: Fix handling of AV_CH_LAYOUT_STEREO_DOWNMIX output Fixes Ticket2859 Note, testcases related to the downmix channels are welcome. (id like to make sure this is working correctly now, as obviously it didnt work before ...) Signed-off-by: Michael Niedermayer (cherry picked from commit c56d4dab039b352961cca298d753b04e2f2fd990) --- libswresample/rematrix.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index c53129b41b..c126565145 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -103,9 +103,6 @@ static int even(int64_t layout){ } static int clean_layout(SwrContext *s, int64_t layout){ - if((layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == AV_CH_LAYOUT_STEREO_DOWNMIX) - return AV_CH_LAYOUT_STEREO; - if(layout && layout != AV_CH_FRONT_CENTER && !(layout&(layout-1))) { char buf[128]; av_get_channel_layout_string(buf, sizeof(buf), -1, layout); @@ -145,6 +142,11 @@ av_cold static int auto_matrix(SwrContext *s) in_ch_layout = clean_layout(s, s->in_ch_layout); out_ch_layout = clean_layout(s, s->out_ch_layout); + if( out_ch_layout == AV_CH_LAYOUT_STEREO_DOWNMIX + && (in_ch_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == 0 + ) + out_ch_layout = AV_CH_LAYOUT_STEREO; + if(!sane_layout(in_ch_layout)){ av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout); av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf); From ec86321424f9eece3b937e5f8e379ef241059073 Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 17 Jul 2013 03:10:16 -0300 Subject: [PATCH 219/328] lavf/matroskaenc: Check for valid metadata before creating tags Tags must have at least one SimpleTag element to be spec conformant. Updated lavf-mkv and seek-lavf-mkv FATE references as the tests were affected by this. Fixes ticket #2785 Signed-off-by: James Almer Signed-off-by: Michael Niedermayer (cherry picked from commit 088ed5314694031e07e02e9d364c9d486a60e704) Conflicts: tests/ref/lavf/mkv tests/ref/seek/lavf_mkv --- libavformat/matroskaenc.c | 18 +++++++++++++--- tests/ref/lavf/mkv | 4 ++-- tests/ref/seek/lavf_mkv | 44 +++++++++++++++++++-------------------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 71236142dc..8b7c912dd4 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -793,6 +793,18 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme return 0; } +static int mkv_check_tag(AVDictionary *m) +{ + AVDictionaryEntry *t = NULL; + int ret = 0; + + while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) + if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode")) + ret++; + + return ret; +} + static int mkv_write_tags(AVFormatContext *s) { ebml_master tags = {0}; @@ -800,7 +812,7 @@ static int mkv_write_tags(AVFormatContext *s) ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); - if (av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + if (mkv_check_tag(s->metadata)) { ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); if (ret < 0) return ret; } @@ -808,7 +820,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; - if (!av_dict_get(st->metadata, "", 0, AV_DICT_IGNORE_SUFFIX)) + if (!mkv_check_tag(st->metadata)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags); @@ -818,7 +830,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; - if (!av_dict_get(ch->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) + if (!mkv_check_tag(ch->metadata)) continue; ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags); diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv index 8820300100..33a5c18677 100644 --- a/tests/ref/lavf/mkv +++ b/tests/ref/lavf/mkv @@ -1,3 +1,3 @@ -796a3bbf2410e55e186367037bda6bb5 *./tests/data/lavf/lavf.mkv -320297 ./tests/data/lavf/lavf.mkv +32892841431db4b1149666cf94a8a714 *./tests/data/lavf/lavf.mkv +320265 ./tests/data/lavf/lavf.mkv ./tests/data/lavf/lavf.mkv CRC=0x7065846b diff --git a/tests/ref/seek/lavf_mkv b/tests/ref/seek/lavf_mkv index ece15a1d75..02427cb1b9 100644 --- a/tests/ref/seek/lavf_mkv +++ b/tests/ref/seek/lavf_mkv @@ -1,48 +1,48 @@ -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 523 size: 208 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292185 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292153 size: 27834 ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292185 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292153 size: 27834 ret: 0 st: 0 flags:1 ts:-0.317000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret:-1 st: 1 flags:0 ts: 2.577000 ret: 0 st: 1 flags:1 ts: 1.471000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320026 size: 209 +ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 319994 size: 209 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146738 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146706 size: 27925 ret: 0 st:-1 flags:1 ts:-0.740831 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret:-1 st: 0 flags:0 ts: 2.153000 ret: 0 st: 0 flags:1 ts: 1.048000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292185 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292153 size: 27834 ret: 0 st: 1 flags:0 ts:-0.058000 -ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 523 size: 208 ret: 0 st: 1 flags:1 ts: 2.836000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320026 size: 209 +ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 319994 size: 209 ret:-1 st:-1 flags:0 ts: 1.730004 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146738 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146706 size: 27925 ret: 0 st: 0 flags:0 ts:-0.482000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret: 0 st: 0 flags:1 ts: 2.413000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292185 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292153 size: 27834 ret:-1 st: 1 flags:0 ts: 1.307000 ret: 0 st: 1 flags:1 ts: 0.201000 -ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 523 size: 208 ret: 0 st:-1 flags:0 ts:-0.904994 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292185 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292153 size: 27834 ret: 0 st: 0 flags:0 ts: 0.883000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292185 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292153 size: 27834 ret: 0 st: 0 flags:1 ts:-0.222000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret:-1 st: 1 flags:0 ts: 2.672000 ret: 0 st: 1 flags:1 ts: 1.566000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320026 size: 209 +ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 319994 size: 209 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146738 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146706 size: 27925 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 From 986b29407cf361f352644d972aa818f35d63df59 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 17 Jul 2013 13:30:36 +0200 Subject: [PATCH 220/328] matroskaenc: simplify mkv_check_tag() Signed-off-by: Michael Niedermayer (cherry picked from commit 066111bf19518a9f4d836991b34dbfc5ab72a41a) --- libavformat/matroskaenc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 8b7c912dd4..bfe3fb9ebe 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -796,13 +796,12 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme static int mkv_check_tag(AVDictionary *m) { AVDictionaryEntry *t = NULL; - int ret = 0; while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode")) - ret++; + return 1; - return ret; + return 0; } static int mkv_write_tags(AVFormatContext *s) From fc83cfda36d540e10f2d93c15768ed8a4d240342 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 17 Aug 2013 14:48:33 -0300 Subject: [PATCH 221/328] matroskadec: Improve TTA duration calculation Calculate the duration as accurately as possible to improve decoding of samples where the last frame is smaller than the rest. Signed-off-by: James Almer Approved-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit af248fa1174200acb537a6ab1198bb2fed38e884) --- libavformat/matroskadec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 5783acacfb..fc584bce86 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1665,7 +1665,7 @@ static int matroska_read_header(AVFormatContext *s) avio_wl16(&b, track->audio.channels); avio_wl16(&b, track->audio.bitdepth); avio_wl32(&b, track->audio.out_samplerate); - avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate); + avio_wl32(&b, av_rescale((matroska->duration * matroska->time_scale), track->audio.out_samplerate, AV_TIME_BASE * 1000)); } else if (codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 || codec_id == AV_CODEC_ID_RV30 || codec_id == AV_CODEC_ID_RV40) { extradata_offset = 26; From a697a2795b6e60c15bc6776b44f8c94ae1a0b76c Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 24 May 2013 12:28:48 -0700 Subject: [PATCH 222/328] doc/encoders: Add documentation for libmp3lame Signed-off-by: Michael Niedermayer (cherry picked from commit 4703a345fb41b14fe28f7e6bf7f60bb2213aa9e0) Signed-off-by: Timothy Gu --- doc/encoders.texi | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index a7a2761f1d..846d56960a 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -412,6 +412,35 @@ Selected by Encoder (default) @end table +@section libmp3lame + +LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper + +Requires the presence of the libmp3lame headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libmp3lame}. + +@subsection Option Mapping + +The following options are supported by the libmp3lame wrapper, +the LAME-equivalent options follow the FFmpeg ones. + +@multitable @columnfractions .2 .2 +@item FFmpeg @tab LAME +@item b @tab b +FFmpeg @code{b} option is expressed in bits/s, lame @code{bitrate} +in kilobits/s. +@item q @tab V +Quality setting for VBR. +@item compression_level @tab q +Algorithm quality. Valid options are integers from 0-9. +@item reservoir @tab N.A. +Enable use of bit reservoir. LAME has this enabled by default. +@item joint_stereo @tab -m j +Enables the the encoder to use (on a frame by frame basis) either L/R +stereo or mid/side stereo. +@end multitable + @c man end AUDIO ENCODERS @chapter Video Encoders From 4c1544ecc8fb2c4eee8ba6201919681a3691033d Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Sat, 1 Jun 2013 16:26:03 -0700 Subject: [PATCH 223/328] doc/encoders: add documentation for libtwolame (cherry picked from commit ea038b996d5662702b2247a6aa919dee1cebc0be) Signed-off-by: Timothy Gu --- doc/encoders.texi | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 846d56960a..63ce92a695 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -441,6 +441,69 @@ Enables the the encoder to use (on a frame by frame basis) either L/R stereo or mid/side stereo. @end multitable +@section libtwolame + +TwoLAME MP2 encoder wrapper + +Requires the presence of the libtwolame headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libtwolame}. + +@subsection Options Mapping + +The following options are supported by the libtwolame wrapper. The +TwoLAME-equivalent options follow the FFmpeg ones and are in +parentheses. + +@table @option +@item b +(b) Set bitrate in bits/s. Note that FFmpeg @code{b} option is +expressed in bits/s, twolame @code{b} in kilobits/s. The default +value is 128k. + +@item q +(V) Set quality for experimental VBR support. Maximum value range is +from -50 to 50, useful range is from -10 to 10. + +@item mode +(mode) Set MPEG mode. Possible values: + +@table @samp +@item auto +Choose mode automatically based on the input. This is the default. +@item stereo +Stereo +@item joint_stereo +Joint stereo +@item dual_channel +Dual channel +@item mono +Mono +@end table + +@item psymodel +(psyc-mode) Set psychoacoustic model to use in encoding. The argument +must be an integer between -1 and 4, inclusive. The higher the value, +the better the quality. The default value is 3. + +@item energy_levels +(energy) Enable energy levels extensions when set to 1. The default +value is 0 (disabled). + +@item error_protection +(protect) Enable CRC error protection when set to 1. The default value +is 0 (disabled). + +@item copyright +(copyright) Set MPEG audio copyright flag when set to 1. The default +value is 0 (disabled). + +@item original +(original) Set MPEG audio original flag when set to 1. The default +value is 0 (disabled). + +@end table + @c man end AUDIO ENCODERS @chapter Video Encoders From 245e97ef616bdabc97359df4a7433a627e44dafc Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 7 Jun 2013 19:54:23 -0700 Subject: [PATCH 224/328] doc/encoders: Add libvo-aacenc doc Signed-off-by: Michael Niedermayer (cherry picked from commit ba7cb4807f050c401f8fd7ef1d1065b138358135) Signed-off-by: Timothy Gu --- doc/encoders.texi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 63ce92a695..a632c878f9 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -504,6 +504,27 @@ value is 0 (disabled). @end table +@section libvo-aacenc + +VisualOn AAC encoder + +Requires the presence of the libvo-aacenc headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libvo-aacenc --enable-version3}. + +@subsection Options + +The VisualOn AAC encoder only support encoding AAC-LC and up to 2 +channels. It is also CBR-only. It is considered to be worse than the +native experimental FFmpeg AAC encoder. + +@table @option + +@item b +Bitrate. + +@end table + @c man end AUDIO ENCODERS @chapter Video Encoders From 277502d10923fa4596562d0657e1365587a3af5a Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 11 Jun 2013 16:58:01 -0700 Subject: [PATCH 225/328] doc/encoders: Add libvo-amrwbenc doc Signed-off-by: Michael Niedermayer (cherry picked from commit 0ec65aa1046a4417d5c7dfcf8faeecde60e3fe00) Signed-off-by: Timothy Gu Conflicts: doc/encoders.texi --- doc/encoders.texi | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index a632c878f9..825cdb7696 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -525,6 +525,44 @@ Bitrate. @end table +@section libvo-amrwbenc + +VisualOn Adaptive Multi-Rate Wideband encoder + +Requires the presence of the libvo-amrwbenc headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libvo-amrwbenc --enable-version3}. + +This is a mono-only encoder. Officially it only supports 16000Hz sample +rate, but you can override it by setting @option{strict} to +@samp{unofficial} or lower. + +@subsection Options + +@table @option + +@item b +Set bitrate in bits/s. Only the following bitrates are supported, otherwise +libavcodec will round to the nearest valid bitrate. + +@table @samp +@item 6600 +@item 8850 +@item 12650 +@item 14250 +@item 15850 +@item 18250 +@item 19850 +@item 23050 +@item 23850 +@end table + +@item dtx +Allow discontinuous transmission (generate comfort noise) when set to 1. The +default value is 0 (disabled). + +@end table + @c man end AUDIO ENCODERS @chapter Video Encoders From a191b3dbccb37018129e071269319ebd45e2b561 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 11 Jun 2013 16:52:12 -0700 Subject: [PATCH 226/328] doc/general: Make the license status of the Android libraries clearer Signed-off-by: Michael Niedermayer (cherry picked from commit 6fe419bf73146655961a373c734e9e4d8826c835) Signed-off-by: Timothy Gu --- doc/general.texi | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 74ab3e0790..2390c98f7c 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -24,7 +24,7 @@ instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjp @file{./configure}. -@section OpenCORE and VisualOn libraries +@section OpenCORE, VisualOn, and Fraunhofer libraries Spun off Google Android sources, OpenCore, VisualOn and Fraunhofer libraries provide encoders for a number of audio codecs. @@ -32,9 +32,14 @@ libraries provide encoders for a number of audio codecs. @float NOTE OpenCORE and VisualOn libraries are under the Apache License 2.0 (see @url{http://www.apache.org/licenses/LICENSE-2.0} for details), which is -incompatible with the LGPL version 2.1 and GPL version 2. You have to +incompatible to the LGPL version 2.1 and GPL version 2. You have to upgrade FFmpeg's license to LGPL version 3 (or if you have enabled -GPL components, GPL version 3) to use it. +GPL components, GPL version 3) by passing @code{--enable-version3} to configure in +order to use it. + +The Fraunhofer AAC library is licensed under a license incompatible to the GPL +and is not known to be compatible to the LGPL. Therefore, you have to pass +@code{--enable-nonfree} to configure to use it. @end float @subsection OpenCORE AMR From ff8e4d7f1b7724391254f6493f9c91e6f6c5e7fd Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 17 Jun 2013 17:42:08 -0700 Subject: [PATCH 227/328] doc/decoders: Document libcelt Signed-off-by: Michael Niedermayer (cherry picked from commit e3580449221c79cf611995dc7e2fcb61dd867d4c) Signed-off-by: Timothy Gu --- doc/decoders.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 87ad4eea26..6a18c76a69 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -60,4 +60,12 @@ This decoder generates wave patterns according to predefined sequences. Its use is purely internal and the format of the data it accepts is not publicly documented. +@section libcelt + +libcelt decoder wrapper + +libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec. +Requires the presence of the libcelt headers and library during configuration. +You need to explicitly configure the build with @code{--enable-libcelt}. + @c man end AUDIO DECODERS From 1c5129c7a0111e7a19a699c5511405e5677ae7e3 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 17 Jun 2013 17:38:38 -0700 Subject: [PATCH 228/328] doc/encoders: Add libopencore-amrnb doc Signed-off-by: Michael Niedermayer (cherry picked from commit 9ead06057acfcc43bcb99a63a7c58543007b2847) Signed-off-by: Timothy Gu --- doc/encoders.texi | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 825cdb7696..1c8731c733 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -563,6 +563,43 @@ default value is 0 (disabled). @end table +@section libopencore-amrnb + +OpenCORE Adaptive Multi-Rate Narrowband encoder. + +Requires the presence of the libopencore-amrnb headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libopencore-amrnb --enable-version3}. + +This is a mono-only encoder. Officially it only supports 8000Hz sample rate, +but you can override it by setting @option{strict} to @samp{unofficial} or +lower. + +@subsection Options + +@table @option + +@item b +Set bitrate in bits per second. Only the following bitrates are supported, +otherwise libavcodec will round to the nearest valid bitrate. + +@table @option +@item 4750 +@item 5150 +@item 5900 +@item 6700 +@item 7400 +@item 7950 +@item 10200 +@item 12200 +@end table + +@item dtx +Allow discontinuous transmission (generate comfort noise) when set to 1. The +default value is 0 (disabled). + +@end table + @c man end AUDIO ENCODERS @chapter Video Encoders From cb0707479ce97bca41304de41c7e0dd8c22699ac Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 18 Jun 2013 16:01:43 -0700 Subject: [PATCH 229/328] doc/decoders: Document libgsm decoder Signed-off-by: Michael Niedermayer (cherry picked from commit c16496c3770fa083472ab86146c18dc96c1feea7) Signed-off-by: Timothy Gu --- doc/decoders.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 6a18c76a69..951fe6d03b 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -68,4 +68,14 @@ libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec. Requires the presence of the libcelt headers and library during configuration. You need to explicitly configure the build with @code{--enable-libcelt}. +@section libgsm + +libgsm decoder wrapper + +libgsm allows libavcodec to decode the GSM full rate audio codec. Requires +the presence of the libgsm headers and library during configuration. You need +to explicitly configure the build with @code{--enable-libgsm}. + +This decoder supports both the ordinary GSM and the Microsoft variant. + @c man end AUDIO DECODERS From 7c23166dd348eb3fb18849dee6fe2c4421d30f2c Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 20 Jun 2013 16:33:49 -0700 Subject: [PATCH 230/328] doc/decoders: Document libilbc decoder Signed-off-by: Michael Niedermayer (cherry picked from commit 8cdea50f6eee1271e24ff0c9590522f8323e87fe) Signed-off-by: Timothy Gu --- doc/decoders.texi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 951fe6d03b..0fe55e4eb3 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -78,4 +78,25 @@ to explicitly configure the build with @code{--enable-libgsm}. This decoder supports both the ordinary GSM and the Microsoft variant. +@section libilbc + +libilbc decoder wrapper + +libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC) +audio codec. Requires the presence of the libilbc headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libilbc}. + +@subsection Options + +The following option is supported by the libilbc wrapper. + +@table @option +@item enhance + +Enable the enhancement of the decoded audio when set to 1. The default +value is 0 (disabled). + +@end table + @c man end AUDIO DECODERS From ef5552a410743d77ae812c7d86981fbfcaf6acfa Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 20 Jun 2013 20:08:35 -0700 Subject: [PATCH 231/328] doc/decoders: Document libopencore-amrnb decoder Signed-off-by: Michael Niedermayer (cherry picked from commit b43860ee0c27279f2fa020ea965c03d359f8f45c) Signed-off-by: Timothy Gu --- doc/decoders.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 0fe55e4eb3..0ef9148281 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -99,4 +99,16 @@ value is 0 (disabled). @end table +@section libopencore-amrnb + +libopencore-amrnb decoder wrapper + +libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate +Narrowband audio codec. Using it requires the presence of the +libopencore-amrnb headers and library during configuration. You need to +explicitly configure the build with @code{--enable-libopencore-amrnb}. + +An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB +without this library. + @c man end AUDIO DECODERS From b4bc355523ba9c9f358838400f4a72d81a56b296 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 21 Jun 2013 18:17:21 +0200 Subject: [PATCH 232/328] doc/decoders: Add libopencore-amrwb decoder doc Signed-off-by: Stefano Sabatini (cherry picked from commit 83647ace735d1707d4b28345ef77fefe525ea52e) Signed-off-by: Timothy Gu --- doc/decoders.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 0ef9148281..f246fc443a 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -111,4 +111,16 @@ explicitly configure the build with @code{--enable-libopencore-amrnb}. An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB without this library. +@section libopencore-amrwb + +libopencore-amrwb decoder wrapper. + +libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate +Wideband audio codec. Using it requires the presence of the +libopencore-amrwb headers and library during configuration. You need to +explicitly configure the build with @code{--enable-libopencore-amrwb}. + +An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB +without this library. + @c man end AUDIO DECODERS From d616b63039499dc5a74fe8df264c9b84bec2f7ef Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 27 Jun 2013 18:50:54 -0700 Subject: [PATCH 233/328] doc/encoders: alphabetically list the encoders Signed-off-by: Stefano Sabatini (cherry picked from commit 934df3b0375743ae2b03168a4174edb9f88a6889) Signed-off-by: Timothy Gu Conflicts: doc/encoders.texi --- doc/encoders.texi | 74 +++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 1c8731c733..a3d434ccf0 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -441,6 +441,43 @@ Enables the the encoder to use (on a frame by frame basis) either L/R stereo or mid/side stereo. @end multitable +@section libopencore-amrnb + +OpenCORE Adaptive Multi-Rate Narrowband encoder. + +Requires the presence of the libopencore-amrnb headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libopencore-amrnb --enable-version3}. + +This is a mono-only encoder. Officially it only supports 8000Hz sample rate, +but you can override it by setting @option{strict} to @samp{unofficial} or +lower. + +@subsection Options + +@table @option + +@item b +Set bitrate in bits per second. Only the following bitrates are supported, +otherwise libavcodec will round to the nearest valid bitrate. + +@table @option +@item 4750 +@item 5150 +@item 5900 +@item 6700 +@item 7400 +@item 7950 +@item 10200 +@item 12200 +@end table + +@item dtx +Allow discontinuous transmission (generate comfort noise) when set to 1. The +default value is 0 (disabled). + +@end table + @section libtwolame TwoLAME MP2 encoder wrapper @@ -563,43 +600,6 @@ default value is 0 (disabled). @end table -@section libopencore-amrnb - -OpenCORE Adaptive Multi-Rate Narrowband encoder. - -Requires the presence of the libopencore-amrnb headers and library during -configuration. You need to explicitly configure the build with -@code{--enable-libopencore-amrnb --enable-version3}. - -This is a mono-only encoder. Officially it only supports 8000Hz sample rate, -but you can override it by setting @option{strict} to @samp{unofficial} or -lower. - -@subsection Options - -@table @option - -@item b -Set bitrate in bits per second. Only the following bitrates are supported, -otherwise libavcodec will round to the nearest valid bitrate. - -@table @option -@item 4750 -@item 5150 -@item 5900 -@item 6700 -@item 7400 -@item 7950 -@item 10200 -@item 12200 -@end table - -@item dtx -Allow discontinuous transmission (generate comfort noise) when set to 1. The -default value is 0 (disabled). - -@end table - @c man end AUDIO ENCODERS @chapter Video Encoders From 2f1370da22841cea3846e86f8cb87d669a396833 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 2 Jul 2013 19:32:27 -0700 Subject: [PATCH 234/328] doc/muxers: Add AIFF doc Signed-off-by: Stefano Sabatini (cherry picked from commit 4ec46b1160eb549a551823c168905b43922add31) Signed-off-by: Timothy Gu --- doc/muxers.texi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index 1685b12ceb..8fd7ecd312 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -18,6 +18,23 @@ enabled muxers. A description of some of the currently available muxers follows. +@anchor{aiff} +@section aiff + +Audio Interchange File Format muxer. + +It accepts the following options: + +@table @option +@item write_id3v2 +Enable ID3v2 tags writing when set to 1. Default is 0 (disabled). + +@item id3v2_version +Select ID3v2 version to write. Currently only version 3 and 4 (aka. +ID3v2.3 and ID3v2.4) are supported. The default is version 4. + +@end table + @anchor{crc} @section crc From cdfca17eb2656f375154192968b2e0a0ad73171a Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 29 Jul 2013 19:12:10 -0700 Subject: [PATCH 235/328] doc/encoders: add libxvid doc Signed-off-by: Stefano Sabatini (cherry picked from commit 6b255e5e70c72aa59ff7aed74b4ee976223eb140) Signed-off-by: Timothy Gu Conflicts: doc/encoders.texi --- doc/encoders.texi | 113 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index a3d434ccf0..e63049e024 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -779,4 +779,117 @@ ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv For more information about libx264 and the supported options see: @url{http://www.videolan.org/developers/x264.html} +@section libxvid + +Xvid MPEG-4 Part 2 encoder wrapper. + +This encoder requires the presence of the libxvidcore headers and library +during configuration. You need to explicitly configure the build with +@code{--enable-libxvid --enable-gpl}. + +The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so +users can encode to this format without this library. + +@subsection Options + +The following options are supported by the libxvid wrapper. Some of +the following options are listed but are not documented, and +correspond to shared codec options. See @ref{codec-options,,the Codec +Options chapter} for their documentation. The other shared options +which are not listed have no effect for the libxvid encoder. + +@table @option +@item b + +@item g + +@item qmin + +@item qmax + +@item mpeg_quant + +@item threads + +@item bf + +@item b_qfactor + +@item b_qoffset + +@item flags +Set specific encoding flags. Possible values: + +@table @samp + +@item mv4 +Use four motion vector by macroblock. + +@item aic +Enable high quality AC prediction. + +@item gray +Only encode grayscale. + +@item gmc +Enable the use of global motion compensation (GMC). + +@item qpel +Enable quarter-pixel motion compensation. + +@item cgop +Enable closed GOP. + +@item global_header +Place global headers in extradata instead of every keyframe. + +@end table + +@item trellis + +@item me_method +Set motion estimation method. Possible values in decreasing order of +speed and increasing order of quality: + +@table @samp +@item zero +Use no motion estimation (default). + +@item phods +@item x1 +@item log +Enable advanced diamond zonal search for 16x16 blocks and half-pixel +refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for +@samp{phods}. + +@item epzs +Enable all of the things described above, plus advanced diamond zonal +search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion +estimation on chroma planes. + +@item full +Enable all of the things described above, plus extended 16x16 and 8x8 +blocks search. +@end table + +@item mbd +Set macroblock decision algorithm. Possible values in the increasing +order of quality: + +@table @samp +@item simple +Use macroblock comparing function algorithm (default). + +@item bits +Enable rate distortion-based half pixel and quarter pixel refinement for +16x16 blocks. + +@item rd +Enable all of the things described above, plus rate distortion-based +half pixel and quarter pixel refinement for 8x8 blocks, and rate +distortion-based search using square pattern. +@end table + +@end table + @c man end VIDEO ENCODERS From b2d6f63ed9d74c2b86f881b4e0aec04b9586f7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Wed, 19 Dec 2012 03:38:57 +0100 Subject: [PATCH 236/328] doc: remove mention of fifo filter in the introduction. It's confusing and not necessary, especially in the introduction. (cherry picked from commit 80a9297b711b7acb152ebbf84b28772945f920ea) Signed-off-by: Timothy Gu --- doc/filters.texi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 56e090f830..64ce647d0b 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16,10 +16,10 @@ To illustrate the sorts of things that are possible, we can use a complex filter graph. For example, the following one: @example -input --> split --> fifo -----------------------> overlay --> output - | ^ - | | - +------> fifo --> crop --> vflip --------+ +input --> split ---------------------> overlay --> output + | ^ + | | + +-----> crop --> vflip -------+ @end example splits the stream in two streams, sends one stream through the crop filter @@ -27,7 +27,7 @@ and the vflip filter before merging it back with the other stream by overlaying it on top. You can use the following command to achieve this: @example -ffmpeg -i input -vf "[in] split [T1], fifo, [T2] overlay=0:H/2 [out]; [T1] fifo, crop=iw:ih/2:0:ih/2, vflip [T2]" output +ffmpeg -i input -vf "[in] split [T1], [T2] overlay=0:H/2 [out]; [T1] crop=iw:ih/2:0:ih/2, vflip [T2]" output @end example The result will be that in output the top half of the video is mirrored @@ -35,8 +35,8 @@ onto the bottom half. Filters are loaded using the @var{-vf} or @var{-af} option passed to @command{ffmpeg} or to @command{ffplay}. Filters in the same linear -chain are separated by commas. In our example, @var{split, fifo, -overlay} are in one linear chain, and @var{fifo, crop, vflip} are in +chain are separated by commas. In our example, @var{split, +overlay} are in one linear chain, and @var{crop, vflip} are in another. The points where the linear chains join are labeled by names enclosed in square brackets. In our example, that is @var{[T1]} and @var{[T2]}. The special labels @var{[in]} and @var{[out]} are the points From 167278f377d8d124c43e525341b78c62bc6b1ed4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 18 Aug 2013 02:20:54 +0200 Subject: [PATCH 237/328] avformat/matroskadec: check out_samplerate before using it in av_rescale() Prevent assertion failure with damaged input Signed-off-by: Michael Niedermayer (cherry picked from commit 338f8b2eaf36f078eb5cc26ac10e651dc4c48243) --- libavformat/matroskadec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index fc584bce86..f3b90a9cb6 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1664,6 +1664,8 @@ static int matroska_read_header(AVFormatContext *s) avio_wl16(&b, 1); avio_wl16(&b, track->audio.channels); avio_wl16(&b, track->audio.bitdepth); + if (track->audio.out_samplerate < 0 || track->audio.out_samplerate > INT_MAX) + return AVERROR_INVALIDDATA; avio_wl32(&b, track->audio.out_samplerate); avio_wl32(&b, av_rescale((matroska->duration * matroska->time_scale), track->audio.out_samplerate, AV_TIME_BASE * 1000)); } else if (codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 || From 7364109d255ff5583c9a3930830e28f5b1f0adce Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 26 Aug 2013 16:28:54 -0700 Subject: [PATCH 238/328] doc/encoders: Remove reference to "Codec Options" chapter The chapter is only presented in later release branches. --- doc/encoders.texi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index e63049e024..6ed45d8d8f 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -794,8 +794,7 @@ users can encode to this format without this library. The following options are supported by the libxvid wrapper. Some of the following options are listed but are not documented, and -correspond to shared codec options. See @ref{codec-options,,the Codec -Options chapter} for their documentation. The other shared options +correspond to shared codec options. The other shared options which are not listed have no effect for the libxvid encoder. @table @option From bb7f5e153eed9a276d61321b7f4bd470bb1b9f81 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 24 Oct 2012 16:39:32 +0200 Subject: [PATCH 239/328] doc/texi2pod.pl: drop unnecessary rule, which was converting "\," to "," I cannot find a reason for such a rule, which was resulting in badly escaped filtergraph snippets. Fix trac ticket #1610. (cherry picked from commit ce875a613a16b06b0a561774955111f7a24d12bb) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 5e8814feff..a057651175 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -211,7 +211,6 @@ INF: while(<$inf>) { s/\@TeX\{\}/TeX/g; s/\@pounds\{\}/\#/g; s/\@minus(?:\{\})?/-/g; - s/\\,/,/g; # Now the ones that have to be replaced by special escapes # (which will be turned back into text by unmunge()) From deb9fb5257421051242594ae8707039b0dccac0b Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 11 Nov 2012 18:44:10 +0100 Subject: [PATCH 240/328] doc/texi2pod: recognize @table @command. (cherry picked from commit ee2d6fbc92e6d55dda319fa56234c5be9a476728) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index a057651175..d20fac6bf6 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -268,7 +268,7 @@ INF: while(<$inf>) { push @icstack, $ic; $endw = $1; $ic = $2; - $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env)/B/; + $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env|command)/B/; $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; From 7e017b9cbff148b3491ec919dbaeb37919672213 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 16 Dec 2012 20:16:43 +0100 Subject: [PATCH 241/328] doc/texi2pod: add support to @ifhtml and @ifnothtml directives With these commands it is possible to add HTML and non-HTML snippets, which will be useful for the "See Also" manual chapters. (cherry picked from commit f14e248783f45a698947a2ed6e2c82069db46bc8) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index d20fac6bf6..6702d7a542 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -150,14 +150,14 @@ INF: while(<$inf>) { # Ignore @end foo, where foo is not an operation which may # cause us to skip, if we are presently skipping. my $ended = $1; - next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/; + next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/; die "\@end $ended without \@$ended at line $.\n" unless defined $endw; die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; $endw = pop @endwstack; - if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { + if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/) { $skipping = pop @skstack; next; } elsif ($ended =~ /^(?:example|smallexample|display)$/) { @@ -190,11 +190,11 @@ INF: while(<$inf>) { next; }; - /^\@(ignore|menu|iftex)\b/ and do { + /^\@(ignore|menu|iftex|ifhtml|ifnothtml)\b/ and do { push @endwstack, $endw; push @skstack, $skipping; $endw = $1; - $skipping = 1; + $skipping = $endw !~ /ifnothtml/; next; }; From ada4f4f715c45809c401b965ac0f9af83fb6b676 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 17 Dec 2012 14:29:17 +0100 Subject: [PATCH 242/328] doc/texi2pod: correctly handle @url commands in the form @url{URL,...} Ignore the other arguments, which have not to be processed by the POD renderer. (cherry picked from commit 1f9855dbc1102e63fa7ce932d0edf0d545c89b09) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 6702d7a542..bf333b891b 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -365,7 +365,7 @@ sub postprocess # @uref can take one, two, or three arguments, with different # semantics each time. @url and @email are just like @uref with # one argument, for our purposes. - s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g; + s/\@(?:uref|url|email)\{([^\},]*),?[^\}]*\}/<B<$1>>/g; s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; From df21807141850d4a09c87b5091aebe487cb1c514 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 12 Jan 2013 00:53:42 +0100 Subject: [PATCH 243/328] doc/texipod: add rule to correctly interpret @ref{ANCHOR,XREF,SECTION_NAME,...} This allows to name an internal reference in the POD/MAN output. (cherry picked from commit c499d45c6bea8d7bbbb7a819c53fe9766136bf29) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index bf333b891b..95e52f545e 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -356,6 +356,7 @@ sub postprocess s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; + s/\@ref\{(?:[^,]*,)(?:[^,]*,)([^,\}]*).*\}/$1/g; s/\@ref\{([^\}]*)\}/$1/g; s/\@noindent\s*//g; s/\@refill//g; From 90b73f25678e029f14a7aac85746ddb59f08cadd Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Wed, 23 Jan 2013 11:43:37 +0100 Subject: [PATCH 244/328] doc: support multitable in texi2pod (cherry picked from commit 5ea5ffc9cee1b91eed471fff2f51d771222cf8d2) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 95e52f545e..52af39f162 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -163,7 +163,7 @@ INF: while(<$inf>) { } elsif ($ended =~ /^(?:example|smallexample|display)$/) { $shift = ""; $_ = ""; # need a paragraph break - } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) { + } elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) { $_ = "\n=back\n"; $ic = pop @icstack; } else { @@ -263,7 +263,7 @@ INF: while(<$inf>) { $endw = "enumerate"; }; - /^\@([fv]?table)\s+(\@[a-z]+)/ and do { + /^\@((?:multi|[fv])?table)\s+(\@[a-z]+)/ and do { push @endwstack, $endw; push @icstack, $ic; $endw = $1; @@ -272,6 +272,7 @@ INF: while(<$inf>) { $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; + $ic =~ s/\@(?:columnfractions)//; $_ = "\n=over 4\n"; }; @@ -282,6 +283,21 @@ INF: while(<$inf>) { $_ = ""; # need a paragraph break }; + /^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do { + my $columns = $1; + $columns =~ s/\@tab/ : /; + + $_ = "\n=item B<". $columns .">\n"; + }; + + /^\@tab\s+(.*\S)\s*$/ and $endw eq "multitable" and do { + my $columns = $1; + $columns =~ s/\@tab/ : /; + + $_ = " : ". $columns; + $section =~ s/\n+\s+$//; + }; + /^\@itemx?\s*(.+)?$/ and do { if (defined $1) { # Entity escapes prevent munging by the <> processing below. From 6002f123bd8877e694eaca1f9e9b953e4d76894d Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 26 Jan 2013 15:10:55 +0100 Subject: [PATCH 245/328] doc/texi2pod: fix warnings introduced in e7e14bc69a606a6bec82efef729263cd38f122d4 The variable "$section" was replaced by "$chapter". (cherry picked from commit c0c06c1bba80c4bee162a3c40eec678ddc65571d) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 52af39f162..8e09c09125 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -295,7 +295,7 @@ INF: while(<$inf>) { $columns =~ s/\@tab/ : /; $_ = " : ". $columns; - $section =~ s/\n+\s+$//; + $chapter =~ s/\n+\s+$//; }; /^\@itemx?\s*(.+)?$/ and do { From 8c4261f411c542830943fb6381daff7dc422b846 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 7 Mar 2013 01:43:39 +0100 Subject: [PATCH 246/328] doc/texi2pod: fix @ref substitution rule, disallow "}" within the fields Fix potential spurious substitution. (cherry picked from commit 9167db3829f360f241255d4240ba6b7135ab4111) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 8e09c09125..20ca764a1a 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -372,7 +372,7 @@ sub postprocess s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; - s/\@ref\{(?:[^,]*,)(?:[^,]*,)([^,\}]*).*\}/$1/g; + s/\@ref\{(?:[^,\}]*,)(?:[^,\}]*,)([^,\}]*).*\}/$1/g; s/\@ref\{([^\}]*)\}/$1/g; s/\@noindent\s*//g; s/\@refill//g; From cf377add098e2c1bf652ffb09f6dd1a692315c20 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 16 Dec 2012 17:45:59 +0100 Subject: [PATCH 247/328] doc/texi2pod: rework man inclusion logic Ignore @c man begin ... @c man end comments, rely on @chapter for marking the beginning of the various manual top level sections. This allows us to write markup which is not dependent on the specific texi2pod.pl implementation. This change causes a few rendering issues, which will be fixed in further patches. (cherry picked from commit ca3d786227adf20f4e19809090c980d6d1109bf8) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 57 +++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 20ca764a1a..697576c185 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -27,9 +27,9 @@ use warnings; $output = 0; $skipping = 0; -%sects = (); -@sects_sequence = (); -$section = ""; +%chapters = (); +@chapters_sequence = (); +$chapter = ""; @icstack = (); @endwstack = (); @skstack = (); @@ -116,18 +116,24 @@ INF: while(<$inf>) { die "cannot open $1: $!\n"; }; - # Look for blocks surrounded by @c man begin SECTION ... @c man end. - # This really oughta be @ifman ... @end ifman and the like, but such - # would require rev'ing all other Texinfo translators. - /^\@c\s+man\s+begin\s+([A-Za-z ]+)/ and $sect = $1, push (@sects_sequence, $sect), $output = 1, next; - /^\@c\s+man\s+end/ and do { - $sects{$sect} = "" unless exists $sects{$sect}; - $sects{$sect} .= postprocess($section); - $section = ""; - $output = 0; + /^\@chapter\s+([A-Za-z ]+)/ and do { + # close old chapter + $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); + + # start new chapter + $chapter_name = $1, push (@chapters_sequence, $chapter_name); + $chapters{$chapter_name} = "" unless exists $chapters{$chapter_name}; + $chapter = ""; + $output = 1; next; }; + /^\@bye/ and do { + # close old chapter + $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); + last INF; + }; + # handle variables /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { $defs{$1} = $2; @@ -309,7 +315,7 @@ INF: while(<$inf>) { } }; - $section .= $shift.$_."\n"; + $chapter .= $shift.$_."\n"; } # End of current file. close($inf); @@ -318,16 +324,15 @@ $inf = pop @instack; die "No filename or title\n" unless defined $fn && defined $tl; -$sects{NAME} = "$fn \- $tl\n"; -$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; +$chapters{NAME} = "$fn \- $tl\n"; +$chapters{FOOTNOTES} .= "=back\n" if exists $chapters{FOOTNOTES}; -unshift @sects_sequence, "NAME"; -for $sect (@sects_sequence) { - if(exists $sects{$sect}) { - $head = $sect; - $head =~ s/SEEALSO/SEE ALSO/; +unshift @chapters_sequence, "NAME"; +for $chapter (@chapters_sequence) { + if (exists $chapters{$chapter}) { + $head = uc($chapter); print "=head1 $head\n\n"; - print scalar unmunge ($sects{$sect}); + print scalar unmunge ($chapters{$chapter}); print "\n"; } } @@ -426,13 +431,13 @@ sub unmunge sub add_footnote { - unless (exists $sects{FOOTNOTES}) { - $sects{FOOTNOTES} = "\n=over 4\n\n"; + unless (exists $chapters{FOOTNOTES}) { + $chapters{FOOTNOTES} = "\n=over 4\n\n"; } - $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; - $sects{FOOTNOTES} .= $_[0]; - $sects{FOOTNOTES} .= "\n\n"; + $chapters{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; + $chapters{FOOTNOTES} .= $_[0]; + $chapters{FOOTNOTES} .= "\n\n"; } # stolen from Symbol.pm From 23eb5a026980c52d16429bbf2e92d1786f64efb9 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 19 Mar 2013 20:34:42 +0100 Subject: [PATCH 248/328] doc/texi2pod.pl: skip printing chapter names if they are disabled (cherry picked from commit c838701ce4515bd51f7827be0b20f256ba5c69f3) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 697576c185..610f349afb 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -121,7 +121,7 @@ INF: while(<$inf>) { $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); # start new chapter - $chapter_name = $1, push (@chapters_sequence, $chapter_name); + $chapter_name = $1, push (@chapters_sequence, $chapter_name) unless $skipping; $chapters{$chapter_name} = "" unless exists $chapters{$chapter_name}; $chapter = ""; $output = 1; From 51daca6c5776a3f00bfdd618a60dab322a85d7d3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 May 2013 04:00:30 +0200 Subject: [PATCH 249/328] matroska_read_seek: Fix used streams for subtitle index compensation Might fix Ticket1907 (I have no testcase so i cant test) Signed-off-by: Michael Niedermayer (cherry picked from commit 4758e32a6c48044f77102a49110c79b4f338f648) Signed-off-by: Michael Niedermayer --- libavformat/matroskadec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 5783acacfb..2663158e45 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2406,10 +2406,11 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE && !tracks[i].stream->discard != AVDISCARD_ALL) { index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD); - if (index_sub >= 0 - && st->index_entries[index_sub].pos < st->index_entries[index_min].pos - && st->index_entries[index].timestamp - st->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale) - index_min = index_sub; + while(index_sub >= 0 + && index_min >= 0 + && tracks[i].stream->index_entries[index_sub].pos < st->index_entries[index_min].pos + && st->index_entries[index].timestamp - tracks[i].stream->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale) + index_min--; } } From 278fbfc6bf3a501eb0af5ce07a528785ce8715a7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 9 Aug 2013 13:23:10 +0200 Subject: [PATCH 250/328] avformat/paf: Fix integer overflow and out of array read Found-by: Laurent Butti Signed-off-by: Michael Niedermayer (cherry picked from commit f58cd2867a8af2eed13acdd21d067b48249b14a1) Signed-off-by: Michael Niedermayer --- libavformat/paf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/paf.c b/libavformat/paf.c index 8fe2ac5638..e695ace35e 100644 --- a/libavformat/paf.c +++ b/libavformat/paf.c @@ -231,10 +231,11 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) p->current_frame_block++; } - size = p->video_size - p->frames_offset_table[p->current_frame]; - if (size < 1) + if (p->frames_offset_table[p->current_frame] >= p->video_size) return AVERROR_INVALIDDATA; + size = p->video_size - p->frames_offset_table[p->current_frame]; + if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); From 65753697efdb9e4dd61f4ba582bd04476acdc69a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 20 Aug 2013 23:18:48 +0200 Subject: [PATCH 251/328] avcodec/flashsv: check diff_start/height Fixes out of array accesses Fixes Ticket2844 Found-by: ami_stuff Signed-off-by: Michael Niedermayer (cherry picked from commit 880c73cd76109697447fbfbaa8e5ee5683309446) Signed-off-by: Michael Niedermayer --- libavcodec/flashsv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 1d94efdb83..db956cb5bd 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -373,6 +373,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, if (has_diff) { s->diff_start = get_bits(&gb, 8); s->diff_height = get_bits(&gb, 8); + if (s->diff_start + s->diff_height > cur_blk_height) { + av_log(avctx, AV_LOG_ERROR, "Block parameters invalid\n"); + return AVERROR_INVALIDDATA; + } av_log(avctx, AV_LOG_DEBUG, "%dx%d diff start %d height %d\n", i, j, s->diff_start, s->diff_height); From 7549bcb295f04071dcbfc7a412e0618fb38dd8a3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 22 Aug 2013 01:07:32 +0200 Subject: [PATCH 252/328] avcodec/rpza: Perform pointer advance and checks before using the pointers Fixes out of array accesses Fixes Ticket2850 Signed-off-by: Michael Niedermayer (cherry picked from commit 3819db745da2ac7fb3faacb116788c32f4753f34) Signed-off-by: Michael Niedermayer --- libavcodec/rpza.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index b12bf04fa2..d37990aa74 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -84,7 +84,7 @@ static void rpza_decode_stream(RpzaContext *s) unsigned short *pixels = (unsigned short *)s->frame.data[0]; int row_ptr = 0; - int pixel_ptr = 0; + int pixel_ptr = -4; int block_ptr; int pixel_x, pixel_y; int total_blocks; @@ -140,6 +140,7 @@ static void rpza_decode_stream(RpzaContext *s) colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; while (n_blocks--) { + ADVANCE_BLOCK() block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ @@ -148,7 +149,6 @@ static void rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); } break; @@ -187,6 +187,7 @@ static void rpza_decode_stream(RpzaContext *s) if (s->size - stream_ptr < n_blocks * 4) return; while (n_blocks--) { + ADVANCE_BLOCK(); block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { index = s->buf[stream_ptr++]; @@ -197,7 +198,6 @@ static void rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); } break; @@ -205,6 +205,7 @@ static void rpza_decode_stream(RpzaContext *s) case 0x00: if (s->size - stream_ptr < 16) return; + ADVANCE_BLOCK(); block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ @@ -218,7 +219,6 @@ static void rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); break; /* Unknown opcode */ From f229c598939c34df75db7845495f077b49e233d4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 24 Aug 2013 03:19:40 +0200 Subject: [PATCH 253/328] jpeg2000: check log2_cblk dimensions Fixes out of array access Fixes Ticket2895 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 9a271a9368eaabf99e6c2046103acb33957e63b7) Conflicts: libavcodec/jpeg2000dec.c Signed-off-by: Michael Niedermayer --- libavcodec/j2kdec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c index b3ba8fc0c9..d1de0b9810 100644 --- a/libavcodec/j2kdec.c +++ b/libavcodec/j2kdec.c @@ -30,6 +30,7 @@ #include "avcodec.h" #include "bytestream.h" #include "j2k.h" +#include "libavutil/avassert.h" #include "libavutil/common.h" #define JP2_SIG_TYPE 0x6A502020 @@ -298,6 +299,10 @@ static int get_cox(J2kDecoderContext *s, J2kCodingStyle *c) c->log2_cblk_width = bytestream2_get_byteu(&s->g) + 2; // cblk width c->log2_cblk_height = bytestream2_get_byteu(&s->g) + 2; // cblk height + if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) { + return AVERROR_PATCHWELCOME; + } + c->cblk_style = bytestream2_get_byteu(&s->g); if (c->cblk_style != 0){ // cblk style av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style); @@ -715,6 +720,9 @@ static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Contex int bpass_csty_symbol = J2K_CBLK_BYPASS & codsty->cblk_style; int vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style; + av_assert0(width <= J2K_MAX_CBLKW); + av_assert0(height <= J2K_MAX_CBLKH); + for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); From 5bd2b24db399d9821a0396f96dc8e2392d80abe1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 30 Aug 2013 23:14:32 +0200 Subject: [PATCH 254/328] avcodec/pngdsp: fix (un)signed type in end comparission Fixes out of array accesses Fixes Ticket2919 Found_by: ami_stuff Signed-off-by: Michael Niedermayer (cherry picked from commit 86736f59d6a527d8bc807d09b93f971c0fe0bb07) --- libavcodec/pngdsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdsp.c b/libavcodec/pngdsp.c index 75ec996ca1..eb8c6b23eb 100644 --- a/libavcodec/pngdsp.c +++ b/libavcodec/pngdsp.c @@ -30,7 +30,7 @@ static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w) { long i; - for (i = 0; i <= w - sizeof(long); i += sizeof(long)) { + for (i = 0; i <= w - (int)sizeof(long); i += sizeof(long)) { long a = *(long *)(src1 + i); long b = *(long *)(src2 + i); *(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80); From 6b5c4be9e0b59b55f7c74466f0d6225623687c61 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 31 Aug 2013 03:08:25 +0200 Subject: [PATCH 255/328] avformat/avidec: match first index and first packet size=0 handling Fixes Ticket2861 Signed-off-by: Michael Niedermayer (cherry picked from commit 227a0eb5a92409572f2cecde6137529b83e7d495) Conflicts: libavformat/avidec.c --- libavformat/avidec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index cf5f86fba8..ce621d6729 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1288,7 +1288,7 @@ static int avi_read_idx1(AVFormatContext *s, int size) st = s->streams[index]; ast = st->priv_data; - if(first_packet && first_packet_pos && len) { + if (first_packet && first_packet_pos) { data_offset = first_packet_pos - pos; first_packet = 0; } From 7599284ad34972e4a0680f0f8f4a51e30ec86b3e Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 2 Sep 2013 08:32:24 +0200 Subject: [PATCH 256/328] Avoid a deadlock when decoding wma. Fixes ticket #2925. (cherry picked from commit ec8a4841f7e81040f9a2757f23e70dff5e6b33a4) --- libavcodec/wmadec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index 39e50a4ffd..fa0d747f8a 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -524,6 +524,10 @@ static int wma_decode_block(WMACodecContext *s) coef escape coding */ total_gain = 1; for(;;) { + if (get_bits_left(&s->gb) < 7) { + av_log(s->avctx, AV_LOG_ERROR, "total_gain overread\n"); + return AVERROR_INVALIDDATA; + } a = get_bits(&s->gb, 7); total_gain += a; if (a != 127) From e12ada6fd1e5860cdbb328eddbcb51c52d2054ca Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 30 Aug 2013 23:40:47 +0200 Subject: [PATCH 257/328] avcodec/dsputil: fix signedness in sizeof() comparissions Signed-off-by: Michael Niedermayer (cherry picked from commit 454a11a1c9c686c78aa97954306fb63453299760) Signed-off-by: Michael Niedermayer --- libavcodec/dsputil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index af939b1f34..2a981902d4 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1922,7 +1922,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){ static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ long i; - for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ + for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){ long a = *(long*)(src+i); long b = *(long*)(dst+i); *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); @@ -1947,7 +1947,7 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, } }else #endif - for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ + for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){ long a = *(long*)(src1+i); long b = *(long*)(src2+i); *(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80); From 11586b077e6e81bc390b6df657429b4a39741d2f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 2 Sep 2013 04:32:23 +0200 Subject: [PATCH 258/328] avfilter/vf_fps: make sure the fifo is not empty before using it Fixes Ticket2905 Signed-off-by: Michael Niedermayer (cherry picked from commit cdd5df8189ff1537f7abe8defe971f80602cc2d2) Signed-off-by: Michael Niedermayer --- libavfilter/vf_fps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index c13b1bd385..3d355cff1a 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -201,7 +201,7 @@ static int end_frame(AVFilterLink *inlink) } /* now wait for the next timestamp */ - if (buf->pts == AV_NOPTS_VALUE) { + if (buf->pts == AV_NOPTS_VALUE || av_fifo_size(s->fifo) <= 0) { return write_to_fifo(s->fifo, buf); } From 49237131e98010e0afe13276bcec7a3afff703f6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 5 Sep 2013 00:36:44 +0200 Subject: [PATCH 259/328] avcodec/mjpegdec: Add some sanity checks to ljpeg_decode_rgb_scan() These prevent the rgb ljpeg code from being run on parameters that it doesnt support. No testcase available but it seems possible to trigger these. Signed-off-by: Michael Niedermayer (cherry picked from commit 61c68000eda643dfce96dc46b488d39fd5c4e309) Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 814571f3bc..4d347af913 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -718,6 +718,12 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p int resync_mb_y = 0; int resync_mb_x = 0; + if (s->nb_components != 3 && s->nb_components != 4) + return AVERROR_INVALIDDATA; + if (s->v_max != 1 || s->h_max != 1 || !s->lossless) + return AVERROR_INVALIDDATA; + + s->restart_count = s->restart_interval; av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size, From fcd46cfbbd90564232dc10a2d4753bf0f251ae98 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 6 Sep 2013 02:53:38 +0200 Subject: [PATCH 260/328] update for 1.0.8 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index fe6b15c332..86936368b7 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.7 +PROJECT_NUMBER = 1.0.8 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 238d6e882a..b0f3d96f87 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.7 +1.0.8 diff --git a/VERSION b/VERSION index 238d6e882a..b0f3d96f87 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.7 +1.0.8 From 8b282d9d8b786397b75e11c74529d0ad033f76f0 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sun, 8 Sep 2013 12:35:31 +0000 Subject: [PATCH 261/328] avformat/matroskaenc: remove bogus prores tag Fixes: ffmpeg -i input -c:v prores output.mkv Signed-off-by: Paul B Mahol (cherry picked from commit 14851ca5f5a3af140085e82589e28e06c7cdefdc) Conflicts: libavformat/matroskaenc.c --- libavformat/matroskaenc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index bfe3fb9ebe..e599970a3d 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1355,7 +1355,6 @@ const AVCodecTag additional_audio_tags[] = { }; const AVCodecTag additional_video_tags[] = { - { AV_CODEC_ID_PRORES, 0xFFFFFFFF }, { AV_CODEC_ID_RV10, 0xFFFFFFFF }, { AV_CODEC_ID_RV20, 0xFFFFFFFF }, { AV_CODEC_ID_RV30, 0xFFFFFFFF }, From 1cfcc9ac8ec6885d370ae6152b46f2969cdff563 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 4 Oct 2013 17:39:19 +0200 Subject: [PATCH 262/328] avformat/mov: force parsing of headers if stts is absent Fixes Ticket2991 Signed-off-by: Michael Niedermayer (cherry picked from commit e41ea866fc26f38d770bbc1ad67703e7f4400ae1) --- libavformat/mov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4c6155895e..bd408afbb6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1669,6 +1669,8 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!entries) { sc->keyframe_absent = 1; + if (!st->need_parsing) + st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (entries >= UINT_MAX / sizeof(int)) From e3b2b884fc337d438e961ade6a435e846e8903f4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 9 Oct 2013 23:52:54 +0200 Subject: [PATCH 263/328] avcodec/h264_refs: modify key frame detection heuristic to detect more cases Fixes Ticket2968 Signed-off-by: Michael Niedermayer (cherry picked from commit 5ac6b6028f17b64723884c9fa72cfcbd369a1ba2) Conflicts: libavcodec/h264_refs.c (cherry picked from commit 6636dd551fda4fac77f2caa25d24d81abcadcd71) --- libavcodec/h264_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index d72c498e7f..37372ef483 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -690,7 +690,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ print_short_term(h); print_long_term(h); - if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (s->picture_structure != PICT_FRAME) && s->current_picture_ptr->f.pict_type == AV_PICTURE_TYPE_I){ + if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=2 + (s->picture_structure != PICT_FRAME) && s->current_picture_ptr->f.pict_type == AV_PICTURE_TYPE_I){ s->current_picture_ptr->sync |= 1; if(!h->s.avctx->has_b_frames) h->sync = 2; From 3c142c196d41db025ead08a2c98edb98ca4ab0af Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 6 Oct 2013 00:07:28 +0200 Subject: [PATCH 264/328] avformat/matroskadec: only set r_frame_rate if the value is within reasonable limits Fixes Ticket2451 Signed-off-by: Michael Niedermayer (cherry picked from commit 6853e40106cac769f0641183ea0bdd530ae9a0a1) --- libavformat/matroskadec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index fbc1d40310..9a0121a931 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1756,7 +1756,8 @@ static int matroska_read_header(AVFormatContext *s) av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, 1000000000, track->default_duration, 30000); #if FF_API_R_FRAME_RATE - st->r_frame_rate = st->avg_frame_rate; + if (st->avg_frame_rate.num < st->avg_frame_rate.den * 1000L) + st->r_frame_rate = st->avg_frame_rate; #endif } From 89b5f5f494a2387541de8960839c2539a73a31fa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 9 Oct 2013 21:43:06 +0200 Subject: [PATCH 265/328] avformat/wavdec: Dont trust the fact chunk for PCM Fixes Ticket3033 Signed-off-by: Michael Niedermayer (cherry picked from commit 83fc6c822b06688e572333299927d93eb3c6c426) Conflicts: libavformat/wav.c --- libavformat/wav.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavformat/wav.c b/libavformat/wav.c index ec527b8619..4648486c00 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -546,8 +546,15 @@ break_loop: avio_seek(pb, data_ofs, SEEK_SET); - if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) - sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); + if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0) + if ( st->codec->channels + && data_size + && av_get_bits_per_sample(st->codec->codec_id) + && wav->data_end <= avio_size(pb)) + sample_count = (data_size << 3) + / + (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); + if (sample_count) st->duration = sample_count; From 946815aa097470127d3d97534cf6a29f7310982c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 25 Oct 2013 20:03:29 +0200 Subject: [PATCH 266/328] avcodec/h264: reduce noisiness of "mmco: unref short failure" Do not consider it an error if we have no frames and should discard one. This condition can easily happen when decoding is started from an I frame Fixes Ticket2811 Signed-off-by: Michael Niedermayer (cherry picked from commit 08a89761964bdd0a023eff6d37a1131fb7e1d7a0) Conflicts: libavcodec/h264_refs.c --- libavcodec/h264_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 37372ef483..7c73cd9eaf 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -553,7 +553,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ if(!pic){ if(mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg] || h->long_ref[mmco[i].long_arg]->frame_num != frame_num) { - av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short failure\n"); + av_log(h->s.avctx, h->short_ref_count ? AV_LOG_ERROR : AV_LOG_DEBUG, "mmco: unref short failure\n"); err = AVERROR_INVALIDDATA; } continue; From 65daa390f87f6cb861e959bf0d4edc14cb63068d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 Oct 2013 01:03:19 +0200 Subject: [PATCH 267/328] avformat/utils: do not override pts in h264 when they are provided from the demuxer Fixes Ticket2143 Signed-off-by: Michael Niedermayer (cherry picked from commit 1e5271a9fd6ddcceb083f2185a4bbd8d44c9a813) --- libavformat/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index b4a8a1fbf2..e5fbc4b6c5 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1106,12 +1106,14 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, if (pkt->dts != AV_NOPTS_VALUE) { // got DTS from the stream, update reference timestamp st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den; - pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; } else if (st->reference_dts != AV_NOPTS_VALUE) { // compute DTS based on reference timestamp pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den; - pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; } + + if (st->reference_dts != AV_NOPTS_VALUE && pkt->pts == AV_NOPTS_VALUE) + pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; + if (pc->dts_sync_point > 0) st->reference_dts = pkt->dts; // new reference } From 0227ecc21f1a1247a5a55da1a3628283f606837b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Fri, 8 Nov 2013 23:55:06 +0100 Subject: [PATCH 268/328] build: avoid stdin stall with GNU AS probing. a758c5e added probing for various tools, such as AS. Unfortunately, GNU AS is reading stdin with -v, and thus configure is stalled with configure arguments such as --as=as. Fixes Ticket #1898. (cherry picked from commit dbb41f93c16cbc65a899a75723c95da51c851cd5) --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 71396b2e72..96b72bfc23 100755 --- a/configure +++ b/configure @@ -2495,7 +2495,9 @@ probe_cc(){ unset _depflags _DEPCMD _DEPFLAGS _flags_filter=echo - if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then + if $_cc --version 2>&1 | grep -q '^GNU assembler'; then + true # no-op to avoid reading stdin in following checks + elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then _type=llvm_gcc gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)') _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver" From cebad79898a4b65d7c7ca66ba21a6cdb66e7bbd1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 18 Nov 2013 03:02:36 +0100 Subject: [PATCH 269/328] avformat/utils: dont count attached pics toward the probesize Such pics behave more like headers which we also dont count. Fixes Ticket3146 Signed-off-by: Michael Niedermayer (cherry picked from commit a8dec360c5db15e8da4b44ff3c0f02a6c57e8ac0) --- libavformat/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index e5fbc4b6c5..18a0165dbc 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2702,9 +2702,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) goto find_stream_info_err; } - read_size += pkt->size; - st = ic->streams[pkt->stream_index]; + if (!(st->disposition & AV_DISPOSITION_ATTACHED_PIC)) + read_size += pkt->size; + if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) { /* check for non-increasing dts */ if (st->info->fps_last_dts != AV_NOPTS_VALUE && From e28d96024bdf3016b9de468981e7b4a64ebe848b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 5 Dec 2013 01:41:10 +0100 Subject: [PATCH 270/328] avcodec/cabac: force get_cabac to be not inlined works around bug in gccs inline asm register assignment Fixes Ticket3177 gcc from 4.4 to 4.6 is affected at least, no non affected gccs known clang seems not affected Signed-off-by: Michael Niedermayer (cherry picked from commit 0538b29ae8002c44f27bae8a1a6fc6e646998be5) --- libavcodec/cabac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c index 385721fe1d..d8f34c8602 100644 --- a/libavcodec/cabac.c +++ b/libavcodec/cabac.c @@ -305,7 +305,7 @@ STOP_TIMER("get_cabac_bypass") for(i=0; i Date: Fri, 20 Dec 2013 15:02:35 +0200 Subject: [PATCH 271/328] arm: Don't clobber callee saved registers in scalarproduct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit q4-q7/d8-d15 are supposed to not be clobbered by the callee. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö (cherry picked from commit d307e408d4a9ada22df443cc38be77cc5e492694) --- libavcodec/arm/int_neon.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/arm/int_neon.S b/libavcodec/arm/int_neon.S index bce84516c6..2ccb4180cd 100644 --- a/libavcodec/arm/int_neon.S +++ b/libavcodec/arm/int_neon.S @@ -42,10 +42,10 @@ function ff_scalarproduct_int16_neon, export=1 vpadd.s32 d16, d0, d1 vpadd.s32 d17, d2, d3 - vpadd.s32 d10, d4, d5 - vpadd.s32 d11, d6, d7 + vpadd.s32 d18, d4, d5 + vpadd.s32 d19, d6, d7 vpadd.s32 d0, d16, d17 - vpadd.s32 d1, d10, d11 + vpadd.s32 d1, d18, d19 vpadd.s32 d2, d0, d1 vpaddl.s32 d3, d2 vmov.32 r0, d3[0] @@ -82,10 +82,10 @@ function ff_scalarproduct_and_madd_int16_neon, export=1 vpadd.s32 d16, d0, d1 vpadd.s32 d17, d2, d3 - vpadd.s32 d10, d4, d5 - vpadd.s32 d11, d6, d7 + vpadd.s32 d18, d4, d5 + vpadd.s32 d19, d6, d7 vpadd.s32 d0, d16, d17 - vpadd.s32 d1, d10, d11 + vpadd.s32 d1, d18, d19 vpadd.s32 d2, d0, d1 vpaddl.s32 d3, d2 vmov.32 r0, d3[0] From cea57b7fe05bea6a8935082d03eb1974c8a06e37 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Sun, 23 Feb 2014 16:39:18 -0800 Subject: [PATCH 272/328] configure: use pkg-config to detect libbluray The current configure fails when static libbluray is compiled with libxml2 support. Signed-off-by: Timothy Gu Signed-off-by: Michael Niedermayer (cherry picked from commit baa650cc7946a9eb1cf5a083f61a581a97122f03) Signed-off-by: Timothy Gu Conflicts: configure --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 71396b2e72..88e14f49a1 100755 --- a/configure +++ b/configure @@ -3637,7 +3637,7 @@ enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_in enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883 enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus enabled libass && require_pkg_config libass ass/ass.h ass_library_init -enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray +enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } From d7ce013de58fc4f2d7dc52d464d156a489189734 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 8 Sep 2013 20:27:54 +0200 Subject: [PATCH 273/328] avcodec/truemotion2: Fix av_freep arguments Fixes null pointer dereference Fixes Ticket2944 Signed-off-by: Michael Niedermayer (cherry picked from commit c54aa2fb0f869ec025933944cbd1634fffe95d09) Conflicts: libavcodec/truemotion2.c Signed-off-by: Michael Niedermayer --- libavcodec/truemotion2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index e9fcf4db46..5a8648351f 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -922,14 +922,14 @@ static av_cold int decode_init(AVCodecContext *avctx){ if (!l->Y1_base || !l->Y2_base || !l->U1_base || !l->V1_base || !l->U2_base || !l->V2_base || !l->last || !l->clast) { - av_freep(l->Y1_base); - av_freep(l->Y2_base); - av_freep(l->U1_base); - av_freep(l->U2_base); - av_freep(l->V1_base); - av_freep(l->V2_base); - av_freep(l->last); - av_freep(l->clast); + av_freep(&l->Y1_base); + av_freep(&l->Y2_base); + av_freep(&l->U1_base); + av_freep(&l->U2_base); + av_freep(&l->V1_base); + av_freep(&l->V2_base); + av_freep(&l->last); + av_freep(&l->clast); return AVERROR(ENOMEM); } l->Y1 = l->Y1_base + l->y_stride * 4 + 4; From 55ad69e851aefdc8f45ae51e7069c818cd445ce6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 9 Sep 2013 17:58:18 +0200 Subject: [PATCH 274/328] avcodec/ffv1enc: update buffer check for 16bps Signed-off-by: Michael Niedermayer (cherry picked from commit 3728603f1854b5c79d1a64dd3b41b80640ef1e7f) Conflicts: libavcodec/ffv1enc.c --- libavcodec/ffv1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index c637b47b9a..57ea929109 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -471,7 +471,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w, int run_mode=0; if(s->ac){ - if(c->bytestream_end - c->bytestream < w*20){ + if(c->bytestream_end - c->bytestream < w*35){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } From 6f9ae27f5136a29eea18effb033fe9d6f67b892e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 26 Sep 2013 21:03:48 +0200 Subject: [PATCH 275/328] avcodec/parser: reset indexes on realloc failure Fixes Ticket2982 Signed-off-by: Michael Niedermayer (cherry picked from commit f31011e9abfb2ae75bb32bc44e2c34194c8dc40a) Signed-off-by: Michael Niedermayer --- libavcodec/parser.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index df5ecb3b87..cf66e93ebb 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -244,8 +244,10 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s if(next == END_NOT_FOUND){ void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); - if(!new_buffer) + if(!new_buffer) { + pc->index = 0; return AVERROR(ENOMEM); + } pc->buffer = new_buffer; memcpy(&pc->buffer[pc->index], *buf, *buf_size); pc->index += *buf_size; @@ -258,9 +260,11 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s /* append to buffer */ if(pc->index){ void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); - - if(!new_buffer) + if(!new_buffer) { + pc->overread_index = + pc->index = 0; return AVERROR(ENOMEM); + } pc->buffer = new_buffer; memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE ); pc->index = 0; From 2448c186768608e8f2d102d4dc8c3c931718b976 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 21 Oct 2013 16:21:14 +0200 Subject: [PATCH 276/328] avfilter/ff_insert_pad: fix order of operations Fixes out of bounds access Fixes CID732170 Fixes CID732169 No filter is known to use this function in a way so the issue can be reproduced. Signed-off-by: Michael Niedermayer (cherry picked from commit ab2bfb85d49b2f8aa505816f93e75fd18ad0a361) Conflicts: libavfilter/avfilter.c (cherry picked from commit 86591b244f3a27293153896813f5569b49b2f5c0) Conflicts: libavfilter/avfilter.c (cherry picked from commit 400c4f8fa3fd58951dc3f356b2b00484e3363694) Signed-off-by: Michael Niedermayer --- libavfilter/avfilter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 9f49a8b2b1..11e880b379 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -112,9 +112,9 @@ void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, (*links)[idx] = NULL; (*count)++; - for (i = idx+1; i < *count; i++) - if (*links[i]) - (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++; + for (i = idx + 1; i < *count; i++) + if ((*links)[i]) + (*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++; } int avfilter_link(AVFilterContext *src, unsigned srcpad, From ba59ab5964625b1128d9f3b3dbd435b962a4a03f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 19 Oct 2013 17:45:54 +0200 Subject: [PATCH 277/328] avcodec/avpacket/av_packet_split_side_data: ensure that side data padding is initialized Signed-off-by: Michael Niedermayer (cherry picked from commit 240fd8c96f59ebe9dcfc4152a1086cd3f63400c0) Signed-off-by: Michael Niedermayer (cherry picked from commit 1e48318802b3caa493a40c0584afc30cc866d9d0) Signed-off-by: Michael Niedermayer --- libavcodec/avpacket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 516f1c972b..c8724de346 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -283,7 +283,7 @@ int av_packet_split_side_data(AVPacket *pkt){ for (i=0; ; i++){ size= AV_RB32(p); av_assert0(size<=INT_MAX && p - pkt->data >= size); - pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); pkt->side_data[i].size = size; pkt->side_data[i].type = p[4]&127; if (!pkt->side_data[i].data) From f83f09bfcef57e5ea871247ca2d6694dcdd04c0a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Oct 2013 18:38:48 +0200 Subject: [PATCH 278/328] avutil/opt: initialize ret Fixes CID1108610 Fixes use of uninitialized variable Signed-off-by: Michael Niedermayer (cherry picked from commit 2d8ccf0adcae09cb9e14b01cfe20e4d77c3bbf5d) Signed-off-by: Michael Niedermayer --- libavutil/opt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 0957281076..76e8c90b18 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -236,7 +236,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { - int ret; + int ret = 0; void *dst, *target_obj; const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); if (!o || !target_obj) From 855fe6544792cc11c159119ce93434f2ad40dfa0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 Oct 2013 23:27:28 +0100 Subject: [PATCH 279/328] avcodec/jpeglsdec: check err value for ls_get_code_runterm() Fixes infinite loop Fixes Ticket3086 Signed-off-by: Michael Niedermayer (cherry picked from commit cc0e47b55096361723b364afa43b79a3f5619cdc) Signed-off-by: Michael Niedermayer --- libavcodec/jpeglsdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index 879922a0e0..417bb4068d 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -142,6 +142,8 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI ret = ret >> 1; } + if(FFABS(ret) > 0xFFFF) + return -0x10000; /* update state */ state->A[Q] += FFABS(ret) - RItype; ret *= state->twonear; From 584e15d64395713c866849aa9097c7d93b34cfca Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 6 Dec 2013 23:30:34 +0100 Subject: [PATCH 280/328] avutil/log: skip IO calls on empty strings These occur when no context is set for example, thus they are common Signed-off-by: Michael Niedermayer (cherry picked from commit a044a183a3fb90b20a8deaa3ea1158510bcdd420) Signed-off-by: Michael Niedermayer --- libavutil/log.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavutil/log.c b/libavutil/log.c index 90a46b0650..f7873a3039 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -100,6 +100,9 @@ static int use_color = -1; #undef fprintf static void colored_fputs(int level, const char *str) { + if (!*str) + return; + if (use_color < 0) { #if defined(_WIN32) && !defined(__MINGW32CE__) CONSOLE_SCREEN_BUFFER_INFO con_info; From e571010c5c68b6b6a9fe367ed3e1b77f1dfb1b32 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 16 Jan 2014 02:53:32 +0100 Subject: [PATCH 281/328] cmdutils: update year Signed-off-by: Michael Niedermayer --- cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index 343914b4af..27e01307d2 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -61,7 +61,7 @@ struct SwsContext *sws_opts; SwrContext *swr_opts; AVDictionary *format_opts, *codec_opts; -const int this_year = 2013; +const int this_year = 2014; static FILE *report_file; From 617fecbe0f9d3d302501ad65c1350d2f8691f220 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 17 Jan 2014 20:09:48 +0100 Subject: [PATCH 282/328] dnxhdenc: fix mb_rc size Fixes out of array access with RC_VARIANCE set to 0 Signed-off-by: Michael Niedermayer (cherry picked from commit f1caaa1c61310beba705957e6366f0392a0b005b) Signed-off-by: Michael Niedermayer --- libavcodec/dnxhdenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index c8b031e739..2a7e7bb748 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -235,7 +235,7 @@ static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias) static int dnxhd_init_rc(DNXHDEncContext *ctx) { - FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail); + FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*(ctx->m.avctx->qmax + 1)*sizeof(RCEntry), fail); if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail); From 87c203ba2684947d92f6bcef4acbfe53d9632299 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 Jan 2014 18:08:18 +0100 Subject: [PATCH 283/328] avcodec/vmnc: Check that rectangles are within the picture Prevents out of array accesses with CODEC_FLAG_EMU_EDGE Signed-off-by: Michael Niedermayer (cherry picked from commit 6ba02602aa7fc7d38db582e75b8b093fb3c1608d) Conflicts: libavcodec/vmnc.c Signed-off-by: Michael Niedermayer (cherry picked from commit 7c17207ab9acfaa934e8feb8fba90765c9d0b989) Signed-off-by: Michael Niedermayer --- libavcodec/vmnc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index 6d091c1bd2..417109b8bd 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -276,6 +276,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int } xy = *src++; wh = *src++; + if ( (xy >> 4) + (wh >> 4) + 1 > w - i + || (xy & 0xF) + (wh & 0xF)+1 > h - j) { + av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n"); + return AVERROR_INVALIDDATA; + } paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride); } } From 5b38967745e9abfaf8cdfb356a1040f6ec214f77 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 1 Feb 2014 19:04:37 +0100 Subject: [PATCH 284/328] avcodec/vc1: reset fcm/field_mode in non advanced header parsing Fixes NULL pointer dereference Fixes: signal_sigsegv_1ab8bf4_2847_cov_4254117347_SA10091.vc1 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit b51e9354772de446e8196dabf9aad1567b22f74d) Signed-off-by: Michael Niedermayer --- libavcodec/vc1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index d7352d3671..deb4efe8ad 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -583,6 +583,8 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant, status; + v->field_mode = 0; + v->fcm = 0; if (v->finterpflag) v->interpfrm = get_bits1(gb); if (!v->s.avctx->codec) From 0e551aa966efb8aad703d365f12f166b07f5faf9 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 30 Jan 2014 14:08:38 -0500 Subject: [PATCH 285/328] samplefmt: avoid integer overflow in av_samples_get_buffer_size() CC:libav-stable@libav.org (cherry picked from commit 0e830094ad0dc251613a0aa3234d9c5c397e02e6) Signed-off-by: Michael Niedermayer --- libavutil/samplefmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index a03648e200..2b5a378c76 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -135,6 +135,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, /* auto-select alignment if not specified */ if (!align) { + if (nb_samples > INT_MAX - 31) + return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } From b9bf17c55ac2b3b06e44a221994563fa894c1347 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 7 Feb 2014 15:07:23 +0100 Subject: [PATCH 286/328] avcodec/wmalosslessdec: fix mclms_coeffs* array size Fixes corruption of context Fixes: 8835659dde6a4f7dcdf341de6a45c6c8-signal_sigsegv_1dce67b_4564_cov_2504444599_classical_22_16_1_14000_v3c_0_extend_0_29.wma Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit ec9578d54d09b64bf112c2bf7a34b1ef3b93dbd3) Signed-off-by: Michael Niedermayer --- libavcodec/wmalosslessdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index 485cab206c..ba4d7edac4 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -125,8 +125,8 @@ typedef struct WmallDecodeCtx { int8_t mclms_order; int8_t mclms_scaling; - int16_t mclms_coeffs[128]; - int16_t mclms_coeffs_cur[4]; + int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32]; + int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS]; int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32]; int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32]; int mclms_recent; From 7ad6b66370e59e7eafb17bd5d43c46e3abf51f04 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 13 Feb 2014 13:59:51 +0100 Subject: [PATCH 287/328] avformat/mpegtsenc: Check data array size in mpegts_write_pmt() Prevents out of array writes Signed-off-by: Michael Niedermayer (cherry picked from commit 842b6c14bcfc1c5da1a2d288fd65386eb8c158ad) Conflicts: libavformat/mpegtsenc.c (cherry picked from commit e87de3f50b765134588d0b048c32ed4b8acc16fb) Signed-off-by: Michael Niedermayer --- libavformat/mpegtsenc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index eba7312fbd..20b92e7ca9 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -255,7 +255,7 @@ static void mpegts_write_pat(AVFormatContext *s) data, q - data); } -static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) +static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) { MpegTSWrite *ts = s->priv_data; uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr; @@ -308,6 +308,10 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) stream_type = STREAM_TYPE_PRIVATE_DATA; break; } + + if (q - data > sizeof(data) - 32) + return AVERROR(EINVAL); + *q++ = stream_type; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; @@ -339,7 +343,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) len_ptr = q++; *len_ptr = 0; - for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { + for (p = lang->value; next && *len_ptr < 255 / 4 * 4 && q - data < sizeof(data) - 4; p = next + 1) { next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; /* not a 3-letter code */ @@ -401,6 +405,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) } mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0, data, q - data); + return 0; } /* NOTE: str == NULL is accepted for an empty string */ From 54b61181ed55ab38034520eb27d18cf8a2d3732e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 16 Feb 2014 23:08:52 +0100 Subject: [PATCH 288/328] avcodec/msrle: use av_image_get_linesize() to calculate the linesize Fixes out of array access Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit c919e1ca2ecfc47d796382973ba0e48b8f6f92a2) Conflicts: libavcodec/msrle.c (cherry picked from commit bc1c8ec5e65098fd2ccd8456f667151dfc9cda42) Signed-off-by: Michael Niedermayer --- libavcodec/msrle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 7c965d25e2..4f2d753550 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -35,6 +35,7 @@ #include "avcodec.h" #include "dsputil.h" #include "msrledec.h" +#include "libavutil/imgutils.h" typedef struct MsrleContext { AVCodecContext *avctx; @@ -112,7 +113,7 @@ static int msrle_decode_frame(AVCodecContext *avctx, /* FIXME how to correctly detect RLE ??? */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ - int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; + int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0); uint8_t *ptr = s->frame.data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j; From d7071f676571465a0fccf41d265cc4f59ec89b92 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 17 Feb 2014 20:49:42 +0100 Subject: [PATCH 289/328] avcodec/ansi: fix integer overflow Fixes out of array read Fixes: 5f9698e86d92f19bb08d54ff0d57027f-signal_sigsegv_b30756_3795_cov_2693691257_ansi256.ans Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit d42ec8433c687fcbccefa51a7716d81920218e4f) Signed-off-by: Michael Niedermayer --- libavcodec/ansi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index 35725005e7..789cb9d456 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -407,7 +407,7 @@ static int decode_frame(AVCodecContext *avctx, switch(buf[0]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - if (s->nb_args < MAX_NB_ARGS) + if (s->nb_args < MAX_NB_ARGS && s->args[s->nb_args] < 6553) s->args[s->nb_args] = FFMAX(s->args[s->nb_args], 0) * 10 + buf[0] - '0'; break; case ';': From a0d15a6271a7af4113af4c9921e4f17e6271eee5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 18 Feb 2014 02:53:14 +0100 Subject: [PATCH 290/328] avcodec/snow: split block clipping checks Fixes out of array read Fixes: d4476f68ca1c1c57afbc45806f581963-asan_heap-oob_2266b27_8607_cov_4044577381_snow_chroma_bug.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 61d59703c91869f4e5cdacd8d6be52f8b89d4ba4) Signed-off-by: Michael Niedermayer --- libavcodec/snow.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/snow.h b/libavcodec/snow.h index 6d6b086907..675c054962 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -312,7 +312,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer if(!sliced && !offset_dst) dst -= src_x; src_x=0; - }else if(src_x + b_w > w){ + } + if(src_x + b_w > w){ b_w = w - src_x; } if(src_y<0){ @@ -321,7 +322,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer if(!sliced && !offset_dst) dst -= src_y*dst_stride; src_y=0; - }else if(src_y + b_h> h){ + } + if(src_y + b_h> h){ b_h = h - src_y; } From e59fe789581324ac48b669caed0ac61fa05902a2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 1 Mar 2014 02:40:19 +0100 Subject: [PATCH 291/328] avcodec/utvideoenc: fix slice_bits size Fixes assertion failure Signed-off-by: Michael Niedermayer (cherry picked from commit 0a8c90202bb906747168a698b6837496f82c717c) Conflicts: libavcodec/utvideoenc.c (cherry picked from commit 57522ca79cc38c279123596d3288ddbf56fa8903) Signed-off-by: Michael Niedermayer --- libavcodec/utvideoenc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c index fe5636fd0b..9e1edd3376 100644 --- a/libavcodec/utvideoenc.c +++ b/libavcodec/utvideoenc.c @@ -468,7 +468,7 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src, * get the offset in bits and convert to bytes. */ offset += write_huff_codes(dst + sstart * width, c->slice_bits, - width * (send - sstart), width, + width * height + 4, width, send - sstart, he) >> 3; slice_len = offset - slice_len; @@ -525,8 +525,7 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream2_init_writer(&pb, dst, pkt->size); - av_fast_malloc(&c->slice_bits, &c->slice_bits_size, - width * height + FF_INPUT_BUFFER_PADDING_SIZE); + av_fast_padded_malloc(&c->slice_bits, &c->slice_bits_size, width * height + 4); if (!c->slice_bits) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer 2.\n"); From 08f53e1b14ff0e6f1d935c5c2d2f2eefbdf73c25 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 10 Mar 2014 13:31:31 +0100 Subject: [PATCH 292/328] update for 1.0.9 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index 86936368b7..2b1d53c872 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.8 +PROJECT_NUMBER = 1.0.9 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index b0f3d96f87..66c4c2263e 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.8 +1.0.9 diff --git a/VERSION b/VERSION index b0f3d96f87..66c4c2263e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.8 +1.0.9 From 519675c49c28eafa592274abea7170c16e8c45fc Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 4 Nov 2013 16:22:27 +0100 Subject: [PATCH 293/328] avformat/mov: only force parsing for video tracks if stss is empty Fixes playback of some AAC streams, which are otherwise mangled by the parser, and stss is typically only valid for video anyway. Fixes a regression since e41ea866. Signed-off-by: Michael Niedermayer (cherry picked from commit 019247bdc326a90bf20d3ce5d2413cc642e8bb08) --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index bd408afbb6..0959b22a89 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1669,7 +1669,7 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!entries) { sc->keyframe_absent = 1; - if (!st->need_parsing) + if (!st->need_parsing && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } From be66ae3b015115aa72bd1bf56946e7c6309f1f14 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Feb 2014 06:32:51 +0100 Subject: [PATCH 294/328] avformat/mov: fix keyframe flags for sample from chromium Issue 340865 Fixes ticket #3362. Signed-off-by: Michael Niedermayer (cherry picked from commit a0911b059763b8f13c70adcbbe71e10382855104) --- libavformat/mov.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 0959b22a89..7d3c85b073 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2007,6 +2007,11 @@ static void mov_build_index(MOVContext *mov, AVStream *st) rap_group_index++; } } + if (sc->keyframe_absent + && !sc->stps_count + && !rap_group_present + && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + keyframe = 1; if (keyframe) distance = 0; sample_size = sc->alt_sample_size > 0 ? sc->alt_sample_size : sc->sample_sizes[current_sample]; From ea66bd0d24f15d19a7e9f5a614ce8ddfdf56e751 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 19 Jan 2014 20:59:28 +0100 Subject: [PATCH 295/328] avformat/matroskaenc: wrap V_QUICKTIME codec private in something that looks like its part of quicktime stsd This is needed for matroska spec compliance Fixes playback of SVQ3 in matroska with vlc Fixes Ticket 3256 Signed-off-by: Michael Niedermayer (cherry picked from commit 8456bd2c0f3b08756f353646fe3b40a6772e665e) --- libavformat/matroskaenc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index e599970a3d..ef10497e12 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -491,8 +491,18 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo if (qt_id) { if (!codec->codec_tag) codec->codec_tag = ff_codec_get_tag(ff_codec_movvideo_tags, codec->codec_id); - if (codec->extradata_size) + if (codec->extradata_size) { + if ( ff_codec_get_id(ff_codec_movvideo_tags, codec->codec_tag) == codec->codec_id + && ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(codec->extradata+4)) != codec->codec_id + ) { + int i; + avio_wb32(dyn_cp, 0x5a + codec->extradata_size); + avio_wl32(dyn_cp, codec->codec_tag); + for(i=0; i<0x5a-8; i++) + avio_w8(dyn_cp, 0); + } avio_write(dyn_cp, codec->extradata, codec->extradata_size); + } } else { if (!codec->codec_tag) codec->codec_tag = ff_codec_get_tag(ff_codec_bmp_tags, codec->codec_id); From 66c927d2172a59b5cd056c0e87d7b232b1e44d53 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 19 Jan 2014 18:35:33 +0100 Subject: [PATCH 296/328] avformat/matroskadec: support SVQ3 as generated by mkvtoolnix-6.6.0 Fixes part of Ticket3256 Signed-off-by: Michael Niedermayer (cherry picked from commit 5800b08572ef5f776950fc6f1b6572ba9a6b1933) Conflicts: libavformat/matroskadec.c --- libavformat/matroskadec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 9a0121a931..44c1a8fe17 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1609,8 +1609,12 @@ static int matroska_read_header(AVFormatContext *s) } else if (!strcmp(track->codec_id, "V_QUICKTIME") && (track->codec_priv.size >= 86) && (track->codec_priv.data != NULL)) { - fourcc = AV_RL32(track->codec_priv.data); + fourcc = AV_RL32(track->codec_priv.data + 4); codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc); + if (ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(track->codec_priv.data))) { + fourcc = AV_RL32(track->codec_priv.data); + codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc); + } } else if (codec_id == AV_CODEC_ID_ALAC && track->codec_priv.size && track->codec_priv.size < INT_MAX-12) { /* Only ALAC's magic cookie is stored in Matroska's track headers. Create the "atom size", "tag", and "tag version" fields the From 0916d0f9d1b94b4bb88382edae45b9276746574d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 11 Jan 2013 00:54:12 +0100 Subject: [PATCH 297/328] vorbisdec: Check bark_map_size. This fixes potential divisions by zero and out of array accesses. Reported-by: Dale Curtis Found-by: inferno@chromium.org Signed-off-by: Michael Niedermayer (cherry picked from commit 2c16bf2de07c68513072bf3cc96401d2c6291a3e) Signed-off-by: Michael Niedermayer --- libavcodec/vorbisdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index 8ce0fc7c83..0ea73d5183 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -599,6 +599,10 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) "Floor 0 amplitude bits is 0.\n"); return AVERROR_INVALIDDATA; } + if (floor_setup->data.t0.bark_map_size == 0) { + av_log(vc->avccontext, AV_LOG_ERROR, "Floor 0 bark map size is 0.\n"); + return AVERROR_INVALIDDATA; + } floor_setup->data.t0.amplitude_offset = get_bits(gb, 8); floor_setup->data.t0.num_books = get_bits(gb, 4) + 1; From 85b1ce977bd5d477cd47d0942e1a09f0a56e6778 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Thu, 10 Jan 2013 11:05:29 -0800 Subject: [PATCH 298/328] matroska: Fix use after free Signed-off-by: Dale Curtis Signed-off-by: Luca Barbato (cherry picked from commit ae3d41636942cbc0236bad21ad06c65f4eb0f096) Signed-off-by: Michael Niedermayer --- libavformat/matroskadec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 44c1a8fe17..59130f1ffd 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1880,6 +1880,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska, */ static void matroska_clear_queue(MatroskaDemuxContext *matroska) { + matroska->prev_pkt = NULL; if (matroska->packets) { int n; for (n = 0; n < matroska->num_packets; n++) { @@ -2393,7 +2394,6 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); matroska->current_id = 0; while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { - matroska->prev_pkt = NULL; matroska_clear_queue(matroska); if (matroska_parse_cluster(matroska) < 0) break; From 588ae964f4bb26918c76253722ea24e004c24b40 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 15 Mar 2014 22:52:22 +0100 Subject: [PATCH 299/328] swscale/x86/swscale: fix missing xmm clobbers in yuv2yuvX_sse3() Signed-off-by: Michael Niedermayer (cherry picked from commit 6c47a4e972485e5f0c812159373f703c6f1d089f) Signed-off-by: Michael Niedermayer --- libswscale/x86/swscale.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c index 102a4e6f22..960f73cc6e 100644 --- a/libswscale/x86/swscale.c +++ b/libswscale/x86/swscale.c @@ -261,7 +261,8 @@ static void yuv2yuvX_sse3(const int16_t *filter, int filterSize, "jb 1b \n\t"\ :: "g" (filter), "r" (dest-offset), "g" ((x86_reg)(dstW+offset)), "m" (offset) - : "%"REG_d, "%"REG_S, "%"REG_c + : XMM_CLOBBERS("%xmm0" , "%xmm1" , "%xmm2" , "%xmm3" , "%xmm4" , "%xmm5" , "%xmm7" ,) + "%"REG_d, "%"REG_S, "%"REG_c ); } #endif From 1ec03662c0f225cba9685cf21328f4847be2ee97 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 18 Mar 2014 18:06:17 +0100 Subject: [PATCH 300/328] avcodec/h263dec: Fix use of uninitialized memory from the bitstream buffer Signed-off-by: Michael Niedermayer (cherry picked from commit f07cebcd910c97ff6012085c21493231752990e9) Signed-off-by: Michael Niedermayer --- libavcodec/h263dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index ef1b6ed62c..a28edbd682 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -724,10 +724,10 @@ frame_end: } if(startcode_found){ - av_fast_malloc( + av_fast_padded_mallocz( &s->bitstream_buffer, &s->allocated_bitstream_buffer_size, - buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE); + buf_size - current_pos); if (!s->bitstream_buffer) return AVERROR(ENOMEM); memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); From 5f7e6b9c37a4c969b9b401c2048df7d8066c0a52 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 25 Mar 2014 00:15:52 +0100 Subject: [PATCH 301/328] avcodec/x86/mpegvideoenc_template: fix integer overflow Signed-off-by: Michael Niedermayer --- libavcodec/x86/mpegvideoenc_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/mpegvideoenc_template.c b/libavcodec/x86/mpegvideoenc_template.c index d874f39ec7..8ec193ef16 100644 --- a/libavcodec/x86/mpegvideoenc_template.c +++ b/libavcodec/x86/mpegvideoenc_template.c @@ -216,7 +216,7 @@ static int RENAME(dct_quantize)(MpegEncContext *s, "psubusw "MM"1, "MM"4 \n\t" "packuswb "MM"4, "MM"4 \n\t" #if COMPILE_TEMPLATE_SSE2 - "packuswb "MM"4, "MM"4 \n\t" + "packsswb "MM"4, "MM"4 \n\t" #endif "movd "MM"4, %0 \n\t" // *overflow : "=g" (*overflow) From 551f36955c6b97a18a214b27328db884dac58fec Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 26 Mar 2014 18:09:23 +0100 Subject: [PATCH 302/328] avcodec/h264_mp4toannexb_bsf: prepend global headers before any in stream parameter sets Fixes h264_mp4toannexb_bsf_failure.mkv Signed-off-by: Michael Niedermayer (cherry picked from commit 289b149cecb381522cc9ccdf382825330169c655) Signed-off-by: Michael Niedermayer --- libavcodec/h264_mp4toannexb_bsf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index 2dea93301a..f9c3621d3f 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -154,7 +154,7 @@ pps: goto fail; /* prepend only to the first type 5 NAL unit of an IDR picture */ - if (ctx->first_idr && unit_type == 5) { + if (ctx->first_idr && (unit_type == 5 || unit_type == 7 || unit_type == 8)) { if ((ret=alloc_and_copy(poutbuf, poutbuf_size, avctx->extradata, avctx->extradata_size, buf, nal_size)) < 0) From 12eb9d9111213fe29105d09565eaebe02da3b941 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 5 Apr 2014 21:34:03 +0200 Subject: [PATCH 303/328] avcodec/wma: use av_freep(), do not leave stale pointers in memory Signed-off-by: Michael Niedermayer (cherry picked from commit d167faafe9dfa0b82bebb267c3c4e5fa5286bd67) Signed-off-by: Michael Niedermayer --- libavcodec/wma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/wma.c b/libavcodec/wma.c index d5e66e25b3..936d5ec6ef 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -385,9 +385,9 @@ int ff_wma_end(AVCodecContext *avctx) } for (i = 0; i < 2; i++) { ff_free_vlc(&s->coef_vlc[i]); - av_free(s->run_table[i]); - av_free(s->level_table[i]); - av_free(s->int_table[i]); + av_freep(&s->run_table[i]); + av_freep(&s->level_table[i]); + av_freep(&s->int_table[i]); } return 0; From 81e5ce4c280e5ef503b45aebc8916c33021b3222 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 8 Apr 2014 00:19:07 +0200 Subject: [PATCH 304/328] swresample/resample: Limit filter length Related to CID1197063 The limit choosen is arbitrary and much larger than what makes sense. It avoids the need for checking arithmetic operations with the length for overflow Signed-off-by: Michael Niedermayer (cherry picked from commit f9158b01d0f3effb58e87fb07db0382bc1e47de5) Signed-off-by: Michael Niedermayer --- libswresample/resample.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libswresample/resample.c b/libswresample/resample.c index 5a82e73875..3c77d6939c 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -227,6 +227,11 @@ ResampleContext *swri_resample_init(ResampleContext *c, int out_rate, int in_rat return NULL; } + if (filter_size/factor > INT32_MAX/256) { + av_log(NULL, AV_LOG_ERROR, "Filter length too large\n"); + goto error; + } + c->phase_shift = phase_shift; c->phase_mask = phase_count - 1; c->linear = linear; From b1ac8b1d3842383a74c7579cca09fc8212b6f9e8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 8 Apr 2014 00:29:06 +0200 Subject: [PATCH 305/328] swresample/dither: use av_malloc_array() Signed-off-by: Michael Niedermayer (cherry picked from commit a5290cb1ac047851563da7aca06569e3ada55f79) Signed-off-by: Michael Niedermayer --- libswresample/dither.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswresample/dither.c b/libswresample/dither.c index 79113f4c23..28cfbdd501 100644 --- a/libswresample/dither.c +++ b/libswresample/dither.c @@ -24,7 +24,7 @@ void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt) { double scale = 0; #define TMP_EXTRA 2 - double *tmp = av_malloc((len + TMP_EXTRA) * sizeof(double)); + double *tmp = av_malloc_array(len + TMP_EXTRA, sizeof(double)); int i; out_fmt = av_get_packed_sample_fmt(out_fmt); From d7573f88a9b9d10e9301b4a3b31784aab3407243 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 8 Apr 2014 00:29:26 +0200 Subject: [PATCH 306/328] swresample/resample: use av_malloc_array() where appropriate Signed-off-by: Michael Niedermayer (cherry picked from commit 5027f39712fdce25b9008e72d52e5abfeefd5fe6) Signed-off-by: Michael Niedermayer --- libswresample/resample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswresample/resample.c b/libswresample/resample.c index 3c77d6939c..1f5724ca58 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -95,7 +95,7 @@ static int build_filter(ResampleContext *c, void *filter, double factor, int tap int filter_type, int kaiser_beta){ int ph, i; double x, y, w; - double *tab = av_malloc(tap_count * sizeof(*tab)); + double *tab = av_malloc_array(tap_count, sizeof(*tab)); const int center= (tap_count-1)/2; if (!tab) From f80af81e6e12a67abdd6a0a1726d417737c88507 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 8 Apr 2014 18:12:12 +0200 Subject: [PATCH 307/328] swscale/x86/swscale_template: loose hardcoded dstw_offset Signed-off-by: Michael Niedermayer (cherry picked from commit f6759d9ad4a8b71e6f212ca4f1e7da9fa56d3298) Signed-off-by: Michael Niedermayer --- libswscale/x86/swscale_template.c | 78 +++++++++++++++---------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index 370a0ebe1b..f89902bc59 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -321,7 +321,7 @@ static void RENAME(yuv2yuvX)(const int16_t *filter, int filterSize, MOVNTQ( q3, 24(dst, index, 4))\ \ "add $8, "#index" \n\t"\ - "cmp "#dstw", "#index" \n\t"\ + "cmp "dstw", "#index" \n\t"\ " jb 1b \n\t" #define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) @@ -347,13 +347,13 @@ static void RENAME(yuv2rgb32_X_ar)(SwsContext *c, const int16_t *lumFilter, "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" - WRITEBGR32(%4, %5, %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6) + WRITEBGR32(%4, "%5", %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6) YSCALEYUV2PACKEDX_END } else { YSCALEYUV2PACKEDX_ACCURATE YSCALEYUV2RGBX "pcmpeqd %%mm7, %%mm7 \n\t" - WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) + WRITEBGR32(%4, "%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) YSCALEYUV2PACKEDX_END } } @@ -376,13 +376,13 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter, "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" - WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) + WRITEBGR32(%4, "%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) YSCALEYUV2PACKEDX_END } else { YSCALEYUV2PACKEDX YSCALEYUV2RGBX "pcmpeqd %%mm7, %%mm7 \n\t" - WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) + WRITEBGR32(%4, "%5", %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) YSCALEYUV2PACKEDX_END } } @@ -411,7 +411,7 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter, MOVNTQ(%%mm1, 8(dst, index, 2))\ \ "add $8, "#index" \n\t"\ - "cmp "#dstw", "#index" \n\t"\ + "cmp "dstw", "#index" \n\t"\ " jb 1b \n\t" #define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index) @@ -435,7 +435,7 @@ static void RENAME(yuv2rgb565_X_ar)(SwsContext *c, const int16_t *lumFilter, "paddusb "GREEN_DITHER"(%0), %%mm4\n\t" "paddusb "RED_DITHER"(%0), %%mm5\n\t" #endif - WRITERGB16(%4, %5, %%REGa) + WRITERGB16(%4, "%5", %%REGa) YSCALEYUV2PACKEDX_END } @@ -459,7 +459,7 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter, "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t" "paddusb "RED_DITHER"(%0), %%mm5 \n\t" #endif - WRITERGB16(%4, %5, %%REGa) + WRITERGB16(%4, "%5", %%REGa) YSCALEYUV2PACKEDX_END } @@ -488,7 +488,7 @@ static void RENAME(yuv2rgb565_X)(SwsContext *c, const int16_t *lumFilter, MOVNTQ(%%mm1, 8(dst, index, 2))\ \ "add $8, "#index" \n\t"\ - "cmp "#dstw", "#index" \n\t"\ + "cmp "dstw", "#index" \n\t"\ " jb 1b \n\t" #define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index) @@ -512,7 +512,7 @@ static void RENAME(yuv2rgb555_X_ar)(SwsContext *c, const int16_t *lumFilter, "paddusb "GREEN_DITHER"(%0), %%mm4\n\t" "paddusb "RED_DITHER"(%0), %%mm5\n\t" #endif - WRITERGB15(%4, %5, %%REGa) + WRITERGB15(%4, "%5", %%REGa) YSCALEYUV2PACKEDX_END } @@ -536,7 +536,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter, "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t" "paddusb "RED_DITHER"(%0), %%mm5 \n\t" #endif - WRITERGB15(%4, %5, %%REGa) + WRITERGB15(%4, "%5", %%REGa) YSCALEYUV2PACKEDX_END } @@ -590,7 +590,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter, "add $24, "#dst" \n\t"\ \ "add $8, "#index" \n\t"\ - "cmp "#dstw", "#index" \n\t"\ + "cmp "dstw", "#index" \n\t"\ " jb 1b \n\t" #define WRITEBGR24MMX2(dst, dstw, index) \ @@ -638,7 +638,7 @@ static void RENAME(yuv2rgb555_X)(SwsContext *c, const int16_t *lumFilter, "add $24, "#dst" \n\t"\ \ "add $8, "#index" \n\t"\ - "cmp "#dstw", "#index" \n\t"\ + "cmp "dstw", "#index" \n\t"\ " jb 1b \n\t" #if COMPILE_TEMPLATE_MMXEXT @@ -665,7 +665,7 @@ static void RENAME(yuv2bgr24_X_ar)(SwsContext *c, const int16_t *lumFilter, "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize "add %4, %%"REG_c" \n\t" - WRITEBGR24(%%REGc, %5, %%REGa) + WRITEBGR24(%%REGc, "%5", %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW_reg), "m"(uv_off) @@ -689,7 +689,7 @@ static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter, "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c" \n\t" //FIXME optimize "add %4, %%"REG_c" \n\t" - WRITEBGR24(%%REGc, %5, %%REGa) + WRITEBGR24(%%REGc, "%5", %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW_reg), "m"(uv_off) @@ -710,7 +710,7 @@ static void RENAME(yuv2bgr24_X)(SwsContext *c, const int16_t *lumFilter, MOVNTQ(%%mm7, 8(dst, index, 2))\ \ "add $8, "#index" \n\t"\ - "cmp "#dstw", "#index" \n\t"\ + "cmp "dstw", "#index" \n\t"\ " jb 1b \n\t" #define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index) @@ -731,7 +731,7 @@ static void RENAME(yuv2yuyv422_X_ar)(SwsContext *c, const int16_t *lumFilter, "psraw $3, %%mm4 \n\t" "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" - WRITEYUY2(%4, %5, %%REGa) + WRITEYUY2(%4, "%5", %%REGa) YSCALEYUV2PACKEDX_END } @@ -752,7 +752,7 @@ static void RENAME(yuv2yuyv422_X)(SwsContext *c, const int16_t *lumFilter, "psraw $3, %%mm4 \n\t" "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" - WRITEYUY2(%4, %5, %%REGa) + WRITEYUY2(%4, "%5", %%REGa) YSCALEYUV2PACKEDX_END } @@ -853,7 +853,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2], "psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ "psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/ "packuswb %%mm7, %%mm1 \n\t" - WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) + WRITEBGR32(%4, DSTW_OFFSET"(%5)", %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "r" (dest), "a" (&c->redDither), "r" (abuf0), "r" (abuf1) @@ -877,7 +877,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2], "packuswb %%mm7, %%mm1 \n\t" "pop %1 \n\t" "pop %0 \n\t" - WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) + WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -891,7 +891,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2], "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" - WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) + WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -908,14 +908,13 @@ static void RENAME(yuv2bgr24_2)(SwsContext *c, const int16_t *buf[2], const int16_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1]; - //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" - WRITEBGR24(%%REGb, 8280(%5), %%REGBP) + WRITEBGR24(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -931,7 +930,6 @@ static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2], const int16_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1]; - //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" @@ -944,7 +942,7 @@ static void RENAME(yuv2rgb555_2)(SwsContext *c, const int16_t *buf[2], "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif - WRITERGB15(%%REGb, 8280(%5), %%REGBP) + WRITERGB15(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -960,7 +958,6 @@ static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2], const int16_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1]; - //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" @@ -973,7 +970,7 @@ static void RENAME(yuv2rgb565_2)(SwsContext *c, const int16_t *buf[2], "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif - WRITERGB16(%%REGb, 8280(%5), %%REGBP) + WRITERGB16(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1029,13 +1026,12 @@ static void RENAME(yuv2yuyv422_2)(SwsContext *c, const int16_t *buf[2], const int16_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1]; - //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :( __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED(%%REGBP, %5) - WRITEYUY2(%%REGb, 8280(%5), %%REGBP) + WRITEYUY2(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1178,7 +1174,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0, "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) - WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) + WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1191,7 +1187,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0, "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" - WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) + WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1207,7 +1203,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0, "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) YSCALEYUV2RGB1_ALPHA(%%REGBP) - WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) + WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (abuf0), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1220,7 +1216,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0, "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" - WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) + WRITEBGR32(%%REGb, DSTW_OFFSET"(%5)", %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1246,7 +1242,7 @@ static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0, "push %%"REG_BP" \n\t" YSCALEYUV2RGB1(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" - WRITEBGR24(%%REGb, 8280(%5), %%REGBP) + WRITEBGR24(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1260,7 +1256,7 @@ static void RENAME(yuv2bgr24_1)(SwsContext *c, const int16_t *buf0, "push %%"REG_BP" \n\t" YSCALEYUV2RGB1b(%%REGBP, %5) "pxor %%mm7, %%mm7 \n\t" - WRITEBGR24(%%REGb, 8280(%5), %%REGBP) + WRITEBGR24(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1291,7 +1287,7 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0, "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif - WRITERGB15(%%REGb, 8280(%5), %%REGBP) + WRITERGB15(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1311,7 +1307,7 @@ static void RENAME(yuv2rgb555_1)(SwsContext *c, const int16_t *buf0, "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif - WRITERGB15(%%REGb, 8280(%5), %%REGBP) + WRITERGB15(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1342,7 +1338,7 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0, "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif - WRITERGB16(%%REGb, 8280(%5), %%REGBP) + WRITERGB16(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1362,7 +1358,7 @@ static void RENAME(yuv2rgb565_1)(SwsContext *c, const int16_t *buf0, "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t" "paddusb "RED_DITHER"(%5), %%mm5 \n\t" #endif - WRITERGB16(%%REGb, 8280(%5), %%REGBP) + WRITERGB16(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1423,7 +1419,7 @@ static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0, "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1(%%REGBP, %5) - WRITEYUY2(%%REGb, 8280(%5), %%REGBP) + WRITEYUY2(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), @@ -1436,7 +1432,7 @@ static void RENAME(yuv2yuyv422_1)(SwsContext *c, const int16_t *buf0, "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2PACKED1b(%%REGBP, %5) - WRITEYUY2(%%REGb, 8280(%5), %%REGBP) + WRITEYUY2(%%REGb, DSTW_OFFSET"(%5)", %%REGBP) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), From b5ec163e5a470113030f0e1384bcd3c77d808bee Mon Sep 17 00:00:00 2001 From: Anthoine Bourgeois Date: Wed, 9 Apr 2014 12:18:32 +0200 Subject: [PATCH 308/328] avcodec/dirac_arith: Fix build with PIC and stack-check options Fixes Ticket3540 The function dirac_get_arith_bit in libavcodec/dirac_arith.h can't be built with PIC and check-stack because the asm code needs 6 registers and PIC and check-stack options take 1 each and x86 is quite limited in this area. Signed-off-by: Michael Niedermayer (cherry picked from commit d8ab7f31dd819f7b3e0d460a2fa4261aaae87b98) Signed-off-by: Michael Niedermayer --- libavcodec/dirac_arith.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/dirac_arith.h b/libavcodec/dirac_arith.h index f9a8bba5fd..089c71a698 100644 --- a/libavcodec/dirac_arith.h +++ b/libavcodec/dirac_arith.h @@ -28,6 +28,7 @@ #ifndef AVCODEC_DIRAC_ARITH_H #define AVCODEC_DIRAC_ARITH_H +#include "libavutil/x86/asm.h" #include "bytestream.h" #include "get_bits.h" @@ -134,7 +135,7 @@ static inline int dirac_get_arith_bit(DiracArith *c, int ctx) range_times_prob = (c->range * prob_zero) >> 16; -#if HAVE_FAST_CMOV && HAVE_INLINE_ASM +#if HAVE_FAST_CMOV && HAVE_INLINE_ASM && HAVE_6REGS low -= range_times_prob << 16; range -= range_times_prob; bit = 0; From 0443fe264068fc890b315e6aba265a852be72682 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 14 Apr 2014 17:29:27 +0200 Subject: [PATCH 309/328] avcodec/x86/idct_sse2_xvid: fix non C99 inline function Found-by: Matt Oliver Signed-off-by: Michael Niedermayer (cherry picked from commit 46d5625f44185271862337d61cd246fd569c42a4) Signed-off-by: Michael Niedermayer --- libavcodec/x86/idct_sse2_xvid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/idct_sse2_xvid.c b/libavcodec/x86/idct_sse2_xvid.c index d121b25031..bb424eed6f 100644 --- a/libavcodec/x86/idct_sse2_xvid.c +++ b/libavcodec/x86/idct_sse2_xvid.c @@ -344,7 +344,7 @@ DECLARE_ASM_CONST(16, int32_t, walkenIdctRounders)[] = { "movdqa %%xmm6, 4*16("dct") \n\t" \ "movdqa "SREG2", 7*16("dct") \n\t" -inline void ff_idct_xvid_sse2(short *block) +av_extern_inline void ff_idct_xvid_sse2(short *block) { __asm__ volatile( "movq "MANGLE(m127)", %%mm0 \n\t" From f3230ba067af1ce564661616be98110e0ff9f4c5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 16 Apr 2014 02:06:37 +0200 Subject: [PATCH 310/328] avformat/mpegts: Remove redundant check Fixes part of Ticket3466 Found-by: Andrey_Karpov / PVS-Studio Signed-off-by: Michael Niedermayer (cherry picked from commit ff6fa0b4b980fc5b9f7653d7b159ae02c3d95210) Signed-off-by: Michael Niedermayer --- libavformat/mpegts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 74de2c72fd..dd37f0f196 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1232,7 +1232,7 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t *section, int section_le AVStream *st; if (ts->pids[pid]->es_id != mp4_descr[i].es_id) continue; - if (!(ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES)) { + if (ts->pids[pid]->type != MPEGTS_PES) { av_log(s, AV_LOG_ERROR, "pid %x is not PES\n", pid); continue; } From 00476d924902e3d863bab57e43f4ec0e77a30675 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 16 Apr 2014 02:06:37 +0200 Subject: [PATCH 311/328] avcodec/diracdec: fix undefined behavior with shifts Fixes part of Ticket3466 Found-by: Andrey_Karpov / PVS-Studio Signed-off-by: Michael Niedermayer (cherry picked from commit b8598f6ce61ccda3f2ff0c730b009fb650e42986) Signed-off-by: Michael Niedermayer --- libavcodec/diracdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 13d9e478b5..48a609b1bb 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1337,8 +1337,8 @@ static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5], motion_y >>= s->chroma_y_shift; } - mx = motion_x & ~(-1 << s->mv_precision); - my = motion_y & ~(-1 << s->mv_precision); + mx = motion_x & ~(-1U << s->mv_precision); + my = motion_y & ~(-1U << s->mv_precision); motion_x >>= s->mv_precision; motion_y >>= s->mv_precision; /* normalize subpel coordinates to epel */ From 43d24fc34cb8a8dfc97055f26ba2f6301e144c62 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 16 Apr 2014 02:55:13 +0200 Subject: [PATCH 312/328] avcodec/g723_1: add assert to help static code analyzers Signed-off-by: Michael Niedermayer (cherry picked from commit 1457f3fd90e17745791354fbb87899fc4803085a) Signed-off-by: Michael Niedermayer --- libavcodec/g723_1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c index 29eb4fae2c..39fc437935 100644 --- a/libavcodec/g723_1.c +++ b/libavcodec/g723_1.c @@ -2289,7 +2289,8 @@ static int pack_bitstream(G723_1_Context *p, unsigned char *frame, int size) if (p->cur_rate == RATE_6300) { info_bits = 0; put_bits(&pb, 2, info_bits); - } + }else + av_assert0(0); put_bits(&pb, 8, p->lsp_index[2]); put_bits(&pb, 8, p->lsp_index[1]); From 8ef02e4e89a2fb35276d668c3d9de16567614bd8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 16 Apr 2014 02:06:37 +0200 Subject: [PATCH 313/328] avfilter/vf_deshake: fix loss of precission with odd resolutions Fixes part of Ticket3466 Found-by: Andrey_Karpov / PVS-Studio Signed-off-by: Michael Niedermayer (cherry picked from commit 73734282e0e4df92269984ee1671424e39249481) Signed-off-by: Michael Niedermayer --- libavfilter/vf_deshake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index ac0a0139c0..f365aa2e30 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -317,8 +317,8 @@ static void find_motion(DeshakeContext *deshake, uint8_t *src1, uint8_t *src2, //av_log(NULL, AV_LOG_ERROR, "\n"); } - p_x = (center_x - width / 2); - p_y = (center_y - height / 2); + p_x = (center_x - width / 2.0); + p_y = (center_y - height / 2.0); t->vector.x += (cos(t->angle)-1)*p_x - sin(t->angle)*p_y; t->vector.y += sin(t->angle)*p_x + (cos(t->angle)-1)*p_y; From ee0db8a51f8c24d7297e43aed2119a4595740d88 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 21 Apr 2014 11:33:17 +0200 Subject: [PATCH 314/328] avfilter/filtfmts: Support dynamically allocated in/outputs Fixes crash Fixes Ticket3468 Signed-off-by: Michael Niedermayer (cherry picked from commit 59c7615d58b5b7ea9caff2c8c774677973eb4f1c) Signed-off-by: Michael Niedermayer --- libavfilter/filtfmts.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavfilter/filtfmts.c b/libavfilter/filtfmts.c index 14417cbd4b..e2a542a869 100644 --- a/libavfilter/filtfmts.c +++ b/libavfilter/filtfmts.c @@ -41,7 +41,7 @@ static void print_formats(AVFilterContext *filter_ctx) for (j = 0; j < fmts->format_count; j++) \ if(av_get_pix_fmt_name(fmts->formats[j])) \ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ - i, filter_ctx->filter->inout##puts[i].name, \ + i, filter_ctx->inout##put_pads[i].name, \ av_get_pix_fmt_name(fmts->formats[j])); \ } else if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_AUDIO) { \ AVFilterFormats *fmts; \ @@ -50,7 +50,7 @@ static void print_formats(AVFilterContext *filter_ctx) fmts = filter_ctx->inout##puts[i]->outin##_formats; \ for (j = 0; j < fmts->format_count; j++) \ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ - i, filter_ctx->filter->inout##puts[i].name, \ + i, filter_ctx->inout##put_pads[i].name, \ av_get_sample_fmt_name(fmts->formats[j])); \ \ layouts = filter_ctx->inout##puts[i]->outin##_channel_layouts; \ @@ -59,7 +59,7 @@ static void print_formats(AVFilterContext *filter_ctx) av_get_channel_layout_string(buf, sizeof(buf), -1, \ layouts->channel_layouts[j]); \ printf(#INOUT "PUT[%d] %s: chlayout:%s\n", \ - i, filter_ctx->filter->inout##puts[i].name, buf); \ + i, filter_ctx->inout##put_pads[i].name, buf); \ } \ } \ } \ @@ -109,12 +109,12 @@ int main(int argc, char **argv) /* create a link for each of the input pads */ for (i = 0; i < filter_ctx->input_count; i++) { AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); - link->type = filter_ctx->filter->inputs[i].type; + link->type = filter_ctx->input_pads[i].type; filter_ctx->inputs[i] = link; } for (i = 0; i < filter_ctx->output_count; i++) { AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); - link->type = filter_ctx->filter->outputs[i].type; + link->type = filter_ctx->output_pads[i].type; filter_ctx->outputs[i] = link; } From acba4d1e55e0eb104abe78716194a8d06cb8b4bd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 23 Apr 2014 21:47:48 +0200 Subject: [PATCH 315/328] avformat/h263dec: Fix h263 probe The code was missing 1 bit in the src format Signed-off-by: Michael Niedermayer (cherry picked from commit fc145e576a443bfc89efdf35b91fd3c9ca0d8388) Signed-off-by: Michael Niedermayer --- libavformat/h263dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/h263dec.c b/libavformat/h263dec.c index 8afacad8b7..166ddb42e0 100644 --- a/libavformat/h263dec.c +++ b/libavformat/h263dec.c @@ -35,7 +35,7 @@ static int h263_probe(AVProbeData *p) for(i=0; ibuf_size; i++){ code = (code<<8) + p->buf[i]; if ((code & 0xfffffc0000) == 0x800000) { - src_fmt= (code>>2)&3; + src_fmt= (code>>2)&7; if( src_fmt != last_src_fmt && last_src_fmt>0 && last_src_fmt<6 && src_fmt<6) From 6b0c1ed11608d7b91606d23331808795dcfa91b3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 24 Apr 2014 01:25:46 +0200 Subject: [PATCH 316/328] swresample: fix AV_CH_LAYOUT_STEREO_DOWNMIX input Fixes Ticket 3542 Signed-off-by: Michael Niedermayer (cherry picked from commit 291d464161a5bf3b566bc147f83e4242b0c18d74) Signed-off-by: Michael Niedermayer --- libswresample/rematrix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c index c126565145..0d568afdbe 100644 --- a/libswresample/rematrix.c +++ b/libswresample/rematrix.c @@ -147,6 +147,11 @@ av_cold static int auto_matrix(SwrContext *s) ) out_ch_layout = AV_CH_LAYOUT_STEREO; + if( in_ch_layout == AV_CH_LAYOUT_STEREO_DOWNMIX + && (out_ch_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == 0 + ) + in_ch_layout = AV_CH_LAYOUT_STEREO; + if(!sane_layout(in_ch_layout)){ av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout); av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf); From 2277706b35814fb8750664d182c030c6e80e703e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 Apr 2014 05:32:56 +0200 Subject: [PATCH 317/328] avcodec/mjpegdec: Fix undefined shift Fixes CID1194388 Signed-off-by: Michael Niedermayer (cherry picked from commit b4329605289e25bb071ec1c1182bf25fc83b09aa) Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 4d347af913..02ad11806d 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1109,7 +1109,7 @@ static int mjpeg_decode_scan_progressive_ac(MJpegDecodeContext *s, int ss, } if (!Al) { - s->coefs_finished[c] |= (1LL << (se + 1)) - (1LL << ss); + s->coefs_finished[c] |= (2LL << se) - (1LL << ss); last_scan = !~s->coefs_finished[c]; } From 033b0a4e7fc86588de76597b3dc21a8b8161bd32 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 Apr 2014 04:01:50 +0200 Subject: [PATCH 318/328] avfilter/graphdump: Fix pointer to local outside scope Fixes CID1194435 Signed-off-by: Michael Niedermayer (cherry picked from commit 18af0ce62da322176f7bd283b85314d2f41bee2c) Signed-off-by: Michael Niedermayer --- libavfilter/graphdump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavfilter/graphdump.c b/libavfilter/graphdump.c index c9d0fb0a7c..c0db843414 100644 --- a/libavfilter/graphdump.c +++ b/libavfilter/graphdump.c @@ -31,9 +31,10 @@ static int print_link_prop(AVBPrint *buf, AVFilterLink *link) { char *format; char layout[64]; + AVBPrint dummy_buffer = { 0 }; if (!buf) - buf = &(AVBPrint){ 0 }; /* dummy buffer */ + buf = &dummy_buffer; switch (link->type) { case AVMEDIA_TYPE_VIDEO: format = av_x_if_null(av_get_pix_fmt_name(link->format), "?"); From 1930efe236503f5ea97ff6a11125f1da91afa931 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 20 May 2014 05:23:52 +0200 Subject: [PATCH 319/328] avutil/cpu: force mmx on selection of higher x86 SIMD features Fixes various runtime failures with manually set flags that represent no existing CPU Fixes Ticket3653 Signed-off-by: Michael Niedermayer (cherry picked from commit 6310eb8010b7a3b3016e297132380cbd4e3d2d10) Signed-off-by: Michael Niedermayer --- libavutil/cpu.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libavutil/cpu.c b/libavutil/cpu.c index f651cab64b..be743ee088 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -23,6 +23,24 @@ static int flags, checked; void av_force_cpu_flags(int arg){ + if ( (arg & ( AV_CPU_FLAG_3DNOW | + AV_CPU_FLAG_3DNOWEXT | + AV_CPU_FLAG_SSE | + AV_CPU_FLAG_SSE2 | + AV_CPU_FLAG_SSE2SLOW | + AV_CPU_FLAG_SSE3 | + AV_CPU_FLAG_SSE3SLOW | + AV_CPU_FLAG_SSSE3 | + AV_CPU_FLAG_SSE4 | + AV_CPU_FLAG_SSE42 | + AV_CPU_FLAG_AVX | + AV_CPU_FLAG_XOP | + AV_CPU_FLAG_FMA4 )) + && !(arg & AV_CPU_FLAG_MMX)) { + av_log(NULL, AV_LOG_WARNING, "MMX implied by specified flags\n"); + arg |= AV_CPU_FLAG_MMX; + } + flags = arg; checked = arg != -1; } From a116f16e5dc76f648b87fd245f9d68c27b9ce5d2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 21 May 2014 03:02:06 +0200 Subject: [PATCH 320/328] avcodec/libvorbisenc: dont add the duration to AV_NOPTS_VALUE Signed-off-by: Michael Niedermayer (cherry picked from commit 19e66c7232d96e4ae8f05b52da2b84dfaa4e4da3) Signed-off-by: Michael Niedermayer --- libavcodec/libvorbisenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index eaeaf04de3..8f93288ba4 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -364,7 +364,8 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, avctx->delay = duration; av_assert0(!s->afq.remaining_delay); s->afq.frames->duration += duration; - s->afq.frames->pts -= duration; + if (s->afq.frames->pts != AV_NOPTS_VALUE) + s->afq.frames->pts -= duration; s->afq.remaining_samples += duration; } ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration); From 8935e2390074cbf189ad1ab9c8f3388781d05317 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 7 Jun 2014 12:03:31 +0200 Subject: [PATCH 321/328] avformat/flvenc: Do not allow creating h263/mpeg4 in flv without unofficial format extensions being enabled. Found-by: Jean-Baptiste Kempf Signed-off-by: Michael Niedermayer (cherry picked from commit 74760883fcb4443d105814ed246b3cf51d7e9dca) Signed-off-by: Michael Niedermayer --- libavformat/flvenc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 5447840b2a..6131bef17c 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -218,6 +218,18 @@ static int flv_write_header(AVFormatContext *s) avcodec_get_name(enc->codec_id), i); return AVERROR(EINVAL); } + if (enc->codec_id == AV_CODEC_ID_MPEG4 || + enc->codec_id == AV_CODEC_ID_H263) { + int error = enc->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL; + av_log(s, error ? AV_LOG_ERROR : AV_LOG_WARNING, + "Codec %s is not supported in the official FLV specification,\n", avcodec_get_name(enc->codec_id)); + + if (error) { + av_log(s, AV_LOG_ERROR, + "use vstrict=-1 / -strict -1 to use it anyway.\n"); + return AVERROR(EINVAL); + } + } break; case AVMEDIA_TYPE_AUDIO: audio_enc = enc; From f48d7abf40f3873016a9b27de89ec29b95947d28 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 8 Jun 2014 14:30:30 +0200 Subject: [PATCH 322/328] avcodec/alsdec: Clear MPEG4AudioConfig so that no use of uninitialized memory is possible Signed-off-by: Michael Niedermayer (cherry picked from commit 6e6bd5481cf42a9765c492c77754d4633092cece) Signed-off-by: Michael Niedermayer --- libavcodec/alsdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 1095b0118a..a8056889a7 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -283,7 +283,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx) GetBitContext gb; uint64_t ht_size; int i, config_offset; - MPEG4AudioConfig m4ac; + MPEG4AudioConfig m4ac = {0}; ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; uint32_t als_id, header_size, trailer_size; From 8f443e4f32c91dc2141b6d0c997a2fe03536e89c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 15 Jun 2014 00:49:02 +0200 Subject: [PATCH 323/328] avformat/mpc: attempt to allocate a packet that is not smaller than the data inside it Signed-off-by: Michael Niedermayer (cherry picked from commit 86a9370e2b91d67375e66a06d6eb573b5a017775) Signed-off-by: Michael Niedermayer --- libavformat/mpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 3b818ed146..b9368112fb 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -151,7 +151,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) } c->curbits = (curbits + size2) & 0x1F; - if ((ret = av_new_packet(pkt, size)) < 0) + if ((ret = av_new_packet(pkt, size + 4)) < 0) return ret; pkt->data[0] = curbits; From ff712a262d317f5bd6fc9552cd837508e584a565 Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Fri, 15 Mar 2013 06:59:22 -0400 Subject: [PATCH 324/328] lzo: fix overflow checking in copy_backptr() The check `src > dst' in the form `&c->out[-back] > c->out' invokes pointer overflow, which is undefined behavior in C. Remove the check. Also replace `&c->out[-back] < c->out_start' with a safe form `c->out - c->out_start < back' to avoid overflow. CC: libav-stable@libav.org Signed-off-by: Xi Wang Signed-off-by: Luca Barbato (cherry picked from commit ca6c3f2c53be70aa3c38e8f1292809db89ea1ba6) Conflicts: libavutil/lzo.c --- libavutil/lzo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/lzo.c b/libavutil/lzo.c index 3642308100..1c65e2f6ed 100644 --- a/libavutil/lzo.c +++ b/libavutil/lzo.c @@ -118,10 +118,10 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt); * cnt > back is valid, this will copy the bytes we just copied, * thus creating a repeating pattern with a period length of back. */ -static inline void copy_backptr(LZOContext *c, int back, int cnt) { - register const uint8_t *src = &c->out[-back]; - register uint8_t *dst = c->out; - if (src < c->out_start || src > dst) { +static inline void copy_backptr(LZOContext *c, int back, int cnt) +{ + register uint8_t *dst = c->out; + if (dst - c->out_start < back) { c->error |= AV_LZO_INVALID_BACKPTR; return; } From 7b5c706494a775b2b0d0e0a38448610802eef8f4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 20 Jun 2014 03:15:28 +0200 Subject: [PATCH 325/328] avutil/lzo: Fix integer overflow Embargoed-till: 2014-06-27 requested by researcher, but embargo broken by libav today (git and mailing list) Fixes: LMS-2014-06-16-4 Found-by: "Don A. Bailey" See: ccda51b14c0fcae2fad73a24872dce75a7964996 Signed-off-by: Michael Niedermayer (cherry picked from commit d6af26c55c1ea30f85a7d9edbc373f53be1743ee) Conflicts: libavutil/lzo.c --- libavutil/lzo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavutil/lzo.c b/libavutil/lzo.c index 1c65e2f6ed..f6c632944a 100644 --- a/libavutil/lzo.c +++ b/libavutil/lzo.c @@ -62,7 +62,13 @@ static inline int get_byte(LZOContext *c) { static inline int get_len(LZOContext *c, int x, int mask) { int cnt = x & mask; if (!cnt) { - while (!(x = get_byte(c))) cnt += 255; + while (!(x = get_byte(c))) { + if (cnt >= INT_MAX - 1000) { + c->error |= AV_LZO_ERROR; + break; + } + cnt += 255; + } cnt += mask + x; } return cnt; From 3a2c4453f04e467e52e66e439f389ac9ae49cc32 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 13 Jul 2014 01:07:59 +0200 Subject: [PATCH 326/328] avformat/utils: do not wait for packets from discarded streams for genpts Fixes long loop Fixes Ticket3208 Signed-off-by: Michael Niedermayer (cherry picked from commit 8202c49b43621c04e26d4a3aa83a10e1e5cc1836) Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 18a0165dbc..fd9a2d6fe6 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1488,7 +1488,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt) } /* read packet from packet buffer, if there is data */ - if (!(next_pkt->pts == AV_NOPTS_VALUE && + st = s->streams[next_pkt->stream_index]; + if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL && next_pkt->dts != AV_NOPTS_VALUE && !eof)) { ret = read_from_packet_buffer(&s->packet_buffer, &s->packet_buffer_end, pkt); From f2a8c429dc605fde48b46e2eb4da387ef9341ac2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Jul 2014 19:18:42 +0200 Subject: [PATCH 327/328] update for 1.0.10 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index 2b1d53c872..7a281f27f3 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.9 +PROJECT_NUMBER = 1.0.10 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 66c4c2263e..7ee7020b38 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -1.0.9 +1.0.10 diff --git a/VERSION b/VERSION index 66c4c2263e..7ee7020b38 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.9 +1.0.10 From e8bf189db28300e592ab104bd8c761139aa01f0a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 31 Jul 2015 15:54:38 +0200 Subject: [PATCH 328/328] MAINTAINERS: Remove myself as leader Signed-off-by: Michael Niedermayer (cherry picked from commit f2c58931e629343f7d68258cc2b2d62c5f501ba5) Signed-off-by: Michael Niedermayer --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0c8a5ff9fc..4992c200a5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14,7 +14,6 @@ and related discussions. Project Leader ============== -Michael Niedermayer final design decisions