aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/utils: Never store negative values in last_IP_durationMichael Niedermayer2018-10-231-2/+3
| | | | | | | | | | Fixes: integer overflow compute_pkt_fields() Fixes: compute_pkt_usan Reported-by: Thomas Guilbert <tguilbert@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 079d1a7175c4b881631a7e7f449c4c13b761cdeb) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Fix integer overflow in discontinuity checkMichael Niedermayer2018-10-231-1/+1
| | | | | | | | | | Fixes: signed integer overflow: 7738135736989908991 - -7954308516317364223 cannot be represented in type 'long' Fixes: find_stream_info_usan Reported-by: Thomas Guilbert <tguilbert@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4e19cfcfa3944fe4cf97bea758f72f104dcaebad) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Fix potential integer overflow in extract_extradata()Michael Niedermayer2018-10-071-1/+3
| | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 0a41a8bf2945e59db7a0773ebce11a26b95d45b6) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: refactor upstream_stream_timingsAman Gupta2018-04-201-11/+10
| | | | | | Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 7b8daa771cbdafa6775e476c65afa659cc1afaac)
* avformat/utils: ignore outlier durations on subtitle/data streams as wellAman Gupta2018-04-201-2/+12
| | | | | | | | | | Similar to 4c9c4fe8b21, but for durations. This fixes #7151, where the report duration and bitrate on a mpegts stream is wildly off due to the dvb_teletext stream's timings. Signed-off-by: Aman Gupta <aman@tmm1.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit fd6e89586c01d068fc8d2cea24292bf8ae836f74)
* avformat/utils: use the existing packet reference when parsing complete framesJames Almer2018-04-131-3/+20
| | | | | | | | | | | | If the parser returns full frames, then the output pointer retured by av_parser_parse2() is guaranteed to point to data contained in the input packet's buffer. Create a new reference to said buffer in that case, to avoid unnecessary data copy when queueing the packet later in the function. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: Check cur_dts in update_initial_timestamps() moreMichael Niedermayer2018-04-131-0/+1
| | | | | | | | | Fixes: runtime error: signed integer overflow: 18133149658382192 - -9223090561878065151 cannot be represented in type 'long long' Fixes: crbug 831552 Reported-by: Matt Wolenetz <wolenetz@google.com> Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Fix integer overflow in end time calculation in ↵Michael Niedermayer2018-04-131-1/+1
| | | | | | | | | | update_stream_timings() Fixes: crbug 829153 Reported-by: Matt Wolenetz <wolenetz@google.com> Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Stream specifier enhancement 2.Bela Bodecs2018-04-131-0/+28
| | | | | | | | | | | | | | | | | In some cases, mainly working with multiprogram mpeg-ts containers as input, it would be handy to select sub stream of a specific program by their metadata. This patch makes it possible to narrow the stream selection among streams of the specified program by stream metadata. Examples: p:601:m:language:hun will select all sub streams of program with id 601 where sub streams have metadata key named 'language' with value 'hun'. p:602:m:guide will select all sub streams of program with id 602 where sub streams have metadata key named 'guide'. Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Stream specifier enhancementBela Bodecs2018-04-121-5/+60
| | | | | | | | | | | | | | | | | | | | Currently when specifying the program id you can only decide to select all stream of the specified program (e.g. p:103 will select all streams of program 103) or narrow the selection to a specific stream sub index (e.g. p:145:1 will select 2nd stream of program 145.) But you can not specify like all audio streams of program 145 or 3rd video stream of program 311. In some case, mainly working with multiprogram mpeg-ts containers as input, this feature would be handy. This patch makes it possible to narrow the stream selection among streams of the specified program by stream type and optionally its index. Handled types: a, v, s, d. Examples: p:601:a will select all audio streams of program 601, p:603:a:1 will select 2nd audio streams of program 603, p:604:v:0 will select first video stream of program 604. Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: optimize ff_packet_list_free()James Almer2018-04-041-3/+6
| | | | | | Don't constantly overwrite the list's head pointer. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: make AVPacketList helper functions sharedJames Almer2018-04-041-24/+33
| | | | | | Based on a patch by Luca Barbato. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: use av_packet_make_refcounted to ensure packets are ref countedJames Almer2018-04-021-7/+3
| | | | | | Simplifies code, while also fixing a potential leak of side data in pkt. Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/utils.c: Don't compute start_time from DISCARD packets for video.Sasi Inguva2018-03-241-1/+3
| | | | | Signed-off-by: Sasi Inguva <isasi@isasi.mtv.corp.google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: Fix integer overflow of fps_first/last_dtsMichael Niedermayer2018-03-071-1/+1
| | | | | | | Fixes: runtime error: signed integer overflow: 7738135736989908991 - -7898362169240453118 cannot be represented in type 'long' Fixes: Chromium bug 796778 Reported-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: simplify ff_alloc_extradata()James Almer2018-03-061-15/+11
| | | | | | | Cosmetic refactor Reviewed-by: 74a2fa708af88d225ed708af758f236f869b1a57 Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: free existing extradata before trying to allocate a new oneJames Almer2018-03-061-0/+1
| | | | | | | | This prevents leaks in the rare cases the function is called when extradata already exists. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: don't overwrite the return value of read_packet()James Almer2018-02-261-3/+3
| | | | | | | This only affected demuxers that didn't return reference counted packets. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* Add muxer/demuxer for raw codec2 and .c2 filesTomas Härdin2018-02-241-0/+1
|
* avformat: deprecate AVFormatContext filename fieldMarton Balint2018-01-281-0/+8
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: migrate to AVFormatContext->urlMarton Balint2018-01-281-1/+1
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: add url field to AVFormatContextMarton Balint2018-01-281-0/+14
| | | | | | | | | This will replace the 1024 character limited filename field. Compatiblity for output contexts are provided by copying filename field to URL if URL is unset and by providing an internal function for muxers to set both url and filename at once. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: add option to parse/store ID3 PRIV tags in metadata.Richard Shaffer2018-01-241-0/+2
| | | | | | | | | | | | | | Enables getting access to ID3 PRIV tags from the command-line or metadata API when demuxing. The PRIV owner is stored as the metadata key prepended with "id3v2_priv.", and the data is stored as the metadata value. As PRIV tags may contain arbitrary data, non-printable characters, including NULL bytes, are escaped as \xXX. Similarly, any metadata tags that begin with "id3v2_priv." are inserted as ID3 PRIV tags into the output (assuming the format supports ID3). \xXX sequences in the value are un-escaped to their byte value. Signed-off-by: wm4 <nfxjfg@googlemail.com>
* avformat: make avformat_network_init() explicitly optionalwm42018-01-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was sort of optional before - if you didn't call it, networking was initialized on demand, and an ugly warning was logged. Also, the doxygen comments threatened that it would be made strictly required one day. Make it explicitly optional. I would prefer to deprecate it fully, but there might still be legitimate reasons to use this. But the average user won't need it. This is needed only for two reasons: to initialize TLS libraries like OpenSSL and GnuTLS, and winsock. OpenSSL and GnuTLS were already silently initialized on demand if the global network init function was not called. They also have various thread-safety acrobatics, which make concurrent initialization within libavformat safe. In addition, the libraries are moving towards making their global init functions safe, which removes all need for central global init. In particular, GnuTLS 3.5.16 and OpenSSL 1.1.0g have been found to have safe init functions. In all cases, they use internal reference counters to avoid that the global uninit functions interfere with concurrent uses of the library by other API users who called global init. winsock should be thread-safe as well, and maintains an internal reference counter as well. Since we still support ancient TLS libraries, which do not have this fixed, and since it's unknown whether winsock and GnuTLS reinitialization is costly in any way, don't deprecate the libavformat functions yet.
* avformat: deprecate another ffserver API leftoverwm42018-01-161-0/+12
|
* avformat/hlsenc, utils: Moved is_http_proto from hlsenc to utils for re-useKarthick Jeyapal2017-12-291-0/+5
| | | | | Reviewed-by: Aman Gupta <aman@tmm1.net> Reviewed-by: Steven Liu <lq@onvideo.cn>
* lavc, lavf: move avformat static mutex from avcodec to avformatwm42017-12-261-0/+13
| | | | | | | | It's completely absurd that libavcodec would care about libavformat locking, but it was there because the lock manager was in libavcodec. This is more stright forward. Changes ABI, but we don't require ABI compatibility currently.
* avformat/utils: fix mixed declarations and codeJames Almer2017-11-241-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: Prevent undefined shift with wrap_bits > 64.Dale Curtis2017-11-241-2/+3
| | | | | | | | | 2LL << (wrap_bits=64 - 1) does not fit in int64_t; change the code to use a uint64_t (2ULL) and add an av_assert2() to ensure wrap_bits <= 64. Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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>