aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_demux.c
Commit message (Collapse)AuthorAgeFilesLines
* fftools/ffmpeg_demux: don't flag timestamps as unreliable if they are generatedJames Almer2025-07-101-1/+10
| | | | | | | | | | Regardless of the source being an AVFMT_NOTIMESTAMPS format, if the timestamps are generated like when using the use_wallclock_as_timestamps demuxer option, then they are reliable. Fixes ticket #11268 Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg_demux: init resume_warn variableMarvin Scholz2025-06-111-1/+1
| | | | | | | Fixes an uninitialized read introduced with 6232f416b172358c9dd82462037953f02743df27 Fix CID 1643162 Uninitialized scalar variable
* ffmpeg: add per-stream input option drop_changedGyan Doshi2025-03-241-1/+14
| | | | | | | | | | | | | | This is a replacement in ffmpeg for the deprecated avcodec flag AV_CODEC_FLAG_DROPCHANGED. This option is meant to be used when the filtergraph should not be reinited upon input parameter changes as that leads to loss of state in the filtergraph potentially leading to broken or aborted output, e.g. inserting of silence with first_pts specified in aresample. Generally useful to avoid corrupted yet decodable packets in live streaming inputs. This option when enabled takes precedence over reinit_filters
* ffmpeg_demux: set default for readrate_catchup to be 5% fasterGyan Doshi2025-03-241-1/+1
| | | | | | | | | The existing default value is the same as the primary readrate. This maintains the flow rate as best as possible but does not reduce the lag. This new value allows catchup to gradually happen without overwhelming the receiver. Addresses a concern brought up in #11469
* all: Fix doxy comments wrongly designated as trailing ///<Andreas Rheinhardt2025-03-121-2/+2
| | | | | | | | | | | The ///< or /**< form of doxygen comments are only to be used when the documentation follows the member and the comment block starts on the same line as the member. This commit fixes wrong uses of them; in particular, this fixes the comment for mb_height in H.264 SPS's structure which was wrongly added to mb_width. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg_demux: add option readrate_catchupGyan Doshi2025-02-241-8/+54
| | | | | | | | | | | At present, if reading from a readrate-limited input is stalled, then upon resumption, ffmpeg will read the input without any throttle till the average readrate matches the specified readrate. This new option allows to set a speed limit when reading is resumed until the average readrate matches the primary readrate. Fixes #11469
* ffmpeg_demux: don't print input error for AVERROR_EXITGyan Doshi2025-01-301-2/+3
| | | | | This error code is for expected exits, like after listing options for a device.
* fftools/ffmpeg_demux: use proper logging contexts everywhereAnton Khirnov2024-10-171-5/+5
|
* fftools/ffmpeg_demux: drop ist_output_add()Anton Khirnov2024-09-301-15/+2
| | | | It is now a trivial wrapper over ist_use(), so export that directly.
* fftools/ffmpeg_demux: drop InputStream.[nb_]outputsAnton Khirnov2024-09-301-7/+0
| | | | It is write-only after d119ae2fd82a494d9430ff4d4fc262961a68c598.
* fftools/ffmpeg: add support for multiview videoAnton Khirnov2024-09-231-5/+19
| | | | | | | | This extends the syntax for specifying input streams in -map and complex filtergraph labels, to allow selecting a view by view ID, index, or position. The corresponding decoder is then set up to decode the appropriate view and send frames for that view to the correct filtergraph input(s).
* fftools/ffmpeg_sched: allow decoders to have multiple outputsAnton Khirnov2024-09-231-1/+1
| | | | Will be useful for multilayer video.
* fftools/ffmpeg_demux: narrow variable scopeMarvin Scholz2024-09-131-3/+1
|
* fftools/ffmpeg_demux: fix variable shadowingMarvin Scholz2024-09-131-5/+5
|
* fftools/ffmpeg: use new stream specifier API in opt_match_per_stream*()Anton Khirnov2024-08-131-67/+20
| | | | Removes a lot of error checking code, as matching cannot fail.
* fftools/ffmpeg: replace remaining uses of MATCH_PER_STREAM_OPT()Anton Khirnov2024-08-131-9/+30
|
* fftools/ffmpeg: replace MATCH_PER_STREAM_OPT(.., str, ..) with a functionAnton Khirnov2024-08-131-23/+51
| | | | | | | | | | | | | | | | | | | | | This has multiple advantages: * The macro has multiple parameters that often have similar or identical values, yet very different meanings (one is the name of the OptionsContext member where the parsed options are stored, the other the name of the variable into which the result is written); this change makes each of these explicit. * The macro returns on failure, which may cause leaks - this was the reason for adding MATCH_PER_STREAM_OPT_CLEAN(), also ost_add() currently leaks encoder_opts. The new function returns failure to its caller, which decides how to deal with it. While that adds a lot of error checks/forwards for now, those will be reduced in following commits. * new code is type- and const- correct Invocations of MATCH_PER_STREAM_OPT() with other types will be converted in following commits.
* fftools/ffmpeg_demux: don't insert the crop filter if frame cropping side ↵James Almer2024-07-181-1/+2
| | | | | | data defines no cropping Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: support applying container level croppingJames Almer2024-07-081-0/+43
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: rewrite checking whether codec AVOptions have been usedAnton Khirnov2024-07-031-39/+11
| | | | | | Share the code between encoding and decoding. Instead of checking every stream's options dictionary (which is also used for other purposes), track all used options in a dedicated dictionary.
* fftools/ffmpeg_demux: honor -ch_layout options for overriding input stream ↵Marton Balint2024-05-271-3/+24
| | | | | | | | | | | | | | | | | | | | | channel layout The code only set the channel layout of the AVFormatContext, so the user could not override the channel layout if the demuxer did not have such parameter. This used to work via the respective AVCodecContext option, but since 639c2f00497257cb60ecaeeac1aacfa80df3be06 it no longer gets passed to the decoders. It is actually better if we set it manually, instead of using the codec option because that way we can also override it on the stream level, so it will also work for stream copy or bitstream filtering. We don't allow changing the number of channels, because that can cause unexpected results. We disable layout guessing, if a channel layout is specified. Fixes ticket #11016. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_demux: make InputStream.autorotate privateAnton Khirnov2024-03-281-3/+5
| | | | It is no longer accessed outside of ffmpeg_demux.
* fftools/ffmpeg_{demux,dec}: pass -bitexact through DecoderFlagsAnton Khirnov2024-03-281-6/+5
| | | | | Avoids abusing AV_DICT_MULTIKEY and relying on undocumented AVDictionary ordering behaviour.
* fftools/ffmpeg_demux: only call filter_codec_opts() when we have a decoderAnton Khirnov2024-03-281-4/+6
| | | | It is pointless otherwise, as decoder options will not be used.
* fftools/ffmpeg: remove unncessary casts for *_thread() return valuesAnton Khirnov2024-03-131-2/+2
| | | | | | These functions used to be passed directly to pthread_create(), which required them to return void*. This is no longer the case, so they can return a plain int.
* fftools/ffmpeg: simplify propagating fallback parameters from decoders to ↵Anton Khirnov2024-03-131-5/+20
| | | | | | | | | | | | | | | | | | | | filters Current callstack looks like this: * ifilter_bind_ist() (filter) calls ist_filter_add() (demuxer); * ist_filter_add() opens the decoder, and then calls dec_add_filter() (decoder); * dec_add_filter() calls ifilter_parameters_from_dec() (i.e. back into the filtering code) in order to give post-avcodec_open2() parameters to the filter. This is unnecessarily complicated. Pass the parameters as follows instead: * dec_init() (which opens the decoder) returns post-avcodec_open2() parameters to its caller (i.e. the demuxer) in a parameter-only AVFrame * the demuxer passes these parameters to the filter in InputFilterOptions, together with other filter options
* fftools/ffmpeg_dec: factor opening the decoder out of dec_open()Anton Khirnov2024-03-131-1/+1
| | | | | | | | Rename dec_open to dec_init(), as it is more descriptive of its new purpose. Will be useful in following commits, which will add a new path for opening decoders.
* fftools/ffmpeg_demux, sync_queue: Constify a bitAndreas Rheinhardt2024-03-021-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: cosmetics, vertically align structsAnton Khirnov2024-02-211-34/+34
|
* fftools/ffmpeg_filter: pass framerate through InputFilterOptionsAnton Khirnov2024-02-211-3/+7
| | | | | | | Rather than read it directly from InputStream. This is a step towards avoiding the assumption that filtergraph inputs are always fed by demuxers.
* fftools/ffmpeg_filter: pass autorotate/reinit flags through InputFilterOptionsAnton Khirnov2024-02-211-2/+6
| | | | | | | Rather than read them directly from InputStream. This is a step towards avoiding the assumption that filtergraph inputs are always fed by demuxers.
* fftools/ffmpeg_filter: pass sub2video canvas size through InputFilterOptionsAnton Khirnov2024-02-211-21/+20
| | | | | | | Rather than read them directly from InputStream. This is a step towards avoiding the assumption that filtergraph inputs are always fed by demuxers.
* fftools/ffmpeg_filter: accept a name from its upstream inputAnton Khirnov2024-02-211-0/+4
| | | | | | | Do not construct the name manually from input file/stream indices. This is a step towards avoiding the assumption that filtergraph inputs are always fed by demuxers.
* fftools/ffmpeg_filter: compute input trim start/end in demuxerAnton Khirnov2024-02-211-5/+19
| | | | | | The computation is based on demuxer properties, so that is the more appropriate place for it. Filter code just receives the desired start time/duration.
* fftools/ffmpeg_demux: set stream index right before sending packet to schedulerAnton Khirnov2024-02-091-3/+2
| | | | | This avoids assuming that it survives unchanged through bitstream filters, if present.
* fftools/ffmpeg: make InputStream.decoder_opts private to demuxerAnton Khirnov2024-01-301-7/+9
| | | | It is no longer used outside of ffmpeg_demux.
* fftools/ffmpeg: make InputStream.decoding_needed private to demuxerAnton Khirnov2024-01-301-4/+9
| | | | It is no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_dec: eliminate all remaining InputStream usesAnton Khirnov2024-01-301-12/+9
| | | | | | | | | | | Previously, the demuxer would register decoder with the scheduler, using InputStream as opaque, and pass the scheduling index to the decoder. Now the registration is done by the decoder itself, using DecoderPriv as opaque, and the scheduling index is returned to demuxer from dec_open(). decoder_thread() then no longer needs to be accessed from outside of ffmpeg_dec and can be made static.
* fftools/ffmpeg_dec: stop passing InputStream to dec_open()Anton Khirnov2024-01-301-1/+3
|
* fftools/ffmpeg_dec: pass AVCodecParameters through DecoderOptsAnton Khirnov2024-01-301-0/+1
| | | | | | Do not retrieve it from InputStream directly. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: pass AVCodec through DecoderOptsAnton Khirnov2024-01-301-0/+2
| | | | | | Do not retrieve it from InputStream directly. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: pass decoder name through DecoderOptsAnton Khirnov2024-01-301-0/+4
| | | | | | Do not build it from InputStream values. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: pass top_field_first through DecoderOptsAnton Khirnov2024-01-301-1/+5
| | | | | | Do not read it from InputStream directly. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: pass input timebase through DecoderOptsAnton Khirnov2024-01-301-0/+2
| | | | | | Do not read it from AVStream directly. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: move setting compute_edt to demuxerAnton Khirnov2024-01-301-0/+9
| | | | | | | It is done based on demuxer information, so that is the more appropriate place for this code. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: pass forced/estimated framerate though DecoderOptsAnton Khirnov2024-01-301-0/+6
| | | | | | Stop reading them from InputStream. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: move flags to DecoderOptsAnton Khirnov2024-01-301-3/+4
| | | | Will be useful in the following commit.
* fftools/ffmpeg_dec: pass hwaccel options to the decoder in a separate structAnton Khirnov2024-01-301-17/+19
| | | | | | Stop reading them from InputStream. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: replace InputFile.format_nots with a decoder flagAnton Khirnov2024-01-301-3/+2
| | | | | | Reduces the need to access InputFile from decoding. This is a step towards decoupling Decoder and InputStream.