Commit Graph

97263 Commits

Author SHA1 Message Date
John Stebbins
32cf264d8f lavc/movtextenc: use correct color component order
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
a52eef68d4 lavc/ass_split: fix parsing utf8 scripts
The [Script Info] section was skipped if starts with UTF8 BOM

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
b8d4a66b29 lavc/movtextdec: allow setting subtitle frame dimensions
Font sizes are relative to the subtitle frame dimensions. If the
expected frame dimensions are not known, the font sizes will most
likely be incorrect.

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
f406dc9ceb lavc/movtextdec: restore active style color after hilite
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
032ad7a0bb lavc/movtextdec: add color and alpha style tags
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
91447ae3ba lavc/movtextdec: add alpha default to ass header colors
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
c0d3fea600 lavc/movtextdec: make sure default font name is set
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
e5b99df096 lavc/movtextdec: only write fontsize, fontID tags if not default
Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
d3c012ff42 lavc/movtextdec: handle changes to default style flags
Style flags were only being turned on.  If the default was on and style
record turned off, style flag remained on.

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
5f39f63a65 lavc/movtextdec: fix bold, italic, underline flags
They should be 0 or 1 so that 0 or -1 is written to the ass header

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
2949f17e99 lavc/movtextdec: simplify style record walk
It's not necessary to walk the style record list twice per subtitle
character.  style records are in order and do not overlap.

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
John Stebbins
47e88adc0d lavc/movtextdec: fix ass header colors
A conversion from rgb to bgr is necessary

Signed-off-by: Philip Langdale <philipl@overt.org>
2020-04-10 09:32:13 -07:00
Anton Khirnov
c3a2615bb8 lavc: install codec_desc.h
Forgotten in 672946c7fe
2020-04-10 18:18:51 +02:00
Anton Khirnov
fc12d6c258 h264dec: do not set picture_structure on init
This has been cargo culted from mpegvideo and serves no useful purpose.
It will be initialize correctly in h264_field_start()
2020-04-10 15:53:31 +02:00
Anton Khirnov
4fb05c0d5d h264dec: rename flush_dpb()
The name is misleading, this function does a lot more than just flushing
the DPB.
2020-04-10 15:53:27 +02:00
Anton Khirnov
5e316096fa h264_ps: make the PPS hold a reference to its SPS
It represents the relationship between them more naturally and will be
useful in the following commits.

Allows significantly more frames in fate-h264-attachment-631 to be
decoded.
2020-04-10 15:52:41 +02:00
Anton Khirnov
ec7f33a38e h264_sei: parse the picture timing SEIs correctly
Those SEIs refer to the currently active SPS. However, since the SEI
NALUs precede the coded picture data in the bitstream, the active SPS is
in general not known when we are decoding the SEI.

Therefore, store the content of the picture timing SEIs and actually
parse it when the active SPS is known.
2020-04-10 15:52:22 +02:00
Anton Khirnov
1e9615c5d4 h264_sei: use a separate reader for the individual SEI messages
This tells the parsing functions the payload size and prevents them from
overreading.
2020-04-10 15:50:26 +02:00
Anton Khirnov
d41faffb53 h264dec: do not abort if decoding extradata fails
Such errors are not necessarily fatal and decoding might still be
possible, e.g. it happens for MVC streams where we do not handle the
subset SPS thus failing to parse its corresponding PPS.
2020-04-10 15:49:27 +02:00
Anton Khirnov
9d6785d426 lavc: do not implicitly share the frame pool between threads
Currently the frame pool used by the default get_buffer2()
implementation is a single struct, allocated when opening the decoder.
A pointer to it is simply copied to each frame thread and we assume that
no thread attempts to modify it at an unexpected time. This is rather
fragile and potentially dangerous.

With this commit, the frame pool is made refcounted, with the reference
being propagated across threads along with other context variables. The
frame pool is now also immutable - when the stream parameters change we
drop the old reference and create a new one.
2020-04-10 15:47:30 +02:00
Anton Khirnov
2944537430 pthread_frame: do not copy a range of AVCodecContext fields at once
This is extremely fragile against reordering and hides what is actually
being copied. Copy all the fields manually instead.
2020-04-10 15:46:09 +02:00
Anton Khirnov
b630a270f5 pthread_frame: do not embed full AVFrame structs into per-thread contexts
Use the AVFrame API to properly allocate and free frames for delayed
release.
2020-04-10 15:45:16 +02:00
Anton Khirnov
e40107c1ad pthread_frame: do not share priv_data between multiple codec contexts
Specifically, between the user-facing one and the first frame thread
one.

This is fragile and dangerous, allocate separate private data for each
per-thread context.
2020-04-10 15:44:15 +02:00
Anton Khirnov
1f4cf92cfb pthread_frame: merge the functionality for normal decoder init and init_thread_copy
The current design, where
- proper init is called for the first per-thread context
- first thread's private data is copied into private data for all the
  other threads
- a "fixup" function is called for all the other threads to e.g.
  allocate dynamically allocated data
is very fragile and hard to follow, so it is abandoned. Instead, the
same init function is used to init each per-thread context. Where
necessary, AVCodecInternal.is_copy can be used to differentiate between
the first thread and the other ones (e.g. for decoding the extradata
just once).
2020-04-10 15:24:54 +02:00
Anton Khirnov
665e5b0fba lavc: replace AVCodecInternal.allocate_progress with an internal cap
This is a constant codec property, so a capability flag is more appropriate.
2020-04-10 14:16:39 +02:00
Anton Khirnov
7385ffbd31 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.
2020-04-10 14:16:22 +02:00
Anton Khirnov
672946c7fe avcodec.h: split AVCodecDescriptor API into its own header 2020-04-10 14:15:14 +02:00
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