6 years agoxwddec: prevent overflow of lsize * avctx->height
Andreas Cadhalpun [Fri, 18 Dec 2015 18:28:51 +0000 (19:28 +0100)]
xwddec: prevent overflow of lsize * avctx->height

This is used to check if the input buffer is larger enough, so if this
overflows it can cause a false negative leading to a segmentation fault
in bytestream2_get_bufferu.

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Anton Khirnov <>
6 years agonuv: sanitize negative fps rate
Andreas Cadhalpun [Wed, 16 Dec 2015 19:52:39 +0000 (20:52 +0100)]
nuv: sanitize negative fps rate

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Anton Khirnov <>
6 years agoon2avc: limit number of bits to 30 in get_egolomb
Andreas Cadhalpun [Wed, 16 Dec 2015 15:48:19 +0000 (16:48 +0100)]
on2avc: limit number of bits to 30 in get_egolomb

More don't fit into the integer output.

Also use get_bits_long, since get_bits only supports reading up to 25
bits, while get_bits_long supports the full integer range.

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Anton Khirnov <>
6 years agonvenc: generate dts properly
Anton Khirnov [Fri, 8 Jan 2016 16:08:39 +0000 (17:08 +0100)]
nvenc: generate dts properly

When there is a non-zero decoding delay due to reordering, the first dts
should be lower than the first pts (since the first packet fed to the
decoder does not produce any output).

Use the same scheme used in mpegvideo_enc (which comes from x264
originally) -- wait for first two timestamps and extrapolate linearly to
the past to produce the first dts value.

6 years agonvenc: fix encoding with B-frames
Anton Khirnov [Fri, 8 Jan 2016 14:59:41 +0000 (15:59 +0100)]
nvenc: fix encoding with B-frames

When B-frames are enabled and the encoder returns success, all currently
pending buffers immediately become valid and can be returned to the
caller. We can only return one packet at a time, so all the other
pending buffers should be transferred to a new 'ready' fifo, from where
they can be returned in subsequent calls (in which the encoder does not
produce any new output). This bug was hidden by the incorrect testing of
the encoder return value (the return value was overwritten before it was

6 years agonvenc: flush the encoder before closing it, as required by the docs
Anton Khirnov [Fri, 8 Jan 2016 11:29:38 +0000 (12:29 +0100)]
nvenc: flush the encoder before closing it, as required by the docs

Otherwise, closing the encoder can crash.

6 years agonvenc: rename encoders
Anton Khirnov [Thu, 7 Jan 2016 06:58:24 +0000 (07:58 +0100)]
nvenc: rename encoders

Change 'nvenc_<codec>' to '<codec>_nvenc', which is consistent with
other similar decoders and encoders (QSV, MMAL).

6 years agonvenc: better error handling
Anton Khirnov [Wed, 6 Jan 2016 18:52:37 +0000 (19:52 +0100)]
nvenc: better error handling

Return proper error codes and print more descriptive error messages.

6 years agomovenc-test: stop setting the GLOBAL_HEADER codec flag
Anton Khirnov [Thu, 7 Jan 2016 07:26:26 +0000 (08:26 +0100)]
movenc-test: stop setting the GLOBAL_HEADER codec flag

This test does no encoding, setting the flag was done just to silence
the warning removed in the previous commit.

6 years agomux: drop the warning about global headers
Anton Khirnov [Thu, 7 Jan 2016 07:24:54 +0000 (08:24 +0100)]
mux: drop the warning about global headers

The AVStream codec context is often not (and should not be) the actual
encoding context, so this warning will be spurious in many cases.

6 years agolavc: Use get_bitsz where needed
Andreas Cadhalpun [Mon, 11 Jan 2016 20:14:00 +0000 (21:14 +0100)]
lavc: Use get_bitsz where needed

Signed-off-by: Luca Barbato <>
6 years agolavc: Add get_bitsz()
Andreas Cadhalpun [Mon, 11 Jan 2016 20:05:55 +0000 (21:05 +0100)]
lavc: Add get_bitsz()

get_bit variant supporting 0-bits reads.

Signed-off-by: Luca Barbato <>
6 years agosunrastenc: Properly load codec private options
Vittorio Giovara [Mon, 4 Jan 2016 13:13:00 +0000 (14:13 +0100)]
sunrastenc: Properly load codec private options

Initialize the private class field and give the class a more
appropriate name. Add a class member to the codec context.

6 years agoget_bits: Support max_depth > 2 in GET_RL_VLC_INTERNAL
Kieran Kunhya [Sun, 13 Dec 2015 18:02:09 +0000 (18:02 +0000)]
get_bits: Support max_depth > 2 in GET_RL_VLC_INTERNAL

6 years agolavu: add AV_CEIL_RSHIFT and use it in various places
Clément Bœsch [Fri, 8 Jan 2016 15:16:10 +0000 (16:16 +0100)]
lavu: add AV_CEIL_RSHIFT and use it in various places

Signed-off-by: Vittorio Giovara <>
6 years agoswfdec: support compressed swf
Clément Bœsch [Wed, 2 Dec 2015 23:41:00 +0000 (18:41 -0500)]
swfdec: support compressed swf

Signed-off-by: Vittorio Giovara <>
6 years agoasfdec: Fix typo in comment
Alexandra Hájková [Sat, 9 Jan 2016 18:35:28 +0000 (19:35 +0100)]
asfdec: Fix typo in comment

Signed-off-by: Luca Barbato <>
6 years agoAPIchanges: Add missing av_pix_fmt_get_chroma_sub_sample entry
Luca Barbato [Mon, 11 Jan 2016 19:51:51 +0000 (20:51 +0100)]
APIchanges: Add missing av_pix_fmt_get_chroma_sub_sample entry

6 years agoarm: Fix vfp dead code elimination with have_vfp_vm
Martin Storsjö [Thu, 7 Jan 2016 13:06:49 +0000 (15:06 +0200)]
arm: Fix vfp dead code elimination with have_vfp_vm

This fixes builds with --disable-vfp.

Checking for the armv6 cpu flag is incorrect, since vfpv2 isn't
armv6 specific.

Signed-off-by: Martin Storsjö <>
6 years agocheckasm: Check register clobbering on aarch64
Martin Storsjö [Thu, 31 Dec 2015 10:20:37 +0000 (12:20 +0200)]
checkasm: Check register clobbering on aarch64

This is disabled on iOS, since iOS uses a slightly different ABI
for vararg parameters.

Signed-off-by: Martin Storsjö <>
6 years agocheckasm: Check register clobbering on arm
Martin Storsjö [Wed, 30 Dec 2015 21:46:06 +0000 (23:46 +0200)]
checkasm: Check register clobbering on arm

Use two separate functions, depending on whether VFP/NEON is available.

This is set to require armv5te - it uses blx, which is only available
since armv5t, but we don't have a separate configure item for that.
(It also uses ldrd, which requires armv5te, but this could be avoided
if necessary.)

Signed-off-by: Martin Storsjö <>
6 years agoavpacket: fix size check in packet_alloc
Andreas Cadhalpun [Tue, 5 Jan 2016 12:05:50 +0000 (13:05 +0100)]
avpacket: fix size check in packet_alloc

The previous check only caught sizes from -AV_INPUT_BUFFER_PADDING_SIZE
to -1.

This fixes ubsan runtime error: signed integer overflow: 2147483647 + 32
cannot be represented in type 'int'

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Anton Khirnov <>
6 years agoasfdec: Remove unused function parameters
Alexandra Hájková [Wed, 6 Jan 2016 05:08:08 +0000 (06:08 +0100)]
asfdec: Remove unused function parameters

Signed-off-by: Anton Khirnov <>
6 years agoasfdec: reject size > INT64_MAX in asf_read_unknown
Andreas Cadhalpun [Wed, 6 Jan 2016 06:32:25 +0000 (07:32 +0100)]
asfdec: reject size > INT64_MAX in asf_read_unknown

Both avio_skip and detect_unknown_subobject use int64_t for the size

This fixes a segmentation fault due to infinite recursion.

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Alexandra Hájková <>
Signed-off-by: Anton Khirnov <>
6 years agoasfdec: only set asf_pkt->data_size after sanity checks
Andreas Cadhalpun [Wed, 6 Jan 2016 06:34:42 +0000 (07:34 +0100)]
asfdec: only set asf_pkt->data_size after sanity checks

Otherwise invalid values are used unchecked in the next run.
This can cause NULL pointer dereferencing.

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Alexandra Hájková <>
Signed-off-by: Anton Khirnov <>
6 years agoqsvenc: split encoding frames and reading from the async FIFO
Anton Khirnov [Wed, 6 Jan 2016 07:39:27 +0000 (08:39 +0100)]
qsvenc: split encoding frames and reading from the async FIFO

This makes sure all the frames are returned at the end.

Found-By: Maxym Dmytrychenko <>
6 years agoqsvenc: properly handle the warning from MFXVideoCORE_SyncOperation
Maxym Dmytrychenko [Fri, 18 Dec 2015 13:24:36 +0000 (14:24 +0100)]
qsvenc: properly handle the warning from MFXVideoCORE_SyncOperation

Same as what is done in 3b6473b43eb69fc3faaf69f7fd0b83b51db7607f.

Signed-off-by: Anton Khirnov <>
6 years agoavconv: Drop an impossible check
Luca Barbato [Sat, 2 Jan 2016 13:43:13 +0000 (14:43 +0100)]
avconv: Drop an impossible check

EAGAIN is already managed in poll_filters().

Signed-off-by: Luca Barbato <>
6 years agoavconv: Simplify poll_filters() return value check
Luca Barbato [Sat, 2 Jan 2016 13:43:12 +0000 (14:43 +0100)]
avconv: Simplify poll_filters() return value check

Signed-off-by: Luca Barbato <>
6 years agoh264_refs: Remove broken trace debug code
Diego Biurrun [Fri, 11 Dec 2015 12:32:47 +0000 (13:32 +0100)]
h264_refs: Remove broken trace debug code

6 years agolavc: Add missing #includes for ff_dlog()
Diego Biurrun [Fri, 11 Dec 2015 12:17:15 +0000 (13:17 +0100)]
lavc: Add missing #includes for ff_dlog()

6 years agoqsvdec: properly handle the warning from MFXVideoCORE_SyncOperation
Maxym Dmytrychenko [Fri, 18 Dec 2015 13:24:36 +0000 (14:24 +0100)]
qsvdec: properly handle the warning from MFXVideoCORE_SyncOperation

Signed-off-by: Anton Khirnov <>
6 years agoqsvenc_hevc: improve the default settings
Maxym Dmytrychenko [Fri, 18 Dec 2015 08:55:13 +0000 (09:55 +0100)]
qsvenc_hevc: improve the default settings

Use 8 B-frames and modify the GOP size to be a multiple of the B-frame

Signed-off-by: Anton Khirnov <>
6 years agoh264: improve behaviour with invalid reference lists
Anton Khirnov [Thu, 17 Dec 2015 18:38:24 +0000 (19:38 +0100)]
h264: improve behaviour with invalid reference lists

Before 741b494fa8cd28a7d096349bac183893c236e3f9, when the reference list
modification description was invalid, the code would substitute the
corresponding reference from the initial ("default") reference list.
After that commit, it will just return an error.

Since there are apparently invalid samples in the wild that used to play
fine with the old code, it is a good idea to re-add some sort of error
resilience here. So, when the reference list modification results in a
missing frame, substitute a previous reference frame for it. The
relevant sample again decodes fine with the same output as previously.

6 years agodca: use defines for subband related constants
Alexandra Hájková [Wed, 30 Dec 2015 14:29:03 +0000 (15:29 +0100)]
dca: use defines for subband related constants

Signed-off-by: Janne Grunau <>
6 years agox86: use emms after ff_int32_to_float_fmul_scalar_sse
Janne Grunau [Tue, 29 Dec 2015 11:08:38 +0000 (12:08 +0100)]
x86: use emms after ff_int32_to_float_fmul_scalar_sse

Intel's Instruction Set Reference (as of September 2015) clearly states
that cvtpi2ps switches to MMX state. Actual CPUs do not switch if the
source is a memory location. The Instruction Set Reference from 1999
(Order Number 243191) describes this behaviour but all later versions
I've seen have make no distinction whether MMX registers or memory is
used as source.
The documentation for the matching SSE2 instruction to convert to double
(cvtpi2pd) was fixed (see the valgrind bug

It will take time to get a clarification and fixes in place. In the
meantime it makes sense to change ff_int32_to_float_fmul_scalar_sse to
be correct according to the documentation. The vast majority of users
will have SSE2 so a change to the SSE version has little effect.

Fixes fate-checkasm on x86 valgrind targets.

Valgrind 'bug' reported as

6 years agocheckasm: x86: post commit review fixes
Janne Grunau [Tue, 22 Dec 2015 21:51:55 +0000 (22:51 +0100)]
checkasm: x86: post commit review fixes

Check the full FPU tag word instead of only the lower half and simplify
the comparison.
Use upper-case function base name as macro name to instantiate both
checked_call variants.

6 years agox86: zero extend the 32-bit length in int32_to_float_fmul_scalar implicitly
Janne Grunau [Tue, 22 Dec 2015 21:45:42 +0000 (22:45 +0100)]
x86: zero extend the 32-bit length in int32_to_float_fmul_scalar implicitly

This reverts commit 5dfe4edad63971d669ae456b0bc40ef9364cca80.

6 years agoRemove stray line breaks from avpriv_{report_missing_feature|request_samples}
Diego Biurrun [Tue, 15 Dec 2015 18:59:14 +0000 (19:59 +0100)]
Remove stray line breaks from avpriv_{report_missing_feature|request_samples}

6 years agortpdec_jpeg: Coalesce redundant error checks
Diego Biurrun [Thu, 17 Dec 2015 12:04:55 +0000 (13:04 +0100)]
rtpdec_jpeg: Coalesce redundant error checks

6 years agodca: remove unused decode_hf function and quant_d tables
Alexandra Hájková [Fri, 18 Dec 2015 13:54:02 +0000 (14:54 +0100)]
dca: remove unused decode_hf function and quant_d tables

They were superseded with their integer equivalents. Rename integer
decode_hf to decode_hf.

6 years agodca: change the core to work with integer coefficients.
Alexandra Hájková [Thu, 17 Dec 2015 14:52:47 +0000 (15:52 +0100)]
dca: change the core to work with integer coefficients.

The DCA core decoder converts integer coefficients read from the
bitstream to floats just after reading them (along with dequantization).
All the other steps of the audio reconstruction are done with floats
which makes the output for the DTS lossless extension (XLL)
actually lossy.
This patch changes the DCA core to work with integer coefficients
until QMF. At this point the integer coefficients are converted to floats.
The coefficients for the LFE channel (lfe_data) are not touched.
This is the first step for the really lossless XLL decoding.

6 years agodca: Add math helpers.
Alexandra Hájková [Thu, 3 Dec 2015 12:45:10 +0000 (13:45 +0100)]
dca: Add math helpers.

They will be used by the integer core decoder.

6 years agocheckasm: add fmtconvert tests
Janne Grunau [Tue, 8 Dec 2015 15:24:57 +0000 (16:24 +0100)]
checkasm: add fmtconvert tests

6 years agocheckasm: add synth_filter test
Janne Grunau [Mon, 7 Dec 2015 22:38:46 +0000 (23:38 +0100)]
checkasm: add synth_filter test

6 years agocheckasm: add tests for dcadsp
Janne Grunau [Mon, 7 Dec 2015 00:23:47 +0000 (01:23 +0100)]
checkasm: add tests for dcadsp

6 years agocheckasm: add float comparison util functions
Janne Grunau [Mon, 7 Dec 2015 15:14:46 +0000 (16:14 +0100)]
checkasm: add float comparison util functions

6 years agox86: checkasm: check for or handle missing cleanup after MMX instructions
Janne Grunau [Fri, 11 Dec 2015 13:06:38 +0000 (14:06 +0100)]
x86: checkasm: check for or handle missing cleanup after MMX instructions

Not every asm routine is expected clear the MMX state after returning.
It is however a requisite for testing floating point code in checkasm.
Annotate functions requiring cleanup with declare_func_emms() and issue
emms after the call. The remaining functions are checked for having  a
cleared MMX state after return.

6 years agoarm64: fix inverted register order in transpose_4x4H
Janne Grunau [Fri, 18 Dec 2015 10:23:22 +0000 (11:23 +0100)]
arm64: fix inverted register order in transpose_4x4H

Fix related register order issue in ff_h264_idct_add_neon.

Found-by: zjh8890 <>
6 years agoexr: fix out of bounds read in get_code
Andreas Cadhalpun [Sun, 13 Dec 2015 22:37:25 +0000 (23:37 +0100)]
exr: fix out of bounds read in get_code

This macro unconditionally used out[-1], which causes an out of bounds
read, if out is the very beginning of the buffer.

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Luca Barbato <>
6 years agoopus: Fix typo causing overflow in silk_stabilize_lsf
Andreas Cadhalpun [Tue, 15 Dec 2015 21:00:31 +0000 (22:00 +0100)]
opus: Fix typo causing overflow in silk_stabilize_lsf

Due to this typo max_center can be too large, causing nlsf to be set to
too large values, which in turn can cause nlsf[i - 1] + min_delta[i] to
overflow to a negative value, which is not allowed for nlsf and can
cause an out of bounds read in silk_lsf2lpc.

Signed-off-by: Andreas Cadhalpun <>
Signed-off-by: Luca Barbato <>
6 years agoarm: add ff_int32_to_float_fmul_array8_neon
Janne Grunau [Thu, 3 Dec 2015 15:17:32 +0000 (16:17 +0100)]
arm: add ff_int32_to_float_fmul_array8_neon

Quite a bit faster than int32_to_float_fmul_array8_c calling
ff_int32_to_float_fmul_scalar_neon through FmtConvertContext.
Number of cycles per int32_to_float_fmul_array8 call while decoding
padded.dts on exynos5422:

               before  after   change
cortex-a7:     1270     951    -25%
cortex-a15:     434     285    -34%

checkasm --bench cycle counts:     cortex-a15   cortex-a7
int32_to_float_fmul_array8_c:      1730.4       4384.5
int32_to_float_fmul_array8_neon_c:  571.5       1694.3
int32_to_float_fmul_array8_neon:    374.0       1448.8

Interesting are the differences between
int32_to_float_fmul_array8_neon_c and int32_to_float_fmul_array8_neon.
The former is current behaviour of calling
ff_int32_to_float_fmul_scalar_neon repeatedly from the c function,
The raw numbers differ since checkasm uses different lengths than the
dca decoder.

6 years agoarm64: int32_to_float_fmul neon asm
Janne Grunau [Thu, 3 Dec 2015 10:04:29 +0000 (11:04 +0100)]
arm64: int32_to_float_fmul neon asm

3% faster dts decoding on a cortex-a57.

                                 cortex-a57   cortex-a53
int32_to_float_fmul_array8_c:    1270.9       4475.6
int32_to_float_fmul_array8_neon:  328.6        569.2
int32_to_float_fmul_scalar_c:     928.5       4119.6
int32_to_float_fmul_scalar_neon:  309.1        524.1

6 years agoarm64: port synth_filter_float_neon from arm
Janne Grunau [Tue, 1 Dec 2015 12:37:41 +0000 (13:37 +0100)]
arm64: port synth_filter_float_neon from arm

~25% faster dts decoding overall. The checkasm CPU cycles numbers are
not that useful since synth_filter_float() calls FFTContext.imdct_half().

                         cortex-a57   cortex-a53
synth_filter_float_c:    1866.2       3490.9
synth_filter_float_neon:  915.0       1531.5

With fftc.imdct_half forced to imdct_half_neon:
                         cortex-a57   cortex-a53
synth_filter_float_c:    1718.4       3025.3
synth_filter_float_neon:  926.2       1530.1

6 years agoarm64: convert dcadsp neon asm from arm
Janne Grunau [Sat, 28 Nov 2015 14:23:52 +0000 (15:23 +0100)]
arm64: convert dcadsp neon asm from arm

~2% faster dts decoding overall.

                    cortex-a57   cortex-a53
dca_decode_hf_c:    474.8        1659.9
dca_decode_hf_neon: 225.2         301.1
dca_lfe_fir0_c:     913.2        1537.7
dca_lfe_fir0_neon:  286.8         451.9
dca_lfe_fir1_c:     848.7        1711.5
dca_lfe_fir1_neon:  387.1         506.4

6 years agoarm: add a cpu flag for the VFPv2 vector mode
Janne Grunau [Wed, 9 Dec 2015 21:28:36 +0000 (22:28 +0100)]
arm: add a cpu flag for the VFPv2 vector mode

The vector mode was deprecated in ARMv7-A/VFPv3 and various cpu
implementations do not support it in hardware. Vector mode code will
depending the OS either be emulated in software or result in an illegal
instruction on cpus which does not support it. This was not really
problem in practice since NEON implementations of the same functions are
preferred. It will however become a problem for checkasm which tests
every cpu flag separately.

Since this is a cpu feature newer cpu do not support anymore the
behaviour of this flag differs from the other flags. It can be only
activated by runtime cpu feature selection.

6 years agox86_64: int32_to_float_fmul_scalar sign extend integer length
Janne Grunau [Tue, 8 Dec 2015 15:20:19 +0000 (16:20 +0100)]
x86_64: int32_to_float_fmul_scalar sign extend integer length

6 years agoarm64: add cycle counter support
Janne Grunau [Wed, 2 Dec 2015 23:12:39 +0000 (00:12 +0100)]
arm64: add cycle counter support

The ISB (instruction synchronization barrier) might be too heavy for
START/STOPTIMER use but should be more accurate in checkasm where the
timing overhead is subtracted.

6 years agolibavutil: move FFALIGN macro from common.h to macros.h
Janne Grunau [Thu, 10 Dec 2015 20:49:30 +0000 (21:49 +0100)]
libavutil: move FFALIGN macro from common.h to macros.h

Include macros.h explicitly in common.h so that external code using
FFALIGN does not break. It was already implicitly included through
version.h. Include macros.h in lls.h and internal.h for FFALIGN.
lls.h was including common.h only for FFALIGN and internal.h was
missing the include for FFALIGN. `make checkheaders` did not catch it
because it's an internal header.

6 years agompegtsenc: add flag to embed an AC-3 ES the DVB way
Stefan Pöschel [Sat, 12 Dec 2015 19:26:38 +0000 (20:26 +0100)]
mpegtsenc: add flag to embed an AC-3 ES the DVB way

So far an AC-3 elementary stream is refered to in the PMT according to
System A (ATSC). However System B (DVB) has a different way to signal an AC-3
ES within the PMT. This different way can be enabled by a new flag. The flag is
more generally named 'system_b' as there are further differences between ATSC
and DVB (e.g. the signalling of E-AC-3) which should then also be covered by it
in the future.

Bug-Id: 73

Signed-off-by: Luca Barbato <>
6 years agoavresample: Mark avresample_buffer() as pointer to const
Kip Warner [Thu, 10 Dec 2015 23:52:50 +0000 (15:52 -0800)]
avresample: Mark avresample_buffer() as pointer to const

That buffer is read only and marking it accordingly let
the user passing a constant buffer to it without having
a const-correctness warning.

Signed-off-by: Luca Barbato <>
6 years agor3d: fix an invalid read introduced in 6bf4c1d
Anton Khirnov [Sun, 13 Dec 2015 06:13:37 +0000 (07:13 +0100)]
r3d: fix an invalid read introduced in 6bf4c1d

6 years agortmpproto: Include the full path as app when "slist=" is found
Martin Storsjö [Wed, 11 Nov 2015 20:38:39 +0000 (22:38 +0200)]
rtmpproto: Include the full path as app when "slist=" is found

This matches what librtmp does. This fixes automatic url parsing of
crunchyroll urls.

Signed-off-by: Martin Storsjö <>
6 years agovocdec: do not create the stream in read_header()
Anton Khirnov [Sun, 18 Oct 2015 19:21:55 +0000 (21:21 +0200)]
vocdec: do not create the stream in read_header()

The stream parameters are not known until we read a packet, so postpone
creating it until then.

6 years agovocdec: put the code not shared with other demuxers under appropriate ifdef
Anton Khirnov [Sun, 18 Oct 2015 18:58:24 +0000 (20:58 +0200)]
vocdec: put the code not shared with other demuxers under appropriate ifdef

6 years agoflvdec: do not create any streams in read_header()
Anton Khirnov [Sun, 11 Oct 2015 09:08:24 +0000 (11:08 +0200)]
flvdec: do not create any streams in read_header()

The current muxer behaviour is to create streams in read_header() based
on the audio/video presence flags, but fill in the stream parameters
later when we actually get some packets for them. This is rather shady,
since other demuxers set the stream parameters immediately when the
stream is created and do not touch the stream codec context after that.

Change the flv demuxer to behave in the same way as other similar
demuxers -- create the streams only when we get a packet for them.

6 years agolavc: make avpriv_mpa_decode_header private on next bump
Anton Khirnov [Fri, 2 Jan 2015 18:16:21 +0000 (19:16 +0100)]
lavc: make avpriv_mpa_decode_header private on next bump

It's not used by anything outside of lavc anymore.

6 years agomp3dec: replace avpriv_mpa_decode_header with avpriv_mpegaudio_decode_header
Anton Khirnov [Fri, 2 Jan 2015 08:49:20 +0000 (09:49 +0100)]
mp3dec: replace avpriv_mpa_decode_header with avpriv_mpegaudio_decode_header

The latter does not require a full AVCodecContext and still provides all
the functionality needed here.

6 years agompegaudiodecheader: check the header in avpriv_mpegaudio_decode_header
Anton Khirnov [Fri, 9 Oct 2015 13:16:46 +0000 (15:16 +0200)]
mpegaudiodecheader: check the header in avpriv_mpegaudio_decode_header

Almost all the places from which this function is called already check
the header manually and in the two that don't (the mp3 muxer) the check
should not cause any problems.

6 years agolavc: get the profile name through the codec descriptor in avcodec_string()
Anton Khirnov [Thu, 1 Jan 2015 13:58:05 +0000 (14:58 +0100)]
lavc: get the profile name through the codec descriptor in avcodec_string()

6 years agolavc: add profiles to AVCodecDescriptor
Anton Khirnov [Wed, 31 Dec 2014 06:57:59 +0000 (07:57 +0100)]
lavc: add profiles to AVCodecDescriptor

The profiles are a property of the codec, so it makes sense to export
them through AVCodecDescriptors, not just the codec implementations.

6 years agolavc: print the name of the codec, not its implementation, in avcodec_string
Anton Khirnov [Tue, 30 Dec 2014 11:44:02 +0000 (12:44 +0100)]
lavc: print the name of the codec, not its implementation, in avcodec_string

6 years agor3d: do not create the audio stream until we know the sample rate
Anton Khirnov [Wed, 21 Oct 2015 09:22:13 +0000 (11:22 +0200)]
r3d: do not create the audio stream until we know the sample rate

6 years agoff_parse_specific_params: do not use AVCodecContext.frame_size
Anton Khirnov [Tue, 30 Dec 2014 06:51:04 +0000 (07:51 +0100)]
ff_parse_specific_params: do not use AVCodecContext.frame_size

It will not be set unless the muxing codec context is also the encoding
context, which is discouraged. When the frame size is not known from
av_get_audio_frame_duration(), the fallback should still be good enough.

6 years agormenc: do not use AVCodecContext.frame_size
Anton Khirnov [Sat, 15 Nov 2014 15:48:59 +0000 (16:48 +0100)]
rmenc: do not use AVCodecContext.frame_size

It will not be set if the stream codec context is not the encoding
context. Use av_get_audio_frame_duration() instead, it should work for
all audio codecs supported by the muxer.

6 years agompegvideo_enc: actually add the side data with vbv_delay to the packet
Anton Khirnov [Thu, 10 Dec 2015 21:16:13 +0000 (22:16 +0100)]
mpegvideo_enc: actually add the side data with vbv_delay to the packet

Fixes 2507b5dd674834be7261772996f47ae3b95cca69

6 years agohevcdsp: use a macro for .rodata section
Dave Yeo [Wed, 9 Dec 2015 15:53:51 +0000 (07:53 -0800)]
hevcdsp: use a macro for .rodata section

fixes assembling on OS/2

Signed-off-by: Dave Yeo <>
Signed-off-by: Luca Barbato <>
6 years agoopenh264: Directly include the deprecation guards header
Luca Barbato [Tue, 8 Dec 2015 17:12:33 +0000 (18:12 +0100)]
openh264: Directly include the deprecation guards header

Make easier to avoid compile failure when reworking the internal

6 years agolog: Use a do {} while (0) for tlog
Luca Barbato [Sat, 5 Dec 2015 12:45:01 +0000 (13:45 +0100)]
log: Use a do {} while (0) for tlog

Avoid the warning `-Wempty-body`.

6 years agomatroskadec: Fix sample_aspect_ratio for stereo matroska content
Aaron Colwell [Wed, 2 Dec 2015 23:13:18 +0000 (18:13 -0500)]
matroskadec: Fix sample_aspect_ratio for stereo matroska content

matroskaenc applies divisors to the display width/height when generating
stereo content. This patch adds the corresponding multipliers to matroskadec
so that the original sample aspect ratio can be recovered.

Signed-off-by: wm4 <>
Signed-off-by: Vittorio Giovara <>
6 years agosgienc: Make sure to initialize skipped header portions
Vittorio Giovara [Thu, 3 Dec 2015 00:10:02 +0000 (19:10 -0500)]
sgienc: Make sure to initialize skipped header portions

Fix fate tests with asan. Introduced during bytestream2 porting
(in revision 62cc8f4d79dad119e8efeaae080a58a8dcb1e89d).

Signed-off-by: Vittorio Giovara <>
6 years agolavc: Drop exporting 2-pass encoding stats
Vittorio Giovara [Mon, 30 Nov 2015 17:19:36 +0000 (12:19 -0500)]
lavc: Drop exporting 2-pass encoding stats

These variables are coming from mpegvideoenc where are supposedly used
as bit counters on various frame properties. However their use is
unclear as they lack documentation, are available only from a very small
subset of encoders, and they are hardly used in the wild. Also frame_bits
in aacenc is employed in a similar way.

Remove this functionality from AVCodecContex, these variable are mostly
frame properties, and too few encoders support setting them with anything

Signed-off-by: Vittorio Giovara <>
6 years agolavc: Deprecate coder_type and its symbols
Vittorio Giovara [Mon, 30 Nov 2015 17:17:31 +0000 (12:17 -0500)]
lavc: Deprecate coder_type and its symbols

Most option values are simply unused or ignored and in practice the
majory of codecs only need to check whether to enable rle or not.

Add appropriate codec private options which better expose the allowed

Signed-off-by: Vittorio Giovara <>
6 years agoh264: do not call frame_start() for missing frames
Anton Khirnov [Mon, 30 Nov 2015 09:44:39 +0000 (10:44 +0100)]
h264: do not call frame_start() for missing frames

We do not need to do a full setup like for a real frame, just allocate a
buffer and set cur_pic(_ptr).

6 years agoaacdec: fix aac_static_table_init() prototype
Anton Khirnov [Sun, 6 Dec 2015 10:02:17 +0000 (11:02 +0100)]
aacdec: fix aac_static_table_init() prototype

6 years agoavpacket: use ERANGE instead of EOVERFLOW
Anton Khirnov [Sun, 6 Dec 2015 09:59:51 +0000 (10:59 +0100)]
avpacket: use ERANGE instead of EOVERFLOW

EOVERFLOW seems to be unavailable on certain platforms.

6 years agortsp: free opts dictionary on failure of getnameinfo
Ganesh Ajjanagadde [Fri, 4 Dec 2015 06:11:10 +0000 (01:11 -0500)]
rtsp: free opts dictionary on failure of getnameinfo

Signed-off-by: Martin Storsjö <>
6 years agomovenc-test: add a missing va_end call
Ganesh Ajjanagadde [Fri, 4 Dec 2015 06:03:26 +0000 (01:03 -0500)]
movenc-test: add a missing va_end call

Signed-off-by: Martin Storsjö <>
6 years agomxfenc: always assume long gop
Anton Khirnov [Sat, 15 Nov 2014 09:41:02 +0000 (10:41 +0100)]
mxfenc: always assume long gop

Checking the codec context parameters to find out this information is
far too unreliable to be useful, so it is safer to assume B-frames are
always present.

6 years agolavc: export Dirac parsing API used by the ogg demuxer as public
Anton Khirnov [Sat, 5 Jul 2014 09:09:15 +0000 (09:09 +0000)]
lavc: export Dirac parsing API used by the ogg demuxer as public

Also, stop using AVCodecContext for storing the stream parameters.

6 years agompegenc: use the CPB props side data
Anton Khirnov [Sun, 4 Oct 2015 10:27:10 +0000 (12:27 +0200)]
mpegenc: use the CPB props side data

Do not access the encoder options, since it makes no sense when the
AVStream codec context is not the encoding context.

6 years agomovenc: use the CPB props side data
Anton Khirnov [Sun, 4 Oct 2015 10:27:10 +0000 (12:27 +0200)]
movenc: use the CPB props side data

Do not access the encoder options, since it makes no sense when the
AVStream codec context is not the encoding context.

6 years agoqsvenc: export CPB props side data
Anton Khirnov [Sat, 3 Oct 2015 13:19:10 +0000 (15:19 +0200)]
qsvenc: export CPB props side data

6 years agonvenc: export CPB props side data
Anton Khirnov [Sat, 3 Oct 2015 13:19:10 +0000 (15:19 +0200)]
nvenc: export CPB props side data

6 years agompegvideo_enc: export vbv_delay in side data
Anton Khirnov [Sun, 4 Oct 2015 10:19:26 +0000 (12:19 +0200)]
mpegvideo_enc: export vbv_delay in side data

Deprecate AVCodecContext.vbv_delay

6 years agompegvideo_enc: export CPB props side data
Anton Khirnov [Sat, 3 Oct 2015 13:19:10 +0000 (15:19 +0200)]
mpegvideo_enc: export CPB props side data

6 years agolibx264: export CPB props side data
Anton Khirnov [Sat, 3 Oct 2015 13:19:10 +0000 (15:19 +0200)]
libx264: export CPB props side data

6 years agolibvpxenc: export CPB props side data
Anton Khirnov [Sat, 3 Oct 2015 13:19:10 +0000 (15:19 +0200)]
libvpxenc: export CPB props side data

6 years agolibopenh264enc: export CPB props side data
Anton Khirnov [Sat, 3 Oct 2015 13:19:10 +0000 (15:19 +0200)]
libopenh264enc: export CPB props side data

6 years agolavc: add a packet side data type for VBV-like parameters
Anton Khirnov [Wed, 22 Jul 2015 12:04:20 +0000 (14:04 +0200)]
lavc: add a packet side data type for VBV-like parameters