Commit Graph

103156 Commits

Author SHA1 Message Date
Zane van Iperen 0c538ce30d
avformat/alp: don't set bits_per_raw_sample
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-07-19 10:47:24 +10:00
Zane van Iperen b28a3135af
avformat/argo_asf: don't set bits_per_raw_sample
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-07-19 10:47:24 +10:00
Zane van Iperen 9f502d8c8d
avformat/argo_cvg: don't set bits_per_raw_sample
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-07-19 10:47:18 +10:00
Andreas Rheinhardt 1c2d8ff92b avcodec/dsd_tablegen: Merge header into dsd.c
Since b492fbcc6e, the DSD tables are
always initialized at runtime, so merge the dsd_tablegen.h header
into dsd.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-19 00:21:42 +02:00
Andreas Rheinhardt b76f9bcfd0 avfilter/internal: Mark ff_filter_get_nb_threads() as av_pure
It does not modify anything; it only returns a value, so it fulfills
the requirements for av_pure.
The deeper rationale behind this change is that this function is called
quite often inside arguments to FFMIN which may lead to two calls to it;
declaring this function as av_pure allows the compiler to optimize the
second call away.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-18 22:33:34 +02:00
Andreas Rheinhardt f9136d6026 Avoid calling functions repeatedly via FFMIN
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-18 22:06:20 +02:00
Andreas Rheinhardt e1836b191b avcodec/libavcodec.v: Tighten export whitelist
Currently every symbol (with external linkage) that starts with "av" is
exported. Yet libaom-av1 has lots of functions that are not meant to be
exported and start with "av1_" (I counted 1236); and libvpx has
average_split_mvs. These functions are exported if one links these
libraries statically into a shared libavcodec.so.

Solve this by tightening the whitelist to "av_", "avcodec_", "avpriv_"
and (as a special-case) "avsubtitle_free".

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-18 21:50:52 +02:00
Andreas Rheinhardt 3ccfd27f1d fftools/ffmpeg: Fix declaration-after-statement warning
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-18 21:09:02 +02:00
Aman Karmani 504c60660d avutil/hwcontext_videotoolbox: implement hwupload to convert AVFrame to CVPixelBuffer
Teach AV_HWDEVICE_TYPE_VIDEOTOOLBOX to be able to create AVFrames of type
AV_PIX_FMT_VIDEOTOOLBOX. This can be used to hwupload a regular AVFrame
into its CVPixelBuffer equivalent.

    ffmpeg -init_hw_device videotoolbox -f lavfi -i color=black:640x480 -vf hwupload -c:v h264_videotoolbox -f null -y /dev/null

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-07-18 12:01:16 -07:00
Lynne 997f9bdb99
x86/tx_float: correctly load the transform length
The field is a standard field, yet we were loading it as if it was
a quadword. This worked for forward transforms by chance, but broke
when the transform was inverse.
checkasm couldn't catch that because we only test forward transforms,
which are identical to inverse transforms but with a different revtab.
2021-07-18 15:04:57 +02:00
Shiwang.Xie 694545b6d5 fftools/ffmpeg: fix -t inaccurate recording time
if input start time is not 0 -t is inaccurate doing stream copy,
will record extra duration according to input start time.
it should base on following cases:

input video start time from 60s, duration is 300s,
1. stream copy:
       ffmpeg -ss 40 -t 60 -i in.mp4 -c copy -y out.mp4
   open_input_file() will seek to 100 and set ts_offset to -100,
   process_input() will offset pkt->pts with ts_offset to make it 0,
   so when do_streamcopy() with -t, exits when ist->pts >= recording_time.

2. stream copy with -copyts:
       ffmpeg -ss 40 -t 60 -copyts -i in.mp4 -c copy -y out.mp4
   open_input_file() will seek to 100 and set ts_offset to 0,
   process_input() will keep raw pkt->pts as ts_offset is 0,
   so when do_streamcopy() with -t, exits when
   ist->pts >= (recording_time+f->start_time+f->ctx->start_time).

3. stream copy with -copyts -start_at_zero:
       ffmpeg -ss 40 -t 60 -copyts -start_at_zero -i in.mp4 -c copy -y out.mp4
   open_input_file() will seek to 120 and set ts_offset to -60 as start_to_zero option,
   process_input() will offset pkt->pts with input file start time,
   so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time).

0      60     40      60                     360
|_______|_____|_______|_______________________|
      start   -ss     -t

This fixes ticket #9141.

Signed-off-by: Shiwang.Xie <shiwang.xie666@outlook.com>
2021-07-18 09:59:02 +05:30
Andreas Rheinhardt ea5bdc8893 avformat/subtitles: Deduplicate subtitles' read_(packet|seek|close)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-18 04:26:35 +02:00
James Almer ef1302db2d avformat/utils: remove AVStreamInternal.orig_codec_id
It's a write only field.

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-17 19:41:45 -03:00
Paul B Mahol 305be41374 avfilter/vf_v360: avoid doubles in fov_from_dfov() 2021-07-17 23:27:51 +02:00
Gyan Doshi c320b78e95 ffmpeg: add option readrate
Allows to read inputs at arbitrary rates.
-re is equivalent to -readrate 1

Tested with -copyts {+ start_at_zero}, -ss, streamcopied & decoded streams.
2021-07-17 20:34:21 +05:30
Paul B Mahol 075157ec86 avfilter/vf_chromanr: add also euclidean distance for calculations 2021-07-17 15:18:30 +02:00
Daniel Playfair Cal 7f6d20931b avfilter/vf_v360: fix visibility test for fisheye projection
Previously the visibility test referred to a circle in the input. This
changes it so that it refers accurately to the entire area in the input.
2021-07-17 11:28:56 +02:00
Michael Niedermayer 748c3fa52a tools/target_dec_fuzzer: Fuzz FF_DEBUG_*
This should increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Michael Niedermayer 9fa30cf855 tools/target_dec_fuzzer: Fuzz AV_CODEC_FLAG2_EXPORT_MVS
This should increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Michael Niedermayer a0fd56f55e tools/target_dec_fuzzer: Set extradata for the parser
This should improve coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Michael Niedermayer 9c8df64a70 tools/target_dec_fuzzer: Fuzz skip_frame
Should allow coverage of related code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Michael Niedermayer c52c99a18f avformat/mov: do not ignore errors in mov_metadata_hmmt()
Fixes: Timeout
Fixes: 35637/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6311060272447488

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Michael Niedermayer 65b862ab59 avformat/mxfdec: Check size for shrinking
av_shrink_packet() takes int size, so size must fit in int
Fixes: out of array access
Fixes: 35607/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4875541323841536

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Michael Niedermayer adae546f24 avcodec/exr: Check uncompressed_size against max_pixels
Fixes: Timeout
Fixes: 35286/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6557139802914816
Fixes: 31253/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-4901782326214656

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-07-17 10:48:27 +02:00
Thilo Borgmann cf12a478b2 fftools/cmdutils.c: Add cmd line option to override detection of cpu count. 2021-07-16 10:06:23 +02:00
Thilo Borgmann 87951dcbe7 lavu/cpu.c: Add av_force_cpu_count() to override auto-detection. 2021-07-16 10:06:10 +02:00
Keyun Tong b7266302a4 fftools/ffmpeg: Add new variant source_no_drop to the force_key_frames option
Suggested-By: ffmpeg@fb.com
2021-07-16 09:50:19 +02:00
Kacper Michajłow b7e350af3e avfilter/[vf_nnedi, vf_estdif]: check interlaced flag on correct frame
Fixes regression in vf_nnedi after
24dc6d386c and vf_estdif while at it.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2021-07-16 09:22:36 +02:00
Paul B Mahol 03a8d9c7fd avfilter/vf_nnedi: fix time base for large denominators 2021-07-16 09:10:08 +02:00
Paul B Mahol ca94d52f2e avfilter/vf_estdif: fix time base for large denominators 2021-07-16 09:10:03 +02:00
Paul B Mahol c4e51af5e7 avfilter/vf_w3fdif: fix time base for large denominators 2021-07-16 09:09:58 +02:00
James Almer 022e50c002 ffprobe: use quotation marks in the xml header output
xmllint (silently) replaces the ' with " when fixing and validating the output
of ffprobe in fate-ffprobe_xsd.

Reviewed-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-15 23:46:40 -03:00
James Almer cdbf2fc3e4 configure: use the correct header for the fallback libxext check
Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-15 16:53:56 -03:00
James Almer 395d9ad00a configure: clean up and fix xlib checks
Split them into separate checks per library.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-15 15:44:46 -03:00
Martin Storsjö 13ec6624b3 mov: Don't export unknown/unhandled metadata types as if they were UTF8
They can be other incompatible text encodings (such as UTF-16),
or even binary data.

Signed-off-by: Martin Storsjö <martin@martin.st>
2021-07-15 10:25:39 +03:00
Martin Storsjö a99dd5f6a4 mov: Pick up "com.apple.quicktime.artwork" as cover art
Signed-off-by: Martin Storsjö <martin@martin.st>
2021-07-15 10:25:35 +03:00
Timo Rothenpieler 7ec7e6aa2d configure: use pkg-config for xlib/Xv 2021-07-14 23:58:24 +02:00
James Almer 1349de10b2 avcodec/libdav1d: parse sequence headers in extradata if available
This allows the decoder context to be initialized with all stream parameters
before a packet is parsed.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-07-14 13:11:51 -03:00
Kevin LaFlamme 3f5d5c1c2d Fix double write of DASH manifest in streaming mode
When streaming mode is enabled, the DASH manifest is written on the
first packet for the segment so that the segment can be advertised
immediately to clients. It was also still writing the manifest at the
end of the segment leading to two duplicate writes.
2021-07-14 19:54:14 +05:30
Tobias Rapp ca56299fb3 avfilter/af_astats: Only print header lines when values are to be printed
Avoids empty "Channel" or "Overall" header lines added to log output
when measurement is restricted to one scope using
"measure_perchannel=none" or "measure_overall=none".

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2021-07-14 10:31:33 +02:00
Tobias Rapp f531a1a4e8 fate/ffprobe: Verify ffprobe XML output against schema file
Adds schema validation for ffprobe XML output so that updating the
ffprobe.xsd file upon changes to ffprobe is not forgotten. This was
suggested by Marton Balint in:
http://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/278428.html

The schema FATE test is only run if xmllint command is available.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2021-07-13 08:57:23 +02:00
Hayden Myers 9b4b0df470 libavformat/rtsp.c: Reply to GET_PARAMETER requests
Some encoders send GET_PARAMETER requests as a keep-alive mechanism.
If the client doesn't reply with an OK message, the encoder will close
the session.  This was encountered with the impath i5110 encoder, when
the RTSP Keep-Alive checkbox is enabled under streaming settings.
Alternatively one may set the X-No-Keepalive: 1 header, but this is more
of a workaround.  It's better practice to respond to an encoder's
keep-alive request, than disable the mechanism which may be manufacturer
specific.

Signed-off-by: Hayden Myers <hmyers@skylinenet.net>
Signed-off-by: Martin Storsjö <martin@martin.st>
2021-07-12 16:00:48 +03:00
Anton Khirnov a948e47960 lavfi/vf_scale: forward errors from swscale 2021-07-12 12:49:25 +02:00
Anton Khirnov 6d51d65fb9 lavfi/vf_scale: pass only the private context to scale_slice()
Not the input link. The function does nothing with the link except
extract the private context from it.
2021-07-12 12:49:07 +02:00
Jan Ekström f32f56468c {configure,avcodec/libx264}: remove separate x264_csp_bgr check
We already require X264_BUILD >= 118, which includes an unconditional
definition of X264_CSP_BGR in itself, thus making this check
effectively always true.
2021-07-12 12:07:10 +03:00
Jan Ekström 25d28f297b configure: move x264_csp_bgr check under general libx264 checks
This makes the libx264rgb check work when pkg-config is utilized
and x264.h is not part of the standard include path (as is often
with cross-compilation, or when you just have a custom prefix in
general in f.ex. your home directory).

The X264_BUILD >= 118 required by configure since 2011 should have
X264_CSP_BGR defined unconditionally (it was added a few X264_BUILD
updates earlier), but as 134cba728b
added this additional check, I have kept it for now.
2021-07-12 12:07:10 +03:00
Guangyu Sun b53738bf90 fate/oggvorbis: Fix tests after fixing AV_PKT_DATA_SKIP_SAMPLES
After fixing AV_PKT_DATA_SKIP_SAMPLES for reading vorbis packets from ogg,
the actual decoded samples become fewer. Three fate tests are failing:

fate-vorbis-20:
The samples in 6.ogg are not frame aligned. 6.pcm file was generated by
ffmpeg before the fix. After the fix, the decoded pcm file does not match
anymore. Ideally the ref file 6.pcm should be updated but it is probably
not worth it including another copy of the same file, only smaller.
SIZE_TOLERANCE is added for this test case.

fate-webm-dash-chapters:
The original vorbis_chapter_extension_demo.ogg is transmuxed to dash-webm.
The ref file webm-dash-chapters needs to be updated.

fate-vorbis-encode:
This exposes another bug in the vorbis encoder that initial_padding is not
correctly set. It is fixed in the previous patch.

Signed-off-by: Guangyu Sun <gsun@roblox.com>
2021-07-12 09:55:21 +02:00
Guangyu Sun 24b3178efd libavcodec/vorbisenc: Add missing initial_padding
Vorbis has priming samples at the beginning. If the initial_padding is not
set in the encoder, the total sample count will be one frame fewer than it
should be. The result is that we get a truncated version of encoding.

initial_padding should be set to the frame_size used in
vorbis_encode_frame().

Signed-off-by: Guangyu Sun <gsun@roblox.com>
2021-07-12 09:54:52 +02:00
Guangyu Sun 75510d7015 avformat/oggparsevorbis: Update end_trimming for the last packet
Without end_trimming, the last packet will contain unexpected samples used
for padding.

This commit partially fixes #6367 when the audio length is long enough.

dd if=/dev/zero of=./silence.raw count=20 bs=500
oggenc --raw silence.raw --output=silence.ogg
oggdec --raw --output silence.oggdec.raw silence.ogg
ffmpeg -codec:a libvorbis -i silence.ogg -f s16le -codec:a pcm_s16le silence.libvorbis.ffmpeg.raw
ffmpeg -i silence.ogg -f s16le -codec:a pcm_s16le silence.native.ffmpeg.raw
ls -l *.raw

The original test case in #6367 is still not fixed due to a remaining issue.

The remaining issue is that ogg_stream->private is not kept during
ogg_save()/ogg_restore(). Field final_duration in the private data is
important to calculate end_trimming.

Some common operations such as avformat_open_input() and
avformat_find_stream_info() before reading packet will trigger ogg_save()
and ogg_restore().

Luckily, final_duration will not get updated until the last ogg page. The
save/restore mentioned above will not change final_duration most of the
time. But if the audio length is short, those reads may be performed on
the last ogg page, causing trouble keeping the correct value of
final_duration. We probably need a more complicated patch to address this
issue.

Signed-off-by: Guangyu Sun <gsun@roblox.com>
2021-07-12 09:54:47 +02:00
Roman Beranek ed240db9e3 cafenc: fill in avg. packet size later if unknown
Frame size of Opus stream was previously presumed here to be 960 samples
(20ms), however sizes of 120, 240, 480, 1920, and 2880 are also allowed.
It can also alter on a per-packet basis and even multiple frames may be
present in a single packet according to the specification, for the sake
of simplicity however, let us assume that this doesn't occur.

Because the mFramesPerPacket field, representing the number of samples
per packet in the ffmpeg terminilogy, is the key factor in calculating
packet durations and all that follows from that (index, bitrate, ...),
it is crucial to get right.

Therefore, if the packet size is not available ahead of time (as it is in
the case of Opus), calculate an average from the stream duration once we
know how many packets there are and update the filed in the header.
2021-07-12 09:54:25 +02:00