summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
Commit message (Collapse)AuthorAge
* lavf: use the new bitstream filter for extracting extradataJames Almer2017-04-07
| | | | | | | | | | | | | | | | | This merges commits 8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4 and 096a8effa3f8f3455292c958c3ed07e798def7bd by Anton Khirnov, with the following change: - extract_extradata_check() is added to know if the codec is supported by the bsf before trying to initialize it. This behaviour is similar to the old AVCodecParser.split checks. The FATE reference changes are due to the filtered out NAL units that the old AVCodecParser.split implementation left alone. Decoding is unchanged as the functions that parse extradata simply ignored said unnecessary NAL units. Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "Merge commit '8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4'"James Almer2017-03-23
| | | | | | | | This reverts commit 1c193ac1f9cfe703d6a1c36795f309ba5d14bf6e, reversing changes made to 7ebc9f8df4035ecaa84ad4429480986e3e7597ae. Several FATE tests started failing after this merge, so it's reverted until it can be properly fixed.
* Merge commit '8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4'James Almer2017-03-23
|\ | | | | | | | | | | | | * commit '8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4': lavf: use the new bitstream filter for extracting extradata Merged-by: James Almer <jamrial@gmail.com>
| * lavf: use the new bitstream filter for extracting extradataAnton Khirnov2016-10-16
| | | | | | | | | | | | | | | | | | This also fixes a minor bug introduced in the codecpar conversion, where the termination condition for extracting the extradata does not match the actual extradata setting code. As a result, the packet durations made up by lavf go back to their values before the codecpar conversion. That is of little consequence since that code should eventually be dropped completely.
* | Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-21
|\| | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-30
| | | | | | | | | | | | | | | | It is supposed to be a flag. The only currently defined value is AVIO_SEEKABLE_NORMAL, but other ones may be added in the future. However all the current lavf code treats this field as a bool (mainly for historical reasons). Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
| * lavf: use new decode APIwm42016-03-23
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | avcodec, avformat: deprecate anything related to side data mergingwm42017-03-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | avformat/utils: Also fill dts==RELATIVE_TS_BASE packets in ↵Michael Niedermayer2017-02-19
| | | | | | | | | | | | | | | | | | | | | | | | update_initial_durations() This dts value can end up in the list in the absence of durations and is in that case semantically identical to AV_NOPTS_VALUE. We can alternatively prevent storing RELATIVE_TS_BASE if there is no duration. Fixes Ticket3640 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: Ignore ID3v2 tags if other tags are present e.g. vorbisPaul Arzelier2017-01-28
| | | | | | | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/utils.c Protect against accessing entries[nb_entries]Matt Wolenetz2016-12-30
| | | | | | | | | | | | | | | | | | | | | | In ff_index_search_timestamp(), if b == num_entries, m == num_entries - 1, and entries[m].flags & AVINDEX_DISCARD_FRAME is true, then the search for the next non-discarded packet could access entries[nb_entries], exceeding its bounds. This change adds a protection against that scenario. Reference: https://crbug.com/666770 Reviewed-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: Auto-detect mjpeg 2000 in mpeg-tsStåle Kristoffersen2016-12-17
| | | | | | | | | | | | | | This makes it possible to decode motion jpeg 2000 encoded in a transport stream without a correct PMT/PAT. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: Print verbose error message if stream count exceeds max_streamsMichael Niedermayer2016-12-13
| | | | | | | | | | Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: Add max_streams optionMichael Niedermayer2016-12-08
| | | | | | | | | | | | This allows user apps to stop OOM due to excessive number of streams Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf: fix the wrong warning msg and comments about av_find_stream_infoJun Zhao2016-12-05
| | | | | | | | | | | | | | | | | | av_find_stream_info() was deprecated by avformat_find_stream_info(), correct the warning message in the avformat_find_stream_info() and comments in the avformat.h Signed-off-by: Jun Zhao <jun.zhao@intel.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: Check start/end before computing duration in ↵Michael Niedermayer2016-12-03
| | | | | | | | | | | | | | | | | | | | update_stream_timings() Fixes undefined behavior Fixes: 637428.ogg Found-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: Fix type mismatchMichael Niedermayer2016-11-27
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf: always forward codec_whitelist in avformat_find_stream_infoAndreas Cadhalpun2016-11-26
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | avformat/utils: add missing brackets around arguments in av_realloc() callJames Almer2016-11-21
| | | | | | | | | | Found-by: Neil Birkbeck <neil.birkbeck@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat/utils: check for overflow before reallocating side dataJames Almer2016-11-19
| | | | | | | | | | | | | | This makes av_stream_add_side_data() consistent with av_packet_add_side_data(). Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat/utils: add av_stream_add_side_data()James Almer2016-11-18
| | | | | | | | | | | | | | | | Functionally similar to av_packet_add_side_data(). Allows the use of an already allocated buffer as stream side data. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat: close parser if codec changedAndreas Cadhalpun2016-11-02
| | | | | | | | | | | | | | | | | | The parser depends on the codec and thus must not be used with a different one. If it is, the 'avctx->codec_id == s->parser->codec_ids[0] ...' assert in av_parser_parse2 gets triggered. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | Revert "img2 encoder: allow %t in filename, based on patch from Yuval Adam"Michael Niedermayer2016-11-01
| | | | | | | | | | | | | | breaks API Found-by: jamrial This reverts commit 1a956c64c8eff5edecb004fc7aafd21207e6485c.
* | img2 encoder: allow %t in filename, based on patch from Yuval Adamrogerdpack2016-11-01
| | | | | | | | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Fix regression loosing streamsMichael Niedermayer2016-10-28
| | | | | | | | | | | | | | Fixes: unknown_video.flv Found-by: Thierry Foucu <tfoucu@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Revert "avformat/utils: Discard huge timestamps which would cause overflows ↵Michael Niedermayer2016-10-26
| | | | | | | | | | | | | | | | | | if used in basic computations" Some people seem to oppose this the patch seems to have been missed for a month on the ML lets restart the discussion and solve this after the release This reverts commit e936c8d176efd1a0a41e22df24564b1178c79ea9.
* | avformat/utils: Discard huge timestamps which would cause overflows if used ↵Michael Niedermayer2016-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | in basic computations Allowing larger timestamps makes it impossible to calculate basic things like the difference of 2 timestamps or their sum without checking each individual computation for overflow. This should avoid a significant number of overflow checks Fixes Ticket5136 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: prevent triggering request_probe assert in ff_read_packetAndreas Cadhalpun2016-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | If probe_codec is called with pkt == NULL, it sets probe_packets to 0 and request_probe to -1. However, request_probe can change when calling s->iformat->read_packet and thus a probe_packets value of 0 doesn't guarantee a request_probe value of -1. In that case calling probe_codec again is necessary to prevent triggering the assert. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* | avformat/utils: Update codec_id before using it in the parser initMichael Niedermayer2016-10-10
| | | | | | | | | | | | | | | | | | Fixes assertion failure Fixes: input.avi Found-by: 连一汉 <lianyihan@360.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/utils: avoid using programs for duration when there's only oneRodger Combs2016-10-06
| | | | | | | | | | This allows us to be more selective about the streams we derive durations from (specifically, ignoring text streams with outlier end times) in the common case
* | lavf/utils: ignore outlier subtitle and data stream end times as wellRodger Combs2016-10-06
| |
* | avformat: add av_stream_get_codec_timebase()James Almer2016-09-27
| | | | | | | | | | | | This will allow ffmpeg.c to stop using AVStream.codec in some cases Signed-off-by: James Almer <jamrial@gmail.com>
* | lavf/utils: Avoid an overflow for huge negative durations.Carl Eugen Hoyos2016-09-24
| | | | | | | | Fixes ticket #5135.
* | avformat/utils: avoid using marked decoders for probingTimo Rothenpieler2016-09-23
| | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: force native h264 decoder for probingTimo Rothenpieler2016-09-22
| | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* | ffmpeg: switch to codecparClément Bœsch2016-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is largely based on commit 15e84ed3 from Anton Khirnov <anton@khirnov.net> which was previously skipped in bbf5ef9d. There are still a bunch of things raising codecpar related warnings that need fixing, such as: - the use of codec->debug in the interactive debug mode - read_ffserver_streams(): it's probably broken now but there is no test - lowres stuff - codec copy apparently required by bitstream filters The matroska references are updated because they now properly forward the field_order (previously unknown, now progressive). Thanks to James Almer for fixing a bunch of FATE issues in this commit. Signed-off-by: Clément Bœsch <clement@stupeflix.com> Signed-off-by: James Almer <jamrial@gmail.com>
* | lavf/utils: Support av_index_search_timestamp in case of AVIndexEntry with ↵Sasi Inguva2016-09-19
| | | | | | | | | | | | | | discarded packets. Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: fix timebase error in avformat_seek_file()Xinzheng Zhang2016-09-14
| | | | | | | | | | | | | | | | When there is only one stream and stream_index has not specified, The ts has been transferd by the timebase of stream0 without modifying the stream_index In this condation it cause seek failure. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/utils: add missing ismv in MOV-like formatsClément Bœsch2016-09-14
| |
* | lavf/utils: simplify matching MOV-like formatsClément Bœsch2016-09-14
| |
* | lavf: add avformat_transfer_internal_stream_timing_info() and use it in ffmpegClément Bœsch2016-09-14
| | | | | | | | | | In lavf we have access to st->internal->avctx so it's a better place than in ffmpeg*.c and will allow moving to codecpar.
* | avformat: Export ticks_per_frame in st->codecMichael Niedermayer2016-09-07
| | | | | | | | | | | | | | | | | | | | Fixes regressions with stream copy and output timebase/fps being twice as fine as needed Makes the timebase and ticks per frame handled identical which should make the code easier to understand and work with. It does not solve the problem without st->codec access Suggested-by: Hendrik Leppkes Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: fix a codecpar non useJames Almer2016-08-27
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat/utils: End probing if the expected codec surpasses ↵Michael Niedermayer2016-08-27
| | | | | | | | | | | | | | | | AVPROBE_SCORE_STREAM_RETRY Fixes Ticket5800 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavformat/utils: added ability to probe AVMEDIA_TYPE_DATA formatErkki Seppälä2016-08-23
| | | | | | | | | | | | | | | | | | | | Now force_codec_ids supports AVMEDIA_TYPE_DATA and avformat_query_codec accepts data codecs as well in addition to video, audio and subtitle tracks. Signed-off-by: Erkki Seppälä <erkki.seppala.ext@nokia.com> Signed-off-by: OZOPlayer <OZOPL@nokia.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec: add 64-bit signed pcm codecPaul B Mahol2016-08-18
| |
* | avformat: factorize iso 8601 timestamp writer to a dictionary avutil functionMarton Balint2016-08-17
| | | | | | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* | lavf: mark stream as const pointer in av_stream_get_side_data() for next bumpClément Bœsch2016-08-17
| |
* | lavf/utils: add some const to pointers parameters in a few functionsClément Bœsch2016-08-17
| |
* | avformat: Add av_get_frame_filename2() and AV_FRAME_FILENAME_FLAGS_MULTIPLEMichael Niedermayer2016-08-04
| | | | | | | | | | | | | | This will be used to allow writing file sequences using the tee output onto multiple places in parallel Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>