aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_demux.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* fftools/ffmpeg: replace InputStream.file_index by a pointerAnton Khirnov2023-12-141-5/+4
| | | | Reduces the need to use the input_files global array.
* fftools/ffmpeg: attach wallclock timing information to packets and framesAnton Khirnov2023-12-141-14/+12
| | | | Will become useful in following commits.
* fftools/ffmpeg: merge DemuxPktData into FrameDataAnton Khirnov2023-12-141-5/+4
| | | | | This way we can propagate arbitrary data from the demuxer all the way into the muxer, using a single struct.
* fftools/ffmpeg: convert to a threaded architectureAnton Khirnov2023-12-121-139/+129
| | | | | | | | | | Change the main loop and every component (demuxers, decoders, filters, encoders, muxers) to use the previously added transcode scheduler. Every instance of every such component was already running in a separate thread, but now they can actually run in parallel. Changes the results of ffmpeg-fix_sub_duration_heartbeat - tested by JEEB to be more correct and deterministic.
* fftools/ffmpeg: add thread-aware transcode scheduling infrastructureAnton Khirnov2023-12-121-5/+41
| | | | | | | | | | | | | | | See the comment block at the top of fftools/ffmpeg_sched.h for more details on what this scheduler is for. This commit adds the scheduling code itself, along with minimal integration with the rest of the program: * allocating and freeing the scheduler * passing it throughout the call stack in order to register the individual components (demuxers/decoders/filtergraphs/encoders/muxers) with the scheduler The scheduler is not actually used as of this commit, so it should not result in any change in behavior. That will change in future commits.
* fftools/ffmpeg_demux: switch from AVThreadMessageQueue to ThreadQueueAnton Khirnov2023-12-121-69/+37
| | | | | | | | | | | | * the code is made shorter and simpler * avoids constantly allocating and freeing AVPackets, thanks to ThreadQueue integration with ObjPool * is consistent with decoding/filtering/muxing * reduces the diff in the future switch to thread-aware scheduling This makes ifile_get_packet() always block. Any potential issues caused by this will be resolved by the switch to thread-aware scheduling in future commits.
* fftools/ffmpeg: rework keeping track of file duration for -stream_loopAnton Khirnov2023-11-141-65/+46
| | | | | | | | | | | | | | | | | | | | Current code tracks min/max pts for each stream separately; then when the file ends it combines them with last frame's duration to compute the total duration of each stream; finally it selects the longest of those durations as the file duration. This is incorrect - the total file duration is the largest timestamp difference between any frames, regardless of the stream. Also change the way the last frame information is reported from decoders to the muxer - previously it would be just the last frame's duration, now the end timestamp is sent, which is simpler. Changes the result of the fate-ffmpeg-streamloop-transcode-av test, where the timestamps are shifted slightly forward. Note that the matroska demuxer does not return the first audio packet after seeking (due to buggy interaction betwen the generic code and the demuxer), so there is a gap in audio.
* fftools/ffmpeg: move a few inline function into a new headerAnton Khirnov2023-11-141-0/+1
| | | | | Will allow to use them in future commits without including the whole ffmpeg.h.
* fftools/ffmpeg_demux: Fix leak on errorAndreas Rheinhardt2023-10-101-5/+5
| | | | | | | | | | | | | | | An AVFormatContext leaks on errors that happen before it is attached to its permanent place (an InputFile). Fix this by attaching it earlier. Given that it is not documented that avformat_close_input() is usable with an AVFormatContext that has only been allocated with avformat_alloc_context() and not opened with avformat_open_input(), one error path before avformat_open_input() had to be treated specially: It uses avformat_free_context(). Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_demux: Don't use fake object with av_opt_evalAndreas Rheinhardt2023-10-101-8/+7
| | | | | | | | | | | | | | | | The av_opt_eval family of functions emits errors messages on error and can therefore not be used with fake objects when the AVClass has a custom item_name callback. The AVClass for AVCodecContext has such a custom callback (it searches whether an AVCodec is set to use its name). In practice it means that whatever is directly after the "cc" pointer to the AVClass for AVCodec in the stack frame of ist_add() will be treated as a pointer to an AVCodec with unpredictable consequences. Fix this by using an actual AVCodecContext instead of a fake object. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: stop injecting stream side data in packetsJames Almer2023-10-061-22/+0
| | | | | | | | | This is no longer needed as the side data is available for decoders in the AVCodecContext. The tests affected reflect the removal of useless CPB and Stereo 3D side data in packets. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: stop using AVStream.side_dataJames Almer2023-10-061-4/+9
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: deprecate the -top optionAnton Khirnov2023-09-181-0/+2
| | | | | | It is badly named (should have been -top_field_first, or at least -tff), underdocumented and underspecified, and (most importantly) entirely redundant with the setfield filter.
* fftools/ffmpeg: return an error from assert_avoptions() instead of abortingAnton Khirnov2023-07-201-1/+4
| | | | Rename it to check_avoptions().
* fftools/cmdutils: add error handling to filter_codec_opts()Anton Khirnov2023-07-201-1/+4
|
* fftools/ffmpeg: return errors from find_codec_or_die() instead of abortingAnton Khirnov2023-07-201-17/+37
| | | | Rename the function to just find_codec().
* fftools/cmdutils: add error handling to GROW_ARRAY()Anton Khirnov2023-07-201-2/+8
|
* fftools/cmdutils: add error handling to allocate_array_elem()Anton Khirnov2023-07-201-2/+14
|
* fftools/cmdutils: return error codes from setup_find_stream_info_opts() ↵Anton Khirnov2023-07-201-1/+5
| | | | instead of aborting
* fftools/ffmpeg_demux: return errors from ist_add() instead of abortingAnton Khirnov2023-07-151-27/+43
|
* fftools/ffmpeg: return errors from assert_file_overwrite() instead of abortingAnton Khirnov2023-07-151-1/+3
|
* fftools/ffmpeg_demux: add logging for -dump_attachmentAnton Khirnov2023-07-151-0/+4
| | | | Makes it more clear what was written where.
* fftools/ffmpeg_demux: forward errors from dump_attachment() instead of abortingAnton Khirnov2023-07-151-7/+12
| | | | Also, check the return code of avio_close().
* fftools/ffmpeg_demux: drop a redundant avio_flush()Anton Khirnov2023-07-151-1/+0
| | | | | It is immediately followed by avio_close(), which is documented to flush the buffers.
* fftools/ffmpeg_demux: return errors from ifile_open() instead of abortingAnton Khirnov2023-07-151-9/+9
|
* fftools/ffmpeg_dec: move InputStream.prev_sub to DecoderAnton Khirnov2023-06-191-1/+0
| | | | It does not need to be visible outside of decoding code.
* fftools/ffmpeg_dec: move InputStream.hwaccel_pix_fmt to DecoderAnton Khirnov2023-06-191-2/+0
| | | | It is purely decoder-internal state.
* fftools/ffmpeg_demux: reindent after previous commitAnton Khirnov2023-06-191-193/+193
|
* fftools/ffmpeg_demux: move the loop out of add_input_streams()Anton Khirnov2023-06-191-10/+6
| | | | | | Make the function process just one input stream at a time and save an indentation level. Also rename it to ist_add() to be consistent with an analogous function in ffmpeg_mux_init.
* fftools/ffmpeg_demux: do not set AVCodecContext.framerateAnton Khirnov2023-06-051-3/+0
| | | | | For decoding, this field is used by the decoder to export information to the caller; it does not make sense for the caller to set it.