aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* | 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>