aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
Commit message (Collapse)AuthorAgeFilesLines
* avformat/rawvideodec: check packet sizeMichael Niedermayer2022-01-131-0/+7
| | | | | | | | | | | | | Fixes: division by zero Fixes: integer overflow Fixes: 43347/clusterfuzz-testcase-minimized-ffmpeg_dem_V210X_fuzzer-5846911637127168 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: lance.lmwang@gmail.com Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit c36a5dfc8f68316f93d03081e5a367b04e1cbd3c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/udp: do not return an uninitialized value from udp_open()Anton Khirnov2022-01-111-2/+6
| | | | | (cherry picked from commit 3c2b67446875f925909fa33d8ee14264e11c293d) Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/movenc: fix duration in mdhd boxZhao Zhili2022-01-101-1/+1
| | | | | | | | mvhd and tkhd present the post-editlist duration, while mdhd should have the pre-editlist duration. Regression since c2424b1f3. Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit f37e66b3937a914e16d89a9050f042ad89567245)
* avformat/amr: Return error upon errorAndreas Rheinhardt2022-01-091-1/+1
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit abc7d1c697e0dbe463ca6632e45142ae72d139a9)
* avformat/mxfdec: support MCA audio informationMarc-Antoine Arnaud2022-01-092-6/+285
| | | | | | | | Channel reordering is removed from this patch because the new channel layout API will support it properly. Signed-off-by: Marton Balint <cus@passwd.hu> (cherry picked from commit 47c4df2203f774f6a62391e1de770cf5b9dddcbd)
* avformat/hlsenc: convey stream id to segment streamsGyan Doshi2022-01-091-0/+1
|
* avformat/matroskaenc: Disable MKV-only code if MKV muxer is disabledAndreas Rheinhardt2022-01-082-41/+60
| | | | | | | | | The Matroska muxer has quite a lot of dependencies and lots of them are unnecessary for WebM. By disabling the Matroska-only code at compile time one can get rid of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 52c1e9e530a46ba62b974f121c9d28a86900a632)
* avformat/matroskaenc: Move AAC extradata check to other audio checksAndreas Rheinhardt2022-01-081-7/+6
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit d266bf17988271d529fd2209681889a78b9f259c)
* avformat/rtsp: #if unused functions away, fix -O0 compilationAndreas Rheinhardt2022-01-081-0/+4
| | | | | | | | | | | | parse_rtsp_message() is only called if the rtsp demuxer is enabled and so it is normally compiled away if said demuxer is disabled. Yet this does not happen when compiling with -O0 and this leads to a linking failure because parse_rtsp_message() calls functions that may not be available if the rtsp demuxer is disabled. Fix this by properly #if'ing the unused functions away. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit aeb5d943c613f50611ca49f5ffbfa8b24820b61d)
* avformat/Makefile: Add entries for CRI, GEM and PGX image pipe demuxersAndreas Rheinhardt2022-01-081-0/+3
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 99f3fb8ea1d0f67c7fd0fda2fce136b5c71fc65e)
* avformat/Makefile: Add missing alp-muxer->rawenc.o dependencyAndreas Rheinhardt2022-01-081-1/+1
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 1beeeaf23ddb1630a66ec762a2270e46b76000d0)
* avformat/amr: Fix writing AMR headerAndreas Rheinhardt2022-01-081-2/+2
| | | | | | | Regression since f282c34c009e3653ec160c3880e64fc1a9300d0e. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit a22a71eb2c633335a037983fda0badc1863fc529)
* avformat/amr: Don't reset AVFormatContext.priv_dataAndreas Rheinhardt2022-01-081-2/+0
| | | | | | | | | The AMR muxer doesn't have a private context, so it's priv_data will be NULL. If it weren't, simply setting it to NULL would lead to a memleak. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit a5a99cc11c7aea587c871d6ca3fc80d9f9828e27)
* avformat/Makefile, amr: Add missing amr-demuxers->rawdec.o dependencyAndreas Rheinhardt2022-01-082-4/+4
| | | | | | | | | | Forgotten in 1f447fd95463bbf39a78d886359a3006d82f6a94. Also only enable amr_probe() and amr_read_header() in case the AMR demuxer is enabled; this avoids having to add a rawdec.o dependency to the muxer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 78a840e7a3b6c4b8d4f665208d4ef4506ef9f5b5)
* avformat/Makefile: Add missing libamqp->urldecode dependencyAndreas Rheinhardt2022-01-081-1/+1
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 5bdd8e67e65db3fd623b1f6835eb8942f3a469bf)
* avformat/matroskaenc: Fix build with only WebM muxer enabledAndreas Rheinhardt2022-01-071-0/+2
| | | | | | | | | | In this case ff_isom_put_dvcc_dvvc() might not be available, leading to linking failures. Given that WebM currently doesn't support DOVI, this is fixed by #if'ing the offending code away if the Matroska muxer is not enabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 217c90aac70af35e34381d7a99b4407686a3f47b)
* avformat/Makefile: Fix name of PhotoCD demuxerAndreas Rheinhardt2022-01-071-1/+1
| | | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> (cherry picked from commit 6e163619e3e46e719903de3271e8c1b850b7d501)
* avformat/imf: Fix indentationPierre-Anthony Lemieux2022-01-051-24/+24
| | | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> (cherry picked from commit 74afc3c6506df4a0b5c85ea84bfd485f3b8c9ecd)
* avformat/imf: fix CPL parsing error handlingPierre-Anthony Lemieux2022-01-051-2/+5
| | | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> (cherry picked from commit 76ffe1c2f1432001f2cdde42d53c839247a43380)
* avformat/imf: fix bad free() when directory name of the input url is emptyPierre-Anthony Lemieux2022-01-051-1/+4
| | | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> (cherry picked from commit 59f1a46048109b8ec9f953d0d9348f9f1ae2a8c2)
* avformat/imf: fix error CPL root element is absentPierre-Anthony Lemieux2022-01-051-1/+1
| | | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> (cherry picked from commit c1b55cb70ce748c1193d3251575b639daf9e96f0)
* lib*/version.h: Bump Versions before release/5.0 branchAndreas Rheinhardt2022-01-041-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/packet_internal: Add proper PacketList structAndreas Rheinhardt2022-01-0413-113/+96
| | | | | | | | | | | | | | | Up until now, we had a PacketList structure which is actually a PacketListEntry; a proper PacketList did not exist and all the related functions just passed pointers to pointers to the head and tail elements around. All these pointers were actually consecutive elements of their containing structs, i.e. the users already treated them as if they were a struct. So add a proper PacketList struct and rename the current PacketList to PacketListEntry; also make the functions use this structure instead of the pair of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/utils: Unavpriv avpriv_toupper4()Andreas Rheinhardt2022-01-045-4/+27
| | | | | | | | | | | | | | | | This function is quite small (96B with GCC 11.2 on x64 Ubuntu 21.10 at -O3), making it more economical to duplicate it into libavformat instead of exporting it as avpriv: Doing so saves 2x24B in .dynsim, 2x16B in .dynstr, 2x2B .gnu.version, 24B in .rela.plt, 16B in .plt, 16B in .plt.sec (if enabled), 4B .gnu.hash; besides the actual duplicated code this also adds 2x8B .eh_frame_hdr and 24B .eh_frame. In other words: Duplicating is neutral size-wise (it is also presumed neutral for other systems). Given that it avoids the runtime overhead of dynamic symbols, it is advantageouos to duplicate the function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpegaudiodata: Unavpriv mpa_bitrate and mpa_frequency tabsAndreas Rheinhardt2022-01-045-7/+32
| | | | | | | | | | | These arrays have a size of 180 resp. six bytes. This does not make it worthwhile to export them due to the overhead this occurs; for x64 Elf/Linux/GNU: 2x2B version, 2x24B .dynsym, 24B .rela.dyn, 8B .got, 4B hash + twice the size of the name (here 20+23B). Therefore these symbols are unavprived and duplicated for shared builds. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg4audio: Unavpriv and deduplicate mpeg4audio_sample_ratesAndreas Rheinhardt2022-01-045-6/+32
| | | | | | | | | | | | | | | | | | | | | avpriv_mpeg4audio_sample_rates has a size of 64B and it is currently avpriv; a clone of it exists in aacenctab.h and from there it is inlined in aacenc.c (which also uses the avpriv version) and in the FLV muxer. This means that despite it being avpriv both libavformat as well as libavcodec have copies already. This situation is clearly suboptimal. Given the overhead of exporting symbols (for x64 Elf/Linux/GNU: 2x2B version, 2x24B .dynsym, 24B .rela.dyn, 8B .got, 4B hash + twice the size of the name (here 31B)) the object is unavprived, i.e. duplicated into libavformat when creating a shared build; but the duplicates in the AAC encoder and FLV muxer are removed. This involves splitting of the sample rate table into a file of its own; this allowed to break some spurious dependencies (e.g. both the AAC encoder as well as the Matroska demuxer actually don't need the mpeg4audio_get_config stuff). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/jpegtables: Unavpriv MJPEG-tablesAndreas Rheinhardt2022-01-044-17/+42
| | | | | | | | | | | | | | | | There are seven MJPEG-tables, five small (1x12, 4x17) and two not small (2x162). These are all avpriv, despite this not being worthwhile due to the overhead of exporting a symbol: The total overhead for each symbol consists of two entries in .dynsym (24B each), one entry in the importing library's .rela.dyn (24B) and one in .got (8B) as well as 2x2B for symbol versions and 4B for symbol hashes in the exporting library; in addition to that, the name of the symbol is included in both exporting and importing libraries, using 2x210 bytes in this case. (The above numbers are for a x64 Elf/Linux/GNU system. Other platforms will give different numbers.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dca: Unavpriv dca_sample_ratesAndreas Rheinhardt2022-01-043-1/+27
| | | | | | | | | | | | | | | Said table is 64 bytes long and exported so that it can be used both in libavcodec and libavformat. This commit stops doing so and instead duplicates it for shared builds, because the overhead of exporting the symbol is bigger than 64 bytes. It consists of the length of the name of the symbol (2x24 bytes), two entries in .dynsym (2x24 bytes), two entries for symbol version (2x2 bytes), one hash value in the exporting library (4 bytes) in addition to one entry in the importing library's .got and .rela.dyn (8 + 24 bytes). (The above numbers are for a Linux/GNU/Elf system; the numbers for other platforms may be different.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/ac3tab: Unavpriv ac3_channel_layout_tabAndreas Rheinhardt2022-01-044-3/+29
| | | | | | | | | | | | | | | | | It is small (16 B) and therefore the overhead of exporting it more than outweighs the size savings from not having duplicated symbols: When the symbol is no longer avpriv, one saves twice the size of the string containing the symbols name (2x30 byte), two entries in .dynsym (24 bytes each on x64), one entry in the importing libraries .got and .rela.dyn (8 + 24 bytes on x64) and two entries for the symbol version (2 bytes each) and one hash value in the exporting library (4 bytes). (The exact numbers are of course different for other platforms (e.g. when using dlls), but given that the strings saved alone more than outweigh the array size it can be presumed that this is beneficial for all platforms.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/raw: Reduce number of avpriv symbolsAndreas Rheinhardt2022-01-043-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libavcodec currently exports four avpriv symbols that deal with PixelFormatTags: avpriv_get_raw_pix_fmt_tags, avpriv_find_pix_fmt, avpriv_pix_fmt_bps_avi and avpriv_pix_fmt_bps_mov. The latter two are lists of PixelFormatTags, the former returns such a list and the second searches a list for a pixel format that matches a given fourcc; only one of the aforementioned three lists is ever searched. Yet for avpriv_pix_fmt_bps_avi, avpriv_pix_fmt_bps_mov and avpriv_find_pix_fmt the overhead of exporting these functions actually exceeds the size of said objects (at least for ELF; the following numbers are for x64 Ubuntu 20.10): The code size of avpriv_find_pix_fmt is small (GCC 10.2 37B, Clang 11 41B), yet exporting it adds a 20B string for the name alone to the exporting as well as to each importing library; there is more: Four bytes in the exporting libraries .gnu.hash; two bytes each for the exporting as well as each importing libraries .gnu.version; 24B in the exporting as well as each importing libraries .dynsym; 16B+24B for an entry in .plt as well as the accompanying relocation entry in .rela.plt for each importing library. The overhead for the lists is similar: The strings are 23B and the .plt+.rela.plt pair is replaced by 8B+24B for an entry in .got and a relocation entry in .rela.dyn. These lists have a size of 80 resp. 72 bytes. Yet for ff_raw_pix_fmt_tags, exporting it is advantageous compared to duplicating it into libavformat and potentially libavdevice. Therefore this commit replaces all library uses of the four symbols with a single function that is exported for shared builds. It has an enum parameter to choose the desired list besides the parameter for the fourcc. New lists can be supported with new enum values. Unfortunately, avpriv_get_raw_pix_fmt_tags could not be removed, as the fourcc2pixfmt tool uses the table of raw pix fmts. No other user of this function remains. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/tests/imf: Don't use uninitialized valueAndreas Rheinhardt2022-01-041-1/+1
| | | | | Reviewed-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/imf: Fix error handling in set_context_streams_from_tracks()Pierre-Anthony Lemieux2022-01-041-2/+1
| | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/movenc: Use dedicated pointer for access to MOVTrackAndreas Rheinhardt2022-01-041-19/+19
| | | | | | | | | Improves readability and slightly decreases codesize. While just at it, also remove a check whether the packet list is nonempty before freeing it, as freeing an empty list is fine and basically a no-op. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux, mxfenc: Don't use sizeof(AVPacket)Andreas Rheinhardt2022-01-042-13/+3
| | | | | | | | This removes one of the last usages of sizeof(AVPacket) in the generic muxing code. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Makefile: Redo duplicating object files in shared buildsAndreas Rheinhardt2022-01-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of shared builds, some object files containing tables are currently duplicated into other libraries: log2_tab.c, golomb.c, reverse.c. The check for whether this is duplicated is simply whether CONFIG_SHARED is true. Yet this is crude: E.g. libavdevice includes reverse.c for shared builds, but only needs it for the decklink input device, which given that decklink is not enabled by default will be unused in most libavdevice.so. This commit changes this by making it more explicit about what to duplicate from other libraries. To do this, two new Makefile variables were added: SHLIBOBJS and STLIBOBJS. SHLIBOBJS contains the objects that are duplicated from other libraries in case of shared builds; STLIBOBJS contains stuff that a library has to provide for other libraries in case of static builds. These new variables provide a way to enable/disable with a finer granularity than just whether shared builds are enabled or not. E.g. lavd's Makefile now contains: SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o Another example is provided by the golomb tables. These are provided by lavc for static builds, even if one uses a build configuration that makes only lavf use them. Therefore lavc's Makefile contains STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o, whereas lavf's Makefile has a corresponding SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o. E.g. in case the MXF muxer is the only component needing these tables only libavformat.so will contain them for shared builds; currently libavcodec.so does so, too. (There is currently a CONFIG_EXTRA group for golomb. But actually one would need two groups (golomb_avcodec and golomb_avformat) in order to know when and where to include these tables. Therefore this commit uses a Makefile-based approach for this and stops using these groups for the users in libavformat.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/(aiff|flac|mov|mp3|tta)enc: Don't create unnecessary referencesAndreas Rheinhardt2022-01-045-5/+9
| | | | | | | | | The packet given to muxers is not used afterwards; it is always unreferenced by libavformat. Ergo muxers are allowed to keep the references in the packets and e.g. move the ownership to a packet list. This is what this commit does. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/movenc: Refactor mov_write_dvcc_dvvc_tag to use ff_isom_put_dvcc_dvvcquietvoid2022-01-042-18/+9
| | | | | | | | Improves code legibility by not using bit shifts. Also avoids duplicating the dvcC/dvvC ISOM box writing code. Signed-off-by: quietvoid <tcChlisop0@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Refactor mov_read_dvcc_dvvc to use ff_isom_parse_dvcc_dvvcquietvoid2022-01-042-44/+8
| | | | | | | To avoid duplicating code. The implementation in dovi_isom is identical. Signed-off-by: quietvoid <tcChlisop0@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroska{dec, enc}: Parse BlockAdditionMapping elementsquietvoid2022-01-044-4/+104
| | | | | | | | | | | | | Adds handling of dvcC/dvvC block addition mappings. The parsing creates AVDOVIDecoderConfigurationRecord side data. The configuration block is written when muxing into Matroska, if DOVI side data is present for the track. Most of the Matroska element parsing is based on Plex's FFmpeg source code. Signed-off-by: quietvoid <tcChlisop0@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dovi_isom: Implement Dolby Vision configuration parsing/writingquietvoid2022-01-042-0/+153
| | | | | | | | | | | | | | Both parse/write implementations are based on mov/movenc. This only adds support for the "Dolby Vision configuration box". Other configuration boxes, such as "Dolby Vision enhancement layer configuration box" are not supported. The new functions will be used to implement parsing/writing the DOVI config for Matroska, as well as to refactor both mov/movenc to use dovi_isom functions. Signed-off-by: quietvoid <tcChlisop0@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: propagate return value of ff_format_io_close in ↵Marton Balint2022-01-031-1/+1
| | | | | | ff_format_shift_data Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/segafilmenc: use ff_format_shift_data for shiftingMarton Balint2022-01-031-46/+5
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/flvenc: use ff_format_shift_data for data shiftingMarton Balint2022-01-031-53/+6
| | | | | | add_keyframe_index seems to generate a corrupted index even before this change. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/movenc: factorize data shiftingMarton Balint2022-01-033-53/+65
| | | | | | And move data shift function from movenc to utils. Signed-off-by: Marton Balint <cus@passwd.hu>
* lib*/version.h: Bump Versions after release/5.0 branchMichael Niedermayer2022-01-031-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lib*/version.h: Bump Versions before release/5.0 branchMichael Niedermayer2022-01-031-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/imfdec: mark as experimentalAnton Khirnov2022-01-031-0/+1
| | | | | People have expressed concerns about its safety, so prevent it from being auto-selected without explicit user indication.
* lavf: add a flag for experimental (de)muxersAnton Khirnov2022-01-033-1/+10
|
* avformat/Makefile: add imf.h to SKIPHEADERSJames Almer2021-12-311-0/+1
| | | | | | Should fix "make checkheaders". Signed-off-by: James Almer <jamrial@gmail.com>
* http: make caching of redirect url optionalerankor2021-12-312-0/+28
| | | | | | | | | | | added "cache_redirect" option to http. when enabled, requests issued after seek will use the latest redirected url. when disabled, each call to seek will revert to the original url that was sent to http_open. currently, the default remains 'enabled', until the next major libavformat bump, where it will change to 'disabled'.