h264: allow cropping to AVCodecContext.width/height

Override the frame size from the SPS with AVCodecContext values
if the latter specify a size smaller by less than one macroblock.
This is required for correct cropping of MOV files from Canon cameras.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 30f515091c323da59c0f1b533703dedca2f4b95d)

Conflicts:

	libavcodec/h264.c
mov: set AVCodecContext.width/height for h264

This is required for correct cropping of files from Canon
cameras.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 8aa93e900449c88c3169ff5636fed03f41779cac)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Fix muxing mjpeg in swf.
(cherry picked from commit 7680d99b4302e476076cc1b8f2567f47c2aaef4d)
Merge remote-tracking branch 'qatar/release/0.8' into release/0.10

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pthread: Avoid crashes/odd behavior caused by spurious wakeups

pthread_wait_cond can wake up for no reason (Wikipedia: Spurious_wakeup).
The FF_THREAD_SLICE thread mechanism could spontaneously execute jobs or
allow the caller of avctx->execute to return before all jobs were complete.
This adds tests to both cases to ensure the wakeup is real.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e3329474a366de066b25e86f35f5abf9c5a4b7b2)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f1ec792ae3011531d47070144b8c91d58bb3e76f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
mpegaudio_parser: reset state to prevent it to be random

Fixes Ticket1718

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 93b240f4a59348c07d3d7e4862227f6949c51e14)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3581ab6ce0754544b06f34f7875b731a5ca2e061)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
sp5xdec: fix off by 1 error causing a crash

Fixes Ticket1633

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f0896a6bd94e5b45447c7d640c8e8aa95d860d7a)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 450e4b1a60721d25f306d97062f35c9c3d7989f8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
escape124: fix integer overflow leading to excessive memory allocation

Fixes Ticket1629

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3d7817048cb387de87600f2152075f78b37b60a6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9f1e01c9915fe0c86ad2b8f50e11fee9e1b00c62)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
faxcompr: fix out of array read

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5891e454a667e42ef71a06bfd9661540ea3f3ebd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 55b3e408fa18b918bd0cabb1b27f1f0c4ce57a64)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
bmv_videodec: fix out of array read

Fixes Ticket1373

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 70f0ffa1ed456fd0b560d0dd1d0d93f1ba3a6d93)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d721cb009d73662f35c629bdc678e25786e79301)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>