aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_demux.c
Commit message (Collapse)AuthorAgeFilesLines
...
* fftools/ffmpeg: move sub2video handling to ffmpeg_filterAnton Khirnov2023-05-311-1/+0
| | | | | | Make all relevant state per-filtergraph input, rather than per-input stream. Refactor the code to make it work and avoid leaking memory when a single subtitle stream is sent to multiple filters.
* fftools/ffmpeg: rework setting sub2video parametersAnton Khirnov2023-05-311-0/+21
| | | | | | Set them in ifilter_parameters_from_dec(), similarly to audio/video streams. This reduces the extent to which sub2video filters need to be treated specially.
* fftools/ffmpeg_demux: log discontinuity warnings to stream contextAnton Khirnov2023-05-281-6/+4
| | | | Allows simplifying the log message.
* fftools/ffmpeg: add InputStream.indexAnton Khirnov2023-05-281-0/+1
| | | | This allows to avoid access to the underlying AVStream in many places.
* fftools/ffmpeg_dec: move timestamp estimation state to DecoderAnton Khirnov2023-05-281-5/+0
| | | | It is purely internal to decoding.
* fftools/ffmpeg_dec: move InputStream.pkt to DecoderAnton Khirnov2023-05-281-5/+0
| | | | It is purely internal to decoding.
* fftools/ffmpeg_dec: add decoder private dataAnton Khirnov2023-05-281-5/+2
| | | | | | | Move InputStream.decoded_frame to it. Analogous to what has been previously done for all the other major components.
* fftools/ffmpeg_demux: skip unused/attachment streams in final statsAnton Khirnov2023-05-281-0/+3
| | | | No useful information can be printed for them.
* fftools/ffmpeg_demux: initialize nb_streams_warnAnton Khirnov2023-05-281-0/+1
| | | | | Fixes spurious new-stream warnings for unused streams after 9429624a76107020b5911f8307f366fed386b336
* fftools/ffmpeg_demux: only print demuxing stats if demuxing actually startedAnton Khirnov2023-05-281-1/+5
| | | | | If the transcoding process never got to reading any packets from this input then printing stats is just pointless noise.
* fftools/ffmpeg: drop outdated commentsAnton Khirnov2023-05-281-1/+0
|
* fftools/ffmpeg: rework handling -max_error_rateAnton Khirnov2023-05-221-2/+3
| | | | | Replace the decode_error_stat global with a per-input-stream variable. Also, print an error message when the error rate is exceeded.
* fftools/ffmpeg_demux: disallow using disabled input streamsAnton Khirnov2023-05-221-0/+6
| | | | | This is less ad-hoc than checking explicitly in every place that binds an input stream to a filter or output.
* fftools/ffmpeg: return error codes from ist_*_add()Anton Khirnov2023-05-221-7/+19
| | | | Will be useful in future commits.
* fftools/ffmpeg_filter: split finding an unused stream into a functionAnton Khirnov2023-05-221-0/+10
| | | | Avoids filtering code from digging in demuxer internals.
* fftools/ffmpeg_demux: stop logging to demuxer contextAnton Khirnov2023-05-151-2/+2
| | | | Only the demuxer itself should do that.
* fftools/ffmpeg_demux: move InputFile.ts_offset_discont,last_ts to private dataAnton Khirnov2023-05-151-12/+19
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg: stop accessing input format from decoding codeAnton Khirnov2023-05-151-0/+2
| | | | | | Export the corresponding flag in InputFile instead. This will allow making the demuxer AVFormatContext private in future commits, similarly to what was previously done for muxers.
* fftools/ffmpeg: replace print_error() by more meaningful messagesAnton Khirnov2023-05-151-1/+2
|
* fftools/ffmpeg_demux: reindent after previous commitAnton Khirnov2023-05-151-10/+10
|
* fftools/ffmpeg: move discarding unused programs to ffmpeg_demuxAnton Khirnov2023-05-151-0/+17
| | | | This is a more appropriate place for this code.
* fftools/ffmpeg: simplify tracking -readrate start timeAnton Khirnov2023-05-151-1/+5
| | | | | | There is no point in having a per-stream wallclock start time, since they are all computed at the same instant. Keep a per-file start time instead, initialized when the demuxer thread starts.
* fftools/ffmpeg_demux: move InputStream.streamcopy_needed to private dataAnton Khirnov2023-05-151-2/+6
| | | | It is no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.wrap_correction_done to private dataAnton Khirnov2023-05-151-4/+5
| | | | It is no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.[next_]dts to private dataAnton Khirnov2023-05-151-24/+35
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.[saw_]first_d?ts to private dataAnton Khirnov2023-05-151-8/+14
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.{nb_packets,data_size} to private dataAnton Khirnov2023-05-151-6/+13
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: reindent after previous commitAnton Khirnov2023-05-151-14/+14
|
* fftools/ffmpeg: move post-demux packet processing to ffmpeg_demuxAnton Khirnov2023-05-151-34/+234
| | | | | | | | | | | | That is a more appropriate place for this code and will allow hiding more of InputStream. The value of repeat_pict extracted from libavformat internal parser no longer needs to be trasmitted outside of the demuxing thread. Move readrate handling to the demuxer thread. This has to be done in the same commit, since it reads InputStream.dts,nb_packets, which are now set in the demuxer thread.
* fftools/ffmpeg: attach InputStream.dts to demuxed packets when neededAnton Khirnov2023-05-151-0/+1
| | | | | | This way computing it and using it for streamcopy does not need to happen in sync. Will be useful in following commits, where updating InputStream.dts will be moved to the demuxing thread.
* fftools/ffmpeg_demux: move preparing DemuxMsg to separate functionAnton Khirnov2023-05-151-8/+23
| | | | | Will be useful in following commits, which will move more code into this function.
* fftools/ffmpeg: stop using deprecated ticks_per_frameAnton Khirnov2023-05-151-0/+2
|
* fftools/ffmpeg: discard packets for unused streams in demuxing threadAnton Khirnov2023-05-081-1/+2
| | | | Avoids the pointless overhead of transferring them to the main thread.
* fftools/ffmpeg_filter: take fallback parameters from decoder, not demuxerAnton Khirnov2023-05-081-0/+7
| | | | | | | | | | When an input stream terminates and no frames were successfully decoded, filtering code will currently configure the filtergraph using demuxer stream parameters. Use decoder parameters instead, which should be more reliable. Also, initialize them immediately when an input stream is bound to a filtergraph input, so that these parameters are always available (if at all) and filtering code does not need to reach into the decoder at some arbitrary later point.
* fftools/ffmpeg: reduce -re to -readrate 1Anton Khirnov2023-05-071-8/+8
| | | | | They are exactly equivalent, so there is no point in maintaining a separate flag for -re.
* fftools/ffmpeg: use a non-zero default for -readrate_initial_burstAnton Khirnov2023-05-071-2/+2
| | | | Use it to replace a hack added in 6f206852289.
* fftools/ffmpeg: add ability to set a input burst time before readrate is ↵Davy Durham2023-05-071-1/+17
| | | | | | enforced Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg: drop InputStream.[next_]ptsAnton Khirnov2023-05-021-1/+0
| | | | They are no longer used for anything.
* fftools/ffmpeg: rework audio-decode timestamp handlingAnton Khirnov2023-05-021-3/+3
| | | | | | | | | | | | | | | | | | | | | Stop using InputStream.dts for generating missing timestamps for decoded frames, because it contains pre-decoding timestamps and there may be arbitrary amount of delay between input packets and output frames (e.g. dependent on the thread count when frame threading is used). It is also in AV_TIME_BASE (i.e. microseconds), which may introduce unnecessary rounding issues. New code maintains a timebase that is the inverse of the LCM of all the samplerates seen so far, and thus can accurately represent every audio sample. This timebase is used to generate missing timestamps after decoding. Changes the result of the following FATE tests * pcm_dvd-16-5.1-96000 * lavf-smjpeg * adpcm-ima-smjpeg In all of these the timestamps now better correspond to actual frame durations.
* fftools/ffmpeg: open decoders right after we know they are neededAnton Khirnov2023-04-171-0/+6
| | | | Will allow initializing subtitle encoding earlier.
* fftools/ffmpeg: stop setting InputStream fields from muxing/filtering codeAnton Khirnov2023-04-171-1/+12
| | | | | | Set InputStream.decoding_needed/discard/etc. only from ist_{filter,output},add() functions. Reduces the knowledge of InputStream internals in muxing/filtering code.
* fftools/ffmpeg: add a function adding a destination filter for InputStreamAnton Khirnov2023-04-171-0/+6
| | | | | This way filtering code does not directly mess with InputStream internals. Will become more useful in following commits.
* fftools/ffmpeg: avoid possible invalid reads with short -tag valuesAnton Khirnov2023-04-171-2/+6
| | | | Fixes #10319 and #10309.
* fftools/ffmpeg: change video decoding timestamp generationAnton Khirnov2023-04-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When no timestamps are available from the container, the video decoding code will currently use fake dts values - generated in process_input_packet() based on a combination of information from the decoder and the parser (obtained via the demuxer) - to generate timestamps during decoder flushing. This is fragile, hard to follow, and unnecessarily convoluted, since more reliable information can be obtained directly from post-decoding values. The new code keeps track of the last decoded frame pts and estimates its duration based on a number of heuristics. Timestamps generated when both pts and pkt_dts are missing are then simple pts+duration of the last frame. The heuristics are somewhat complicated by the fact that lavf insists on making up packet timestamps based on its highly incomplete information. That should be removed in the future, allowing to further simplify this code. The results of the following tests change: * h264-3386 now requires -fps_mode passthrough to avoid dropping frames at the end; this is a pathology of the interaction of the new and old code, and the fact that the sample switches from field to frame coding in the last packet, and will be fixed in following commits * hevc-conformance-DELTAQP_A_BRCM_4 stops inventing an arbitrary timestamp gap at the end * hevc-small422chroma - the single frame output by this test now has a timestamp of 0, rather than an arbitrary 7
* fftools/ffmpeg_demux: set the timebase on demuxed packetsAnton Khirnov2023-04-131-7/+9
| | | | | Simplifies tracking what timebase are the timestamps in. Will be useful in following commits.
* fftools/ffmpeg: track a list of non-lavfi outputs in InputStreamAnton Khirnov2023-04-131-0/+7
| | | | | | | Currently, output streams where an input stream is sent directly (i.e. not through lavfi) are determined by iterating over ALL the output streams and skipping the irrelevant ones. This is awkward and inefficient.
* fftools/ffmpeg_demux: log final stats to demuxer contextAnton Khirnov2023-04-131-8/+8
|
* fftools/ffmpeg_demux: reindentAnton Khirnov2023-04-131-26/+26
|
* fftools/ffmpeg: move printing verbose demuxing stats to ffmpeg_demuxAnton Khirnov2023-04-131-0/+38
| | | | This is a more appropriate place for this.
* fftools/ffmpeg: move initializing next_[pd]ts to add_input_streams()Anton Khirnov2023-04-091-0/+3
| | | | | They are initialized to constants, so it makes most sense to do it as soon as possible.