platform/upstream/libav.git
11 years agoflvenc: Write proper cropping for VP6 even if there's no extradata
Martin Storsjö [Thu, 15 Aug 2013 08:07:30 +0000 (11:07 +0300)]
flvenc: Write proper cropping for VP6 even if there's no extradata

This keeps cropping when remuxing from F4V to FLV.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoflvenc: Support muxing VP6A as well
Martin Storsjö [Thu, 15 Aug 2013 08:04:07 +0000 (11:04 +0300)]
flvenc: Support muxing VP6A as well

Handle it in the same way as VP6F, except for the codec tag.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoflvenc: Don't pretend to support muxing "plain" VP6
Martin Storsjö [Thu, 15 Aug 2013 08:01:55 +0000 (11:01 +0300)]
flvenc: Don't pretend to support muxing "plain" VP6

The plain VP6 format is vertically flipped compared to VP6F/VP6A.
Support for the plain VP6 format was added in 09d8c0ae831 (which
also introduced support for muxing VP6F properly in general).

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agovp6: Support cropping to AVCodecContext.width/height
Martin Storsjö [Wed, 14 Aug 2013 09:39:29 +0000 (12:39 +0300)]
vp6: Support cropping to AVCodecContext.width/height

In these cases, there is no extradata but only the properly set
width/height values by the demuxer.

This makes sure VP6 in F4V files is cropped properly.

This is similar to what is done for H264 for letting the container
width/height override what's in the bitstream, since 30f515091.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoavi: directly resync on DV in AVI read failure
Luca Barbato [Tue, 6 Aug 2013 01:52:48 +0000 (03:52 +0200)]
avi: directly resync on DV in AVI read failure

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agoavi: DV in AVI must be considered single stream
Luca Barbato [Tue, 6 Aug 2013 01:38:12 +0000 (03:38 +0200)]
avi: DV in AVI must be considered single stream

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agoavi: properly fail if the dv demuxer is missing
Luca Barbato [Mon, 5 Aug 2013 23:39:07 +0000 (01:39 +0200)]
avi: properly fail if the dv demuxer is missing

CC: libav-stable@libav.org
11 years agojpeg2000: Check block length
Luca Barbato [Wed, 9 Oct 2013 04:17:12 +0000 (06:17 +0200)]
jpeg2000: Check block length

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agovmnc: Use meaningful return values
Luca Barbato [Wed, 9 Oct 2013 03:58:59 +0000 (05:58 +0200)]
vmnc: Use meaningful return values

11 years agovmnc: Check the cursor dimensions
Luca Barbato [Wed, 9 Oct 2013 03:51:20 +0000 (05:51 +0200)]
vmnc: Check the cursor dimensions

And manage the reallocation failure path.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agovmnc: Port to bytestream2
Luca Barbato [Wed, 9 Oct 2013 03:13:59 +0000 (05:13 +0200)]
vmnc: Port to bytestream2

Fix some buffer overreads.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agovmnc: K&R formatting cosmetics
Luca Barbato [Wed, 9 Oct 2013 10:58:42 +0000 (12:58 +0200)]
vmnc: K&R formatting cosmetics

Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years agox86inc: Remove .rodata kludges
Henrik Gramner [Wed, 11 Sep 2013 15:49:25 +0000 (17:49 +0200)]
x86inc: Remove .rodata kludges

The Mach-O bug was fixed in yasm 0.8.0 and we don't
support versions that old anymore.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agobuild: Require yasm 0.8.0 or higher
Derek Buitenhuis [Mon, 7 Oct 2013 11:18:54 +0000 (07:18 -0400)]
build: Require yasm 0.8.0 or higher

This is in preparation for removing a .rodata kludge
which was only required for older YASM versions.

The movbe instruction was introduced in 0.8.0, which already
had AVX, which was introduced in 0.7.0, and NASM introduced
movbe in 2.0.3, which is the same version which introduced
AVX support.

Also, make the failure message more accurate.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agoshorten: Extend fixed_coeffs to properly support pred_order 0
Luca Barbato [Wed, 4 Sep 2013 17:26:36 +0000 (19:26 +0200)]
shorten: Extend fixed_coeffs to properly support pred_order 0

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agox86: h264_idct: Update comments to match 8/10-bit depth optimization split
Diego Biurrun [Sun, 6 Oct 2013 16:15:14 +0000 (18:15 +0200)]
x86: h264_idct: Update comments to match 8/10-bit depth optimization split

11 years agox86inc: remove misaligned cpu flag
Henrik Gramner [Wed, 11 Sep 2013 15:49:29 +0000 (17:49 +0200)]
x86inc: remove misaligned cpu flag

Prevents a crash if the misaligned exception mask bit is
cleared for some reason.

Misaligned SSE functions are only used on AMD Phenom CPUs
and the benefit is miniscule. They also require modifying
the MXCSR control register and by removing those functions
we can get rid of that complexity altogether.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: various minor backports from x264
Jason Garrett-Glaser [Wed, 11 Sep 2013 15:49:28 +0000 (17:49 +0200)]
x86inc: various minor backports from x264

Small backports that sneaked into other asm commits in x264.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: Check for __OUTPUT_FORMAT__ having a value of "x64"
Derek Buitenhuis [Wed, 11 Sep 2013 15:49:27 +0000 (17:49 +0200)]
x86inc: Check for __OUTPUT_FORMAT__ having a value of "x64"

This is also a valid value for WIN64.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: Utilize the shadow space on 64-bit Windows
Henrik Gramner [Wed, 11 Sep 2013 15:49:26 +0000 (17:49 +0200)]
x86inc: Utilize the shadow space on 64-bit Windows

Store XMM6 and XMM7 in the shadow space in functions that
clobbers them. This way we don't have to adjust the stack
pointer as often, reducing the number of instructions as
well as code size.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: create xm# and ym#, analagous to m#
Loren Merritt [Wed, 11 Sep 2013 15:49:24 +0000 (17:49 +0200)]
x86inc: create xm# and ym#, analagous to m#

For when we want to mix simd sizes within one function.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: fix some corner cases of SWAP
Loren Merritt [Wed, 11 Sep 2013 15:49:23 +0000 (17:49 +0200)]
x86inc: fix some corner cases of SWAP

SWAP with >=3 named (rather than numbered) args
PERMUTE followed by SWAP with 2 named args
used to produce the wrong permutation

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: Use SSE instead of SSE2 for copying data
Henrik Gramner [Wed, 11 Sep 2013 15:49:22 +0000 (17:49 +0200)]
x86inc: Use SSE instead of SSE2 for copying data

Reduces code size because movaps/movups is one byte
shorter than movdqa/movdqu.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: Set ELF hidden visibility for global constants
Henrik Gramner [Wed, 11 Sep 2013 15:49:21 +0000 (17:49 +0200)]
x86inc: Set ELF hidden visibility for global constants

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agobuild: Strip spurious labels
Loren Merritt [Thu, 12 Sep 2013 18:06:23 +0000 (18:06 +0000)]
build: Strip spurious labels

The implementation of 25cb0c1a involves lots of spurious labels.

The effect of keeping those labels around is making debugging harder.
Those labels are meaningless, and complicate the disassembly. Also,
gdb can't tell the difference between them and function entry points.

This new strip command is irrelevant to any usage of Libav that would
have used the old fully stripped version, because the old one was for
non-debug use.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86inc: activate REP_RET automatically
Loren Merritt [Wed, 11 Sep 2013 15:49:20 +0000 (17:49 +0200)]
x86inc: activate REP_RET automatically

Now RET checks whether it immediately follows a branch, so the
programmer dosen't have to keep track of that condition. REP_RET
is still needed manually when it's a branch target, but that's
much rarer.

The implementation involves lots of spurious labels, but that's OK
because we strip them.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
11 years agox86: fdct: Employ more specific ifdefs
Diego Biurrun [Mon, 16 Sep 2013 11:58:26 +0000 (13:58 +0200)]
x86: fdct: Employ more specific ifdefs

This avoids building mmxext and sse2 code when disabled by configure.

11 years agobmv: Remove unused variable
Diego Biurrun [Sun, 6 Oct 2013 10:52:12 +0000 (12:52 +0200)]
bmv: Remove unused variable

11 years agooggparsevorbis: return meaningful errors
Vittorio Giovara [Sat, 5 Oct 2013 20:10:01 +0000 (22:10 +0200)]
oggparsevorbis: return meaningful errors

Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years agox86: dsputil: Separate ff_add_hfyu_median_prediction_cmov from dsputil_mmx
Diego Biurrun [Sat, 5 Oct 2013 16:38:06 +0000 (18:38 +0200)]
x86: dsputil: Separate ff_add_hfyu_median_prediction_cmov from dsputil_mmx

The function does not depend on MMX and compilation without MMX enabled
fails if the function is compiled conditional on MMX availability.

11 years agoswscale: provide a default scaler if none is set
Vittorio Giovara [Tue, 1 Oct 2013 17:11:00 +0000 (19:11 +0200)]
swscale: provide a default scaler if none is set

Lanczos for general case, sinc for upscaling, Gaussian for
downscaling. According to current literature these scalers
should be the best quality-wise algorithms for each case.

Inspired from a patch by wm4 <nfxjfg@googlemail.com>

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
11 years agox86: fdct: Initialize optimized fdct implementations in the standard way
Diego Biurrun [Mon, 30 Sep 2013 13:25:47 +0000 (15:25 +0200)]
x86: fdct: Initialize optimized fdct implementations in the standard way

11 years agox86: xviddct: Employ more specific ifdefs
Diego Biurrun [Mon, 16 Sep 2013 11:47:35 +0000 (13:47 +0200)]
x86: xviddct: Employ more specific ifdefs

This avoids building mmxext and sse2 code when disabled by configure.

11 years agodoxy: Document avlog
Luca Barbato [Wed, 18 Sep 2013 13:27:52 +0000 (15:27 +0200)]
doxy: Document avlog

Provide some information for every function and add a group.

11 years agoismindex: Change the duration field to int64_t
Martin Storsjö [Fri, 4 Oct 2013 07:14:49 +0000 (10:14 +0300)]
ismindex: Change the duration field to int64_t

This reduces the risk for overflow in pathlogical cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoismindex: Calculate the file duration among the included tracks
Martin Storsjö [Fri, 4 Oct 2013 07:12:07 +0000 (10:12 +0300)]
ismindex: Calculate the file duration among the included tracks

If the input file contains other tracks (non video/audio) that
aren't included in ismindex, the global file duration as returned
by libavformat might not be equal to the maximum of the duration
of the actual included tracks.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoismindex: Use the individual stream duration instead of the global one
Martin Storsjö [Wed, 2 Oct 2013 22:52:37 +0000 (01:52 +0300)]
ismindex: Use the individual stream duration instead of the global one

The stream duration is used for calculating the duration of the
last fragment easily without manually parsing anything else than
the mfra/tfra atoms. When the global file duration was used
previously, the duration of the last fragment could end up wrong
if the streams weren't equally long.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agomov: Don't allocate arrays with av_malloc that will be realloced
Martin Storsjö [Fri, 4 Oct 2013 06:52:02 +0000 (09:52 +0300)]
mov: Don't allocate arrays with av_malloc that will be realloced

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agox86: fdct: Only build fdct code if encoders have been enabled
Diego Biurrun [Mon, 16 Sep 2013 11:55:07 +0000 (13:55 +0200)]
x86: fdct: Only build fdct code if encoders have been enabled

fdct is only initialized if encoders are enabled.

11 years agortmpproto: Validate the embedded flv packet size before copying
Martin Storsjö [Thu, 3 Oct 2013 11:49:50 +0000 (13:49 +0200)]
rtmpproto: Validate the embedded flv packet size before copying

This wasn't an issue prior to 58404738, when the whole RTMP packet
was copied at once and the length of the individual embedded flv
packets only were validated by the flv demuxer.

Prior to this patch, this could lead to reads and writes out of bound.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agortmpproto: Readjust the end of the flv buffer if handle_metadata exited early
Martin Storsjö [Thu, 3 Oct 2013 11:44:38 +0000 (13:44 +0200)]
rtmpproto: Readjust the end of the flv buffer if handle_metadata exited early

If the embedded flv packets were incomplete and we aborted the
copying loop early, make sure the flv buffer is trimmed to
only contain full packets.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agortmpproto: Move the flv header/trailer addition to append_flv_data
Martin Storsjö [Thu, 3 Oct 2013 10:29:37 +0000 (12:29 +0200)]
rtmpproto: Move the flv header/trailer addition to append_flv_data

update_offset is also called from handle_metadata, where the
packet header sizes is already included in the size.

Previously this lead to flv_data/flv_size including 15 uninitialized
bytes at the end after each call to handle_metadata, making the
flv demuxer lose sync with the stream.

Also remove leftover copying in handle_metadata. This is a leftover
from the refactoring in 5840473. (Previously this final mempcy was
the one that copied all the packets at once, while this is done
within the loop right now.) After making sure flv_size is set to
the right size, this write was out of bounds.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agortmpproto: Clear the flv allocation size on reallocp failures
Martin Storsjö [Thu, 3 Oct 2013 10:27:10 +0000 (12:27 +0200)]
rtmpproto: Clear the flv allocation size on reallocp failures

This was overlooked in d872fb0f7 since I assumed all the realloc
issues in the rtmp code was fixed already.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agortmpproto: Pass the 'live' parameter in the right unit
Martin Storsjö [Thu, 3 Oct 2013 07:09:56 +0000 (09:09 +0200)]
rtmpproto: Pass the 'live' parameter in the right unit

The current magic numbers passed are values in seconds, while the
parameter itself should be passed over the wire in milliseconds.

This makes (some/all?) live streams from Red5 work correctly, that
previously returned StreamNotFound even with "-rtmp_live live". After
this commit, the default 'any' also works on these streams.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agortmpproto: Print the error code string if there's no description
Martin Storsjö [Thu, 3 Oct 2013 05:44:51 +0000 (07:44 +0200)]
rtmpproto: Print the error code string if there's no description

On (certain streams/setups at least on) Red5, the description string
actually is present, but empty. Therefore, first try loading the
description, but if not found or empty, load the code string instead.
The code string is quite understandable in most cases anyway (like
"NetStream.Play.StreamNotFound").

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agocosmetics: Group .name and .long_name together in codec/format declarations
Diego Biurrun [Thu, 3 Oct 2013 20:57:53 +0000 (22:57 +0200)]
cosmetics: Group .name and .long_name together in codec/format declarations

11 years agooggparsevorbis: K&R formatting cosmetics
Vittorio Giovara [Wed, 2 Oct 2013 14:26:38 +0000 (16:26 +0200)]
oggparsevorbis: K&R formatting cosmetics

Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years agoavformat/output-example: Declare link dependency on libswscale in the Makefile
Diego Biurrun [Tue, 1 Oct 2013 11:34:02 +0000 (13:34 +0200)]
avformat/output-example: Declare link dependency on libswscale in the Makefile

11 years agox86: cpu: Restore some explanatory comments removed in 7160bb7
Diego Biurrun [Fri, 27 Sep 2013 13:24:55 +0000 (15:24 +0200)]
x86: cpu: Restore some explanatory comments removed in 7160bb7

11 years agoatrac: Add missing av_cold
Maxim Poliakovski [Thu, 3 Oct 2013 18:49:50 +0000 (20:49 +0200)]
atrac: Add missing av_cold

Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years agoatrac3: Generalize gain compensation code
Maxim Poliakovski [Mon, 30 Sep 2013 21:14:51 +0000 (23:14 +0200)]
atrac3: Generalize gain compensation code

Move it to the ATRAC common code, to reuse in the upcoming ATRAC3+ decoder.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years agoUse correct Doxygen syntax
Diego Biurrun [Thu, 3 Oct 2013 15:46:36 +0000 (17:46 +0200)]
Use correct Doxygen syntax

11 years agoatrac: Move doxygen comments to the header
Maxim Poliakovski [Mon, 30 Sep 2013 21:14:51 +0000 (23:14 +0200)]
atrac: Move doxygen comments to the header

Also update copyright info and file description.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
11 years agoatrac3: Replace a silly counter variable name with plain 'j'
Diego Biurrun [Tue, 1 Oct 2013 18:39:23 +0000 (20:39 +0200)]
atrac3: Replace a silly counter variable name with plain 'j'

11 years agolavc: mark deprecated AVCodec.max_lowres for removal on next bump
Anton Khirnov [Mon, 30 Sep 2013 12:44:24 +0000 (14:44 +0200)]
lavc: mark deprecated AVCodec.max_lowres for removal on next bump

11 years agovf_interlace: do not process an already interlaced frame
Vittorio Giovara [Tue, 1 Oct 2013 17:08:03 +0000 (19:08 +0200)]
vf_interlace: do not process an already interlaced frame

Signed-off-by: Anton Khirnov <anton@khirnov.net>
11 years agortmp: alias rtmp_listen to listen
Luca Barbato [Tue, 1 Oct 2013 13:42:06 +0000 (15:42 +0200)]
rtmp: alias rtmp_listen to listen

Make it uniform with the other protocols.

11 years agomxf: Remove a typo
Luca Barbato [Tue, 1 Oct 2013 11:43:48 +0000 (13:43 +0200)]
mxf: Remove a typo

Introduced in 93370d1216

11 years agoasfdec: Check the return value of asf_read_stream_properties
Martin Storsjö [Sat, 28 Sep 2013 20:32:57 +0000 (23:32 +0300)]
asfdec: Check the return value of asf_read_stream_properties

This makes sure errors in setting stream parameters are passed
on to the caller. This avoids successfully opening files while
some parameters aren't filled in properly.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoomadec: fix bitrate for ATRAC3+ streams
Maxim Poliakovski [Sun, 29 Sep 2013 19:53:49 +0000 (21:53 +0200)]
omadec: fix bitrate for ATRAC3+ streams

Signed-off-by: Anton Khirnov <anton@khirnov.net>
11 years agoAdd support for multichannel ATRAC3+ streams.
Maxim Poliakovski [Fri, 27 Sep 2013 22:18:18 +0000 (00:18 +0200)]
Add support for multichannel ATRAC3+ streams.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
11 years agomxfdec: set audio timebase to 1/samplerate
Anton Khirnov [Sat, 28 Sep 2013 14:56:54 +0000 (16:56 +0200)]
mxfdec: set audio timebase to 1/samplerate

Fixes sync in some samples (e.g. bugs 7581 and 8374 in VLC).
Based on a commit by Matthieu Bouron <matthieu.bouron@gmail.com>

Reported-by: Jean-Baptiste Kempf <jb@videolan.org>
CC: libav-stable@libav.org
11 years agopcx: Return an error on broken palette if err_detect is set to 'explode'
Martin Storsjö [Sun, 29 Sep 2013 15:39:52 +0000 (18:39 +0300)]
pcx: Return an error on broken palette if err_detect is set to 'explode'

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agopcx: Check the packet size before assuming it fits a palette
Martin Storsjö [Sun, 29 Sep 2013 10:02:27 +0000 (13:02 +0300)]
pcx: Check the packet size before assuming it fits a palette

This fixes reads out of bounds.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agorpza: Fix a buffer size check
Martin Storsjö [Sat, 28 Sep 2013 22:24:20 +0000 (01:24 +0300)]
rpza: Fix a buffer size check

We read 2 bytes for 15 out of 16 pixels, therefore we need to
have at least 30 bytes, not 16.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoxxan: Disallow odd width
Martin Storsjö [Sat, 28 Sep 2013 22:04:05 +0000 (01:04 +0300)]
xxan: Disallow odd width

Decoded data is always written in pairs within this decoder.
This fixes writes out of bounds.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoxan: Only read within the data that actually was initialized
Martin Storsjö [Sat, 28 Sep 2013 21:59:50 +0000 (00:59 +0300)]
xan: Only read within the data that actually was initialized

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoxan: Use bytestream2 to limit reading to within the buffer
Martin Storsjö [Sat, 28 Sep 2013 21:53:58 +0000 (00:53 +0300)]
xan: Use bytestream2 to limit reading to within the buffer

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agopcx: Consume the whole packet if giving up due to missing palette
Martin Storsjö [Sat, 28 Sep 2013 21:38:50 +0000 (00:38 +0300)]
pcx: Consume the whole packet if giving up due to missing palette

Previously, we returned 0, meaning successful decoding but 0
bytes consumed, leading to an infinite loop.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agopngdec: Stop trying to decode once inflate returns Z_STREAM_END
Martin Storsjö [Sat, 28 Sep 2013 21:12:04 +0000 (00:12 +0300)]
pngdec: Stop trying to decode once inflate returns Z_STREAM_END

If the input buffer contains more data after the deflate stream,
the loop previously left running infinitely, with inflate returning
Z_STREAM_END.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agomov: Make sure the read sample count is nonnegative
Martin Storsjö [Sat, 28 Sep 2013 20:57:36 +0000 (23:57 +0300)]
mov: Make sure the read sample count is nonnegative

This avoids setting a negative number of frames, ending up with a
negative average frame rate.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agobfi: Add some very basic sanity checks for input packet sizes
Martin Storsjö [Sat, 28 Sep 2013 20:46:04 +0000 (23:46 +0300)]
bfi: Add some very basic sanity checks for input packet sizes

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agobfi: Avoid divisions by zero
Martin Storsjö [Sat, 28 Sep 2013 20:42:40 +0000 (23:42 +0300)]
bfi: Avoid divisions by zero

If a zero-length video packet is to be returned, just return
AVERROR(EAGAIN) and switch back to the audio stream.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoelectronicarts: Add more sanity checking for the number of channels
Martin Storsjö [Sat, 28 Sep 2013 20:38:40 +0000 (23:38 +0300)]
electronicarts: Add more sanity checking for the number of channels

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoriffdec: Add sanity checks for the sample rate
Martin Storsjö [Sat, 28 Sep 2013 20:32:39 +0000 (23:32 +0300)]
riffdec: Add sanity checks for the sample rate

This avoids a division by zero for G726.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agomvi: Add sanity checking for the audio frame size
Martin Storsjö [Sat, 28 Sep 2013 20:26:18 +0000 (23:26 +0300)]
mvi: Add sanity checking for the audio frame size

This avoids a division by zero.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoalac: Do bounds checking of lpc_order read from the bitstream
Martin Storsjö [Fri, 27 Sep 2013 21:22:52 +0000 (00:22 +0300)]
alac: Do bounds checking of lpc_order read from the bitstream

In lpc_prediction(), we write up to array element 'lpc_order' in
an array allocated to hold 'max_samples_per_frame' elements.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoxwma: Avoid division by zero
Martin Storsjö [Sat, 28 Sep 2013 20:13:26 +0000 (23:13 +0300)]
xwma: Avoid division by zero

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agoavidec: Make sure a packet is large enough before reading its data
Martin Storsjö [Fri, 27 Sep 2013 21:41:31 +0000 (00:41 +0300)]
avidec: Make sure a packet is large enough before reading its data

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agovqf: Make sure the bitrate is in the valid range
Martin Storsjö [Sat, 28 Sep 2013 20:19:10 +0000 (23:19 +0300)]
vqf: Make sure the bitrate is in the valid range

Even if the sample rate is valid, an invalid bitrate could
pass the mode combination test below.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agovqf: Make sure sample_rate is set to a valid value
Martin Storsjö [Fri, 27 Sep 2013 21:34:35 +0000 (00:34 +0300)]
vqf: Make sure sample_rate is set to a valid value

This avoids divisions by zero later (and possibly assertions in
time base scaling), since an invalid rate_flag combined with an
invalid bitrate below could pass the mode combination test.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agolavfi: allow user-provided execute() callbacks
Anton Khirnov [Thu, 8 Aug 2013 14:28:41 +0000 (16:28 +0200)]
lavfi: allow user-provided execute() callbacks

11 years agoavframe: note that linesize is not the usable data size
Anton Khirnov [Fri, 27 Sep 2013 14:49:05 +0000 (16:49 +0200)]
avframe: note that linesize is not the usable data size

11 years agolxf: check the nb_streams instead of relying on padding
Luca Barbato [Tue, 25 Jun 2013 14:42:02 +0000 (16:42 +0200)]
lxf: check the nb_streams instead of relying on padding

Remove the now unneeded stream pointer while at it.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agolxf: remove deplanarization hack
Paul B Mahol [Fri, 16 Nov 2012 15:10:36 +0000 (15:10 +0000)]
lxf: remove deplanarization hack

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
11 years agopcm: support 24-bit/32-bit little-endian planar
Paul B Mahol [Fri, 16 Nov 2012 16:00:04 +0000 (16:00 +0000)]
pcm: support 24-bit/32-bit little-endian planar

Used by LXF.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
11 years agolxf: Support 16-channel files
Carl Eugen Hoyos [Thu, 16 Aug 2012 08:20:25 +0000 (10:20 +0200)]
lxf: Support 16-channel files

Reported, analyzed and tested by Gabriel Gerard.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
11 years agolxf: Support version 1 files
Reimar Döffinger [Sat, 24 Mar 2012 15:47:33 +0000 (16:47 +0100)]
lxf: Support version 1 files

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
11 years agolavf: Reset the entry count and allocation size variables on av_reallocp failures
Martin Storsjö [Thu, 26 Sep 2013 13:37:02 +0000 (16:37 +0300)]
lavf: Reset the entry count and allocation size variables on av_reallocp failures

When av_reallocp fails, the associated variables that keep track of
the number of elements in the array (and in some cases, the
separate number of allocated elements) need to be reset.

Not all of these might technically be needed, but it's better to
reset them if in doubt, to make sure variables don't end up
conflicting.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agolavf: Allocate arrays with av_realloc if they will be realloced later
Martin Storsjö [Thu, 26 Sep 2013 13:34:04 +0000 (16:34 +0300)]
lavf: Allocate arrays with av_realloc if they will be realloced later

Pointers returned from av_malloc can't in general be passed
to av_realloc.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agortpdec_qt: Add an accidentally removed allocation return value check
Martin Storsjö [Thu, 26 Sep 2013 13:34:59 +0000 (16:34 +0300)]
rtpdec_qt: Add an accidentally removed allocation return value check

This check was mistakenly removed in 5626f994f.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agotls: Add support for listen mode
Martin Storsjö [Thu, 19 Sep 2013 09:30:52 +0000 (12:30 +0300)]
tls: Add support for listen mode

Also add options for specifying a certificate and key, which can
be used both when operating as client and as server.

Partially based on a patch by Peter Ross.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agohttp: Pass options through to the nested protocol
Martin Storsjö [Mon, 7 Nov 2011 09:06:50 +0000 (11:06 +0200)]
http: Pass options through to the nested protocol

When passing a dict to the nested protocol, it will consume
the used options from it, so a separate copy needs to be used
when reopening the connection multiple times.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agotls: Add options for verifying the peer certificate
Martin Storsjö [Tue, 22 Feb 2011 10:02:01 +0000 (12:02 +0200)]
tls: Add options for verifying the peer certificate

A file containing the trusted CA certificates needs to be
supplied via the ca_file AVOption, unless the TLS library
has got a system default file/database set up.

This doesn't check the hostname of the peer certificate with
openssl, which requires a non-trivial piece of code for
manually matching the desired hostname to the string provided
by the certificate, not provided as a library function.

That is, with openssl, this only validates that the received
certificate is signed with the right CA, but not that it is
the actual server we think we're talking to.

Verification is still disabled by default since we can't count
on a proper CA database existing at all times.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agog2meet: Respect cursor_stride properly everywhere
Kostya Shishkov [Wed, 25 Sep 2013 09:09:33 +0000 (12:09 +0300)]
g2meet: Respect cursor_stride properly everywhere

This fixes a regression with rgb cursors since b1e46988.

Signed-off-by: Martin Storsjö <martin@martin.st>
11 years agolavc doxy: document that avcodec_flush_buffers() invalidates decoded frames
Anton Khirnov [Tue, 18 Jun 2013 09:35:44 +0000 (11:35 +0200)]
lavc doxy: document that avcodec_flush_buffers() invalidates decoded frames

11 years agodoc/filters: fix an option name in the unsharp docs
Anton Khirnov [Thu, 11 Jul 2013 02:44:41 +0000 (04:44 +0200)]
doc/filters: fix an option name in the unsharp docs

11 years agoh264: do not reinitialize the global cabac tables at each slice header
Anton Khirnov [Sun, 11 Aug 2013 10:14:44 +0000 (12:14 +0200)]
h264: do not reinitialize the global cabac tables at each slice header

11 years agocabac: remove write-only h264_mps_state[]
Anton Khirnov [Sun, 11 Aug 2013 10:12:43 +0000 (12:12 +0200)]
cabac: remove write-only h264_mps_state[]

11 years agomatroskadec: check av_strdup() when setting defaults
Anton Khirnov [Wed, 4 Sep 2013 06:55:17 +0000 (08:55 +0200)]
matroskadec: check av_strdup() when setting defaults