summaryrefslogtreecommitdiff
path: root/fftools
Commit message (Collapse)AuthorAgeFilesLines
* ffmpeg: fix implementation of updated input start timeGyan Doshi2022-11-034-14/+30
| | | | | | | | | | The current adjustment of input start times just adjusts the tsoffset. And it does so, by resetting the tsoffset to nullify the new start time. This leads to breakage of -copyts, ignoring of input_ts_offset, breaking of -isync as well as breaking wrap correction. Fixed by taking cognizance of these parameters, and by correcting start times just before sync offsets are applied.
* ffmpeg: shift start time correction to ffmpeg_optGyan Doshi2022-11-032-22/+27
| | | | | In preparation for applying start time correction that accounts for all factors such as copyts, input_ts_offset ..etc
* fftools/ffmpeg_demux: stop modifying OptionsContextAnton Khirnov2022-10-251-17/+22
| | | | It should be input-only to this code.
* fftools/ffmpeg_mux_init: stop modifying OptionsContext.*_disableAnton Khirnov2022-10-251-7/+12
| | | | | | | | | | | The current code will override the *_disable fields (set by -vn/-an options) when creating output streams for unlabeled complex filtergraph outputs, in order to disable automatic mapping for the corresponding media type. However, this will apply not only to automatic mappings, but to manual ones as well, which should not happen. Avoid this by adding local variables that are used only for automatic mappings.
* fftools/ffmpeg_mux_init: move code creating streams into a new functionAnton Khirnov2022-10-251-33/+39
| | | | | Makes it easy to see where all the streams are created. Will also be useful in the following commit.
* fftools/ffmpeg_mux_init: stop modifying some OptionsContext fieldsAnton Khirnov2022-10-251-9/+12
| | | | | | Specifically recording_time and stop_time - use local variables instead. OptionsContext should be input-only to this code. Will allow making it const in future commits.
* fftools/ffmpeg_mux_init: constify metadata specifier argumentsAnton Khirnov2022-10-251-2/+2
|
* fftools/ffmpeg_mux_init: avoid modifying OptionsContext.chapters_input_fileAnton Khirnov2022-10-251-7/+8
| | | | | Use a local variable instead. This will allow making OptionsContext const in future commits.
* fftools/ffmpeg: factor out copying metadata/chapters from of_open()Anton Khirnov2022-10-251-57/+66
| | | | | This code shares variables like OptionsContext.metadata_*_manual, so it makes sense to group it together.
* fftools/ffmpeg_demux: log when the demuxer thread terminatesAnton Khirnov2022-10-251-0/+8
| | | | Similar to what is done for muxing, may be useful for debugging.
* fftools/ffmpeg: move nb_streams_warn from InputFile to DemuxerAnton Khirnov2022-10-252-7/+9
| | | | | It is private to the demuxer and do not need to be visible outside of it.
* fftools/ffmpeg_demux: do not log to the demuxer contextAnton Khirnov2022-10-251-1/+1
| | | | Only the demuxer itself is supposed to do that.
* fftools/ffmpeg: move duration/time_base from InputFile to DemuxerAnton Khirnov2022-10-252-15/+18
| | | | | They are private to the demuxer and do not need to be visible outside of it.
* fftools/ffmpeg: move threading fields from InputFile to DemuxerAnton Khirnov2022-10-252-27/+27
| | | | | They are private to the demuxer and do not need to be visible outside of it.
* fftools/ffmpeg: drop free_input_threads()Anton Khirnov2022-10-253-16/+6
| | | | | Stop demuxer threads in ifile_close() instead. Simplifies the demuxer API.
* fftools/ffmpeg: move closing the input file into a separate functionAnton Khirnov2022-10-253-4/+16
| | | | | For now this is just closing the format context and freeing InputFile, but will contain more in the future.
* fftools/ffmpeg: drop init_input_threads()Anton Khirnov2022-10-253-19/+9
| | | | | Start threads implicitly when ifile_get_packet() is called. Simplifies the demuxer API.
* fftools/ffmpeg_demux: add demuxer private dataAnton Khirnov2022-10-252-11/+27
| | | | Move InputFile.loop into it.
* fftools/ffmpeg_opt: move opening input files to ffmpeg_demux.cAnton Khirnov2022-10-253-643/+656
| | | | | | | | | This is similar to what was done before for output files and will allow introducing demuxer-private state in future commits Unlike for muxing, the code is moved to existing ffmpeg_demux.c rather than to a new file. The reason is just file size - the demuxing code is much smaller than muxing.
* fftools/ffmpeg: set thread namesAnton Khirnov2022-10-242-0/+18
|
* fftools/ffmpeg: rename read_file() to avoid conflict with libassAnton Khirnov2022-10-213-5/+5
| | | | | libass defines a non-static read_file() symbol, which causes conflicts with static linking.
* ffmpeg: Deprecate display rotation override with a metadata keyJan Ekström2022-10-193-0/+17
| | | | | | | | Now that we have proper options for defining display matrix overrides, this should no longer be required. fftools does not have its own versioning, so for now the define is just set to 1 and disables the functionality if set to zero.
* ffmpeg: Add display_{rotation, hflip, vflip} optionsJan Ekström2022-10-192-0/+56
| | | | | | | | | This enables overriding the rotation as well as horizontal/vertical flip state of a specific video stream on the input side. Additionally, switch the singular test that was utilizing the rotation metadata to instead override the input display rotation, thus leading to the same result.
* fftools/ffmpeg_opt: Move stuff only used by ffmpeg_mux_init to itAndreas Rheinhardt2022-10-183-12/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_mux: move muxing queue fields from OutputStream to MuxStreamAnton Khirnov2022-10-184-11/+11
| | | | | They are private to the muxer and do not need to be visible outside of it.
* fftools/ffmpeg_mux: move bsf_ctx from OutputStream to MuxStreamAnton Khirnov2022-10-184-10/+13
| | | | | It is private to the muxer and does not need to be visible outside of it.
* fftools/ffmpeg_mux: embed OutputStream in a MuxStreamAnton Khirnov2022-10-183-33/+28
| | | | | | | | This is now possible since OutputStream is a child of OutputFile and the code allocating it can access MuxStream. Avoids the overhead and extra complexity of allocating two objects instead of one. Similar to what was previously done for OutputFile/Muxer.
* fftools/ffmpeg: free output streams in of_close()Anton Khirnov2022-10-182-54/+52
| | | | | Output streams are now children of OutputFile, so it makes more sense to free them there.
* fftools/ffmpeg: remove a cleanup block at the end of transcode()Anton Khirnov2022-10-181-18/+11
| | | | | Some of it is already duplicated in ost_free() - those parts can be just dropped. The rest is moved to ost_free(), as it properly belongs there.
* fftools/ffmpeg: remove the output_streams globalAnton Khirnov2022-10-186-98/+97
| | | | | | | Replace it with an array of streams in each OutputFile. This is a more accurate reflection of the actual relationship between OutputStream and OutputFile. This is easier to handle and will allow further simplifications in future commits.
* fftools/ffmpeg_mux_init: pass Muxer to new_output_stream()Anton Khirnov2022-10-181-47/+50
| | | | And intermediate functions. Will be useful in the following commit.
* fftools/ffmpeg: reindent after previous commitAnton Khirnov2022-10-181-17/+17
|
* fftools/ffmpeg: move freeing an output stream into a separate functionAnton Khirnov2022-10-181-32/+37
|
* fftools/ffmpeg: move init_output_bsfs() to ffmpeg_muxAnton Khirnov2022-10-182-36/+38
| | | | | Bitstream filtering is done as a part of muxing, so this is the more proper place for this.
* fftools/ffmpeg_mux: move sq_mux from OutputFile to MuxerAnton Khirnov2022-10-184-9/+9
| | | | | It is internal to ffmpeg_mux* and does not need to be visible to other code.
* fftools/ffmpeg_mux: inline mux_free() into of_close()Anton Khirnov2022-10-181-18/+13
| | | | mux_free() is no longer called from anywhere else.
* fftools/ffmpeg_mux: inline of_muxer_init() into of_open()Anton Khirnov2022-10-184-64/+40
| | | | | A separate muxer init is no longer necessary, now that of_open() has access to Muxer.
* fftools/ffmpeg_mux: allocate sq_pkt in setup_sync_queues()Anton Khirnov2022-10-182-11/+10
| | | | This is now possible since setup_sync_queues() can interact with Muxer.
* fftools/ffmpeg_mux: embed OutputFile in a MuxerAnton Khirnov2022-10-184-72/+69
| | | | | | | | This is now possible since the code allocating OutputFile can see sizeof(Muxer). Avoids the overhead and extra complexity of allocating two objects instead of one. Similar to what is done e.g. for AVStream/FFStream in lavf.
* fftools/ffmpeg_mux: move Muxer and MuxStream to a new headerAnton Khirnov2022-10-182-35/+73
| | | | This will allow ffmpeg_mux_init.c to work with these structs.
* fftools/ffmpeg_opt: move opening output files into a new fileAnton Khirnov2022-10-184-1906/+1977
| | | | | | | | | | | | | ffmpeg_opt.c currently contains code for - parsing the options provided on the command line - opening and initializing input files based on these options - opening and initializing output files based on these options The code dealing with each of these is for the most part disjoint, so it makes sense to move them to separate files. Beyond reducing the quite considerable size of ffmpeg_opt.c, this will also allow exposing muxer internals (currently private to ffmpeg_mux.c) to the initialization code, thus removing the awkward separation currently in place.
* fftools/ffmpeg: move some stream initialization code to ffmpeg_muxAnton Khirnov2022-10-183-12/+21
| | | | | The code in question is muxing-specific and so belongs there. This will allow make some objects private to the muxer in future commits.
* fftools/ffmpeg_mux: drop the of_ prefix from of_submit_packet()Anton Khirnov2022-10-181-3/+3
| | | | This function is now static.
* fftools/ffmpeg_mux: rename submit_packet() to thread_submit_packet()Anton Khirnov2022-10-181-3/+3
| | | | | This is more descriptive, and the submit_packet() name will be reused in following commits.
* fftools/ffmpeg: move output_packet() to ffmpeg_muxAnton Khirnov2022-10-183-73/+72
| | | | | This function is common to both transcoding and streamcopy, so it properly belongs into the muxing code.
* fftools/ffmpeg_mux: do not unref a NULL packetAnton Khirnov2022-10-181-1/+2
| | | | The packet submitted to of_submit_packet() may be NULL to signal EOF.
* fftools/ffmpeg_opt: Use av_err2strMarvin Scholz2022-10-141-3/+1
| | | | | | | This simplifies the code as there is no other place the error buffer is needed, so the av_err2str helper macro can be used. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffprobe: Use av_err2strMarvin Scholz2022-10-141-7/+1
| | | | | | | | | av_err2str which is a wrapper for av_strerror already calls strerror_r if available and if not has a fallback for the other error codes that would be handled by that, so manually calling strerror again if it fails is not necessary. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/cmdutils: Use av_err2strMarvin Scholz2022-10-141-6/+1
| | | | | | | | | av_err2str which is a wrapper for av_strerror already calls strerror_r if available and if not has a fallback for the other error codes that would be handled by that, so manually calling strerror again if it fails is not necessary. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* ffmpeg: Make find_stream_info behave like a normal per-file optionMarvin Scholz2022-10-132-3/+4
| | | | | | | | | Currently it would essentially change the find_stream_info setting for the file it was specified for and all following files, which is unusual and somewhat unexpected behaviour for a per-file option and not even documented to behave like this. Signed-off-by: Anton Khirnov <anton@khirnov.net>