lavc/movtextdec: keep the min size instead of max to fix overread.

Fixes Ticket #2087.
(cherry picked from commit 7d66bc7920240cc0e8df6c44b2d2cdbe4b228fbe)

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
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)

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
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)

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
lavf: move force_codec_ids() up

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3a6b6f425ee3f552eaaf6bde7480be5cb38aba1d)
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
lavf: Fix codec id forcing with probed codecs

Fixes Ticket2088

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 341e40f1e1eeba1a2952c26363630596193e887b)
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
tiffdec: Use the correct height field.

Fixes Ticket913

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4784a135b2b0fe4d1b4c6256bd37265fc45aed3d)
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
ffmpeg: mark attachment streams finished.

Fix trac ticket #2083.
(cherry picked from commit 69a1667b064b11a2df4b4bdc136955f76d17f558)

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
ff_get_audio_frame_size: try to fix wma in wav

Fixes Ticket1905, Ticket2114

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2713e43ac85245805db95048493dde121a20aee7)
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
Fix detection of struct v4l2_frmsize_discrete.

It was always detected successfully.
(cherry picked from commit c345100efc9baae0ea7c9fcc376725cae5d3df6e)

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
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)

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
swr: fix handling of timestamps that cause multiple drops or silence injections

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d676598f879ba01ddb62f9abe8e17b2e94cb91cd)
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
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 <michaelni@gmx.at>
(cherry picked from commit f6badba1859fb266a9c0bdaf006a04c73873cd90)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
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 <michaelni@gmx.at>
(cherry picked from commit 2c85d7c015489e169759e52c21499579dae5c2b1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
mpeg12: Support decoding dimensions that are a multiple of 4096

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
mpeg12enc: Correctly mask dimensions

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
mpeg12enc: check dimension validity

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
mpeg1enc: Disable threads for resolutions too large for multi-threading

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
update for FFmpeg 1.0.2

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
aacenc: Fix assignments in if()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
libfaac: Fix assignments in if()

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>