truemotion2: convert packet header reading to bytestream2.

Also use correct buffer sizes in calls to tm2_read_stream(). Together,
this prevents overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
h264: fix cabac-on-stack after safe cabac reader.
WMAL: Remove inaccurate and unnecessary doxy

A call to decode_packet() does not always decode a complete WMA packet.
Moreover, this is not the correct place to document calls that are part
of the public API.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
lzw: prevent buffer overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Revert "Fix compilation with hardcoded tables."

This reverts commit b17b2963692f5f7c19a2188e61922e00680c5fb4.
Do not try to use lowres for unusual jpg subsampling.

Fixes ticket #1144.
id3v2: add another mimetype for JPEG image
mp3dec: perform I/S and M/S only when frame mode is joint stereo.

Looks like some LAME versions produce dual stereo mode MP3s with
flags for intensity and middle stereo set. In this mode those flags
should be ignored like the reference decoder and derived ones do.
ffmpeg: switch duration calculation code from avg to r frame_rate.

This heuristic is less likely to overshoot and cause encoder failure.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
configure: Check for a different SDL function

This one is available both in SDL 1.2 and in 1.3 (which is the current
version available e.g. in macports), while 1.3 doesn't contain
SDL_Linked_Version().

The current check for SDL_Linked_Version() (available since SDL 1.2.13)
was added in 8f1b06c8, because including the headers for SDL_Init()
redirects the main() function, requiring the main function signature
to match the one of SDL_main (including argc/argv).

Signed-off-by: Martin Storsjö <martin@martin.st>
lavf: print ts values in pts < dts error message

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
truemotion2: handle out-of-frame motion vectors through edge extension.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
truemotion: forbid invalid VLC bitsizes and token values.

SHOW_UBITS() is only defined up to n_bits is 25, therefore forbid
values larger than this in get_vlc2() (max_bits). tokens[][] can be
used as an index in deltas[], which has a size of 64, so ensure the
values are smaller than that.

This prevents crashes on corrupt bitstreams.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
lzw: fix potential integer overflow.
mov: don't overwrite existing indexes.

Prevents all kind of badness if files contain multiple
indexes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
ffmpeg: check pts like dts for being in the past.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
img2: glob matching for image series

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
img2dec: Recognize glob meta chars only if prefixed by %

  This changes globbing support to only be used if the character
contains at least one glob meta character that is preceded by
an unescaped %. To escape a literal % one would use %% which is
identical to the way to match a % with image2 sequence generation
feature.

* Makes it possible to have patterns like %04d-[720p].jpg work
  again with sequence number generation. Previously this would
  always be detected as a glob pattern and was interpreted by
  the image2 glob code instead.

* Makes it possible to use %*-[720p].jpg to match above pattern
  without having to double escape it to be not interpreted by most
  shells and not by the image2 glob code (previously one would
  need to use \*-\\\[720p\\\].jpg to achieve the same)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avf: fix audio writing in the output-example

av_init_packet does not reset data and size fields in AVPacket,
avcodec_encode_audio2 can use preallocated AVPacket.
avf: make the example output the proper message

av_dump_format needs the codecs opened in order to print
them.