Commit Graph

99805 Commits

Author SHA1 Message Date
Andreas Rheinhardt 11ea0ed20e avformat/jacosubdec: Fix unintended fallthrough
Regression since 715ff75e5d.

Fixes Coverity issues #1468654 and #1468656.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-30 14:06:19 +01:00
Timo Rothenpieler bb6edf618a avcodec/nvenc: all presets are SDK10 presets now 2020-10-29 21:59:37 +01:00
Michael Niedermayer ec7e0d4288 avcodec/utils: Check sample rate before use for AV_CODEC_ID_BINKAUDIO_DCT in get_audio_frame_duration()
Fixes: shift exponent 95 is too large for 32-bit type 'int'
Fixes: 26590/clusterfuzz-testcase-minimized-ffmpeg_dem_SMACKER_fuzzer-5120609937522688

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-29 20:42:48 +01:00
Jan Ekström fbb44bc51a ffmpeg: move field order decision making to encoder initialization
We now have the possibility of getting AVFrames here, and we should
not touch the muxer's codecpar after writing the header.

Results of FATE tests change as the MXF and Matroska muxers actually
write down the field/frame coding type of a stream in their
respective headers. Before this change, these values in codecpar
would only be set after the muxer was initialized. Now, the
information is also available for encoder and muxer initialization.
2020-10-29 16:59:49 +02:00
Jan Ekström 7369595c55 ffmpeg: pass decoded or filtered AVFrame to output stream initialization
Additionally, reap the first rewards by being able to set the
color related encoding values based on the passed AVFrame.

The only tests that seem to have changed their results with this
change seem to be the MXF tests. There, the muxer writes the
limited/full range flag to the output container if the encoder
is not set to "unspecified".
2020-10-29 16:59:49 +02:00
Jan Ekström 67be1ce0c6 ffmpeg: move A/V non-streamcopy initialization to a later point
- For video, this means a single initialization point in do_video_out.
- For audio we unfortunately need to do it in two places just
  before the buffer sink is utilized (if av_buffersink_get_samples
  would still work according to its specification after a call to
  avfilter_graph_request_oldest was made, we could at least remove
  the one in transcode_step).

Other adjustments to make things work:
- As the AVFrame PTS adjustment to encoder time base needs the encoder
  to be initialized, so it is now moved to do_{video,audio}_out,
  right after the encoder has been initialized. Due to this,
  the additional parameter in do_video_out is removed as it is no
  longer necessary.
2020-10-29 16:59:49 +02:00
Jan Ekström 3360c9a567 ffmpeg: move AVFrame time base adjustment into a function
This will have to be called later for video down the line.
2020-10-29 16:59:48 +02:00
Jan Ekström 453b2f3c15 ffmpeg: add a data size threshold for muxing queue size
This way the old max queue size limit based behavior for streams
where each individual packet is large is kept, while for smaller
streams more packets can be buffered (current default is at 50
megabytes per stream).

For some explanation, by default ffmpeg copies packets from before
the appointed seek point/start time and puts them into the local
muxing queue. Before, it getting utilized was much less likely
since as soon as the filter chain was initialized, the encoder
(and thus output stream) was also initialized.

Now, since we will be pushing the encoder initialization to when the
first AVFrame is decoded and filtered - which only happens after
the exact seek point is hit as packets are ignored until then -
this queue will be seeing much more usage.

In more layman's terms, this attempts to fix cases such as where:
- seek point ends up being 5 seconds before requested time.
- audio is set to copy, and thus immediately begins filling the
  muxing queue.
- video is being encoded, and thus all received packets are skipped
  until the requested time is hit.
2020-10-29 16:59:48 +02:00
Andreas Rheinhardt 9b45c6d74b avcodec/vp3: Don't check for errors for complete VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-29 11:22:35 +01:00
Andreas Rheinhardt c72a29df6b avcodec/cllc: Don't unnecessarily free VLC
The Canopus Lossless decoder uses several VLCs and if initializing the
ith VLC fails, all the VLCs 0..i have been freed; the ith VLC's table is
initialized to NULL for this purpose. Yet it is totally unnecessary to
free the ith VLC table at all: ff_init_vlc_sparse() cleans up after
itself on error and if an error happens before ff_init_vlc_sparse(),
the ith VLC hasn't been touched yet and doesn't need freeing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-29 11:22:35 +01:00
Andreas Rheinhardt 1d658e65ab avcodec/clearvideo: Don't check for errors for complete VLC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-29 11:22:35 +01:00
ruiquan.crq ae9a1a9698 lavf/url: fix relative url parsing when the query string or fragment has a colon
This disallows the usage of ? and # in libavformat specific scheme options
(e.g. subfile,,start,32815239,end,0,,:video.ts) but this change was considered
acceptable.

Signed-off-by: ruiquan.crq <caihaoning83@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-10-28 21:34:09 +01:00
James Almer 37d742b607 avcodec/codec2utils: move the remaining avpriv functions to lavf
They are only used by the codec2 demuxers.

The symbols are kept around until the next major bump.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:59:35 -03:00
James Almer 7f76974e7d libavcodec/codec2utils: remove codec2_version_from_extradata()
It's only used in the codec2 demuxers, and can be simplified with an AV_RB16()
call instead.

Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:59:16 -03:00
James Almer 3916af4d95 avcodec/codec2utils: remove avpriv prefix from inline functions
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:55:53 -03:00
James Almer fec1b4738f avcodec/av1dec: fix loading PrevGmParams for frames with primary_ref_frame none
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
James Almer 7dac8ddb20 avcodec/av1dec: don't derive loop filter delta parameters
This is now handled by CBS.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
James Almer 5ed9f8c66c avcodec/cbs_av1: infer segmentation parameters from reference frames
Partially implements setup_past_independence() and load_previous().
These ensures they are always set, even if the values were not coded
in the input bitstream and will not be coded in the output bitstream.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
James Almer 5d1238f77f avcodec/cbs_av1: infer loop filter delta parameters from reference frames
Partially implements setup_past_independence() and load_previous().
These ensures they are always set, even if the values were not coded
in the input bitstream and will not be coded in the output bitstream.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-28 11:26:25 -03:00
Anton Khirnov 744b7f2e91 lavf: move AVStream.last_in_packet_buffer to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 15:01:40 +01:00
Anton Khirnov 30f5180ca6 lavf: move AVStream.probe_data to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 15:01:22 +01:00
Anton Khirnov 91a98cc4ea lavf: move AVStream.pts_buffer to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 15:00:40 +01:00
Anton Khirnov cea7c19cda lavf: move AVStream.*index_entries* to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header. Since there are some (semi-)public fields located after these,
even though this section is supposed to be private, keep some dummy
padding there until the next major bump to preserve ABI compatibility.
2020-10-28 14:59:28 +01:00
Anton Khirnov 7e87288f73 lavf: move AVStream.interleaver_chunk_* to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:58:28 +01:00
Anton Khirnov 108864acee lavf: move AVStream.{request_probe,skip_to_keyframe} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:57:01 +01:00
Anton Khirnov 456b170bd7 lavf: move AVStream.{*skip_samples.*_discard_sample} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:56:20 +01:00
Anton Khirnov cb46a6bcbc lavf: move AVStream.{nb_decoded_frames,mux_ts_offset} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:55:53 +01:00
Anton Khirnov 323c9a8c52 lavf: move AVStream.{pts_wrap_*,update_initial_durations_done} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:54:51 +01:00
Anton Khirnov 36d7c1dee8 lavf: move AVStream.pts_reorder_error[_count] to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:54:35 +01:00
Anton Khirnov 25bade3258 lavf: move AVStream.{last_dts_for_order_check,dts_[mis]ordered} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:54:22 +01:00
Anton Khirnov c1b916580a lavf: move AVStream.{inject_global_side_data,display_aspect_ratio} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.
2020-10-28 14:53:45 +01:00
Anton Khirnov 8741f1fe26 lavf: move AVStream.info to AVStreamInternal
This struct is for internal use of avformat_find_stream_info(), so it
should not be exposed in public headers. Keep a stub pointer in its
place to avoid changing AVStream layout, since e.g. ffmpeg.c accesses
some fields located after it (even though they are marked as private).
2020-10-28 14:52:06 +01:00
Anton Khirnov 87f0c8280c ffmpeg.c: stop accessing private AVStream.codec_info_nb_frames
Use AVSTREAM_EVENT_FLAG_NEW_PACKETS instead, which should provide the
same information in this case.
2020-10-28 13:58:32 +01:00
Anton Khirnov f95d9510ff avformat: add a stream event flag for new packets 2020-10-28 13:58:29 +01:00
Anton Khirnov 201b1246e2 ffmpeg.c: rename 'area' to 'score'
Other factors besides area are used to pick the best video stream, so
the name 'area' is misleading.
2020-10-28 13:57:38 +01:00
Anton Khirnov 48f3ed96e9 avformat: extend documentation of event_flags
Document how it is to be used for muxing (currently supported by
flvenc).
2020-10-28 13:57:38 +01:00
Anton Khirnov c515a35dde avformat: fix typo in doxy
av_read_frame() reads new packets, av_read_packet() does not exist.
2020-10-28 13:57:38 +01:00
Anton Khirnov 0438521888 lavc: un-avpriv avpriv_bprint_to_extradata()
It has not been used outside of lavc since 6f69f7a8bf.

Also, move it to the only place where it is used.
2020-10-28 13:53:23 +01:00
Anton Khirnov dc1099442e put_bits: make avpriv_copy_bits() lavc-local
It is not used outside of lavc anymore. Keep the avpriv exported symbol
around until the next bump to preserve ABI compatibility.
2020-10-28 13:53:23 +01:00
Anton Khirnov 944ba30db0 put_bits: make avpriv_put_string() lavc-local
It has not been used outside of libavcodec since
20f325f320
2020-10-28 13:53:23 +01:00
Anton Khirnov 717503f716 put_bits: make avpriv_align_put_bits() inline
This function is so extremely simple that it is preferable to make it
inline rather than deal with all the complications arising from it being
an exported symbol.

Keep avpriv_align_put_bits() around until the next major bump to
preserve ABI compatibility.
2020-10-28 13:53:23 +01:00
Anton Khirnov 886c601a70 lavf/latmenc: use a local simplified copy of avpriv_copy_bits()
This is the only place in lavf where avpriv_copy_bits() is used, so this
allows us to make avpriv_copy_bits() lavc-local.
2020-10-28 13:53:23 +01:00
Anton Khirnov 2068ad5914 lavf/latmenc: fix units mismatch
avpriv_copy_bits() takes the size in bits, not bytes. According to
a736eb4a60, nobody is quite sure whether
this code produces working files.
2020-10-28 13:53:23 +01:00
Yigit Uyan c1efb1decb rtsp: increase the control uri size
Current browsers support up to 2k characters.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-10-28 13:53:20 +01:00
Andreas Rheinhardt 81d4b8fb3c avcodec/bitstream: Stop allocating one VLCcode more than needed
Allocating one temporary entry more than needed was made necessary by
the COPY loop below writing an element before having checked that it
should be written at all. But given that this behaviour changed, the
need for overallocating is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-28 11:28:24 +01:00
Andreas Rheinhardt e75b6ec43b avcodec/bitstream: Check code length before truncating to uint8_t
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-28 11:23:33 +01:00
Xu Guangxin e5be4c5a88 avcodec/hevcdec: constrained intra predict, do not check top left IS_INTRA if it's not available
fix ticket: 8932

For poc 2, we have tile boundary at x = 640.
When we predict cu(640,912),the top left pixel is not avaliable to the cu.
So, we can not check it's intra or not. We need set top[-1] = top[0] directly.
see 8.4.4.2.1 for details

Signed-off-by: Xu Guangxin <oddstone@gmail.com>
Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2020-10-28 11:29:09 +08:00
Paul B Mahol c7ece8e26f avfilter/vf_normalize: fix regression with white/black point calculation 2020-10-27 19:45:51 +01:00
Andreas Rheinhardt 8b1bb4f38e avcodec/webp: Replace never-true check by assert
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 11:51:01 +01:00
Andreas Rheinhardt 548f1a3fa4 avcodec/webp: Return directly when creating Huff table fails
Neither the auxiliary VLC table nor the code_lengths array need to be
freed if creating the auxiliary VLC table fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-27 11:51:01 +01:00