1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

97236 Commits

Author SHA1 Message Date
Anton Khirnov
c6978418b8 avcodec.h: split codec IDs into their own header 2020-04-10 13:57:21 +02:00
Anton Khirnov
9875fd24ce avcodec.h: split AVPacket API into its own header 2020-04-10 13:54:03 +02:00
Anton Khirnov
f1e3e9e204 wavpack: fully support stream parameter changes
Fix invalid memory access on DSD streams with changing channel count.
2020-04-10 13:52:15 +02:00
Anton Khirnov
a1133db30e decode: make sure ff_get_buffer() cleans the frame on failure
Merge ff_get_buffer() and get_buffer_internal() to simplify the code.
2020-04-10 13:52:06 +02:00
Anton Khirnov
e923a35988 pthread_frame: make sure ff_thread_release_buffer always cleans the frame 2020-04-10 13:51:23 +02:00
Linjie Fu
917d28d5ff 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>
2020-04-10 13:50:47 +02:00
Paul B Mahol
932493f9c2 avcodec/zerocodec: use init cleanup internal cap 2020-04-10 12:22:09 +02:00
Paul B Mahol
05e04e821d avcodec/zerocodec: implement flushing 2020-04-10 12:22:09 +02:00
Paul B Mahol
481ebb1c8b avcodec: add MV30 decoder 2020-04-10 12:22:09 +02:00
Limin Wang
df08db0711 avformat/hlsenc: return media_url directly if failed to get seperator
Fix ticket: 8606
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-04-10 11:44:36 +08:00
Andreas Rheinhardt
081ef58619 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 bb47aa5850 and has
never been used at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-10 00:32:42 +02:00
Andreas Rheinhardt
7104c4dd88 avcodec/jpeg2000dec: Fix mixed declaration and code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-09 18:19:04 +02:00
Andreas Rheinhardt
a39536caee 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>
2020-04-09 15:16:20 +02:00
Limin Wang
46d2b2071b 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>
2020-04-09 15:03:36 +02:00
Gautam Ramakrishnan
e531891f3d 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>
2020-04-09 13:43:15 +02:00
Andriy Gelman
cd04bb4afe avcodec/v4l2_context: Use av_freep()
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-04-08 21:41:52 -04:00
Rosen Penev
8beb9e571c 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>
2020-04-09 00:59:21 +02:00
Marton Balint
df4e008995 avformat/segment: always use interleaved writes for formats with custom interleaving
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-08 21:57:57 +02:00
Limin Wang
99ebb033d2 avformat/hlsenc: use av_asprintf()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-04-08 23:54:55 +08:00
Andreas Rheinhardt
d7780636df avformat/hlsenc: Factor out deleting files from deleting segments
Removes code duplication.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-08 17:06:21 +02:00
Limin Wang
cd8c5e89ba 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✌️0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
 -b🅰️0 256k \
 -c:s webvtt -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0🅰️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>
2020-04-08 23:02:41 +08:00
Limin Wang
73dc87c4f0 avformat/hlsplaylist: simplify code for checking whether the string is empty
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-04-08 23:02:39 +08:00
Limin Wang
e2e8ef5076 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✌️0 5250k -c:v h264 -pix_fmt yuv420p -profile:v main -level 4.1 \
 -b🅰️0 256k \
 -c:a mp2 -ar 48000 -ac 2 -map 0:v -map 0🅰️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>
2020-04-08 23:02:36 +08:00
Andreas Rheinhardt
c9cd0a20b2 avformat/hlsenc: Use AVBPrint to avoid allocations of strings
when deleting old segments.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-08 16:47:19 +02:00
Andreas Rheinhardt
de8f6a4033 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>
2020-04-08 16:30:45 +02:00
Andreas Rheinhardt
95e9cf813e 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>
2020-04-08 16:23:07 +02:00
Andreas Rheinhardt
a9ad8867c4 avformat/smacker: Remove unused structure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-08 16:21:17 +02:00
Andreas Rheinhardt
b6ebc5aeb2 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>
2020-04-08 16:13:20 +02:00
Andreas Rheinhardt
33bc45e4fc 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>
2020-04-08 16:04:37 +02:00
Andreas Rheinhardt
7885c73573 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>
2020-04-08 15:53:04 +02:00
Michael Niedermayer
3935c891e9 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>
2020-04-07 18:29:20 +02:00
Michael Niedermayer
8dee1d7a30 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>
2020-04-07 18:27:40 +02:00
Michael Niedermayer
7ccb576191 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>
2020-04-07 18:24:14 +02:00
Michael Niedermayer
187161d62f 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>
2020-04-07 18:21:28 +02:00
Michael Niedermayer
054ce5f786 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>
2020-04-07 17:01:58 +02:00
Andreas Rheinhardt
1719c7f5db avformat/webmdashenc: Use AVCodecDescriptors for codec names
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-07 15:02:54 +02:00
Andreas Rheinhardt
cbea58b2b3 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>
2020-04-07 15:01:10 +02:00
Vittorio Giovara
a13841b797 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>
2020-04-07 13:20:59 +01:00
Lynne
97b526c192 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.
2020-04-07 12:52:56 +01:00
Paul B Mahol
3f9fd9dcfd avfilter/vf_xfade: add slice transitions 2020-04-07 13:51:25 +02:00
Peter Ross
31c4fe177d 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>
2020-04-07 20:59:15 +10:00
Guo, Yejun
7e4527e8fa 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>
2020-04-07 11:04:47 +08:00
Guo, Yejun
bbc64799dc dnn-layer-mathbinary-test: add unit test for subtraction
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2020-04-07 11:04:40 +08:00
Guo, Yejun
ffa1561608 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>
2020-04-07 11:04:34 +08:00
Guo, Yejun
2114c42418 avfilter/vf_dnn_processing.c: fix typo for the linesize of dnn data
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2020-04-07 11:03:25 +08:00
Lynne
ca76a5ba1a scale_vulkan: correctly copy the colormatrix 2020-04-06 19:16:35 +01:00
Timo Rothenpieler
30b28f9a83 avutil/hwcontext_cuda: Only handle CUDA hardware frames 2020-04-06 19:33:01 +02:00
Michael Niedermayer
741565a1e6 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>
2020-04-05 23:18:55 +02:00
Carl Eugen Hoyos
8defd0ca7b 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
2020-04-05 22:47:21 +02:00
Andreas Rheinhardt
da44bbefaa 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>
2020-04-05 18:38:26 +02:00