Commit Graph

1382 Commits

Author SHA1 Message Date
Derek Buitenhuis 21f9468402 avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT
Libav, for some reason, merged this as a public API function. This will
aid in future merges.

A define is left for backwards compat, just in case some person
used it, since it is in a public header.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-27 16:36:46 +00:00
Michael Niedermayer ed0c550564 avcodec/utils: run ff_frame_thread_encoder_init() only for encoders
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-25 16:47:15 +01:00
Michael Niedermayer a7305c780b Print the whitelists if entities are not found on them
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-24 16:52:10 +01:00
Michael Niedermayer 0869ff7e9d avcodec/utils: Check bits_per_raw_sample on video encoder open
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-07 02:00:34 +01:00
Hendrik Leppkes 15c60c8af2 Merge commit 'cea1eef25c3310a68dd327eb74aae14ad3c2ddef'
* commit 'cea1eef25c3310a68dd327eb74aae14ad3c2ddef':
  lavc: get the profile name through the codec descriptor in avcodec_string()

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 16:29:28 +01:00
Hendrik Leppkes 5e8b053452 Merge commit '2c6811397bdf13d43ca206e48d6d6da9c2cd47c6'
* commit '2c6811397bdf13d43ca206e48d6d6da9c2cd47c6':
  lavc: add profiles to AVCodecDescriptor

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-01 16:20:39 +01:00
Hendrik Leppkes 50401f5fb7 avcodec: properly check pkt_timebase for validity
Unset/invalid timebases have a zero numerator.
This makes the checks consistent with other timebase checks and fixes an
integer division by 0.
2015-12-28 10:24:15 +01:00
Hendrik Leppkes f49264a1c5 Merge commit '11c9bd633f635f07a762be1ecd672de55daf4edc'
* commit '11c9bd633f635f07a762be1ecd672de55daf4edc':
  libopenh264enc: export CPB props side data

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-17 13:31:21 +01:00
Hendrik Leppkes dd6ee019ea Merge commit 'f0b769c16daafa64720dcba7fa81a9f5255e1d29'
* commit 'f0b769c16daafa64720dcba7fa81a9f5255e1d29':
  lavc: add a packet side data type for VBV-like parameters

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-17 13:25:52 +01:00
Hendrik Leppkes a7d5b9f1c3 Merge commit '84adab333cddeefc3cfd843089dee23f58bd372c'
* commit '84adab333cddeefc3cfd843089dee23f58bd372c':
  lavc: add stream-global packet side data

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-17 13:18:18 +01:00
Matthieu Bouron ae1c750cb4 lavc/utils: use AVPixFmtDescriptor to probe palette formats
Also use the input frame format instead of the AVCodecContext one according
to the documentation of AVCodecContext.get_buffer2().
2015-12-15 10:35:47 +01:00
Anton Khirnov cea1eef25c lavc: get the profile name through the codec descriptor in avcodec_string() 2015-12-12 21:24:29 +01:00
Anton Khirnov 2c6811397b 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.
2015-12-12 21:22:49 +01:00
Anton Khirnov cdc9ce098e lavc: print the name of the codec, not its implementation, in avcodec_string 2015-12-12 21:21:54 +01:00
Clément Bœsch a8bb81a05c lavc, lavu: use avutil/thread.h instead of redundant conditional includes 2015-12-07 17:25:51 +01:00
Anton Khirnov 11c9bd633f libopenh264enc: export CPB props side data 2015-12-06 10:24:21 +01:00
Anton Khirnov f0b769c16d lavc: add a packet side data type for VBV-like parameters 2015-12-06 10:23:45 +01:00
Anton Khirnov 84adab333c lavc: add stream-global packet side data
This is similar to what is done for AVStream.
2015-12-06 10:22:43 +01:00
Michael Niedermayer 15d14ce47c avcodec/utils: Fix overflow in get_bit_rates computations
Fixes: 129ca3e28d73af7b1e24a9d4118e7a2d/signal_sigabrt_7ffff6ae7cc9_836_762b310fc3ef6087bd7771e5d8e90b9b.asf

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-05 13:20:03 +01:00
Michael Niedermayer abee0a1c60 avcodec/utils: Clear dimensions in ff_get_buffer() on failure
Fixes out of array access
Fixes: 482d8f2fd17c9f532b586458a33f267c/asan_heap-oob_4a52b6_7417_1d08d477736d66cdadd833d146bb8bae.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-28 20:10:51 +01:00
Michael Niedermayer 4f03bebc79 avcodec/utils: Use 64bit for aspect ratio calculation in avcodec_string()
Fixes integer overflow
Fixes: 3a45b2ae02f2cf12b7bd99543cdcdae5/asan_heap-oob_1dff502_8022_899f75e1e81046ebd7b6c2394a1419f4.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-28 20:10:51 +01:00
Michael Niedermayer 4e16ad2868 avcodec/utils: Better check for channels in av_get_audio_frame_duration()
Fixes integer overflow
Fixes: 0c2625f236ced104d402b4a03c0d65c7/asan_generic_274e1ce_5990_9314e7a67c26aecf011b178ade9f217c.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-14 01:38:15 +01:00
Paul B Mahol af3f793f60 avcodec: add ADPCM AICA decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-29 21:26:43 +01:00
Hendrik Leppkes c2f861ca42 Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
Hendrik Leppkes 7f5af80ba4 Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'
* commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457':
  avpacket: Replace av_free_packet with av_packet_unref

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 14:28:56 +01:00
Hendrik Leppkes 31741aecbf avcodec: disallow hwaccel with frame threads
HWAccels with frame threads are fundamentally flawed in avcodecs current
design, and there are several known problems ranging from image corruption
to driver crashes.

These problems come down to two design problems in the interaction of
threads and HWAccel decoding:

(1)
While avcodec prevents parallel decoding and as such simultaneous access
to the hardware accelerator from the decoding threads, it cannot account
for the user code and its access to the hardware surfaces and the hardware
itself.

This can result in image corruption or even driver crashes if the
user code locks image surfaces while they are being used by the decoder
threads as reference frames.

The current HWAccel API does not offer any way to ensure exclusive access
to the hardware or the surfaces if frame threading is used.

(2)
Initialization of the HWAccel with frame threads is non-trivial, and many
decoders had and still have issues that cause excess calls to the
get_format callback.

This will potentially cause duplicate HWAccel initialization, which in
extreme cases can even lead to driver crashes if the HWAccel is
re-initialized while the user code is actively accessing the hardware
surfaces associated with it, or lead to image corruption due to lost
reference frames.

While both of these issues are solvable, fixing (1) would at least require
a huge API redesign which would move a lot of complexity into the user
code.

The only reason the combination of frame threads and HWAccel was
considered useful is to allow a seamless fallback to multi-threaded
software decoding if the HWAccel is not available, however the issues
outlined above far outweigh this.

The proper solution for a fallback is to re-open the AVCodecContext with
threading enabled if the HWAccel failed, which is a practice commonly used
by various user applications using avcodec today already.

Reviewed-by: Gwenole Beauchesne <gb.devel@gmail.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 10:19:05 +01:00
Luca Barbato ce70f28a17 avpacket: Replace av_free_packet with av_packet_unref
`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.

Deprecate `av_free_packet`.
2015-10-26 18:00:55 +01:00
Paul B Mahol 035ae3c009 avcodec: add SDX2 DPCM decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-26 10:08:01 +01:00
Hendrik Leppkes dde8e5ad02 Merge commit '3ee2c60cc296eee3f63d7b5fee9b4332eeeac9fa'
* commit '3ee2c60cc296eee3f63d7b5fee9b4332eeeac9fa':
  utils: Use data buffers directly instead of an AVPicture

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-22 21:46:56 +02:00
Hendrik Leppkes ee573b4d31 Merge commit 'a17a7661906ba295d67afd80ac0770422e1b02b3'
* commit 'a17a7661906ba295d67afd80ac0770422e1b02b3':
  lavc: Add data and linesize to AVSubtitleRect

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-22 21:41:53 +02:00
Vittorio Giovara 3ee2c60cc2 utils: Use data buffers directly instead of an AVPicture
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-22 13:31:58 +02:00
Andreas Cadhalpun a4680e7170 avcodec: rename avpriv_color_frame to ff_color_frame
It is only used inside libavcodec.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-22 00:38:50 +02:00
Vittorio Giovara a17a766190 lavc: Add data and linesize to AVSubtitleRect
Use the new fields directly instead of the ones from AVPicture.
This removes a layer of indirection which serves no pratical purpose
whatsoever, and will help in removing AVPicture structure completely
later.

Every subtitle encoder/decoder seamlessly points to the new arrays,
so it is possible to deprecate AVSubtitleRect.pict.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-21 12:02:29 +02:00
Paul B Mahol 8b11e43799 avcodec: add ADPCM PSX decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-16 16:37:40 +02:00
Derek Buitenhuis 17e41cf361 avcodec: Do not lock during init if there is no init function
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-13 13:43:29 +02:00
Derek Buitenhuis 1156b634c1 avcodec: Don't lock on init for codecs without an init function
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-12 15:25:51 -03:00
Andreas Cadhalpun ec0275843d avcodec: remove leftover iff_byterun1 decoder
It was merged with the iff_ilbm decoder in commit
929a24efff.

Define AV_CODEC_ID_IFF_BYTERUN1 as AV_CODEC_ID_IFF_ILBM for API
compatibility.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-12 00:21:13 +02:00
Derek Buitenhuis eae58428bd avcodec: Do not lock during open for codecs marked as having threadsafe init
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-04 13:21:16 +02:00
Derek Buitenhuis abaa12263e avcodec: Don't lock during open if the codec has threadsafe init
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-02 14:07:14 +01:00
Hendrik Leppkes 2f63e83c26 Merge commit 'a5d58fea68b9212e0065a71939e921505504a9bb'
* commit 'a5d58fea68b9212e0065a71939e921505504a9bb':
  lavc: reimplement avcodec_get_type() using codec descriptors

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-29 13:45:19 +02:00
wm4 a5d58fea68 lavc: reimplement avcodec_get_type() using codec descriptors
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-09-28 10:50:38 +02:00
Carl Eugen Hoyos 040ddd27bf lavc/utils: Correctly show bit_rate >INT_MAX.
Fixes ticket #2089.
2015-09-15 20:56:23 +02:00
Michael Niedermayer 7404f3bdb9 lavc: Switch bitrate to 64bit unless compatibility with avconv was requested. 2015-09-15 18:02:43 +02:00
wm4 87a051f976 lavc: allow asynchronous decoders to return correct pkt_dts values
The generic code in utils.c sets the AVFrame.pkt_dts field from the
packet it was supposedly decoded. This does not have to be true for a
fully asynchronous decoder like mmaldec. It could be overwritten with an
incorrect value. Even if the decoder doesn't determine the DTS (but sets
it to AV_NOPTS_VALUE), it's impossible to determine a correct value in
utils.c.

Decoders can now be marked with FF_CODEC_CAP_SETS_PKT_DTS, in which case
utils.c won't overwrite the field. The decoders are expected to set this
field (even if they only set it to AV_NOPTS_VALUE).

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-09-12 12:27:19 +02:00
Hendrik Leppkes 264ff3dd2e Merge commit '87a051f97633010f71dfc1d23d806856499bf231'
* commit '87a051f97633010f71dfc1d23d806856499bf231':
  lavc: allow asynchronous decoders to return correct pkt_dts values

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-12 13:30:33 +02:00
Hendrik Leppkes 5d8e836d0e Replace all remaining occurances of step/depth_minus1 and offset_plus1 2015-09-08 17:10:48 +02:00
James Almer 2bef340cb2 avcodec: remove duplicate AVCodecIDs
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-09-07 12:46:56 -03:00
Hendrik Leppkes d02d208211 Merge commit 'c45fcf30cfab687004ed1cdc06ebaa21f4262a0b'
* commit 'c45fcf30cfab687004ed1cdc06ebaa21f4262a0b':
  DXV decoder

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-07 16:07:07 +02:00
Hendrik Leppkes 24e3bac52a avcodec: remove deprecated codec id aliases 2015-09-05 21:15:58 +02:00
Hendrik Leppkes 76cac7ed45 avcodec: remove deprecated old video encode API 2015-09-05 21:15:57 +02:00