aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
Commit message (Collapse)AuthorAgeFilesLines
...
* avformat/utils: remove usage of AVCodecContext accessorsJames Almer2017-11-151-5/+9
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: Look at the first 3 frames if timestamps indicate frame ↵Michael Niedermayer2017-11-111-4/+12
| | | | | | | | reorder but decoder delay does not Fixes: Ticket6487 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: preserve AV_PKT_FLAG_DISCARD in parse_packetJohn Stebbins2017-11-111-0/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* aptx: add raw muxer and demuxer for aptXAurelien Jacobs2017-11-101-0/+1
|
* avformat: move priv_pts from AVStream to an internal structJames Almer2017-11-071-3/+3
| | | | | | | It has no reason to be in a public header, even if defined as private. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: deprecate getters and setters for AVFormatContext and AVStream fieldsJames Almer2017-10-291-0/+4
| | | | | | | The fields can be accessed directly, so these are not needed anymore. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '9e4a5eb51b9f3b2bff0ef08e0074b7fe4893075d'James Almer2017-10-281-6/+1
|\ | | | | | | | | | | | | * commit '9e4a5eb51b9f3b2bff0ef08e0074b7fe4893075d': avformat: Free the internal codec context at the end Merged-by: James Almer <jamrial@gmail.com>
| * avformat: Free the internal codec context at the endLuca Barbato2017-04-131-5/+1
| | | | | | | | | | | | Avoid a use after free in avformat_find_stream_info. CC: libav-stable@libav.org
| * utils: Add av_stream_add_side_data()James Almer2016-11-231-10/+27
| | | | | | | | | | | | | | | | Functionally similar to av_packet_add_side_data(). Allows the use of an already allocated buffer as stream side data. Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * lavf: check that the codec is supported by extract_extradataAnton Khirnov2016-10-211-0/+10
| | | | | | | | | | Avoids superfluous error message spam after 8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4
* | avformat: remove dead av_stream_get_side_data() cruftJames Almer2017-10-221-5/+0
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat: remove ABI portion of the side data merging APIJames Almer2017-10-221-7/+0
| | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat: fix id3 chaptersLukas Stabe2017-10-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | These changes store id3 chapter data in ID3v2ExtraMeta and introduce ff_id3v2_parse_chapters to parse them into the format context if needed. Encoders using ff_id3v2_read, which previously parsed chapters into the format context automatically, were adjusted to call ff_id3v2_parse_chapters. Signed-off-by: wm4 <nfxjfg@googlemail.com>
* | lavf/utils: Do not force chapter end time before chapter start.Carl Eugen Hoyos2017-09-201-1/+1
| | | | | | | | Fixes ticket #6671.
* | avformat/utils: always av_reduce r_frame_rateMarton Balint2017-08-171-2/+2
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/utils: fix memory leak in avformat_free_contextSteven Siloti2017-08-051-1/+1
| | | | | | | | | | | | | | | | The pointer to the packet queue is stored in the internal structure so the queue needs to be flushed before internal is freed. Signed-off-by: Steven Siloti <ssiloti@bittorrent.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf: consider codec framerate for framerate detectionwm42017-06-071-0/+10
| | | | | | | | | | | | | | Fixes detection of some TV sample as 24.5 FPS. With the patch applied, it's detected as 25 FPS. This is enabled for mpegts only.
* | avformat/utils: Slightly un-clutter code in determinable_frame_size() by ↵Michael Niedermayer2017-06-061-5/+6
| | | | | | | | | | | | using a switch Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: change bitrate to int64_t in av_find_best_streamMarton Balint2017-06-041-2/+4
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/utils: return impaired streams in av_find_best_stream if only those ↵Marton Balint2017-06-041-8/+9
| | | | | | | | | | | | | | | | | | exist Fixes ticket #6397. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/options: log filename on openMichael Niedermayer2017-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | The loglevel is choosen so that the main filename and any images of multi image sequences are shown only at debug level to avoid clutter. This makes exploits in playlists more visible. As they would show accesses to private/sensitive files Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/utils: free AVStream.codec properly in free_stream()Aaron Levinson2017-05-061-3/+1
| | | | | | | | | | | | Fixes memory leaks. Signed-off-by: James Almer <jamrial@gmail.com>
* | lavf: use the new bitstream filter for extracting extradataJames Almer2017-04-071-13/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-231-110/+13
| | | | | | | | | | | | | | | | 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-231-13/+110
|\| | | | | | | | | | | | | * 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-161-13/+110
| | | | | | | | | | | | | | | | | | 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-211-1/+1
|\| | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-301-1/+1
| | | | | | | | | | | | | | | | 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-231-12/+12
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | avcodec, avformat: deprecate anything related to side data mergingwm42017-03-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-191-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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-281-1/+16
| | | | | | | | | | 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-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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-171-0/+1
| | | | | | | | | | | | | | 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-131-1/+4
| | | | | | | | | | Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat: Add max_streams optionMichael Niedermayer2016-12-081-1/+1
| | | | | | | | | | | | 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-051-3/+3
| | | | | | | | | | | | | | | | | | 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-031-2/+5
| | | | | | | | | | | | | | | | | | | | 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-271-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf: always forward codec_whitelist in avformat_find_stream_infoAndreas Cadhalpun2016-11-261-1/+5
| | | | | | | | | | 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-211-1/+1
| | | | | | | | | | 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-191-1/+4
| | | | | | | | | | | | | | 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-181-9/+23
| | | | | | | | | | | | | | | | 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-021-0/+12
| | | | | | | | | | | | | | | | | | 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-011-38/+4
| | | | | | | | | | | | | | breaks API Found-by: jamrial This reverts commit 1a956c64c8eff5edecb004fc7aafd21207e6485c.
* | img2 encoder: allow %t in filename, based on patch from Yuval Adamrogerdpack2016-11-011-4/+38
| | | | | | | | | | Signed-off-by: rogerdpack <rogerpack2005@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flvdec: Fix regression loosing streamsMichael Niedermayer2016-10-281-0/+2
| | | | | | | | | | | | | | 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-261-6/+0
| | | | | | | | | | | | | | | | | | 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-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>