aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_demux.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* fftools/ffmpeg: refactor disabling decoder threading for attached picturesAnton Khirnov2024-01-301-0/+5
| | | | | | | * as this decision is based on demuxing information, move it from the decoder to the demuxer * as the issue being addressed is latency added by frame threading, we only need to disable frame threading, not all threading
* fftools/ffmpeg_dec: stop accesing InputStream.fix_sub_durationAnton Khirnov2024-01-301-1/+2
| | | | | | Pass this information to dec_open() instead. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: override video SAR with AVCodecParameters valueAnton Khirnov2024-01-301-0/+3
| | | | | | Rather than access the AVStream one. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg: move decoder existence check to a more appropriate placeAnton Khirnov2024-01-301-0/+7
|
* fftools/ffmpeg_dec: move decoding counters from InputStream to DecoderAnton Khirnov2024-01-301-2/+2
| | | | This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg_dec: pass decoder options as an argument to dec_open()Anton Khirnov2024-01-301-1/+2
| | | | | | Rather than access the dictionary in InputStream. This is a step towards decoupling Decoder and InputStream.
* fftools/ffmpeg: make decoding AVCodecContext private to the decoderAnton Khirnov2024-01-301-14/+2
|
* fftools/ffmpeg_demux: implement -bsf for inputAnton Khirnov2024-01-191-15/+124
| | | | | Previously bitstream filters could only be applied right before muxing, this allows to apply them right after demuxing.
* fftools/ffmpeg_demux: add demuxing thread private dataAnton Khirnov2024-01-191-22/+45
| | | | | To be used for data that never needs to be visible outside of the demuxer thread, similarly as was previously done for other components.
* fftools/ffmpeg_demux: only allocate the decoder when actually decodingAnton Khirnov2024-01-191-12/+12
| | | | It is not needed otherwise.
* fftools/ffmpeg_demux: set options on codec parameters rather than decoderAnton Khirnov2024-01-191-22/+21
| | | | This avoids the requirement to always have a decoder context.
* fftools/ffmpeg_demux: do not set bitexact directly on the decoderAnton Khirnov2024-01-191-1/+1
| | | | | | Add it to decoder options instead, to be processed when opening the decoder. This way it won't be overridden by flags the user might be setting otherwise.
* fftools/ffmpeg_demux: replace abort() by av_assert0(0)Anton Khirnov2024-01-191-2/+1
| | | | This is the standard way to mark unreachable cases in a switch
* fftools/ffmpeg: improve WARN_MULTIPLE_OPT_USAGE()Anton Khirnov2023-12-221-14/+0
| | | | | | | | | | | | Currently it requires every single OPT_SPEC option to be accompanied by an array of alternate names for this option. The vast majority of options have no alternate names, resulting in a large numbers of unnecessary single-element arrays that merely contain the option name. Extend the option parsing API to allow marking options as having alternate names, or as being the canonical name for some existing alternatives. Use this new information to avoid the need for abovementioned unnecessary single-element arrays.
* fftools/ffmpeg: change the MATCH_PER_TYPE_OPT macro into a functionAnton Khirnov2023-12-221-8/+8
| | | | | There is no reason for it to be a macro anymore, this makes the code using it cleaner and simpler.
* fftools/cmdutils: add a struct for a list of SpecifierOptAnton Khirnov2023-12-221-15/+15
| | | | Significantly simplifies the code dealing with OPT_SPEC.
* fftools/ffmpeg_demux: set discard on the AVStream directlyAnton Khirnov2023-12-221-8/+7
| | | | Avoid taking an ugly detour through the decoder AVCodecContext.
* fftools/ffmpeg_demux: move InputFile.readrate to private dataAnton Khirnov2023-12-141-9/+10
| | | | It is not used outside of ffmpeg_demux.
* fftools/ffmpeg: move InputStream.codec_desc to private dataAnton Khirnov2023-12-141-3/+5
| | | | It is not used outside of ffmpeg_demux.
* fftools/ffmpeg: move InputStream.discard to private dataAnton Khirnov2023-12-141-8/+15
| | | | It is not used outside of ffmpeg_demux.