summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avcodec/utils: Unavpriv avpriv_toupper4()Andreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | | 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-04
| | | | | | | | | | | 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-04
| | | | | | | | | | | | | | | | | | | | | 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-04
| | | | | | | | | | | | | | | | 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-04
| | | | | | | | | | | | | | | 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-04
| | | | | | | | | | | | | | | | | 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-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-04
| | | | | 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-04
| | | | | 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-04
| | | | | | | | | 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-04
| | | | | | | | 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-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-04
| | | | | | | | | 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-04
| | | | | | | | 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-04
| | | | | | | 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-04
| | | | | | | | | | | | | 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-04
| | | | | | | | | | | | | | 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-03
| | | | | | ff_format_shift_data Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/segafilmenc: use ff_format_shift_data for shiftingMarton Balint2022-01-03
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/flvenc: use ff_format_shift_data for data shiftingMarton Balint2022-01-03
| | | | | | 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-03
| | | | | | 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-03
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lib*/version.h: Bump Versions before release/5.0 branchMichael Niedermayer2022-01-03
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/imfdec: mark as experimentalAnton Khirnov2022-01-03
| | | | | 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-03
|
* avformat/Makefile: add imf.h to SKIPHEADERSJames Almer2021-12-31
| | | | | | Should fix "make checkheaders". Signed-off-by: James Almer <jamrial@gmail.com>
* http: make caching of redirect url optionalerankor2021-12-31
| | | | | | | | | | | 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'.
* avformat/mov: add option max_stts_deltaGyan Doshi2021-12-31
| | | | | | | | | | | | | | | | Very high stts sample deltas may occasionally be intended but usually they are written in error or used to store a negative value for dts correction when treated as signed 32-bit integers. This option lets the user set an upper limit, beyond which the delta is clamped to 1. Values greater than the limit if negative when cast to int32 are used to adjust onward dts. Unit is the track time scale. Default is UINT_MAX - 48000*10 which allows upto a 10 second dts correction for 48 kHz audio streams while accommodating 99.9% of uint32 range. Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/imf: TestsPierre-Anthony Lemieux2021-12-31
| | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/imf: DemuxerPierre-Anthony Lemieux2021-12-31
| | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat: add bitpacked demuxerLimin Wang2021-12-31
| | | | | | | | Allows user can playback bitpacked pixel format directly: ffplay -video_size 1280x720 -pixel_format yuv422p10 test.bitpacked ffplay -f bitpacked -video_size 1280x720 -pixel_format uyvy422 test.yuv Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/flvdec: timestamps cannot use the full int64 rangeMichael Niedermayer2021-12-30
| | | | | | | | | We do not support this as we multiply by 1000 Fixes: signed integer overflow: -45318575073853696 * 1000 cannot be represented in type 'long' Fixes: 42804/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-4630325425209344 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/tls_mbedtls: fix handling of tls_verify=0sfan52021-12-30
| | | | | If ca_file was set, setting tls_verify=0 would not actually disable verification.
* avformat/mxfenc: fix DNxHD GC element_typeNicolas Gaullier2021-12-27
| | | | | | | | | | | | | | | | The values for the essence element type were updated in the spec from 0x05/0x06 (ST2019-4 2008) to 0x0C/0x0D (ST2019-4 2009). Fixes ticket #6380. Thanks-to: Philip de Nier <philip.denier@bbc.co.uk> Thanks-to: Matthieu Bouron <matthieu.bouron@gmail.com> Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com> Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfenc: fix DNxHD GC container_ulNicolas Gaullier2021-12-27
| | | | | | | Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris> Reviewed-by: Matthieu Bouron <matthieu.bouron@gmail.com> Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mvdec: Check bytes_per_sampleMichael Niedermayer2021-12-25
| | | | | | | | | | Fixes: division by zero Fixes: 42814/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4787014237552640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Reviewed-by: John-Paul Stewart <jpstewart@personalprojects.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavformat: add side_data copy in concat demuxerGerard Sole2021-12-22
| | | | | | | | | | | | Adds support for concat demuxer to copy the side data information from the input file to the resulting file. It will behave like the metadata copy, where the metadata of the first file is kept in the the output file. Extract the current code that already performs the stream side_data copy into a separate method and reuse the method in the concat demuxer. Signed-off-by: Gerard Sole <g.sole.ca@gmail.com>
* avformat/mvdec: explicitly set durationJohn-Paul Stewart2021-12-21
| | | | | | | | Resolves a warning that duration is being innaccurately estimated based on bitrate. Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net> Reviewed-by: Peter Ross <pross@xvid.org>
* avformat/mvdec: read frame rate from data streamJohn-Paul Stewart2021-12-21
| | | | | | | | | | Prior to this patch, for version 2 of the file format the frame rate was hard-coded at 15 fps. This uses the 64-bit floating-point value from the data stream, similar to what is already done for version 3 of the file format (around line 206). Signed-off-by: John-Paul Stewart <jpstewart@personalprojects.net> Reviewed-by: Peter Ross <pross@xvid.org>
* avformat/wvenc: Make init function out of write_headerAndreas Rheinhardt2021-12-20
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/crcenc: Make init function out of write_headerAndreas Rheinhardt2021-12-20
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/sdp: Fix use of uninitialised valueAndreas Rheinhardt2021-12-20
| | | | | | | Fixes Coverity ticket #1495831. Regression since fe31708eaa10af42507b8db773d5af5a56e1aff4. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfenc: Avoid allocation for timecode trackAndreas Rheinhardt2021-12-19
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfenc: Use smaller types to make struct smallerAndreas Rheinhardt2021-12-19
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/Makefile: Remove superfluous avformat->DNXHD dependenciesAndreas Rheinhardt2021-12-19
| | | | | | | | | There is no mxfenc dependency any more since commit b9a26b9d55f77ebbff3596e46be54bb5fed469d3. Also remove a dnxhddata.h inclusion in mxfenc that was forgotten in the very same commit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aviobuf: ffio_copy_url_optionsPierre-Anthony Lemieux2021-12-19
| | | | | Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* lavf/sdp: add more thorough error handlingAnton Khirnov2021-12-17
| | | | | | Return error codes when constructing a stream config fails, rather than just disregarding the failure and continuing. Propagate the error codes from av_sdp_create().
* lavf/sdp: reindent switch() according to our conventionsAnton Khirnov2021-12-17
|
* lavf/sdp: add const qualifiers where appropriateAnton Khirnov2021-12-17
| | | | Declares that these structs are read-only for this code.
* avformat/4xm: Check for duplicate track idsMichael Niedermayer2021-12-16
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>