Commit Graph

662 Commits

Author SHA1 Message Date
Anton Khirnov 044d70736e fftools/ffmpeg: move some code from init_output_stream() to init_output_stream_encode()
The code is subtitle-encoding-specific, so this is a more appropriate
place for it.
2022-10-04 11:55:03 +02:00
Anton Khirnov 29188f9c62 fftools/ffmpeg: rename OutputStream.sync_opts to next_pts
The current name is confusing.
2022-10-04 11:55:03 +02:00
Anton Khirnov 3c0f532cbc fftools/ffmpeg: pass the timestamp to check_recording_time()
Stop setting OutputStream.sync_opts for subtitle encoding, as it is now
unused.
2022-10-04 11:55:03 +02:00
Anton Khirnov 69f770f77c fftools/ffmpeg: stop setting OutputStream.sync_opts for streamcopy
It is not used for anything.
2022-10-04 11:55:03 +02:00
Anton Khirnov 76678b7137 fftools/ffmpeg: drop never-set OutputStream.first_pts 2022-10-04 11:55:03 +02:00
Anton Khirnov 5188aeaffb fftools/ffmpeg: cosmetics
Reindent after previous commit, apply some style fixes.
2022-10-04 11:55:03 +02:00
Anton Khirnov c75be06148 fftools/ffmpeg: move forced keyframe processing into its own function 2022-10-04 11:55:03 +02:00
Anton Khirnov 7a994c8701 fftools/ffmpeg: drop always-true conditions
in_picture->pts cannot be AV_NOPTS_VALUE, as it is set to ost->sync_opts
a few lines above. ost->sync_opts is never AV_NOPTS_VALUE.
2022-10-04 11:55:03 +02:00
Anton Khirnov 3d86a13b47 fftools/ffmpeg: drop the -async option
It has been deprecated in favor of the aresample filter for almost 10
years.

Another thing this option can do is drop audio timestamps and have them
generated by the encoding code or the muxer, but
- for encoding, this can already be done with the setpts filter
- for muxing this should almost never be done as timestamp generation by
  the muxer is deprecated, but people who really want to do this can use
  the setts bitstream filter
2022-10-04 11:55:03 +02:00
Marvin Scholz cc48454561 fftools/ffmpeg: Remove unused frame_bits_per_raw_sample variable
Unused since the bits_per_raw_sample was made a per-output-stream
option in 4258893961

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-10-02 11:59:25 +02:00
Marvin Scholz 793953f44a fftools/ffmpeg: Remove unused do_deinterlace variable
Unused since removal of the -deinterlace option in
d013453caa

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-10-02 11:59:25 +02:00
Marvin Scholz 1c8e95bd99 fftools: Remove unused videotoolbox_init declaration
The code that defined videotoolbox_init was removed in
4b54818981

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-10-02 11:59:25 +02:00
Marvin Scholz d2cf6d1665 fftools: Remove unused qsv declarations
The code that uses these was removed in
ecee3b07cd

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-10-02 11:59:25 +02:00
Derek Buitenhuis f5cd00bf52 ffprobe: Check for invalid matrix error when printing rotation
av_display_rotation_get will return NAN when the display matrix is invalid,
which would end up printing NAN as an integer in the rotation field. This
is poor for multiple reasons:

* Users of ffprobe have no way of discerning "valid but ugly rotation from
  display matrix" from "invalid display matrix".
* It can have unintended consequences on some platforms, such as Linux x86_64,
  where NAN is equal to INT64_MIN, which, for example, when printed as JSON,
  which uses floating point for all numbers, can end up as invalid JSON or wit
  a number that cannot be reserialized as an integer at all.

Since NAN is av_display_rotation_get's error case, just print 0 (no rotation)
when that happens.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2022-09-27 17:37:21 +01:00
Zhao Zhili 686096739b fftools/ffmpeg_filter: configure min_hard_comp unconditionally
There are two issues here. Firstly, the floating-point comparison
is always true. Seconly, the code depends on the default value of
min_hard_comp implicitly, which can be dangerous.

Partially fixes ticket 9859.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-09-23 19:58:08 +08:00
Zhao Zhili af919cf780 fftools/ffmpeg: fix av_display_rotation_set() type cast
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-09-22 20:03:57 +08:00
Wang Yaqiang 3f0fac9303 fftools/ffplay: fix rotation incorrect when frame contains the displaymatrix
For example, if the jpeg contains exif information
and the rotation direction is included in the exif,
the displaymatrix will be set on the side_data of the frame when decoding.
However, when ffplay is used to play the image,
only the side data in the stream will be determined.
It does not check whether the frame also contains rotation information,
causing it to play in the wrong direction

Reviewed-by: Zhao Zhili <zhilizhao@tencent.com>
Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
2022-09-15 16:16:16 +08:00
James Almer 130483449e fftools/opt_common: check the return value of av_hwdevice_get_type_name before printing it
It may be NULL, as is the case for D3D11VA_VLD.

Running "ffmpeg -h decoder=h264" on a Windows build

Before:
Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:
    Supported hardware devices: dxva2 (null) d3d11va cuda

After:
Decoder h264 [H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:
    Supported hardware devices: dxva2 d3d11va cuda

Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-14 09:54:19 -03:00
Andreas Rheinhardt 5c16df1b92 fftools/ffprobe: Report initial and trailing padding
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-05 20:32:12 +02:00
Andreas Rheinhardt 90aa2a88f9 fftools/ffmpeg_opt: Check creation of new program
Fixes Coverity issue #1512413.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-01 14:26:01 +02:00
Andreas Rheinhardt 601faaed92 fftools: Use report_error_then_exit_program() for allocation failures
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-01 14:26:00 +02:00
Andreas Rheinhardt e157b21a90 fftools/cmdutils: Add function to report error before exit
This is designed to improve and unify error handling for
allocation failures for the many (often small) allocations that we have
in the fftools. These typically either don't return an error message
or an error message that is not really helpful to the user
and can be replaced by a generic error message without loss of
information.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-01 14:21:56 +02:00
Anton Khirnov 4fce3bab64 fftools/ffmpeg: use a separate counter for encoded packet data size
update_video_stats() currently uses OutputStream.data_size to print the
total size of the encoded stream so far and the average bitrate.
However, that field is updated in the muxer thread, right before the
packet is sent to the muxer. Not only is this racy, but the numbers may
not match even if muxing was in the main thread due to bitstream
filters, filesize limiting, etc.

Introduce a new counter, data_size_enc, for total size of the packets
received from the encoder and use that in update_video_stats(). Rename
data_size to data_size_mux to indicate its semantics more clearly.

No synchronization is needed for data_size_mux, because it is only read
in the main thread in print_final_stats(), which runs after the muxer
threads are terminated.
2022-08-29 15:42:11 +02:00
Anton Khirnov 0dd7347963 fftools/ffmpeg: drop OutputStream.fps_mode
It is only used within new_video_stream(), so make it a local variable
there.
2022-08-29 15:42:11 +02:00
Anton Khirnov d0f767f81f fftools/ffmpeg: drop OutputStream.enc
It is either equal to OutputStream.enc_ctx->codec, or NULL when enc_ctx
is NULL. Replace the use of enc with enc_ctx->codec, or the equivalent
enc_ctx->codec_* fields where more convenient.
2022-08-29 15:42:11 +02:00
Anton Khirnov 4a4a206304 fftools/ffmpeg_filter: remove an always-true check
ost->enc is always non-NULL here, since
- this code is never called for streamcopy
- opening the output file will fail if an encoder cannot be found, so
  filters are never initialized
2022-08-29 15:42:11 +02:00
Anton Khirnov c97bb940c2 fftools/ffmpeg_filter: remove an always-false check
This code cannot be triggered, since after 90944ee3ab opening the
output file will abort if an encoder cannot be found and streamcopy was
not explicitly requested.
2022-08-29 15:42:11 +02:00
Anton Khirnov 7c8737548f fftools/ffmpeg: remove a stale extern declaration
Forgotten in 8cbf229c94
2022-08-29 15:42:11 +02:00
Anton Khirnov 8d26a21bf6 fftools/ffmpeg: stop accessing av_stream_get_parser() from the main thread
It races with the demuxing thread. Instead, send the information along
with the demuxed packets.

Ideally, the code should stop using the stream-internal parsing
completely, but that requires considerably more effort.

Fixes races, e.g. in:
- fate-h264-brokensps-2580
- fate-h264-extradata-reload
- fate-iv8-demux
- fate-m4v-cfr
- fate-m4v
2022-08-29 15:42:11 +02:00
James Almer f5a663f2a9 fftools/ffmpeg_opt: try to propagate the requested output channel layout
Don't silently replace it with the default layout for the amount of channels
from the requested layout.

Should fix ticket #9869

Signed-off-by: James Almer <jamrial@gmail.com>
2022-08-23 13:03:56 -03:00
Anton Khirnov f23e3ce858 fftools/ffmpeg: call av_guess_frame_rate() when opening the file
It is currently called when configuring the filter, which races with the
demuxer thread.
2022-08-22 11:36:43 +02:00
Gyan Doshi d5544f6457 ffprobe: restore reporting error code for failed inputs
c11fb46731 led to a regression whereby the return code for missing
input or input probe is overridden by writer close return code and
hence not conveyed in the exit code.
2022-08-17 16:46:05 +05:30
Anton Khirnov ab31473830 fftools/ffmpeg: store a separate copy of input codec parameters
Use it instead of AVStream.codecpar in the main thread. While
AVStream.codecpar is documented to only be updated when the stream is
added or avformat_find_stream_info(), it is actually updated during
demuxing. Accessing it from a different thread then constitutes a race.

Ideally, some mechanism should eventually be provided for signalling
parameter updates to the user. Then the demuxing thread could pick up
the changes and propagate them to the decoder.
2022-08-16 11:09:09 +02:00
Timo Rothenpieler f85e0673c3 fftools: add DPI awareness manifest
Some filters, like gdigrab, rely on this to be set to see and report
proper dimensions.
2022-08-13 14:42:52 +02:00
Anton Khirnov 6ded80af92 fftools/ffmpeg: move packet timestamp processing to demuxer thread
Discontinuity detection/correction is left in the main thread, as it is
entangled with InputStream.next_dts and related variables, which may be
set by decoding code.

Fixes races e.g. in fate-ffmpeg-streamloop after
aae9de0cb2.
2022-08-13 12:41:05 +02:00
Anton Khirnov 3b2beceae1 fftools/ffmpeg: use a separate variable for discontinuity offset
This will allow to move normal offset handling to demuxer thread, since
discontinuities currently have to be processed in the main thread, as
the code uses some decoder-produced values.
2022-08-13 12:41:05 +02:00
Anton Khirnov ca38fe927e fftools/ffmpeg: simplify conditions in ts_discontinuity_process 2022-08-13 12:41:05 +02:00
Anton Khirnov aa6d4a53e3 fftools/ffmpeg: move inter-stream ts discontinuity handling to ts_discontinuity_process() 2022-08-13 12:41:05 +02:00
Anton Khirnov e2d784a5b7 fftools/ffmpeg: move timestamp discontinuity correction out of process_input() 2022-08-13 12:41:05 +02:00
Anton Khirnov 274c8d5882 fftools/ffmpeg: pre-compute the streamcopy start pts before transcoding starts
InputFile.ts_offset can change during transcoding, due to discontinuity
correction. This should not affect the streamcopy starting timestamp.

Cf. bf2590aed3
2022-08-13 12:41:05 +02:00
Anton Khirnov 86e9cef77b fftools/ffmpeg: move stream-dependent starttime correction to transcode_init()
Currently this code is located in the discontinuity handling block,
where it does not belong.
2022-08-13 12:41:05 +02:00
Anton Khirnov ee2092ddec fftools/ffmpeg_mux: avoid leaking pkt on errors 2022-08-13 12:41:05 +02:00
Anton Khirnov 5d499d3250 fftools/ffmpeg: mark all encode sync queues as done before flushing encoders 2022-08-13 12:41:05 +02:00
Anton Khirnov a5e025e826 fftools/ffmpeg: move handling corrupt packets to the input thread 2022-08-08 16:20:58 +02:00
Anton Khirnov 61d9f34c70 fftools/ffmpeg_demux: do not store demux packet in the context
Its use is local to input_thread().
2022-08-08 16:20:58 +02:00
Anton Khirnov de9fb9fba7 fftools/ffmpeg_demux: factorize signalling end of demuxing 2022-08-08 16:20:58 +02:00
Anton Khirnov aae9de0cb2 fftools/ffmpeg: move -stream_loop handling to the demuxer thread
-stream_loop is currently handled by destroying the demuxer thread,
seeking, then recreating it anew. This is very messy and conflicts with
the future goal of moving each major ffmpeg component into its own
thread.

Handle -stream_loop directly in the demuxer thread. Looping requires the
demuxer to know the duration of the file, which takes into account the
duration of the last decoded audio frame (if any). Use a thread message
queue to communicate this information from the main thread to the
demuxer thread.
2022-08-08 16:20:58 +02:00
Anton Khirnov b99462cd27 fftools/ffmpeg: move seek_to_start() to ffmpeg_demux.c
Reduces the diff in the following commit.
2022-08-08 16:20:58 +02:00
Anton Khirnov 57d75ca031 fftools/ffmpeg: move get_input_packet() to ffmpeg_demux.c
Also rename it to use the ifile_* namespace.
2022-08-08 16:20:58 +02:00
Anton Khirnov 07da07ddb0 fftools/ffmpeg: report new streams from the input thread
This avoids a potential race with the demuxer adding new streams. It is
also more efficient, since we no longer do inter-thread transfers of
packets that will be just discarded.
2022-08-08 16:20:58 +02:00
Anton Khirnov 9c16310fe5 fftools/ffmpeg: handle dumping input packets in input_thread()
This is a more appropriate place for this.
2022-08-08 16:20:58 +02:00
Anton Khirnov b1f24afe7e fftools/ffmpeg: drop the 'h' key handling
This undocumented feature runtime-enables dumping input packets. I can
think of no reasonable real-world use case that cannot also be
accomplished in a different way. Keeping this functionality would
interfere with the following commit moving it to the input thread (then
setting the variable would require locking or atomics, which would be
unnecessarily complicated for a feature that probably nobody uses).
2022-08-08 16:20:58 +02:00
Anton Khirnov 7b6622705e fftools/ffmpeg: move the input thread into its own file
It will contain more demuxing-specific code in the future.
2022-08-08 16:20:58 +02:00
Anton Khirnov c3b8d59d2f fftools/ffmpeg: drop a write-only variable 2022-08-08 16:20:58 +02:00
Anton Khirnov d8bf53710f fftools/ffmpeg: always read input in a thread
This will be required by the following architecture changes.
2022-08-08 16:20:58 +02:00
Anton Khirnov cc2b7f4625 fftools/ffmpeg: store the input file index in InputFile
Use it to simplify some code and fix two off-by-one errors.

Similar to what was previously done for OutputFile.
2022-08-08 16:20:58 +02:00
Anton Khirnov 9139ea4c8d fftools/ffmpeg: drop a superfluous stack variable 2022-08-08 16:20:58 +02:00
Anton Khirnov fee249b30a fftools/ffmpeg: deprecate specifying a sync stream with -map
It has not had any effect whatsoever for over 10 years.
2022-08-08 16:20:58 +02:00
Anton Khirnov 49123dd058 fftools/ffmpeg: remove OutputStream.sync_ist
It is not actually used for anything.
2022-08-08 16:20:58 +02:00
Anton Khirnov 8e092c3eac fftools/ffmpeg: remove OutputStream.encoding_needed
It is unnecessary, as it is always exactly equivalent to !!ost->enc_ctx
2022-08-08 16:20:58 +02:00
Anton Khirnov 80e7feb48b fftools/ffmpeg: remove OutputStream.stream_copy
There are currently three possible modes for an output stream:
1) The stream is produced by encoding output from some filtergraph. This
   is true when ost->enc_ctx != NULL, or equivalently when
   ost->encoding_needed != 0.
2) The stream is produced by copying some input stream's packets. This
   is true when ost->enc_ctx == NULL && ost->source_index >= 0.
3) The stream is produced by attaching some file directly. This is true
   when ost->enc_ctx == NULL && ost->source_index < 0.

OutputStream.stream_copy is currently used to identify case 2), and
sometimes to confusingly (or even incorrectly) identify case 1). Remove
it, replacing its usage with checking enc_ctx/source_index values.
2022-08-08 16:20:58 +02:00
Anton Khirnov 4f2b946c19 fftools/ffmpeg_opt: drop redundant decoder selection
A decoder is already selected above, in choose_decoder().
2022-08-08 16:20:58 +02:00
Anton Khirnov a1da77bd71 fftools/ffmpeg: stop accessing the decoder context unnecessarily
The same information is available from AVStream.codecpar. This will
allow to stop allocating a decoder unless decoding is actually
performed.
2022-08-08 16:20:58 +02:00
Anton Khirnov 04b340e6b8 fftools/ffmpeg_hw: stop logging to the decoder context
Only the decoder itself should do that. Use NULL as is done by all other
logging code in ffmpeg.
2022-08-08 16:20:58 +02:00
Anton Khirnov 20ba49c1a4 fftools/ffmpeg_opt: move adding metadata out of open_output_file() 2022-08-08 16:20:58 +02:00
Anton Khirnov 7cafea59bc fftools/ffmpeg_opt: move adding programs out of open_output_file() 2022-08-08 16:20:58 +02:00
Anton Khirnov aad68ab0e0 fftools/ffmpeg_opt: move adding attachments out of open_output_file() 2022-08-08 16:20:58 +02:00
Haihao Xiang ad67ea9eee ffmpeg_opt: consider HW acceleration method when selecting decoder
Usually a HW decoder is expected when user specifies a HW acceleration
method via -hwaccel option, however the current implementation doesn't
take HW acceleration method into account, it is possible to select a SW
decoder.

For example:
$ ffmpeg -hwaccel vaapi -i av1.mp4 -f null -
$ ffmpeg -hwaccel nvdec -i av1.mp4 -f null -
$ ffmpeg -hwaccel vdpau -i av1.mp4 -f null -
[...]
Stream #0:0 -> #0:0 (av1 (libdav1d) -> wrapped_avframe (native))

libdav1d is selected in this case even if vaapi, nvdec or vdpau is
specified.

After applying this patch, the native av1 decoder (with vaapi, nvdec or
vdpau support) is selected for decoding(libdav1d is still used for
probing format).
$ ffmpeg -hwaccel vaapi -i av1.mp4 -f null -
$ ffmpeg -hwaccel nvdec -i av1.mp4 -f null -
$ ffmpeg -hwaccel vdpau -i av1.mp4 -f null -
[...]
Stream #0:0 -> #0:0 (av1 (native) -> wrapped_avframe (native))

Tested-by: Mario Roy <marioeroy@gmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-08-03 11:10:57 +08:00
Haihao Xiang df5defe15a ffmpeg_opt: select a decoder after getting values for per-stream hwdec options
After applying this patch, the desired HW acceleration method is known
before selecting decoder, so we may take HW acceleration method into
account when selecting decoder for input stream in the next commit

There should be no functional changes in this patch

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2022-08-03 09:54:20 +08:00
Andreas Rheinhardt d9cd192ddd fftools/ffmpeg_opt: Fix copyinkf
Broken in 9c2b800203.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-08-02 09:02:11 +02:00
Anton Khirnov 6b12208646 fftools/ffmpeg_opt: reindent 2022-07-28 16:37:16 +02:00
Anton Khirnov ac3e461348 fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov 753195944a fftools/ffmpeg_opt: reindent 2022-07-28 16:37:16 +02:00
Anton Khirnov 85692aeecb fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov 6bd98d9ed8 fftools/ffmpeg_opt: reduce indentation in map_auto_subtitle()
Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
2022-07-28 16:37:16 +02:00
Anton Khirnov 6ab412ef9c fftools/ffmpeg_opt: factor auto-mapping subtitles out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov ff40d9e8ed fftools/ffmpeg_opt: reduce indentation in map_auto_audio()
Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
2022-07-28 16:37:16 +02:00
Anton Khirnov b898dc8934 fftools/ffmpeg_opt: factor auto-mapping audio out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov 74176f3cd6 fftools/ffmpeg_opt: reduce indentation in map_auto_video()
Fix indentation after the previous commit. Also use an early return to
save one extra indentation level.
2022-07-28 16:37:16 +02:00
Anton Khirnov 1a464efae3 fftools/ffmpeg_opt: factor auto-mapping video out of open_output_file() 2022-07-28 16:37:16 +02:00
Anton Khirnov ecfdab20e4 fftools/ffmpeg: do not log to the decoder context
That should only be done from inside the decoder. Log to NULL instead,
as is the current convention in ffmpeg.
2022-07-28 16:37:16 +02:00
Anton Khirnov d6cbc04229 fftools/ffmpeg_mux: move some functions closer to their only callers 2022-07-28 16:37:16 +02:00
Anton Khirnov df5ea28b3c fftools/ffmpeg_filter: drop a block commented out since 2012
Since the option it relates to is deprecated, it is highly unlikely to
become useful.
2022-07-28 16:37:16 +02:00
Anton Khirnov 98ece428e3 fftools/ffmpeg: deprecate the -map_channel option
It is now entirely redundant with audio filters, and is in fact
implemented by setting up a 'pan' filter instance.
2022-07-28 16:37:16 +02:00
Anton Khirnov 4f91782fcd fftools/ffmpeg: move guess_input_channel_layout() to ffmpeg_opt.c
That is the only place where it is used. Also make it static.
2022-07-28 16:37:16 +02:00
Anton Khirnov 6353b28042 fftools/ffmpeg: drop unused hwaccel variables 2022-07-28 16:37:16 +02:00
Anton Khirnov cb045f7f5a fftools/ffmpeg_opt: drop a redundant assignment
The codec type will be set by avcodec_alloc_context3(), there is no
reason to set it manually.
2022-07-28 16:37:16 +02:00
Anton Khirnov 8384d8403f fftools/ffmpeg: stop allocating an encoder context when not encoding 2022-07-28 16:37:16 +02:00
Anton Khirnov 1a378b8274 fftools/ffmpeg: deprecate -psnr
It is entirely redundant with -flags +psnr.
2022-07-28 16:37:16 +02:00
Anton Khirnov 1eae0ee02e fftools/ffmpeg: do not use the encoder context for streamcopy
The streamcopy initialization code briefly needs an AVCodecContext to
apply AVOptions to. Allocate a temporary codec context, do not use the
encoding one.
2022-07-28 16:37:16 +02:00
Anton Khirnov 61e42e04ed fftools/ffmpeg: drop OutputStream.ref_par
It serves no purpose, codec parameters can be written directly to
AVStream.codecpar with the same effect.
2022-07-28 16:37:16 +02:00
Anton Khirnov 8cbf229c94 fftools/ffmpeg: drop the -vol option
It has been deprecated in favor of the volume filter since 2012.
2022-07-28 16:37:16 +02:00
Anton Khirnov a04d83181a fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt()
It only uses strict_std_compliance, so pass just that value. Makes it
more clear what fields are accessed.
2022-07-28 16:37:16 +02:00
Anton Khirnov 7650d34367 fftools/ffmpeg_filter: remove unused function argument 2022-07-28 16:37:16 +02:00
Anton Khirnov 1cd60d3b35 fftools/ffmpeg: remove an unnecessary avcodec_close() call
No encoders can possibly be opened at this point. And even if some were,
they would be closed in ffmpeg_cleanup().
2022-07-28 16:37:16 +02:00
Anton Khirnov c2f2dd0296 fftools/ffmpeg: stop accessing the encoder context unnecessarily
The same information is available from AVStream.codecpar. This will
allow to stop allocating an encoder unless encoding is actually
performed.
2022-07-28 16:37:16 +02:00
Anton Khirnov 34cbda3ee1 fftools/ffmpeg: replace AVFrame.pkt_duration with duration
Mistakenly reintroduced in 4740fea7dd.
2022-07-24 08:46:16 +02:00
Andreas Rheinhardt b0ae5d02f3 fftools/ffmpeg: Zero subtitle packet padding
Fixes uninitialized reads in the sub-lrc-remux test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-23 19:01:44 +02:00
Andreas Rheinhardt 8136ab8e76 fftools/objpool: Don't use return with expression when returning void
Using tail calls with functions returning void is forbidden
(C99/C11 6.8.6.4: "A return statement with an expression shall not appear
in a function whose return type is void.") GCC emits a warning
because of this when using -pedantic: "ISO C forbids ‘return’ with
expression, in function returning void"

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-07-23 18:58:35 +02:00
Anton Khirnov 2d924b3a63 fftools/ffmpeg: move each muxer to a separate thread 2022-07-23 11:53:19 +02:00