aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | avcodec, avformat: deprecate anything related to side data mergingwm42017-03-211-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch deprecates anything that has to do with merging/splitting side data. Automatic side data merging (and splitting), as well as all API symbols involved in it, are removed completely. Two FF_API_ defines are dedicated to deprecating API symbols related to this: FF_API_MERGE_SD_API removes av_packet_split/merge_side_data in libavcodec, and FF_API_LAVF_KEEPSIDE_FLAG deprecates AVFMT_FLAG_KEEP_SIDE_DATA in libavformat. Since it was claimed that changing the default from merging side data to not doing it is an ABI change, there are two additional FF_API_ defines, which stop using the side data merging/splitting by default (and remove any code in avformat/avcodec doing this): FF_API_MERGE_SD in libavcodec, and FF_API_LAVF_MERGE_SD in libavformat. It is very much intended that FF_API_MERGE_SD and FF_API_LAVF_MERGE_SD are quickly defined to 0 in the next ABI bump, while the API symbols are retained for a longer time for the sake of compatibility. AVFMT_FLAG_KEEP_SIDE_DATA will (very much intentionally) do nothing for most of the time it will still be defined. Keep in mind that no code exists that actually tries to unset this flag for any reason, nor does such code need to exist. Code setting this flag explicitly will work as before. Thus it's ok for AVFMT_FLAG_KEEP_SIDE_DATA to do nothing once side data merging has been removed from libavformat. In order to avoid that anyone in the future does this incorrectly, here is a small guide how to update the internal code on bumps: - next ABI bump (probably soon): - define FF_API_LAVF_MERGE_SD to 0, and remove all code covered by it - define FF_API_MERGE_SD to 0, and remove all code covered by it - next API bump (typically two years in the future or so): - define FF_API_LAVF_KEEPSIDE_FLAG to 0, and remove all code covered by it - define FF_API_MERGE_SD_API to 0, and remove all code covered by it This forces anyone who actually wants packet side data to temporarily use deprecated API to get it all. If you ask me, this is batshit fucked up crazy, but it's how we roll. Making AVFMT_FLAG_KEEP_SIDE_DATA to be set by default was rejected as an ABI change, so I'm going all the way to get rid of this once and for all. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'e9bfff1cc66c85b91b262c41e8aa5e8685606225'Clément Bœsch2017-03-181-2/+2
|\| | | | | | | | | | | | | | | | | | | | | * commit 'e9bfff1cc66c85b91b262c41e8aa5e8685606225': lavc: free buffer_frame/pkt on avcodec_open2() failure This commit is a noop, see 27adf9f9cdbc6f1dc0a1292dc97490eec6f2f068. Only reordered to reduce diff. Merged-by: Clément Bœsch <u@pkh.me>
| * lavc: free buffer_frame/pkt on avcodec_open2() failureAnton Khirnov2016-08-111-0/+2
| | | | | | | | Fixes memory leaks in some FATE tests.
| * lavc: align the linesize to 32 when AVX is enabledAnton Khirnov2016-08-031-1/+3
| |
* | avcodec: estimate output bitrate for uncompressed video codecsTobias Rapp2017-03-171-0/+21
| | | | | | | | | | | | | | | | | | | | | | Allows to get a more realistic total bitrate (and estimated file size) in avi_write_header. Previously a static default value of 200k was assumed. Adds an internal helper function for bitrate guessing. Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: fix uninitialized variable readwm42017-03-171-1/+1
| | | | | | | | | | | | | | This cna happen if the user tries to call the new decode API for subtitles. Fixes CID 1402071.
* | lavc/internal: Constify AVPacket* in AVCodecInternal.Carl Eugen Hoyos2017-03-161-2/+2
| | | | | | | | | | Fixes a gcc warning: libavcodec/utils.c:2244:26: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
* | Merge commit 'f65285aba0df7d46298abe0c945dfee05cbc6028'Clément Bœsch2017-03-121-0/+11
|\| | | | | | | | | | | | | * commit 'f65285aba0df7d46298abe0c945dfee05cbc6028': lavc: set sw_pix_fmt for hwaccel encoding Merged-by: Clément Bœsch <u@pkh.me>
| * lavc: set sw_pix_fmt for hwaccel encodingAnton Khirnov2016-07-221-0/+11
| |
* | aacdec: do not mutate input packet metadatawm42017-03-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently the demuxer outputs the wrong padding for HE-AAC (based on the raw sample rate, or so). aacdec contains a hack to adjust the muxer padding accordingly before it's used to trim the decoder output. This modified the packet side data, which in combination with the old decoding API would change the packet the user passed to the decoder. This is clearly not allowed, and it breaks running some gapless fate tests with "-fflags +keepside" applied (without keepside, the packet metadata is typically newly allocated, essentially making a copy and not modifying the user's input packet). This should probably be fixed in the demuxer (and consequently also the muxer), but for now only fix the immediate problem. Regression since 946ed78f5f8 (2012).
* | avcodec: consider an error during decoder draining as EOFwm42017-03-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no reason that draining couldn't return an error or two. But some decoders don't handle this very well, and might always return an error. This can lead to API users getting into an infinite loop and burning CPU, because no progress is made and EOF is never returned. In fact, ffmpeg.c contains a hack against such a case. It is made unnecessary with this commit, and removed with the next one. (This particular error case seems to have been fixed since the hack was added, though.) This might lose frames if decoding returns errors during draining.
* | lavc/utils: Make second parameter to apply_param_change() const.Carl Eugen Hoyos2017-02-241-1/+1
| | | | | | | | | | Fixes a compilation warning: passing argument 2 of ‘apply_param_change’ discards ‘const’ qualifier from pointer target type
* | lavc: Add device context field to AVCodecContextMark Thompson2017-02-131-0/+1
| | | | | | | | For use by codec implementations which can allocate frames internally.
* | avcodec/utils: Fix memleak with subtitles and sidedataMichael Niedermayer2017-02-031-5/+7
| | | | | | | | | | | | | | Fixes: 454/fuzz-3-ffmpeg_SUBTITLE_AV_CODEC_ID_MOV_TEXT_fuzzer Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/utils: correct align value for interplayMichael Niedermayer2017-01-251-1/+6
| | | | | | | | | | | | | | | | Fixes out of array access Fixes: 452/fuzz-1-ffmpeg_VIDEO_AV_CODEC_ID_INTERPLAY_VIDEO_fuzzer Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: add pcm_f16le and pcm_f24le decoderPaul B Mahol2016-12-221-0/+2
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | lavc: Fix ticket 6024, truncated mode decodingPavel Koshevoy2016-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The assumption that avcodec_send_packet makes regarding decoders consuming the entire packet is not true if the codec supports truncated decoding mode and the truncated flag is turned on. Steps to reproduce: ./ffmpeg_g -flags truncated \ -i "http://samples.ffmpeg.org/MPEG2/test-ebu-422.40000.pakets.ts" \ -c:v ffv1 -c:a copy -y /tmp/truncated.nut Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: Add max_pixels optionsMichael Niedermayer2016-12-101-6/+6
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc: Add spherical packet side data APIVittorio Giovara2016-12-071-0/+1
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavc/utils.c: Make sure skip_samples never goes negative.Sasi Inguva2016-11-101-1/+1
| | | | | | | | | | | | Signed-off-by: Sasi Inguva <isasi@google.com> Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/utils: avcodec_string: dump field order when knownRodger Combs2016-10-241-0/+14
| |
* | avcodec/utils: Move emms_c() before memory allocation functions in ↵Michael Niedermayer2016-10-221-1/+2
| | | | | | | | | | | | avcodec_encode_video2() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/utils: Clear MMX state before returning from avcodec_default_execute*()Michael Niedermayer2016-10-211-0/+2
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/utils: print Chroma Location string in verbose log levelJames Almer2016-10-161-1/+1
| | | | | | | | | | | | | | | | It's container level information on some formats (Matroska, MXF, yuv4mpeg), so it should be printed at higher log levels than debug. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '32c8359093d1ff4f45ed19518b449b3ac3769d27'Hendrik Leppkes2016-10-071-4/+20
|\| | | | | | | | | | | | | * commit '32c8359093d1ff4f45ed19518b449b3ac3769d27': lavc: export the timestamps when decoding in AVFrame.pts Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavc: export the timestamps when decoding in AVFrame.ptsAnton Khirnov2016-06-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | Currently it's exported as AVFrame.pkt_pts, which is also the only use for that field. The reason it is done like this is that lavc used to export various codec-specific "timing" information in AVFrame.pts, which is not done anymore. Since it is confusing to the callers to have a separate field which is used only for decoder timestamps and nothing else, deprecate pkt_pts and use just AVFrame.pts everywhere.
* | lavc: set best effort timestamp if unset when using new decode APIwm42016-10-051-1/+8
| | | | | | | | | | Some API users (in particular ffmpeg.c) check the best effort timestamp only.
* | lavc/utils: disallow zero sized packets with data set in avcodec_send_packetMarton Balint2016-10-031-0/+3
| | | | | | | | | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* | ffmpeg: move subframe warning to libavcodecwm42016-10-011-0/+6
| | | | | | | | | | | | | | | | | | | | | | With the new decode API, doing this in ffmpeg.c is impractical. There was resistance against removing the warning, so put it into libavcodec. Not bothering with reducing the warning to verbose log level for subsequent wanrings. The warning should be rare, and only happen when developing new codecs for the old API. Includes a change suggested by Michael Niedermayer.
* | lavc/utils.c: Subtract skip_samples when frame is DISCARDed.Sasi Inguva2016-09-291-9/+7
| | | | | | | | | | Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'e85f6f7f8d037c0af0f294000718d9ba22753baa'James Almer2016-09-281-0/+15
|\| | | | | | | | | | | | | | | | | | | | | * commit 'e85f6f7f8d037c0af0f294000718d9ba22753baa': lavc: allow using AVCodecContext.hw_frames_ctx for decoding Conflicts: doc/APIchanges libavcodec/version.h Merged-by: James Almer <jamrial@gmail.com>
| * lavc: allow using AVCodecContext.hw_frames_ctx for decodingAnton Khirnov2016-06-211-0/+15
| | | | | | | | | | For now it will only be used by the default get_buffer2 callback for allocating hw frames.
* | avcodec/utils: If using discard frame flag, ignore skip_samples set by the ↵Sasi Inguva2016-09-191-0/+4
| | | | | | | | | | | | decoder Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc: Add a flag in AVPacket to discard packet after decoding. Discard ↵Sasi Inguva2016-09-191-1/+14
| | | | | | | | | | | | | | frames after decoding based on the flag. Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/utils: print only the padding values that are setJames Almer2016-09-031-4/+7
| | | | | | | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec/utils: print initial and trailing paddings only in verbose levelsJames Almer2016-09-031-1/+2
| | | | | | | | | | Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | avcodec: add 64-bit signed pcm codecPaul B Mahol2016-08-181-0/+3
| |
* | lavc: add trailing_padding to AVCodecContext to match AVCodecParameters.Jon Toohill2016-08-161-17/+23
| | | | | | | | | | | | Shows encoder delay/padding in the stream summary if they are set. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/utils: only warn when passed invalid lowres valueAman Gupta2016-08-121-3/+2
| | | | | | | | | | | | | | | | | | This makes it easier to use the lowres option when dealing with input files in different codecs. If the codec doesn't support lowres=1 for instance, it will throw a warning and use lowres=0 instead of erroring out completely. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'e62ff72fc1052273deb708ba715f73e5187281d4'Clément Bœsch2016-06-221-0/+7
|\| | | | | | | | | | | | | * commit 'e62ff72fc1052273deb708ba715f73e5187281d4': lavc: make avcodec_open2() fail when the timebase is not set for encoding Merged-by: Clément Bœsch <u@pkh.me>
| * lavc: make avcodec_open2() fail when the timebase is not set for encodingAnton Khirnov2016-05-161-0/+7
| | | | | | | | | | Many encoders use it. There is also a divide by the timebase lower in this function, which would crash when it is not set.
* | libavcodec: factor out SEI generation for A53 captionsAndrey Turkin2016-06-191-0/+43
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/utils: check skip_samples signednessMichael Niedermayer2016-06-071-1/+1
| | | | | | | | | | | | Fixes Ticket5528 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/utils: initialize delay in avcodec_parameters_to_context()Michael Niedermayer2016-06-041-0/+1
| | | | | | | | | | | | | | Fixes lost codec delayy Should fix Ticket5509 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: add adpcm MTAF decoderPaul B Mahol2016-05-211-0/+2
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avcodec/utils: Move avctx->codec check before its useMichael Niedermayer2016-05-201-2/+3
| | | | | | | | | | | | Fixes CID1361954 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: add Direct Stream Transfer (DST) decoderPeter Ross2016-05-151-0/+2
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'Derek Buitenhuis2016-05-111-20/+0
|\| | | | | | | | | | | | | | | * commit 'd12b5b2f135aade4099f4b26b0fe678656158c13': build: Split test programs off into separate files Some conversions done by: James Almer <jamrial@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavc: introduce a new decoding/encoding API with decoupled input/outputwm42016-03-231-2/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, the decoding API was restricted to outputting 0 or 1 frames per input packet. It also enforces a somewhat rigid dataflow in general. This new API seeks to relax these restrictions by decoupling input and output. Instead of doing a single call on each decode step, which may consume the packet and may produce output, the new API requires the user to send input first, and then ask for output. For now, there are no codecs supporting this API. The API can work with codecs using the old API, and most code added here is to make them interoperate. The reverse is not possible, although for audio it might. Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * lavc: factor apply_param_change() AV_EF_EXPLODE handlingwm42016-03-051-13/+15
| | | | | | | | | | | | Remove the duplicated code for handling failure of apply_param_change(). Signed-off-by: Anton Khirnov <anton@khirnov.net>