summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/argo_asf: strip file extension from nameZane van Iperen2020-08-11
| | | | | | | Only when the user hasn't manually specified one. Matches the original files more closely. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: add name optionZane van Iperen2020-08-11
| | | | | | Reviewed-by: Alexander Strasser <eclipse7@gmx.net> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: add version_major and version_minor optionsZane van Iperen2020-08-11
| | | | | | Reviewed-by: Alexander Strasser <eclipse7@gmx.net> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: don't check file versionZane van Iperen2020-08-11
| | | | | | | | | | | | | | | | It has no bearing on structure. Determined by looking at the ASF files from several Argonaut games: - FX Fighter, - Croc, - Croc 2, - The Emperor's New Groove, and - Disney's Aladdin in Nasira's Revenge The only versions that appear are 1.1, 1.2, and 2.1, and their structure is identical. Reviewed-by: Alexander Strasser <eclipse7@gmx.net> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/argo_asf: add games to version listZane van Iperen2020-08-11
| | | | | Reviewed-by: Alexander Strasser <eclipse7@gmx.net> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/mpegts: Don't leave context in inconsistent state upon errorAndreas Rheinhardt2020-08-10
| | | | | | | | | | | | | | | Up until now, opening a section filter works as follows: A filter is opened and (on success) attached to the MpegTSContext. Then a buffer for said filter is allocated and upon success attached to the section filter; on error, the filter is simply freed without removing it from the MpegTSContext, leaving the latter in an inconsistent state. This leads to use-after-frees lateron. This commit fixes this by allocating the buffer first; the filter is only opened if the buffer could be successfully allocated. Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/hlsenc: write temp file for append single file by encryption modeSteven Liu2020-08-10
| | | | | | | | | | | | fix ticket: 8783 Because in single file by encryption mode, it cannot get the last one block of the file, it need ff_format_io_close for get full file size, then hlsenc can get the total size of the encryption content, so write the content into temp file first, and get the temp file content append the temp file content into append to single file, then hlsenc can get the correct file/content size and offset. Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/hls: support avio_seek in encryption modeSteven Liu2020-08-10
| | | | Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/sierravmd: Don't return packets for non-existing streamAndreas Rheinhardt2020-08-09
| | | | | | | It leads to an assert in ff_read_packet(). Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/vividas: Check allocation for successAndreas Rheinhardt2020-08-09
| | | | | Reviewed-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/vividas: Check return value before storing it in smaller typeAndreas Rheinhardt2020-08-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: add argo_asf muxerZane van Iperen2020-08-07
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/argo_asf: check sample count in demuxerZane van Iperen2020-08-07
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/mxfdec: Read color metadata from MXFHarry Mallon2020-08-06
| | | | | | | Reads color_primaries, color_trc and color_space from mxf headers. ULs are from https://registry.smpte-ra.org/ site. Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avformat/dv: Avoid allocation for reading timecodeAndreas Rheinhardt2020-08-06
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/dv: Avoid alloction of DVDemuxContextAndreas Rheinhardt2020-08-06
| | | | | | | | | This commit avoids allocating a DVDemuxContext when demuxing raw DV by making it part of the demuxer's context. This also allows to remove dv_read_close(). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/3dostr: Return directly after having read packetAndreas Rheinhardt2020-08-05
| | | | | | | Avoids an avio_skip(s->pb, 0). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mov: Check comp_brand_sizeMichael Niedermayer2020-08-04
| | | | | | | | Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 24457/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5760093644390400 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec, avfilter, avformat: Remove redundant avpriv_align_put_bitsAndreas Rheinhardt2020-08-01
| | | | | | | | flush_put_bits() already fills the bitstream with zeroes, so it is unnecessary to align the bitstream before. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/apm: fix APM_FILE_HEADER_SIZE valueZane van Iperen2020-07-30
| | | | | | Value was incorrectly changed in 3bf1be210150b435c51c7c8eb8fd05a1fca08814. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/hlsenc: increase initial program date time precisionMarton Balint2020-07-29
| | | | | | | | | Also query time only once, not for every variant stream, otherwise variant streams might get a slightly different initial program date time. And we can set this unconditionally because HLS_PROGRAM_DATE_TIME flag is checked elsewhere. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/smacker: Don't return packets for streams with AVDISCARD_ALLAndreas Rheinhardt2020-07-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: Fix duration for PCM audioAndreas Rheinhardt2020-07-28
| | | | | | | | | | | | For non-PCM audio, a Smacker frame contains the size of the decoded audio in the first four bytes of the audio packet data; for PCM data, said information would be redundant and according to [1] this field does not exist. Therefore this commit sets the duration and timestamps properly for PCM audio. [1]: https://wiki.multimedia.cx/index.php/Smacker#Audio_Track_Chunk Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: Set audio durationAndreas Rheinhardt2020-07-28
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/smacker: Support seeking to first frameTimotej Lazar2020-07-28
| | | | | | | | | Add .read_seek function to the smacker demuxer for the special case of seeking to ts=0. This is useful because smacker – like bink, with a similar implementation – was mostly used to encode clips in video games, where random seeks are rare but looping media are common. Signed-off-by: Timotej Lazar <timotej.lazar@araneo.si>
* lavf/srt: fix build fail when used the libsrt 1.4.1Jun Zhao2020-07-28
| | | | | | | | | | | | libsrt changed the: SRTO_SMOOTHER -> SRTO_CONGESTION SRTO_STRICTENC -> SRTO_ENFORCEDENCRYPTION and removed the front of deprecated options (SRTO_SMOOTHER/SRTO_STRICTENC) in the header, it's lead to build fail fix #8760 Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/ape: Error out in case of EOF in the headerMichael Niedermayer2020-07-26
| | | | | | | | Fixes: OOM Fixes: 24375/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6216862443241472 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/segafilmenc: Avoid seek when writing headerAndreas Rheinhardt2020-07-26
| | | | | | | | | | | | | | | | | | Up until now, the Sega FILM muxer would first write all the packet data, then shift the data (in the muxer's write_trailer function) by the amount necessary to write the header at the front (which entails a seek to the front), then seek back to the beginning and actually write the header. This commit changes this: The dynamic buffer that is used to write the sample table (containing information about each sample in the file) is now used to write the complete header. This is possible because the size of everything in the header except the sample table is known in advance. Said buffer can then be used as one of the two temporary buffers used for shifting which also reduces the amount one has to allocate for this. Thereby the header will be written when shifting, so that the second seek to the beginning is unnecessary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilmenc: Don't store packet info in linked listAndreas Rheinhardt2020-07-26
| | | | | | | | | | | | | | | | | Up until now, the Sega FILM muxer would store some information about each packet in a linked list. When writing the trailer, the information in said linked list would be used to write a table in the file header. Each entry in said table is 16 bytes long, but each entry of the linked list is 32 bytes long (assuming 64 bit pointer and no padding). Therefore it makes sense to remove the linked list and write the array entries directly into a dynamic buffer while writing the packet (this is possible because the table entries don't depend on any information not available when writing the packet (the offset is not relative to the beginning of the file, but to the end of the table). This also simplifies writing the array at the end (there is no need to traverse a linked list). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilmenc: Simplify writing two bytesAndreas Rheinhardt2020-07-26
| | | | | | Use avio_wb16() instead of avio_write() to write two zero bytes. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilmenc: Remove write-only variableAndreas Rheinhardt2020-07-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/segafilm: Reorder elements of struct to make it smallerAndreas Rheinhardt2020-07-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/daudenc: Return proper error codes instead if -1Andreas Rheinhardt2020-07-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/daudenc: Turn write_header function into init functionAndreas Rheinhardt2020-07-26
| | | | | | daud_write_header() doesn't write anything. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: CosmeticsAndreas Rheinhardt2020-07-26
| | | | | | | | | Mostly using intermediate pointers for accesses (i.e. storing s->pb in a variable pb and then using pb for writing instead of s->pb) to improve readability. Furthermore, the opening brace '{' of a function has been moved into a line of its own in instances where it wasn't before. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Only check for existence of metadata if it is usedAndreas Rheinhardt2020-07-26
| | | | | | | Also return proper error codes when it is absent: AVERROR(EINVAL) instead of AVERROR_INVALIDDATA. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Avoid allocations, fix memleakAndreas Rheinhardt2020-07-26
| | | | | | | | | | | | | | | | | | | When using the WebM DASH Manifest muxer, every stream of each adaptation set has to contain a metadata entry containing the filename of the source file. In case of live stream manifests, said filename has to conform to a pattern of <file_description>_<representation_id>.<extension>. These pieces are used to create the other strings that are actually output. Up until now, these other strings would be allocated, used once and then freed directly after usage. This commit changes this: The function that allocated and assembled these strings now returns pointers to the '_' and '.' delimiters and so that the caller can easily pick substrings from it without needing to copy the string. Avoiding allocations also fixes a memleak: One of the allocated strings would leak upon a subsequent allocation failure. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Fix segfault when no filename is given when liveAndreas Rheinhardt2020-07-26
| | | | | | by checking a bit earlier. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/riffenc: correct calculation for extradata sizeGyan Doshi2020-07-26
| | | | | | In 1ec2b3de5a, the extradata size was affected when the raster was signaled as flipped due to user-set option rather than via extradata. This resulted in a wrong header size being written. Fixed.
* avformat/mpegtsenc: use local variable store st->codecpar->codec_idLimin Wang2020-07-25
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/mpegtsenc: reindent the last commitLimin Wang2020-07-25
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/mpegtsenc: simplify code for condition checksLimin Wang2020-07-25
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/matroskadec: Slightly simplify version checkAndreas Rheinhardt2020-07-24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/matroskadec: Avoid undefined pointer arithmeticAndreas Rheinhardt2020-07-24
| | | | | | | | | | | | | | | | The Matroska demuxer currently always opens a GetByteContext to read the content of the projection's private data buffer; it does this even if there is no private data buffer in which case opening the GetByteContext will lead to a NULL + 0 which is undefined behaviour. Furthermore, in this case the code relied both on the implicit checks of the bytestream2 API as well as on the fact that it returns zero if there is not enough data available. Both of these issues have been addressed by not using the bytestream API any more; instead the data is simply read directly by using AV_RB. This is possible because the offsets are constants. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: Fix memleak upon repeating tagsAndreas Rheinhardt2020-07-24
| | | | | | | | | | | When parsing MXF encountering some tags leads to allocations. And when these tags were encountered repeatedly, this could lead to memleaks, because the pointer to the old data got simply overwritten with a pointer to the new data (or to NULL on allocation failure). This has been fixed. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: Fix memleak when parsing tag failsAndreas Rheinhardt2020-07-24
| | | | | | | | | | | | | | The MXF demuxer uses an array of pointers to different structures of metadata (all containing a common initial sequence containing a type field to distinguish them) and some of these structures contain pointers to separately allocated subelements. If an error happens while reading and creating the tags, the semi-finished new tag is freed using the function to free these tags. But this function doesn't free the already allocated subelements, because the type has not been set yet. This commit changes this. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: Fix memleak when adding element to array failsAndreas Rheinhardt2020-07-24
| | | | | | | | | Said array contains pointers to other structs and both the designated new element as well as other stuff contained in it (e.g. strings) leak if the new element can't be added to the array. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: add apm muxerZane van Iperen2020-07-21
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/apm: fix sample_rate checkZane van Iperen2020-07-21
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/sbgdec: Check for overflow in parse_timestamp()Michael Niedermayer2020-07-20
| | | | | | | | | Fixes: signed integer overflow: 33986707200000000 + 9195561788997000192 cannot be represented in type 'long' Fixes: 23790/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554232198266880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>