summaryrefslogtreecommitdiff
path: root/fftools
Commit message (Collapse)AuthorAgeFilesLines
* fftools/ffmpeg: rename transcode_init()Anton Khirnov2023-05-151-14/+4
| | | | | | | It does no initialization anymore, except for setting transcode_init_done - the bulk of the function is printing the input/output maps. It also cannot fail anymore, so remove the useless return value.
* 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-152-17/+19
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg: stop accessing input format from decoding codeAnton Khirnov2023-05-153-3/+7
| | | | | | 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: log corrupt-frame errors to the appropriate contextAnton Khirnov2023-05-151-2/+2
|
* fftools/ffmpeg: replace print_error() by more meaningful messagesAnton Khirnov2023-05-153-5/+7
|
* fftools/ffmpeg_demux: reindent after previous commitAnton Khirnov2023-05-151-10/+10
|
* fftools/ffmpeg: move discarding unused programs to ffmpeg_demuxAnton Khirnov2023-05-152-16/+17
| | | | This is a more appropriate place for this code.
* fftools/ffmpeg: simplify tracking -readrate start timeAnton Khirnov2023-05-153-11/+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-152-3/+6
| | | | It is no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.wrap_correction_done to private dataAnton Khirnov2023-05-152-6/+5
| | | | It is no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.[next_]dts to private dataAnton Khirnov2023-05-152-28/+35
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.[saw_]first_d?ts to private dataAnton Khirnov2023-05-152-10/+14
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg_demux: move InputStream.{nb_packets,data_size} to private dataAnton Khirnov2023-05-152-10/+13
| | | | They are no longer used outside of ffmpeg_demux.
* fftools/ffmpeg: drop unused decode_video() parameterAnton Khirnov2023-05-151-4/+2
|
* fftools/ffmpeg_demux: reindent after previous commitAnton Khirnov2023-05-151-14/+14
|
* fftools/ffmpeg: move post-demux packet processing to ffmpeg_demuxAnton Khirnov2023-05-153-228/+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-153-2/+28
| | | | | | 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 decoder properties in ist_dts_update()Anton Khirnov2023-05-151-3/+3
| | | | | | This code runs post-demuxing and is not synchronized with the decoder output (which may be delayed with respect to its input by arbitrary and unknowable amounts), so accessing any decoder properties is incorrect.
* fftools/ffmpeg: reindent after previous commitAnton Khirnov2023-05-151-29/+29
|
* fftools/ffmpeg: consolidate InputStream.[next_]dts updatesAnton Khirnov2023-05-151-50/+55
| | | | | | Move them to a separate function called right after timestamp discontinuity processing. This is now possible, since these values have no interaction with decoding anymore.
* fftools/ffmpeg: stop using deprecated ticks_per_frameAnton Khirnov2023-05-153-6/+10
|
* fftools/ffmpeg: fix computing video frame duration from repeat_pictAnton Khirnov2023-05-151-4/+4
| | | | | This field contains the number of _field_ durations by which the standard frame duration should be extended.
* fftools/opt_common: stop printing deprecated AV_CODEC_CAP_SUBFRAMESAnton Khirnov2023-05-151-2/+0
|
* fftools/ffprobe: print exported stream AVOptionsJames Almer2023-05-081-11/+18
| | | | | | | Similar to the decoder AVOptions, this is useful to show values from options exported by the demuxer. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: discard packets for unused streams in demuxing threadAnton Khirnov2023-05-082-5/+2
| | | | Avoids the pointless overhead of transferring them to the main thread.
* fftools/ffmpeg_filter: use InputFilterPriv.eof instead of InputFile.eof_reachedAnton Khirnov2023-05-081-5/+6
| | | | | | The two checks using eof_reached are testing whether more input can possibly appear on this filtergraph input. InputFilterPriv.eof is the more authoritative source for this information.
* fftools/ffmpeg: move unconfigured graph handling to ffmpeg_filterAnton Khirnov2023-05-082-24/+28
| | | | This code more properly belongs there.
* fftools/ffmpeg_filter: use av_buffer_replace() to improve codeAnton Khirnov2023-05-081-7/+3
| | | | It is shorter and more efficient.
* fftools/ffmpeg_filter: move InputFilter.hw_frames_ctx to private dataAnton Khirnov2023-05-082-9/+9
| | | | It is not used outside of ffmpeg_filter.
* fftools/ffmpeg_filter: move InputFilter.displaymatrix to private dataAnton Khirnov2023-05-082-7/+9
| | | | It is not used outside of ffmpeg_filter.
* fftools/ffmpeg_filter: move InputFilter.eof to private dataAnton Khirnov2023-05-082-4/+5
| | | | It is not used outside of ffmpeg_filter.
* fftools/ffmpeg_filter: take fallback parameters from decoder, not demuxerAnton Khirnov2023-05-084-25/+67
| | | | | | | | | | 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_enc: stop configuring filter inputs from encoder flushAnton Khirnov2023-05-081-10/+0
| | | | | | | | | | | | | | | When no frames are ever seen by an encoder, encoder flush will do a last-ditch attempt to configure its source filtergraph in order to at least get the stream parameters. This involves extracting demuxer parameters from filtergraph source inputs, which is * a bad layering violation * probably unreachable, because decoders are flushed before encoders, which should call ifilter_send_eof(), which will also set these parameters; however due to complex control flow it is hard to be entirely sure this code can never be triggered Even if this code can actually be reached, it is probably better to return an error as the comment above it says.
* fftools/ffmpeg: eliminate need_output()Anton Khirnov2023-05-081-28/+10
| | | | Replace it by simply calling choose_output() earlier.
* fftools/ffmpeg: merge choose_output() and got_eagain()Anton Khirnov2023-05-081-22/+19
| | | | | | | These two functions are a part of a single logical action - determining which, if any, output stream needs to be processed next. Keeping them separate is a historical artifact that obscures what is actually being done.
* fftools/ffmpeg: reduce -re to -readrate 1Anton Khirnov2023-05-073-10/+9
| | | | | 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-073-1/+21
| | | | | | enforced Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools: use the new AVFrame keyframe flagJames Almer2023-05-043-5/+5
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools: use the new AVFrame interlace flagsJames Almer2023-05-043-7/+10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: always use the same path for setting InputStream.[next_]dtsAnton Khirnov2023-05-021-29/+5
| | | | | | | | | | | | | | | | | | | | | Currently those are set in different ways depending on whether the stream is decoded or not, using some values from the decoder if it is. This is wrong, because there may be arbitrary amount of delay between input packets and output frames (depending e.g. on the thread count when frame threading is used). Always use the path that was previously used only for streamcopy. This should not cause any issues, because these values are now used only for streamcopy and discontinuity handling. This change will allow to decouple discontinuity processing from decoding and move it to ffmpeg_demux. It also makes the code simpler. Changes output in fate-cover-art-aiff-id3v2-remux and fate-cover-art-mp3-id3v2-remux, where attached pictures are now written in the correct order. This happens because InputStream.dts is no longer reset to AV_NOPTS_VALUE after decoding, so streamcopy actually sees valid dts values.
* fftools/ffmpeg: constify packets passed to decode*()Anton Khirnov2023-05-021-4/+4
| | | | They are not modified by these functions.
* fftools/ffmpeg: drop InputStream.[next_]ptsAnton Khirnov2023-05-023-24/+1
| | | | They are no longer used for anything.
* fftools/ffmpeg_filter: stop using InputStream.pts for filter EOF tsAnton Khirnov2023-05-021-1/+3
| | | | Use InputStream.last_frame_pts/duration instead, which is more accurate.
* fftools/ffmpeg: stop using InputStream.pts for generating video timestampsAnton Khirnov2023-05-021-5/+2
| | | | | | | This was added in 380db569287ba99d903b7629f209b9adc7fd2723 as a temporary crutch that is not needed anymore. The only case where this code can be triggered is the very first frame, for which InputStream.pts is always equal to 0.
* fftools/ffmpeg: rework audio-decode timestamp handlingAnton Khirnov2023-05-023-23/+89
| | | | | | | | | | | | | | | | | | | | | 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: set AVFrame.time_base for decoded framesAnton Khirnov2023-05-021-10/+12
| | | | Makes it easier to keep track of the timebase the frames are in.
* fftools/ffmpeg: stop using packet pts for decoded audio frame ptsAnton Khirnov2023-05-021-3/+0
| | | | | | | | | | If input packets have timestamps, they will be propagated to output frames by the decoder, so at best this block does not do anything. There can also be an arbitrary amount of delay between packets sent to the decoder and decoded frames (e.g. due to decoder's intrinsic delay or frame threading), so deriving any timestamps from packet properties is wrong.