aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/internal.h
Commit message (Collapse)AuthorAgeFilesLines
* avformat/internal: add missing __clang__ checkKacper Michajłow2025-06-121-1/+1
| | | | | | | Clang x86_64-pc-windows-msvc doesn't define __GNUC__. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* avutil/dict: Unavpriv avpriv_dict_set_timestamp()Andreas Rheinhardt2025-03-281-0/+11
| | | | | | | And move it to lavf, its only user. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: remove deprecated FF_API_AVSTREAM_SIDE_DATAJames Almer2025-03-281-11/+0
| | | | | | Deprecated since 2023-10-06. Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/flvdec: replace a private option with a field in FFFormatContextAnton Khirnov2024-10-161-0/+2
| | | | | | | | | | | The demuxer's 'missing_streams' private option is used to communicate information from the demuxer to avformat_find_stream_info(). However, that is not only unnecessarily complicated, it also leaks internal information to users, e.g. this option appears in the results of the fate-flv-demux test. Use a new field in FFFormatContext to communicate this information instead.
* lavf: replace FFFormatContext.prefer_codec_framerate with FF_INFMT_FLAGAnton Khirnov2024-10-161-5/+0
| | | | | There is no reason for this to be a dynamic property, as the only demuxer using this sets it unconditionally.
* lavf: move demuxing-specific fields from FFFormatContext to ↵Anton Khirnov2024-10-161-25/+0
| | | | FormatContextInternal
* lavf: move muxing-specific fields from FFFormatContext to FormatContextInternalAnton Khirnov2024-10-161-33/+0
|
* lavf: add a header for generic-layer interfacesAnton Khirnov2024-10-161-45/+0
| | | | Analogous to what was previously done in avcodec and avfilter.
* lavf/internal: remove a prototype for non-existent functionAnton Khirnov2024-10-161-9/+0
| | | | | ff_stream_side_data_copy() has been gone since 5432d2aacad5fa7420fe2d9369ed061d521e92d6
* avformat/internal: Add ff_get_frame_filenameZhao Zhili2024-09-291-0/+16
| | | | | | | | | It's similar to av_get_frame_filename2 but with int64_t number support. Make av_get_frame_filename* a wrapper over ff_get_frame_filename. Co-authored-by: Filip Mašić <shoutplenty@gmail.com> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* lavf: deprecate avformat_transfer_internal_stream_timing_info()Anton Khirnov2024-07-091-0/+2
| | | | | | | | | And av_stream_get_codec_timebase(). They were both added for ffmpeg CLI, which no longer calls either of them. Furthermore the notion of "internal stream timing info" that needs to be transferred with a special magic API function is fundamentally flawed and should be removed.
* avformat/utils: Use static mutexes instead of ff_lock_avformat()Andreas Rheinhardt2024-05-201-3/+0
| | | | | | | | | Its existence is a remnant of (libavcodec's) lock-manager API which has been removed in a04c2c707de2ce850f79870e84ac9d7ec7aa9143. There is no need to use the same lock for avisynth, chromaprint or tls, so switch to ordinary static mutexes instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.hAndreas Rheinhardt2024-03-261-6/+0
| | | | | | | | | and rename it to FF_INFMT_INIT_CLEANUP. This flag is demuxer-only, so this is the more appropriate place for it. This does not preclude adding internal flags common to both demuxer and muxer in the future. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Remove declaration for ff_format_io_close_default()Andreas Rheinhardt2024-03-141-4/+0
| | | | | | Forgotten in d6799ee0e41dee35ebf9c664173aed8e3ab24141. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Add FFInputFormat, hide internals of AVInputFormatAndreas Rheinhardt2024-03-071-2/+4
| | | | | | | | | | | | | | | | | | | | | This commit does for AVInputFormat what commit 59c9dc82f450638a3068deeb1db5c56f6d155752 did for AVOutputFormat: It adds a new type FFInputFormat, moves all the internals of AVInputFormat to it and adds a now reduced AVInputFormat as first member. This does not affect/improve extensibility of both public or private fields for demuxers (it is still a mess due to lavd). This is possible since 50f34172e0cca2cabc5836308ec66dbf93f5f2a3 (which removed the last usage of an internal field of AVInputFormat in fftools). (Hint: tools/probetest.c accesses the internals of FFInputFormat as well, but given that it is a testing tool this is not considered a problem.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: add support for tile HEIF still imagesJames Almer2024-02-261-0/+5
| | | | | | | | | | | | Export each tile as its own stream, and the grid information as a Stream Group of type TILE_GRID. This also enables exporting other stream items like thumbnails, which may be present in non tiled HEIF images too. For those, the primary stream will be tagged with the default disposition. Based on a patch by Swaraj Hota Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: Don't allocate priv_pts separatelyAndreas Rheinhardt2024-02-071-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/options: Only allocate AVCodecContext for demuxersAndreas Rheinhardt2024-02-071-0/+2
| | | | | | | | | | | The muxer's AVCodecContext is currently used for exactly one thing: To store a time base in it that has been derived via heuristics in avformat_transfer_internal_stream_timing_info(); said time base can then be read back via av_stream_get_codec_timebase(). But one does not need a whole AVCodecContext for that, a simple AVRational is enough. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: remove ff_remove_stream_group()James Almer2023-12-201-5/+0
| | | | | | It's unused. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: introduce AVStreamGroupJames Almer2023-12-181-0/+33
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/avformat: use the side data from AVStream.codecparJames Almer2023-10-061-0/+4
| | | | | | | | | | | | Deprecate AVStream.side_data and its helpers in favor of the AVStream's codecpar.coded_side_data. This will considerably simplify the propagation of global side data to decoders and from encoders. Instead of having to do it inside packets, it will be available during init(). Global and frame specific side data will therefore be distinct. Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: deprecate AVFMT_FLAG_SHORTESTAnton Khirnov2023-09-181-0/+2
| | | | | | | | | | | It was added in cb114ed4640 with the comment "This will allow fixing several bugs with the -shortest option". Since * there is no explanation of what these bugs are * libavformat is not the place to work around ffmpeg CLI bugs * there is no indication that this feature is actually in use deprecate it without replacement.
* avformat/internal: Avoid casting const awayAndreas Rheinhardt2023-09-101-1/+1
| | | | | | | Fixes many warnings when using -Wcast-qual. Reviewed-by: Tomas Härdin <git@haerdin.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Avoid including codec.h, frame.hAndreas Rheinhardt2023-09-071-2/+2
| | | | | | | | | | | | | | | | AVCodec is only ever used as an incomplete type (i.e. via a pointer to an AVCodec) in avformat.h and it is not really part of the core of avformat.h or libavformat; almost none of our internal users make use of it (and none make use of hwcontext.h, which is implicitly included). So switch to use struct AVCodec, but continue to include codec.h for external users for compatibility. Also, do the same for AVFrame and frame.h, which is implicitly included by codec.h (via lavu/hwcontext.h). Also, remove an unnecessary inclusion of <time.h>. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Don't auto-include os_support.hAndreas Rheinhardt2023-09-021-1/+0
| | | | | | | | | | | | | | | | | | | | It includes various Windows-specific headers when compiling for Windows and these sometimes cause issues: E.g. winbase.h defines IGNORE, which clashes with a macro used in the Matroska muxer (since 884653ee5be03ed38db957c14fad51b300611c8c) and demuxer. This header provides fallback defines for various stuff that is mostly not used directly by (de)muxers at all: mkdir, rename, rmdir, unlink, access, poll, pollfd, nfds_t, closesocket, socklen_t, fstat, stat, lseek, SHUT_(RD|WR|RDWR) and various POLL* constants. Ergo fix this issue by not auto-including this header in lots of places via an inclusion in internal.h and instead include it everywhere where the above stuff is used (most of these translation units already included os_support.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Use forward declaration for AVCodecDescriptorAndreas Rheinhardt2023-08-051-2/+1
| | | | | | | | | | | This avoids including lavc/codec_desc.h everywhere and thereby forces users to include it directly instead of lazily and potentially unknowingly relying on indirect inclusions. Also add the proper inclusion to libavformat/demux.c, one of the two files that actually use the new field. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavf: use AV_CODEC_PROP_FIELDS where appropriateAnton Khirnov2023-05-151-0/+3
| | | | | | | | | | H.264 and mpeg12 parsers need to be adjusted at the same time to stop using the value of AVCodecContext.ticks_per_frame, because it is not set correctly unless the codec has been opened. Previously this would result in both the parser and lavf seeing the same incorrect value, which would cancel out. Updating lavf and not the parsers would result in correct value in lavf, but the wrong one in parsers, which would break some tests.
* avformat: add ff_match_url_ext()Michael Niedermayer2023-05-151-0/+9
| | | | | | Match url against a list of extensions similar to av_match_ext() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/avformat: Move AVOutputFormat internals out of public headerAndreas Rheinhardt2023-02-091-1/+2
| | | | | | | | | | | | | | This commit does for AVOutputFormat what commit 20f972701806be20a77f808db332d9489343bb78 did for AVCodec: It adds a new type FFOutputFormat, moves all the internals of AVOutputFormat to it and adds a now reduced AVOutputFormat as first member. This does not affect/improve extensibility of both public or private fields for muxers (it is still a mess due to lavd). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/internal: Don't include avcodec.hAndreas Rheinhardt2022-09-261-2/+1
| | | | | | | | | | | | | | | The general demuxing API uses parsers and decoders. Therefore FFStream contains pointers to AVCodecContexts and AVCodecParserContext and lavf/internal.h includes lavc/avcodec.h. Yet actually only a few files files really use these; and it is best when this number stays small. Therefore this commit uses opaque structs in lavf/internal.h for these contexts and stops including avcodec.h. This also avoids including lavc/codec_desc.h implicitly. All other headers are implicitly included as now (mostly through codec.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mux: Allow muxers to set custom min timestampAndreas Rheinhardt2022-09-051-0/+7
| | | | | | | | | | | | | | Matroska requires pts to be >= 0 with a slight exception: It has a mechanism to deal with codec delay, i.e. with the data added at the beginning that does not correspond to actual input data and should be discarded by the player. Only the audio actually intended to be output needs to have a timestamp >= 0. In order to avoid unnecessary timestamp shifting, this patch allows muxers to inform the shifting code about this so that it can take it into account. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: refactor ff_stream_encode_params_copy() to stream_params_copy()Pierre-Anthony Lemieux2022-08-121-0/+11
| | | | | | Addresses http://ffmpeg.org/pipermail/ffmpeg-devel/2022-August/299726.html Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Hide BSF stuff only used by the core APIsAndreas Rheinhardt2022-05-121-3/+2
| | | | | | | | | | | | | | | | | | | | | The general demuxing API uses bitstream filters to extract extradata and the muxing API uses them in order to transform packets into the format desired by the target format. Therefore FFStream contains pointers to AVBSFContexts and lavf/internal.h includes lavc/bsf.h. Yet actually, only a few files files are supposed to use these, namely avformat.c, demux.c and mux.c. For all the other files, it should be an opaque type that they should not touch and that they need not know anything about. This can be achieved by not including these headers and using the structs instead of the corresponding typedefs. This also forces translation units that really use the BSF API themselves to include lavc/bsf.h directly instead of relying on indirect inclusions (a few other files also use the BSF API; they already abided by this). Of course, it also avoids unnecessary rebuilds when bsf.h changes. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Move FFERROR_REDO to demux.hAndreas Rheinhardt2022-05-121-6/+0
| | | | | | It is demuxer-only. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_find_stream_index to demux_utils.cAndreas Rheinhardt2022-05-101-6/+0
| | | | | | | 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 ff_get_extradata to demux_utils.cAndreas Rheinhardt2022-05-101-9/+0
| | | | | | | | 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-101-1/+1
| | | | | | | 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-101-6/+0
| | | | | | Only used by demuxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_add_param_change to demux_utils.cAndreas Rheinhardt2022-05-101-8/+0
| | | | | | 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-101-16/+0
| | | | | | | 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 avpriv_new_chapter to demux_utils.cAndreas Rheinhardt2022-05-101-14/+0
| | | | | | | 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-101-2/+0
| | | | | | | 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-101-29/+1
| | | | | | It is only used by avformat_find_stream_info(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Add new demux.h headerAndreas Rheinhardt2022-05-101-114/+0
| | | | | | And move those stuff already in demuxer-only files to it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_stream_encode_params_copy() to mux_utils.cAndreas Rheinhardt2022-05-101-9/+0
| | | | | | Only used by muxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_format_output_open() to mux_utils.cAndreas Rheinhardt2022-05-101-10/+0
| | | | | | 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-101-20/+0
| | | | | | 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-101-27/+0
| | | | | | | | | | 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-101-7/+0
| | | | | | | | 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-101-1/+11
| | | | | | | | | 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>