]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agolavc: replace AVCodecInternal.allocate_progress with an internal cap
Anton Khirnov [Mon, 9 Jan 2017 17:01:02 +0000 (18:01 +0100)]
lavc: replace AVCodecInternal.allocate_progress with an internal cap

This is a constant codec property, so a capability flag is more appropriate.

4 years agompeg4videodec: do not copy a range of fields at once
Anton Khirnov [Wed, 11 Mar 2020 17:08:28 +0000 (18:08 +0100)]
mpeg4videodec: do not copy a range of fields at once

This is extremely fragile against reordering and hides what is actually
being copied. Copy all the fields manually instead.

4 years agoavcodec.h: split AVCodecDescriptor API into its own header
Anton Khirnov [Tue, 7 Apr 2020 14:41:48 +0000 (16:41 +0200)]
avcodec.h: split AVCodecDescriptor API into its own header

4 years agoavcodec.h: split codec IDs into their own header
Anton Khirnov [Tue, 7 Apr 2020 14:41:48 +0000 (16:41 +0200)]
avcodec.h: split codec IDs into their own header

4 years agoavcodec.h: split AVPacket API into its own header
Anton Khirnov [Tue, 7 Apr 2020 14:41:48 +0000 (16:41 +0200)]
avcodec.h: split AVPacket API into its own header

4 years agowavpack: fully support stream parameter changes
Anton Khirnov [Sun, 5 Apr 2020 20:01:40 +0000 (22:01 +0200)]
wavpack: fully support stream parameter changes

Fix invalid memory access on DSD streams with changing channel count.

4 years agodecode: make sure ff_get_buffer() cleans the frame on failure
Anton Khirnov [Sun, 5 Apr 2020 08:48:33 +0000 (10:48 +0200)]
decode: make sure ff_get_buffer() cleans the frame on failure

Merge ff_get_buffer() and get_buffer_internal() to simplify the code.

4 years agopthread_frame: make sure ff_thread_release_buffer always cleans the frame
Anton Khirnov [Sun, 5 Apr 2020 08:41:35 +0000 (10:41 +0200)]
pthread_frame: make sure ff_thread_release_buffer always cleans the frame

4 years agolavc/libopenh264enc: fix the if-else coding style
Linjie Fu [Mon, 6 Apr 2020 11:14:45 +0000 (19:14 +0800)]
lavc/libopenh264enc: fix the if-else coding style

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
4 years agoavcodec/zerocodec: use init cleanup internal cap
Paul B Mahol [Thu, 9 Apr 2020 08:48:35 +0000 (10:48 +0200)]
avcodec/zerocodec: use init cleanup internal cap

4 years agoavcodec/zerocodec: implement flushing
Paul B Mahol [Thu, 9 Apr 2020 08:45:55 +0000 (10:45 +0200)]
avcodec/zerocodec: implement flushing

4 years agoavcodec: add MV30 decoder
Paul B Mahol [Tue, 18 Feb 2020 18:33:33 +0000 (19:33 +0100)]
avcodec: add MV30 decoder

4 years agoavformat/hlsenc: return media_url directly if failed to get seperator
Limin Wang [Thu, 9 Apr 2020 01:50:46 +0000 (09:50 +0800)]
avformat/hlsenc: return media_url directly if failed to get seperator

Fix ticket: 8606
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/matroskaenc: Remove unnecessary headers
Andreas Rheinhardt [Thu, 9 Apr 2020 22:25:14 +0000 (00:25 +0200)]
avformat/matroskaenc: Remove unnecessary headers

subtitles.h has been included in order to use ff_subtitles_next_line()
to help parsing srt subtitles which at that time had their timing as
part of the payload and not as part of the AVPacket fields. When this
changed (in 55180b32) it has been forgotten to remove this header.

libavcodec/internal.h meanwhile has been added in bb47aa5850c and has
never been used at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/jpeg2000dec: Fix mixed declaration and code
Andreas Rheinhardt [Thu, 9 Apr 2020 12:37:37 +0000 (14:37 +0200)]
avcodec/jpeg2000dec: Fix mixed declaration and code

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/mpeg: Don't use unintialized value
Andreas Rheinhardt [Tue, 22 Oct 2019 12:54:09 +0000 (14:54 +0200)]
avformat/mpeg: Don't use unintialized value

vobsub_read_packet() didn't check whether an array of AVPackets was
valid and therefore used uninitialized values.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/ebur128: prefer to use variable instead of type for sizeof
Limin Wang [Thu, 9 Apr 2020 11:07:20 +0000 (19:07 +0800)]
avfilter/ebur128: prefer to use variable instead of type for sizeof

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec/jpeg2000dec.c: Add support for PPT marker
Gautam Ramakrishnan [Tue, 7 Apr 2020 16:57:13 +0000 (22:27 +0530)]
libavcodec/jpeg2000dec.c: Add support for PPT marker

This patch adds functional changes to support the
PPT marker. This patch fixes bug ticket #4610.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/v4l2_context: Use av_freep()
Andriy Gelman [Sun, 5 Apr 2020 05:36:13 +0000 (01:36 -0400)]
avcodec/v4l2_context: Use av_freep()

Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
4 years agoavfilter/vf_drawtext: only test available exceptions
Rosen Penev [Tue, 7 Apr 2020 00:38:59 +0000 (17:38 -0700)]
avfilter/vf_drawtext: only test available exceptions

soft float systems do not define these macros under musl.

Fixes: Ticket7102
Signed-off-by: Rosen Penev <rosenp@gmail.com>
4 years agoavformat/segment: always use interleaved writes for formats with custom interleaving
Marton Balint [Tue, 31 Mar 2020 23:03:29 +0000 (01:03 +0200)]
avformat/segment: always use interleaved writes for formats with custom interleaving

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/hlsenc: use av_asprintf()
Limin Wang [Thu, 26 Mar 2020 13:57:00 +0000 (21:57 +0800)]
avformat/hlsenc: use av_asprintf()

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/hlsenc: Factor out deleting files from deleting segments
Andreas Rheinhardt [Wed, 8 Apr 2020 13:23:03 +0000 (15:23 +0200)]
avformat/hlsenc: Factor out deleting files from deleting segments

Removes code duplication.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat: add subtitle support in master playlist m3u8
Limin Wang [Sun, 29 Mar 2020 11:13:44 +0000 (19:13 +0800)]
avformat: add subtitle support in master playlist m3u8

Test with the following command for the webvtt subtitle:
$ ./ffmpeg -y -i input_with_subtitle.mkv \
 -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
 -b:a:0 256k \
 -c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0 -map 0:s:0 \
 -f hls -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \
 -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \
 10 -master_pl_publish_rate 10  -hls_flags \
 delete_segments+discont_start+split_by_time ./tmp/video.m3u8

Check the master m3u8:
$ cat tmp/master.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subtitle",NAME="subtitle_0",DEFAULT=YES,URI="video_vtt.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33",SUBTITLES="subtitle"
video.m3u8

Check the result by convert to mkv:
$ ./ffmpeg -strict experimental -i ./tmp/master.m3u8 -c:v copy -c:a mp2 -c:s srt ./test.mkv

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/hlsplaylist: simplify code for checking whether the string is empty
Limin Wang [Thu, 26 Mar 2020 13:56:58 +0000 (21:56 +0800)]
avformat/hlsplaylist: simplify code for checking whether the string is empty

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/hlsenc: remove the first slash of the relative path line in the master m3u8...
Limin Wang [Thu, 26 Mar 2020 13:56:57 +0000 (21:56 +0800)]
avformat/hlsenc: remove the first slash of the relative path line in the master m3u8 file

Please testing with the following command:
./ffmpeg -y -i input.mkv \
 -b:v:0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
 -b:a:0 256k \
 -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0:a:0\
 -f hls -var_stream_map "v:0,a:0" \
 -master_pl_name master.m3u8 -t 300 -hls_time 10 -hls_init_time 4 -hls_list_size \
 10 -master_pl_publish_rate 10  -hls_flags \
 delete_segments+discont_start+split_by_time ./tmp/video.m3u8

then cat ./tmp/master.m3u8
before:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33"
/video.m3u8

$ ./ffmpeg -i  ./tmp/master.m3u8 -c:v copy -c:a mp2 ./test.mkv
[hls @ 0x7f82f9000000] Skip ('#EXT-X-VERSION:3')
[hls @ 0x7f82f9000000] Opening '/video.m3u8' for reading
[hls @ 0x7f82f9000000] parse_playlist error No such file or directory [/video.m3u8]
./tmp/master.m3u8: No such file or directory

after:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=6056600,RESOLUTION=1280x720,CODECS="avc1.4d4829,mp4a.40.33"
video.m3u8

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
4 years agoavformat/hlsenc: Use AVBPrint to avoid allocations of strings
Andreas Rheinhardt [Wed, 8 Apr 2020 11:14:17 +0000 (13:14 +0200)]
avformat/hlsenc: Use AVBPrint to avoid allocations of strings

when deleting old segments.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hlsenc: Fix memleak when deleting old segments
Andreas Rheinhardt [Wed, 8 Apr 2020 10:19:39 +0000 (12:19 +0200)]
avformat/hlsenc: Fix memleak when deleting old segments

if the directory name of the segments contains "%v".

This memleak is caused by masking the pointer that will eventually
be freed by a variable of the same name in a smaller scope.
Therefore the pointer that gets freed is always NULL when it is
freed and the allocated data leaks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/smacker: Cosmetics
Andreas Rheinhardt [Sun, 29 Mar 2020 08:28:29 +0000 (10:28 +0200)]
avformat/smacker: Cosmetics

This is mainly about improving legibility of the code and getting rid of
overlong lines by using variables for st->codecpar instead of accessing
the codecparameters via st->codecpar->.

Also, some code has been moved to better fitting places.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/smacker: Remove unused structure
Andreas Rheinhardt [Sun, 29 Mar 2020 07:03:02 +0000 (09:03 +0200)]
avformat/smacker: Remove unused structure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/smacker: Only store what is needed later
Andreas Rheinhardt [Sun, 29 Mar 2020 06:42:15 +0000 (08:42 +0200)]
avformat/smacker: Only store what is needed later

This commit removes data that is only used during smacker_read_header()
from the demuxer's context and replaces the data that is used by local
variables. The other data is completely dropped.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/smacker: Create audio streams immediately
Andreas Rheinhardt [Sun, 29 Mar 2020 06:19:45 +0000 (08:19 +0200)]
avformat/smacker: Create audio streams immediately

The Smacker demuxer currently parses several fields that indicate
how many audio streams a file contains. This data is parsed and stored
into arrays in the demuxer's context and although the data is used only
to initialize the audio streams, it is kept for the whole lifetime of
the demuxer.

This has been changed: The data is used directly to create
the audio streams and no longer kept at all.

This also simplifies error handling in case adding a new stream fails:
Several arrays which until now have been allocated between parsing the
data determining how many audio streams to create and actually creating
them would need to be freed in this case. Now the streams are created
first, so freeing is no longer an issue.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/smacker: Read extradata directly into extradata
Andreas Rheinhardt [Sun, 29 Mar 2020 04:40:57 +0000 (06:40 +0200)]
avformat/smacker: Read extradata directly into extradata

The Smacker demuxer reads four consecutive 32bit values from the file
header into its demux context (as four uint32_t), converting it to
native endianness in the process and then writing these four values
later (after extradata has been allocated) to extradata as four 32bit
values (converting to little endian in the process).

This commit changes this: The stream and the extradata are allocated
earlier, so that the data destined for extradata can be read directly
into extradata.

Furthermore, given that these values are not needed for demuxing itself
they are now no longer kept as part of the demuxing context.

Finally, a check regarding the number of frames has been moved up,
too, in order to exit early before unnecessarily allocating the
stream and the extradata.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavcodec/flacdsp_template: Fix invalid shifts in decorrelate
Michael Niedermayer [Sat, 1 Feb 2020 21:52:13 +0000 (22:52 +0100)]
avcodec/flacdsp_template: Fix invalid shifts in decorrelate

Fixes: left shift of negative value -2
Fixes: 20303/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLAC_fuzzer-5096829297623040
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agotools/target_dec_fuzzer: Adjust threshold for screenpresso
Michael Niedermayer [Wed, 29 Jan 2020 18:25:31 +0000 (19:25 +0100)]
tools/target_dec_fuzzer: Adjust threshold for screenpresso

Fixes: Timeout (332 -> 21 sec)
Fixes: 20280/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCREENPRESSO_fuzzer-6238663432470528
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/xvididct: Fix integer overflow in MULT()
Michael Niedermayer [Fri, 31 Jan 2020 22:43:57 +0000 (23:43 +0100)]
avcodec/xvididct: Fix integer overflow in MULT()

Fixes: signed integer overflow: 23170 * 95058 cannot be represented in type 'int'
Fixes: 20295/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5800212870463488
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/ffwavesynth: Correct undefined overflow of PINK_UNIT
Michael Niedermayer [Fri, 17 Jan 2020 22:42:08 +0000 (23:42 +0100)]
avcodec/ffwavesynth: Correct undefined overflow of PINK_UNIT

Fixes: signed integer overflow: 9223372036854775775 + 128 cannot be represented in type 'long'
Fixes: 20054/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5686385113825280
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/ilbc: Add missing #if for muxer
Michael Niedermayer [Tue, 7 Apr 2020 14:55:41 +0000 (16:55 +0200)]
avformat/ilbc: Add missing #if for muxer

Fixes: building without muxers
Fixes: 21594
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/webmdashenc: Use AVCodecDescriptors for codec names
Andreas Rheinhardt [Mon, 30 Mar 2020 01:09:41 +0000 (03:09 +0200)]
avformat/webmdashenc: Use AVCodecDescriptors for codec names

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/webmdashenc: Check codec types
Andreas Rheinhardt [Mon, 30 Mar 2020 00:50:02 +0000 (02:50 +0200)]
avformat/webmdashenc: Check codec types

The WebM DASH Manifest muxer only supports VP8, VP9, Vorbis and Opus,
but there was no check for this. The codec type is used to get a pointer
to a string containing the codec name or NULL if it is not one of those
four codecs. Said pointer has then been used without further checks as
string for the %s conversion specifier in an avio_printf()) call which
is undefined behaviour.

This commit adds a check for the supported codec types.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agomov: Support fake moov boxes disguised as hoov
Vittorio Giovara [Thu, 8 Aug 2019 20:28:26 +0000 (22:28 +0200)]
mov: Support fake moov boxes disguised as hoov

Some broken apps generate files that have a fake box named 'hoov'
instead of a proper 'moov' one. This is speculation but it seems like
this box contains data to be modified later (eg as file grows in size,
data gets re-written) and its name is supposed to be changed to 'moov'
once it can be used as a 'moov', but for some reason this step is skipped.

Since this is not the first time this happens ('moov' boxes can be found
in 'free' ones) extend the existing hacks to search for the moov in such
boxes and skip the moov_retry since it needs to be found right away.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 years agohwcontext_vulkan: only use one semaphore per image
Lynne [Mon, 6 Apr 2020 17:18:50 +0000 (18:18 +0100)]
hwcontext_vulkan: only use one semaphore per image

The idea was to allow separate planes to be filtered independently, however,
in hindsight, literaly nothing uses separate per-plane semaphores and it
would only work when each plane is backed by separate device memory.

4 years agoavfilter/vf_xfade: add slice transitions
Paul B Mahol [Tue, 7 Apr 2020 11:48:38 +0000 (13:48 +0200)]
avfilter/vf_xfade: add slice transitions

4 years agoavcodec/vp3: propagate error codes
Peter Ross [Sun, 5 Apr 2020 05:44:44 +0000 (15:44 +1000)]
avcodec/vp3: propagate error codes

throughout vp3_decode_frame the error code was being captured (ret) but never returned.

Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
4 years agoavfilter/vf_derain.c: put all the calculation in model file.
Guo, Yejun [Fri, 20 Mar 2020 12:54:07 +0000 (20:54 +0800)]
avfilter/vf_derain.c: put all the calculation in model file.

currently, the model outputs the rain, and so need a subtraction
in filter c code to get the final derain result.

I've sent a PR to update the model file and accepted, see at
https://github.com/XueweiMeng/derain_filter/pull/3

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
4 years agodnn-layer-mathbinary-test: add unit test for subtraction
Guo, Yejun [Sat, 21 Mar 2020 02:58:11 +0000 (10:58 +0800)]
dnn-layer-mathbinary-test: add unit test for subtraction

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 years agodnn_backend_native_layer_mathbinary: add sub support
Guo, Yejun [Fri, 20 Mar 2020 12:55:38 +0000 (20:55 +0800)]
dnn_backend_native_layer_mathbinary: add sub support

more math binary operations will be added here

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 years agoavfilter/vf_dnn_processing.c: fix typo for the linesize of dnn data
Guo, Yejun [Sat, 21 Mar 2020 09:33:26 +0000 (17:33 +0800)]
avfilter/vf_dnn_processing.c: fix typo for the linesize of dnn data

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
4 years agoscale_vulkan: correctly copy the colormatrix
Lynne [Mon, 6 Apr 2020 18:15:51 +0000 (19:15 +0100)]
scale_vulkan: correctly copy the colormatrix

4 years agoavutil/hwcontext_cuda: Only handle CUDA hardware frames
Timo Rothenpieler [Mon, 6 Apr 2020 17:33:01 +0000 (19:33 +0200)]
avutil/hwcontext_cuda: Only handle CUDA hardware frames

4 years agoavcodec/cbs_h264_syntax_template: fix off by 1 error with slice_group_change_cycle
Michael Niedermayer [Sun, 22 Mar 2020 15:38:24 +0000 (16:38 +0100)]
avcodec/cbs_h264_syntax_template: fix off by 1 error with slice_group_change_cycle

Fixes: assertion failure
Fixes: 20390/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5683400772157440
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavf/chromaprint: Silence compilation warnings
Carl Eugen Hoyos [Tue, 13 Aug 2019 10:42:27 +0000 (12:42 +0200)]
lavf/chromaprint: Silence compilation warnings

Fixes the following warnings:
libavformat/chromaprint.c:117:42: warning: passing argument 2 of â€˜chromaprint_feed’ from incompatible pointer type
libavformat/chromaprint.c:132:52: warning: passing argument 2 of â€˜chromaprint_get_raw_fingerprint’ from incompatible pointer type
libavformat/chromaprint.c:143:71: warning: passing argument 4 of â€˜chromaprint_encode_fingerprint’ from incompatible pointer type

4 years agoavformat/avidec: Fix memleak with embedded GAB2 subtitles
Andreas Rheinhardt [Fri, 27 Mar 2020 07:31:29 +0000 (08:31 +0100)]
avformat/avidec: Fix memleak with embedded GAB2 subtitles

The code for GAB2 subtitles predates refcounting AVPackets. So in order
to transfer the ownership of a packet's data pkt->data was simply stored
and the packet zeroed; in the end (i.e. in the read_close-function) this
data was then simply freed with av_freep(). This of course leads to a leak
of an AVBufferRef and an AVBuffer. It has been fixed by keeping and
eventually unreferencing the packet's buf instead.

Additionally, the packet is now reset via av_packet_unref().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/avidec: Fix memleak when allocating DVDemuxContext fails
Andreas Rheinhardt [Fri, 27 Mar 2020 04:31:13 +0000 (05:31 +0100)]
avformat/avidec: Fix memleak when allocating DVDemuxContext fails

An AVIStream (intended to be used as private data for an AVStream) would
leak in this scenario.

Also return a more fitting error code instead of AVERROR_INVALIDDATA.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/avidec: Fix memleak when DV demuxer is disabled
Andreas Rheinhardt [Fri, 27 Mar 2020 04:21:32 +0000 (05:21 +0100)]
avformat/avidec: Fix memleak when DV demuxer is disabled

If one uses a build without dv demuxer, an AVIStream struct that is
destined to be used as private data for an AVStream by the avi demuxer
would leak, because it has been moved from the AVStream (that is going
to be freed) and only stored in a local variable (in order to be used
for another AVStream), but if the dv demuxer is disabled, the earlier
code returned immediately instead.

Also return a better error code in this scenario (instead of
AVERROR_INVALIDDATA).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/avidec: Don't reimplement ff_free_stream()
Andreas Rheinhardt [Fri, 27 Mar 2020 03:42:15 +0000 (04:42 +0100)]
avformat/avidec: Don't reimplement ff_free_stream()

Using ff_free_stream() makes the code more readable, more future-proof
(the old code freed AVCodecContexts and AVCodecParameters and its
substructures manually, so that there is a chance that there would be a
memleak for some time if new substructures were added) and reduces
code size.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agolavc/amrwbdec: Use av_samples_set_silence().
Carl Eugen Hoyos [Sun, 5 Apr 2020 15:04:44 +0000 (17:04 +0200)]
lavc/amrwbdec: Use av_samples_set_silence().

Suggested-by: James Almer
4 years agoRevert "avformat/rtp: Pass sources and block filter addresses via sdp file for rtp"
Carl Eugen Hoyos [Sun, 5 Apr 2020 09:58:02 +0000 (11:58 +0200)]
Revert "avformat/rtp: Pass sources and block filter addresses via sdp file for rtp"

This reverts commit b71685865fe761925feedda3cd0b288224d9a509.

The commit lead to the use of an uninitialized variable.
Other issues were listed by Andreas Rheinhardt:
https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/259150.html

4 years agodoc/general: update avisynth docs with a way to install just the headers using CMake
Stephen Hutchinson [Sun, 5 Apr 2020 09:37:43 +0000 (11:37 +0200)]
doc/general: update avisynth docs with a way to install just the headers using CMake

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agolavc/amrwbdec: Do not ignore NO_DATA frames.
Carl Eugen Hoyos [Tue, 29 Jan 2019 21:46:37 +0000 (22:46 +0100)]
lavc/amrwbdec: Do not ignore NO_DATA frames.

Fixes the actual output duration of the sample in ticket #7113.

4 years agoavformat/avisynth: fix deprecation warning
Stephen Hutchinson [Thu, 12 Mar 2020 23:38:02 +0000 (19:38 -0400)]
avformat/avisynth: fix deprecation warning

4 years agodoc/general: AviSynth+ works on Linux now, AvxSynth is gone.
Stephen Hutchinson [Thu, 12 Mar 2020 23:38:01 +0000 (19:38 -0400)]
doc/general: AviSynth+ works on Linux now, AvxSynth is gone.

Related to this are the following changes:
* Mention the GNUmakefile that AviSynth+ provides for installing
  just the headers.
* Expand on users installing AviSynth on their system a little
  more.

4 years agoavformat/avisynth: switch to AviSynth+ on Linux
Stephen Hutchinson [Thu, 12 Mar 2020 23:38:00 +0000 (19:38 -0400)]
avformat/avisynth: switch to AviSynth+ on Linux

AviSynth+ now supports non-Windows OSes, making AvxSynth
obsolete.  Since we no longer support AviSynth 2.5 (which is
essentially what AvxSynth is), remove AvxSynth support and
replace it with AviSynth+.

As a result, the USING_AVISYNTH defines can be switched back
to generic _WIN32.

4 years agocompat/avisynth: remove avisynth headers
Stephen Hutchinson [Thu, 12 Mar 2020 23:37:59 +0000 (19:37 -0400)]
compat/avisynth: remove avisynth headers

4 years agolavc/aacdec_template: Only warn once about unusual 7.1 encoding.
Carl Eugen Hoyos [Fri, 27 Mar 2020 21:37:23 +0000 (22:37 +0100)]
lavc/aacdec_template: Only warn once about unusual 7.1 encoding.

4 years agoconfigure: Filter -Wl, linker flags out for msvc compilation.
Carl Eugen Hoyos [Wed, 1 Apr 2020 14:57:40 +0000 (16:57 +0200)]
configure: Filter -Wl, linker flags out for msvc compilation.

4 years agolavc/sbc: Remove bool usage.
Carl Eugen Hoyos [Wed, 1 Apr 2020 19:28:09 +0000 (21:28 +0200)]
lavc/sbc: Remove bool usage.

4 years agolavf, lavfi: Remove uses of sizeof(char).
Carl Eugen Hoyos [Fri, 3 Apr 2020 23:30:14 +0000 (01:30 +0200)]
lavf, lavfi: Remove uses of sizeof(char).

The C standard requires sizeof(char) == 1.

4 years agolavfi/scale_qsv: Fix a format specifier for a variable of type int.
Carl Eugen Hoyos [Wed, 1 Apr 2020 14:53:04 +0000 (16:53 +0200)]
lavfi/scale_qsv: Fix a format specifier for a variable of type int.

4 years agolavc/qsvenc: Fix format specifiers for two variables of type int.
Carl Eugen Hoyos [Wed, 1 Apr 2020 14:52:19 +0000 (16:52 +0200)]
lavc/qsvenc: Fix format specifiers for two variables of type int.

4 years agolavc: Use supported_samplerates for Dolby Digital encoders.
Carl Eugen Hoyos [Mon, 10 Feb 2020 23:20:52 +0000 (00:20 +0100)]
lavc: Use supported_samplerates for Dolby Digital encoders.

Fixes ticket #8518.

4 years agoavformat/mpegts: use buffer pools for allocating PES payloads
Marton Balint [Fri, 3 Apr 2020 21:32:38 +0000 (23:32 +0200)]
avformat/mpegts: use buffer pools for allocating PES payloads

This brings a performance improvement when demuxing files, most of the
improvement comes from buffer pooling unbound packets.

time ffprobe -i samples/ffmpeg-bugs/trac/ticket6132/Samsung_HDR_-_Chasing_the_Light.ts -show_packets >/dev/null 2>&1

Before:
    real    0m1.967s
    user    0m1.471s
    sys     0m0.493s

After:
    real    0m1.497s
    user    0m1.364s
    sys     0m0.129s

Based on a patch of James Almer.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavdevice/decklink_dec: increase autodetect timeout to 3 sec
Marton Balint [Tue, 31 Mar 2020 23:04:06 +0000 (01:04 +0200)]
avdevice/decklink_dec: increase autodetect timeout to 3 sec

1 sec might not be enough for the cards to detect the format...

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/mov: Discard last STSC if its empty
Michael Niedermayer [Tue, 4 Feb 2020 08:45:35 +0000 (09:45 +0100)]
avformat/mov: Discard last STSC if its empty

Fixes: Ticket8508
4 years agoswscale/output: Fix integer overflow in yuv2rgb_write_full() with out of range input
Michael Niedermayer [Sun, 16 Feb 2020 19:11:52 +0000 (20:11 +0100)]
swscale/output: Fix integer overflow in yuv2rgb_write_full() with out of range input

Fixes: signed integer overflow: 1169365504 + 981452800 cannot be represented in type 'int'
Fixes: ticket8293
Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoswscale/output: Fix integer overflow in alpha computation in yuv2gbrp16_full_X_c()
Michael Niedermayer [Sun, 16 Feb 2020 19:18:11 +0000 (20:18 +0100)]
swscale/output: Fix integer overflow in alpha computation in yuv2gbrp16_full_X_c()

Fixes: signed integer overflow: 524280 * 4432 cannot be represented in type 'int'
Fixes: ticket8322
Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agofftools/ffmpeg: Disable copy_ts on timestamp wraparound
Michael Niedermayer [Fri, 3 May 2019 11:38:57 +0000 (13:38 +0200)]
fftools/ffmpeg: Disable copy_ts on timestamp wraparound

This allows handling more than 26.5h of mpeg* input

Fixes: Ticket 7876
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec/jpeg2000dec.c: Fix indentation
Gautam Ramakrishnan [Fri, 3 Apr 2020 18:27:58 +0000 (23:57 +0530)]
libavcodec/jpeg2000dec.c: Fix indentation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolibavcodec/jpeg2000dec.c: Handle non EOC streams
Gautam Ramakrishnan [Fri, 3 Apr 2020 18:27:57 +0000 (23:57 +0530)]
libavcodec/jpeg2000dec.c: Handle non EOC streams

This patch allows decoding of j2k streams which do
not have an EOC marker.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_v360: add pannini input support
Paul B Mahol [Sat, 4 Apr 2020 12:12:43 +0000 (14:12 +0200)]
avfilter/vf_v360: add pannini input support

4 years agoffplay: flush correct stream after stats update
Gyan Doshi [Fri, 3 Apr 2020 16:29:31 +0000 (21:59 +0530)]
ffplay: flush correct stream after stats update

Stats and logs are written to stderr, not stdout.

4 years agoffplay: always show stats at all log levels if requested by user
Gyan Doshi [Fri, 3 Apr 2020 11:06:31 +0000 (16:36 +0530)]
ffplay: always show stats at all log levels if requested by user

Since 3b491c5a500, stats would be hidden if loglevel was lower than
info, even if -stats was set.

Fixes #6962

4 years agoavformat/matroska: clean the structure formatting
Steve Lhomme [Sun, 22 Mar 2020 08:59:21 +0000 (09:59 +0100)]
avformat/matroska: clean the structure formatting

Always use a comma at the end, order elements by value.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/dss: Remove unnecessary allocation
Andreas Rheinhardt [Thu, 2 Apr 2020 16:41:11 +0000 (18:41 +0200)]
avformat/dss: Remove unnecessary allocation

Put a buffer with a known fixed size into the demuxer's context instead
of allocating it separately. This also allows to remove the demuxer's
read_close()-function.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/ilbc: Don't reimplement ff_raw_write_packet
Andreas Rheinhardt [Thu, 2 Apr 2020 16:05:15 +0000 (18:05 +0200)]
avformat/ilbc: Don't reimplement ff_raw_write_packet

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavfilter/vf_v360: improve description of output fov options
Paul B Mahol [Fri, 3 Apr 2020 15:14:58 +0000 (17:14 +0200)]
avfilter/vf_v360: improve description of output fov options

4 years agoavformat/matroskaenc: Improve BlockAdditions
Andreas Rheinhardt [Wed, 20 Nov 2019 14:10:34 +0000 (15:10 +0100)]
avformat/matroskaenc: Improve BlockAdditions

8ffcc826 added support for muxing BlockAdditions with BlockAddID equal
to one. The restriction to BlockAddID == 1 probably resulted from
a limitation to what was needed; yet over time this led to three
occurences of "(side_data_size && additional_id == 1)". This commit
changes this by setting side_data_size to 0 if additional_id != 1.

It also stops hardcoding 1 for the value of BlockAddID to write;
but it still upholds the requirement that it is 1. See below.

Despite BlockAddId actually having a default value of 1, it is still
written, because until very recently (namely dbc50f8a) our demuxer
used a wrong default value of 0.

Furthermore, use put_ebml_binary() to write the BlockAdditional element.

(The Matroska specifications have evolved and now the BlockAddID 1 is
reserved for the codec (as described in the codec's codec mapping),
BlockMore elements with BlockAddID > 1 are now of a more
codec-independent nature and require a BlockAdditionalMapping in the
track's TrackEntry. Given that this muxer does not support writing said
BlockAdditionalMapping yet (actually, none have been defined yet), we
have to uphold the requirement that BlockAddID == 1.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Improve checks for updating Tags
Andreas Rheinhardt [Wed, 22 Jan 2020 18:37:29 +0000 (19:37 +0100)]
avformat/matroskaenc: Improve checks for updating Tags

When updating the Tags at the end, the Matroska muxer would twice check
for whether (!mkv->is_live) is true, despite this code being only executed
if it is. Furthermore, a loop iterates over all the streams even when
there is no Tags element to update at all, because the check for whether
there are Tags is only performed later. This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Remove unnecessary avio_tell(), avio_seek()
Andreas Rheinhardt [Wed, 22 Jan 2020 17:45:08 +0000 (18:45 +0100)]
avformat/matroskaenc: Remove unnecessary avio_tell(), avio_seek()

avio_close_dyn_buf() has a bug: When the write pointer does not point to
the end of the written data when calling it (i.e. when one has performed
a seek back to update already written data), it would not add padding to
the end of the buffer, but to the current position, overwriting other
data; furthermore the reported size would be wrong (off by the amount of
data it has overwritten with padding).

In order not to run into this when updating already written elements or
elements for which size has only been reserved, the Matroska muxer would
first record the current position of the dynamic buffer, then seek to
the desired position, perform the update and seek back to the earlier
position.

But now that end_ebml_master_crc32() does not make use of
avio_close_dyn_buf() any more, this is no longer necessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Stop reallocating of Cluster buffer
Andreas Rheinhardt [Sun, 29 Dec 2019 00:01:52 +0000 (01:01 +0100)]
avformat/matroskaenc: Stop reallocating of Cluster buffer

The Matroska muxer uses a dynamic buffer to buffer the content of
Clusters before eventually writing them. Up until now, each time a
Cluster was written, the dynamic buffer was closed, i.e. freed; now it
is only reset, saving allocations of the AVIOContext itself, its opaque
as well as most of the reallocations of the buffer.

This is advantageous performance-wise, in particular on systems where
reallocations are slow (namely Windows). The following table shows the
decicyles for writing a frame on Linux (Ubuntu 19.10) and Windows (7)
on an x64 Haswell (to /dev/null on Linux, to stdout which is discarded
on Windows (the default values of the size and duration of clusters for
seekable output have been explicitly set in this case); in all tests,
writing CRC-32 values has been disabled in all tests; calls to the muxer's
write_packet function in write_packet() in libavformat/mux.c have been
timed; each of the following tests has been repeated 50 times):

    | Windows before | Windows after | Linux before | Linux after
_________________________________________________________________
 A  |     979437     |    192304     |    259500    |   183320
 B  |     715936     |    155648     |    152786    |   130879
 C  |     265115     |     56034     |     78496    |    53243
 D  |     386224     |     80307     |    128894    |    75354
 E  |      21732     |     10695     |     11320    |     9801

(A is a 10.2 mb/s file with a GOP length of 2s, amounting to an average
Cluster size of about 2.5 MiB; the average Cluster size of B is 1.1 MiB;
for C it is 2.35 MiB, for D it is 0.46 MiB; for E - a file with just a
single audio track of 158kb/s resulting in a Cluster size of about 100
kB, the relative gains were the smallest, probably because of the small
Cluster size.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoconfigure: fix build issue of vf_dnn_processing.c when --disable-swscale
Guo, Yejun [Thu, 2 Apr 2020 03:18:08 +0000 (11:18 +0800)]
configure: fix build issue of vf_dnn_processing.c when --disable-swscale

vf_dnn_processing.c recently changed to use swscale to trasfer data
between AVFrame and dnn model.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
4 years agolibavformat/amr.c: Check return value from avio_read()
John Rummell [Tue, 31 Mar 2020 04:30:33 +0000 (21:30 -0700)]
libavformat/amr.c: Check return value from avio_read()

If the buffer doesn't contain enough bytes when reading a stream,
fail rather than continuing on with initialized data. Caught by
Chromium fuzzeras (crbug.com/1065731).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoswscale/swscale: remove useless code
Ruiling Song [Wed, 1 Apr 2020 07:32:15 +0000 (15:32 +0800)]
swscale/swscale: remove useless code

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoconfigure: Do not abort when cross-compiling to the native CPU
David Michael [Wed, 1 Apr 2020 04:07:55 +0000 (00:07 -0400)]
configure: Do not abort when cross-compiling to the native CPU

Using a compiler with a different host triplet is considered
cross-compiling, even when it is for the same architecture as the
build system.  With such a cross-compiler, it is still valid to
optimize builds with --cpu=host.  Make the condition that aborts in
this case into a warning instead, since a cross-compiler for an
incompatible architecture will fail with -mtune=native anyway.

Signed-off-by: David Michael <fedora.dm0@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agofate/matroska: Add test for updating CodecPrivate from packet sidedata
Andreas Rheinhardt [Wed, 1 Apr 2020 18:22:29 +0000 (20:22 +0200)]
fate/matroska: Add test for updating CodecPrivate from packet sidedata

containing updated extradata, in this case a new FLAC streaminfo.
Furthermore, it also tests that the Matroska muxer is able to preserve
uncommon channel layouts by adding Vorbis comments to the CodecPrivate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/hnm: Only keep and parse what is needed later
Andreas Rheinhardt [Sat, 21 Mar 2020 05:17:36 +0000 (06:17 +0100)]
avformat/hnm: Only keep and parse what is needed later

The hnm demuxer's context struct contained lots of fields that are
write-only variables or that are not used outside of parsing the header
and that can therefore be replaced by local variables of hnm_read_header().
This commit removes all of these from the context; the second type has
been replaced by local variables.

An AVPacket (that was initialized when reading the header and for which
dead code to unreference it existed in hnm_read_close()) is among the
removed things. Removing it allowed to remove hnm_read_close()
altogether and also removes another instance of usage of sizeof(AVPacket).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Don't implicitly mark WebVTT in WebM as English
Andreas Rheinhardt [Sat, 18 Jan 2020 01:19:46 +0000 (02:19 +0100)]
avformat/matroskaenc: Don't implicitly mark WebVTT in WebM as English

Writing the language of WebVTT in WebM proceeded differently than the
language of all other tracks: In case no language was given, it does not
write anything instead of "und" (for undefined). Because the default
value of the Language element in WebM (that inherited it from Matroska)
is "eng" (for English), any such track will actually be flagged as
English.

Doing it this way goes back to commit 509642b4 (the commit adding
support for WebVTT) and no reason for this has been given in the commit
message or in the discussion about this patch on the mailing list; the
best I can think of is this: the WebM wiki contains "The srclang attribute
is stored as the Language sub-element." Someone unfamiliar with default
values in Matroska/WebM could interpret this as meaning that no Language
element should be written if the language is unknown. And this is wrong
and this commit changes it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Reindent after previous commit
Andreas Rheinhardt [Fri, 17 Jan 2020 19:40:15 +0000 (20:40 +0100)]
avformat/matroskaenc: Reindent after previous commit

Also remove { } after an if if there is only one statement inside { }.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Combine checks for audio
Andreas Rheinhardt [Fri, 17 Jan 2020 19:14:24 +0000 (20:14 +0100)]
avformat/matroskaenc: Combine checks for audio

mkv_write_track() currently has three places where it checks for whether
the current codec type is audio: One in a switch and two outside of it.
These checks can be combined by moving the code after the other two checks
inside the audio-related part of the switch.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
4 years agoavformat/matroskaenc: Simplify writing Void elements
Andreas Rheinhardt [Sun, 12 Jan 2020 00:30:58 +0000 (01:30 +0100)]
avformat/matroskaenc: Simplify writing Void elements

Reserving space in Matroska works by writing a Void element. And until
now this worked as follows: The current position was recorded and the
EBML ID as well as the length field written; then the new position was
recorded to know how much more to write. Afterwards the actual writing
has been performed via ffio_fill().

But it is unnecessary to explicitly use the positions (obtained via
avio_tell()) to find out how much still needs to be written, because the
length of the ID and the length field are known. So rewrite the function
to no longer use them.

Also, given that ffio_fill() uses an int parameter and given that no
current caller (and no sane future caller) will want to reserve several
GB of space, make the size parameter of put_ebml_void() itself an int.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>