Commit Graph

20900 Commits

Author SHA1 Message Date
Paul B Mahol b2570afde3 avformat/yuv4mpegdec: fix seeking backwards
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-25 18:30:46 +02:00
Rostislav Pehlivanov 4ac0ff8ec2 Revert "libavformat: add mbedTLS based TLS"
This reverts commit 62f5c9d68b,
which was pushed a bit prematurely.
2018-04-23 20:29:02 +01:00
Thomas Volkert 62f5c9d68b libavformat: add mbedTLS based TLS 2018-04-23 20:48:11 +02:00
Carl Eugen Hoyos 2442cf3615 lavf/os_support: Only compile inet_aton() if getaddrinfo() is needed.
Silences a warning:
libavformat/os_support.c:49:12: warning: 'inet_aton' defined but not used

Reported-by: Reino Wijnsma
2018-04-23 13:39:29 +02:00
James Almer 153e920892 avformat/vpcc: add ff_isom_get_vpcc_features()
Should be useful for muxers that require values as defined in the
vpcc atom but don't need to write the atom itself.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-22 16:24:48 -03:00
Paul B Mahol 00099ef0d0 avformat/dsfdec: fix calculation of size of data chunk
Ignore extra 12 bytes that belong to tag and size.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-22 13:14:26 +02:00
Paul B Mahol 5d3efe9e1f avformat/dsfdec: properly handle padded last packet
Fixes #5489.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-22 12:00:43 +02:00
Gyan Doshi 9f9f56e679 avformat/segafilm - revert keyframe detection
Keyframe detection was inverted in cfe1a9d311 in order to fix keyframe
flags set for the sample attached to trac #7091. However, that sample is
errantly muxed.

As noted at
https://web.archive.org/web/20020803104640/http://www.pcisys.net:80/~melanson/codecs/film-format.txt,
the original keyframe detection logic is correct, and this patch
restores it.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-22 00:32:49 -03:00
Carl Eugen Hoyos 8592ae1a1e lavf/dashdec: Do not use memcpy() to copy a struct.
Fixes a warning:
libavformat/dashdec.c:1900:65: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'struct fragment *' as the destination; expected 'struct fragment' or an explicit length
2018-04-21 22:59:34 +02:00
Jacob Trimble e5ba5fab49 avformat/mov: Fix parsing of saio/siaz atoms in encrypted content.
This doesn't support saio atoms with more than one offset.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-21 00:45:31 +02:00
Aman Gupta 7b8daa771c avformat/utils: refactor upstream_stream_timings
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 12:12:15 -07:00
Aman Gupta fd6e89586c avformat/utils: ignore outlier durations on subtitle/data streams as well
Similar to 4c9c4fe8b2, but for durations. This fixes #7151, where
the report duration and bitrate on a mpegts stream is wildly off
due to the dvb_teletext stream's timings.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 12:12:07 -07:00
Vishwanath Dixit 30940be359 avformat/http: flushing tcp receive buffer when it is write only mode
In write only mode, the TCP receive buffer's data keeps growing with
http response messages and the buffer eventually becomes full.
This results in zero tcp window size, which in turn causes unwanted
issues, like, terminated tcp connection. The issue is apparent when
http persistent connection is enabled in hls/dash live streaming use
cases. To overcome this issue, the logic here reads the buffer data
when a file transfer is completed, so that any accumulated data in
the recieve buffer gets flushed out.
2018-04-20 11:31:21 +05:30
Steven Liu 002e45b407 avformat/dashenc: change the hls version from 6 to 7
reference hls support fmp4 file from  draft-pantos-http-live-streaming-20
the spec describes version 7 of hls protocol

Suggested-by: Ronak <ronak2121@yahoo.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-04-20 13:31:05 +08:00
Stephan Holljes 7b6b8c9265 lavf/http.c: Free allocated client URLContext in case of error.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-20 01:46:32 +02:00
Richard Shaffer c705476c47 libavformat/http: Refactor and fix additional leaks in get_cookies.
This refactors get_cookies to simplify some code paths, specifically for
skipping logic in the while loop or exiting it. It also simplifies the logic
for appending additional values to *cookies by replacing strlen/malloc/snprintf
with one call av_asnprintf.

This refactor fixes a bug where the cookie_params AVDictionary would get leaked
if we failed to allocate a new buffer for writing to *cookies.
2018-04-19 22:01:51 +02:00
Jacob Trimble baf9c0bd99 avformat/mov: Remove old encryption info methods.
Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-19 21:49:47 +02:00
Jacob Trimble 606c5c7f3a avformat/mov: Fix memory leak in encryption info.
Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-19 21:49:47 +02:00
Hendrik Leppkes 5c6365af45 avformat/tls_schannel: fix handling of EOF after avio changes 2018-04-19 13:26:53 +02:00
Jacob Trimble f7221d8e67 avformat/mov: Increase support for common encryption.
- Parse schm atom to get different encryption schemes.
- Allow senc atom to appear in track fragments.
- Allow 16-byte IVs.
- Allow constant IVs (specified in tenc).
- Allow only tenc to specify encryption (i.e. no senc/saiz/saio).
- Use sample descriptor to detect clear fragments.

This doesn't support:
- Different sample descriptor holding different encryption info.
  - Only first sample descriptor can be encrypted.
- Encrypted sample groups (i.e. seig).
- Non-'cenc' encryption scheme when using -decryption_key.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-19 03:15:32 +02:00
Stephan Holljes 3717512282 lavf/tcp.c: Free allocated client URLContext in case of error.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-19 03:15:32 +02:00
Steven Liu 223f3dff8c avformat/hls: remove redundant code
Suggested-by: Richard Shaffer <rshaffer@tunein.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-04-18 11:22:23 +08:00
Richard Shaffer 9a8811f478 libavformat/http: Fix memory leak in get_cookies. 2018-04-17 22:00:54 +02:00
Timo Teräs 9af71b326f avformat/movenc: support writing iTunes cover image
Fixes https://trac.ffmpeg.org/ticket/2798

This makes movenc handle AV_DISPOSITION_ATTACHED_PIC and write
the associated pictures in iTunes cover atom. This corresponds
to how 'mov' demuxer parses and exposes the cover images when
reading.

Most of the existing track handling loops properly ignore
these 'virtual streams' as MOVTrack->entry is never incremented
for them. However, additional tests are added as needed to ignore
them.

Tested to produce valid output with:
  ffmpeg -i movie.mp4 -i thumb.jpg -disposition✌️1 attached_pic \
         -map 0 -map 1 -c copy movie-with-cover.mp4

The cover image is also copied correctly with:
  ffmpeg -i movie-with-cover.mp4 -map 0 -c copy out.mp4

AtomicParseley says that the attached_pic stream is properly
not visible in the main tracks of the file.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2018-04-17 20:11:34 +01:00
Vishwanath Dixit d10cefbfe5 avformat/dashenc: addition of segment index correction logic
The logic is applicable only when use_template is enabled and use_timeline
is disabled. The logic monitors the flow of segment indexes. If a streams's
segment index value is not at the expected real time position, then
the logic corrects that index value.

Typically this logic is needed in live streaming use cases. The network
bandwidth fluctuations are common during long run streaming. Each
fluctuation can cause the segment indexes fall behind the expected real
time position. Without this logic, players will not be able to consume
the content, even after encoder's network condition comes back to
normal state.
2018-04-17 14:35:40 +05:30
Vishwanath Dixit 2c51e33bc1 avformat/dashenc: addition of muxer overhead for @bandwidth param in MPD 2018-04-17 14:35:16 +05:30
Vishwanath Dixit af6058d03b avformat/dashenc: constructing MPD's bandwidth string locally 2018-04-17 14:34:52 +05:30
Vishwanath Dixit 0c7bc7eb47 avformat/dashenc: addition of muxer overhead in master playlist's bandwidth 2018-04-17 14:34:25 +05:30
Vishwanath Dixit 85ae55eca3 avformat/dashenc: logic to compute muxer overhead 2018-04-17 14:34:03 +05:30
Vishwanath Dixit 990380367b avformat/dashenc: addition of @availabilityTimeOffset in MPD
availability time of Nth segment = availabilityStartTime + (N*segment duration) - availabilityTimeOffset.
This field helps to reduce the latency by about a segment duration in streaming mode.
2018-04-17 14:33:37 +05:30
Vishwanath Dixit 3e75057a1d avformat/dashenc: setting @availabilityStartTime when the first frame is ready
@availabilityStartTime specifies the anchor for the computation of the earliest
availability time (in UTC) for any Segment in the Media Presentation.

As per this requirement, the @AvailabilityStartTime should be set to the
wallclock time at which the first frame of the first segment begins encoding.
But, it was getting set only when the first segment was completely ready. Making
the required correction in this patch. This correction is mainly needed to reduce
the latency in live streaming use cases.
2018-04-17 14:32:50 +05:30
Vishwanath Dixit 1263d91198 avformat/dashenc: removed 'write_manifest' call from 'write_header'
Calling 'write_manifest' from 'write_header' was causing creation of
first MPD with invalid values. Ex: zero @duration param value. Also,
the manifest files (MPD or M3U8s) should be created when at-least
one media frame is ready for consumption.
2018-04-17 14:32:24 +05:30
Vishwanath Dixit 51888c85d4 avformat/dashenc: writing average segment duration for @duration in template mode 2018-04-17 14:32:01 +05:30
Vishwanath Dixit ab789e184c avformat/dashenc: segmentation at the configured segment duration rate
When use_template is enabled and use_timeline is disabled, typically
it is required to generate the segments at the configured segment duration
rate on an average. This commit is particularly needed to handle the
segmentation when video frame rates are fractional like 29.97 or 59.94 fps.
2018-04-17 14:31:22 +05:30
Vishwanath Dixit 01ba52852d avformat/dashenc: replacing 'min_seg_duration' with 'seg_duration'
There are use cases where average segment duration needs to be configured
and muxer is expected to maintain the average segment duration. So, using
the name 'min_seg_duration' will be misleading. So, changing the parameter
name to 'seg_duration', where it can be minimum segment duration or average
segment duration based on the use-case. The additional updates needed for
this functinality are made the sub-sequent patches of this patch series.
2018-04-17 14:30:47 +05:30
Richard Shaffer c116221d90 avformat/hls: clean up duplicate option fields
The HLSContext struct contains fields which duplicate the data stored in the
avio_opts field. This change removes those fields in favor of avio_opts, and
updates the code accordingly.
The original patch caused the buffer pointed to by new_cookies in open_url to be
leaked. The only thing that buffer is used for is to store the value until it
can be passed to av_dict_set. To fix the leak, v2 of the patch simply calls
av_dict_set with the AV_DICT_DONT_STRDUP_VAL flag, so that the dictionary takes
ownership of the memory instead of copying it again.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Richard Shaffer <rshaffer@tunein.com>
2018-04-17 14:40:06 +08:00
Richard Shaffer 6a1be7561c avformat/hls: copy rw_timeout from parent to child AVIOContexts.
The rw_timeout option is currently not applied when opening media playlist,
segment, or encryption key URLs. This can cause the HLS demuxer to block
indefinitely, even when the rw_timeout option has been specified. This change
simply enables carrying over the rw_timeout option when the demuxer opens these
URLs.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Richard Shaffer <rshaffer@tunein.com>
2018-04-17 14:39:26 +08:00
sanilraut 9e2b4c7ecc libavformat/dashdec: Avoid multiple HTTP requests for initialization segment that is common among all representations
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: sanilraut <raut.sanil@gmail.com>
2018-04-17 14:36:45 +08:00
Steven Liu 0b3c1854cb Revert "avformat/hls: copy rw_timeout from parent to child AVIOContexts."
This reverts commit 36deec010c.
2018-04-17 14:33:36 +08:00
Steven Liu 6eaaad37f8 Revert "avformat/dashdec: Avoid multiple HTTP requests for initialization segment that is common among all representations"
This reverts commit 4effd1c4a2.
2018-04-17 14:32:27 +08:00
Steven Liu 36deec010c avformat/hls: copy rw_timeout from parent to child AVIOContexts.
The rw_timeout option is currently not applied when opening media playlist,
segment, or encryption key URLs. This can cause the HLS demuxer to block
indefinitely, even when the rw_timeout option has been specified. This change
simply enables carrying over the rw_timeout option when the demuxer opens these
URLs.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Richard Shaffer <rshaffer@tunein.com>
2018-04-17 14:25:07 +08:00
Steven Liu 4effd1c4a2 avformat/dashdec: Avoid multiple HTTP requests for initialization segment that is common among all representations
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: sanilraut <raut.sanil@gmail.com>
2018-04-17 14:19:00 +08:00
Steven Liu 6fbfb20faf avformat/hls: remove redundant code
Reviewed-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-04-17 13:16:33 +08:00
James Almer 6838359448 avformat/flacenc: add flac_init()
Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-16 13:46:10 -03:00
Rodger Combs 00d8598eba avformat/flacenc: support writing attached pictures
Usage of packet queueing API and some cleaning done by the committer.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-16 13:46:09 -03:00
James Almer 62bdbb5ce0 avformat/movenc: forbid muxing AV1 streams until the spec is finished
This prevents creating potentially broken files, as both the AV1 and
the AV1 in ISOMBFF specs are unfinished.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-16 10:20:46 -03:00
Michael Niedermayer 3c1ecb057d Bump minor versions after release/4.0 branching
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00
Michael Niedermayer 7e3a070d9a Bump minor versions for branching release/4.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00
Steven Liu 783df2eb59 avformat/hlsenc: avformat/hlsenc: add error message for encrypt fmp4 mode
and refine the warning message when use both hls_key_info_file and hls_enc

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2018-04-16 14:35:14 +08:00
James Almer 23e994ca49 avformat/utils: use the existing packet reference when parsing complete frames
If the parser returns full frames, then the output pointer retured by
av_parser_parse2() is guaranteed to point to data contained in the
input packet's buffer.

Create a new reference to said buffer in that case, to avoid
unnecessary data copy when queueing the packet later in the function.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-13 21:19:22 -03:00