summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
Commit message (Collapse)AuthorAge
* avformat/utils: Move ff_format_io_close.* to options.c, avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | These are not pure avio-functions, but auxiliary AVFormatContext functions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_stream_side_data_copy to avformat.cAndreas Rheinhardt2022-05-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move avpriv_set_pts_info() to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | It is an essential auxiliary function for both demuxing and muxing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_copy_whiteblacklists to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | This is an auxiliary function for AVFormatContexts. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_format_set_url to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | An auxiliary function for AVFormatContexts (mainly muxers, but potentially (e.g. rtsp) also demuxers). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_is_intra_only to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | It is an auxiliary function only used by the generic muxing and demuxing code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_find_stream_index to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | | It is only used by demuxers (and it is generally demuxers who have to translate format-specific IDs to stream indices). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move av_find_best_stream to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | | | It is not forbidden to call this with a muxer, so it is moved to avformat.c and not demux_utils.c. ff_find_decoder(), which is used by av_find_best_stream() is also moved as well, despite being even more geared towards demuxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move av_find_default_stream_index to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | | While it is clearly written with demuxers in mind, it is not forbidden to call it with muxers, hence avformat.c and not demux_utils.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move av_find_program_from_stream to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | It is potentially used with both demuxers and muxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move guessing frame rate/SAR to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | | | It is not explicitly forbidden to call these functions with muxers (although it is probably intended to be only called by demuxers; av_guess_sample_aspect_ratio even says that "the stream aspect ratio is set by the demuxer"). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move matching stream specificiers to avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | It is not to call this with a muxer, so move it to avformat.c and not demux_utils.c. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move internal stream timebase stuff to avformat.cAndreas Rheinhardt2022-05-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move adding AVProgram to avformat.cAndreas Rheinhardt2022-05-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move av_stream_*_side_data API to avformat.cAndreas Rheinhardt2022-05-10
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move freeing AVFormatContext to a new file avformat.cAndreas Rheinhardt2022-05-10
| | | | | | | This file will contain the AVFormatContext-specific parts that are used by both demuxers and muxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_get_extradata to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | | | It is only used by demuxers (although it is hypothetically possible that some day e.g. a protocol might need it, but that is unlikely given that they don't deal with AVCodecParameters). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Make AVFormatContext* a logctx in ff_get_extradataAndreas Rheinhardt2022-05-10
| | | | | | | I.e. use void* instead of AVFormatContext*, because it is only used for logging. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_generate_avci_extradata to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | Only used by demuxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move av_read_(play|pause) to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | These functions are for demuxers only. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_add_param_change to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | Only demuxers have a need to add side-data to a packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_add_attached_pic to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | | It is demuxer-only: It potentially adds an AVStream and it sets AVStream.attached_pic. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move avformat_queue_attached_pictures to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | AVStream.attached_pic is only used for demuxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move av_format_inject_global_side_data to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | | This function is only intended for demuxers (as calling it doesn't have any observable effect for a muxer). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move avpriv_new_chapter to demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | | It is demuxer-only: Muxers deal only with chapters given to them; they don't create any of their own. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move parser functions to a new file, demux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | | This file is both for the various public APIs that are demuxer-only as well as for the demuxer-only internal functions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Move definition of FFStream->info to demux.hAndreas Rheinhardt2022-05-10
| | | | | | It is only used by avformat_find_stream_info(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_stream_encode_params_copy() to mux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | Only used by muxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move av_stream_get_end_pts() to mux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | It is only to be used with muxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move avformat_query_codec() to mux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | It is obviously muxer-only. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_format_output_open() to mux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | It is obviously a muxing-only function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move creation-time functions to mux_utilsAndreas Rheinhardt2022-05-10
| | | | | | Only used by muxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_get_packet_palette() to rawutils.cAndreas Rheinhardt2022-05-10
| | | | | | | | | | ff_get_packet_palette() and ff_reshuffle_raw_rgb() belong together: E.g. the former takes the return value of the latter as argument. So move ff_get_packet_palette() to rawutils.c (which consists solely of ff_reshuffle_raw_rgb()). Also add a separate header for these two functions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux_utils: Move ff_format_shift_data to new file for mux utilsAndreas Rheinhardt2022-05-10
| | | | | | | | It is only used by muxers. Given that it is not part of the core muxing code and given that mux.c is already big enough, it is moved to a new file for utility functions for muxing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move stream_options, avformat_new_stream to options.cAndreas Rheinhardt2022-05-10
| | | | | | | | | This is the appropriate place given that AVStream is about to become an AVOpt-enabled struct. Also move av_disposition_(to|from)_string, as these are tied to the disposition stream option. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_stream_add_bitstream_filter to mux.cAndreas Rheinhardt2022-05-10
| | | | | | | It is muxing-only; in fact, it should be considered part of the core muxing code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Use av_realloc_array for reallocating arrayAndreas Rheinhardt2022-05-10
| | | | | | | | | | Also improve the size check a bit; given that av_realloc_array() checks for overflow itself, we only have to check for nb_side_data + 1 still being representable in an int. But given that we can check for representability in size_t at no additional cost we do so as it leads to a nicer error code. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lib*/version: Move library version functions into files of their ownAndreas Rheinhardt2022-05-10
| | | | | | | This avoids having to rebuild big files every time FFMPEG_VERSION changes (which it does with every commit). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavformat: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* lavf: convert the generic layer to the new channel layoutAnton Khirnov2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: deprecate channel count/layout changing side dataAnton Khirnov2022-03-15
| | | | | | | | They are incompatible with the new channel layout scheme and no decoder uses them. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: fix logic error in ff_mkdir_pPeter Ross2022-02-16
| | | | | | Fix ticket# 9605 Signed-off-by: Peter Ross <pross@xvid.org>
* avformat/utils: Fix invalid NULL pointer operation in ff_parse_key_value()Michael Niedermayer2022-02-09
| | | | | | | | Fixes: pointer index expression with base 0x000000000000 overflowed to 0xffffffffffffffff Fixes: 44012/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-5670607746891776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/utils: keep chapter monotonicity on chapter updatesMichael Niedermayer2022-02-09
| | | | | | | | | Updating a chapter with the same id does not break monotonicity Fixes: Timeout Fixes: 43727/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-4960623367159808 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/packet_internal: Add proper PacketList structAndreas Rheinhardt2022-01-04
| | | | | | | | | | | | | | | 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-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>
* 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/movenc: factorize data shiftingMarton Balint2022-01-03
| | | | | | And move data shift function from movenc to utils. Signed-off-by: Marton Balint <cus@passwd.hu>
* 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: introduce AVFormatContext io_close2 which returns an intMarton Balint2021-12-12
| | | | | | | | | | | | | | | | | Otherwise there is no way to detect an error returned by avio_close() because ff_format_io_close cannot get the return value. Checking the return value of the close function is important in order to check if all data was successfully written and the underlying close() operation was successful. It can also be useful even for read mode because it can return any pending AVIOContext error, so the user don't have to manually check AVIOContext->error. In order to still support if the user overrides io_close, the generic code only uses io_close2 if io_close is either NULL or the default io_close callback. Signed-off-by: Marton Balint <cus@passwd.hu>