summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/{isom,mov,movenc}: add support for CMAF DASH rolesJan Ekström2021-10-04
| | | | | | | | | | | | | | | | This information is coded in a standard MP4 KindBox and utilizes the scheme and values as per the DASH role scheme defined in MPEG-DASH. Other schemes are technically allowed, but where multiple schemes define the same concepts, the DASH scheme should be utilized. Such flagging is additionally utilized by the DASH-IF CMAF ingest specification, enabling an encoder to inform the following component of the roles of the incoming media streams. A test is added for this functionality in a similar manner to the matroska test. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/{aviobuf,avio_internal}: add max_len argument to ↵Jan Ekström2021-10-04
| | | | | | | | | | ff_read_string_to_bprint_overwrite This is especially useful when reading things such as null-terminated strings from MOV/MP4-likes, where the size of the box is known, but not the exact size of the string. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/{aviobuf,avio_internal}: add ff_read_string_to_bprint_overwriteJan Ekström2021-10-04
| | | | | | | For now, same as ff_read_line_to_bprint_overwrite, but reads until the end of a null-terminated string. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/aviobuf: add a full string reading mode to read_line_to_bprintJan Ekström2021-10-04
| | | | | | | | | | Additionally: * rename it to read_string_to_bprint * split most of ff_read_line_to_bprint_overwrite into an internal function which can then be utilized to implement other functionality without duplicating code. Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* avformat/mux: Remove unnecessary av_packet_unref()Andreas Rheinhardt2021-10-03
| | | | | | AVFormatInternal.parse_pkt is always blank after having been used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tee: ReindentationAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tee: Process strings immediately if possibleAndreas Rheinhardt2021-10-03
| | | | | | This avoids having to free them manually lateron. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tee: Fix leak of FIFO-options dictionaryAndreas Rheinhardt2021-10-03
| | | | | | Happened for all slaves which didn't use the FIFO. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tee: Fix leak of stringsAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tee: Avoid stack packetAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tee: Unref packet on av_bsf_send_packet() failureAndreas Rheinhardt2021-10-03
| | | | | | | | Given that the packet sent to av_bsf_send_packet() is always already refcounted, it is doubtful whether the error can even be triggered currently. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tee: Fix inconsistency wrt av_packet_ref() failure handlingAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/webpenc: Don't use sizeof(AVPacket)Andreas Rheinhardt2021-10-03
| | | | | | | | | In this case it means replacing a packet in the muxer's context by a pointer to an AVPacket, namely AVFormatInternal.pkt. Because this packet is freed generically, one can remove the muxer's deinit function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/flacenc: Avoid stack packetAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/img2enc: Don't use sizeof(AVPacket)Andreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mp3enc: Avoid stack packetAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/ttaenc: Avoid stack packetAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Avoid allocation of AVPacketAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avienc: Avoid allocating AVPacketAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/amvenc: Avoid allocating packetAndreas Rheinhardt2021-10-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Allow AVFormatInternal.pkt to be used by muxersAndreas Rheinhardt2021-10-03
| | | | | | It is unused by the generic muxing code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/asfenc: Return proper error codesAndreas Rheinhardt2021-10-03
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/asfenc: Add deinit functionAndreas Rheinhardt2021-10-03
| | | | | | Fixes leaks when the trailer is never written. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/asfenc: Avoid allocations when writing metadataAndreas Rheinhardt2021-10-03
| | | | | | Also improves the error check for avio_open_dyn_buf(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/asfenc: Remove unused fields from ASFStreamAndreas Rheinhardt2021-10-03
| | | | | | | | | It has never been done in b08569a23948db107e5e6175cd4c695427d5339d, 30b8f3e7dcd0318b91e205dcbf774ef92fb6193c. After this change, this muxer does no longer use sizeof(AVPacket). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux: Use AVFormatInternal.parse_pkt for temporary packetsAndreas Rheinhardt2021-10-03
| | | | | | | | The documentation of said packet ("Every user has to ensure that this packet is blank after using it") perfectly fits how we use said packet in the generic muxing code. Better than the documentation of pkt. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux: Don't use stack packet when writing interleaved packetsAndreas Rheinhardt2021-10-03
| | | | | | | | | | | | | | | | | | | Currently the interleave_packet functions use a packet for a new packet to be interleaved (may be NULL if there is none) and a packet for output; said packet is always a stack packet in interleaved_write_packet(). But all the interleave_packet functions in use first move the packet to the packet list and then check whether a packet can be returned, i.e. the effective lifetime of the new packet ends before the packet for output is touched. So one can use one packet both for input and output by adding a new parameter that indicates whether there is a packet to add to the packet list; there is just one complication: In case the muxer is flushed, there is no packet available. This can be solved by reusing one of the packets from AVFormatInternal. They are currently unused when flushing in av_interleaved_write_frame(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Clarify documentation of av_interleaved_write_frame()Andreas Rheinhardt2021-10-03
| | | | | | | | | | | | | | | | | | | The earlier documentation claimed that av_interleaved_write_frame() always orders by dts, which is not necessarily true when using muxers with custom interleavement functions or the audio_preload option. Furthermore, the documentation stated that libavformat takes ownership of the reference of the provided packet (if it is refcounted) and that the caller may not access the data through this reference after the function returns. This suggests that the returned packet is not blank, but instead still contains some set, but invalid fields, which implies that it would be dangerous to unreference this packet again. But this is not true: av_interleaved_write_frame()'s actual behaviour is to always output blank packet (even on error). This commit documents this fact so that callers know that they can directly reuse this packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux: Sanitize packets without data and side-dataAndreas Rheinhardt2021-10-03
| | | | | | | | | The BSF API treats such packets as signalling EOF and therefore such a packet might corrupt the BSF state. In such a case, the guarantee that av_interleaved_write_frame() always frees the packet is not upheld. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/amr*dec: add multichannel supportPaul B Mahol2021-10-03
|
* avcodec: add amr parserPaul B Mahol2021-10-02
|
* avformat/lrcenc: Remove unnecessary headerAndreas Rheinhardt2021-10-02
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/(lrc|scc)enc: Use avio_w8() to write a single charAndreas Rheinhardt2021-10-02
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/subtitles: Honour ff_subtitles_read_line() documentationAndreas Rheinhardt2021-10-02
| | | | | | | | | It claims to always zero-terminate its buffer like snprintf(), yet it does it not on EOF. Because of this the mcc demuxer used uninitialized values when reading an empty input file. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Avoid zero-terminating unnecessarilyAndreas Rheinhardt2021-10-02
| | | | | | | | ff_subtitles_queue_insert() does not require its events to be zero-terminated as it has a parameter for the length. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Make constants more intelligibleAndreas Rheinhardt2021-10-02
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Fix position of returned subtitle packetsAndreas Rheinhardt2021-10-02
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Remove redundant checkAndreas Rheinhardt2021-10-02
| | | | | | | The av_sscanf() will filter lines like "Scenarist_SCC V1.0" out. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sccdec: Don't use uninitialized data, fix crash, simplify logicAndreas Rheinhardt2021-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, the scc demuxer not only read the line that it intends to process, but also the next line, in order to be able to calculate the duration of the current line. This approach leads to unnecessary complexity and also to bugs: For the last line, the timing of the next subtitle is not only logically indeterminate, but also uninitialized and the same applies to the duration of the last packet derived from it.* Worse yet, in case of e.g. an empty file, it is not only the duration that is uninitialized, but the whole timing as well as the line buffer itself.** The latter is used in av_strtok(), which could lead to crashes. Furthermore, the current code always outputs at least one packet, even for empty files. This commit fixes all of this: It stops using two lines at a time; instead only the current line is dealt with and in case there is a packet after that, the duration of the last packet is fixed up after having already parsed it; consequently the duration of the last packet is left in its default state (meaning "unknown/up until the next subtitle"). If no further line could be read, processing is stopped; in particular, no packet is output for an empty file. *: Due to stack reuse it seems to be zero quite often; for the same reason Valgrind does not report any errors for a normal input file. **: While ff_subtitles_read_line() claims to always zero-terminate the buffer like snprintf(), it doesn't do so if it didn't read anything. And even if it did, it would not necessarily help here: The current code jumps over 12 bytes that it deems to have read even when it hasn't. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavf/movenc: Write 'dby1' minor brand if Dolby content is being muxed to MP4Derek Buitenhuis2021-10-01
| | | | | | | | | This is as per: * mp4ra: http://mp4ra.org/#/brands * Dolby Vision muxing spec (which is public): https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* libavformat/asfdec: Add braces to defineSoft Works2021-09-30
| | | | | Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat/asfdec: Use predefined constantsSoft Works2021-09-30
| | | | | Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/hlsenc: add const for filename argumentLimin Wang2021-09-29
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/utils: add const for argument passed to ff_is_http_proto()Limin Wang2021-09-29
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/aacdec: enable probesize-sized resyncs mid-streamJan Ekström2021-09-28
| | | | | | | | | | Before adts_aac_resync would always bail out after probesize amount of bytes had been progressed from the start of the input. Now just query the current position when entering resync, and at most advance probesize amount of data from that start position. Fixes #9433
* avformat/mxfenc: Simplfy writing paddingAndreas Rheinhardt2021-09-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/gxfenc: Simplify writing padding/reserved elementsAndreas Rheinhardt2021-09-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avienc: Simplify writing paddingAndreas Rheinhardt2021-09-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/omaenc: Simplify writing paddingAndreas Rheinhardt2021-09-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/asfenc: Simplify writing error correction dataAndreas Rheinhardt2021-09-27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>