Commit Graph

19275 Commits

Author SHA1 Message Date
Michael Niedermayer
1fb8f6b75c avformat/img2enc: Use AV_FRAME_FILENAME_FLAGS_MULTIPLE, support tee:
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-04 23:22:54 +02:00
Michael Niedermayer
dd96a58473 avformat/hlsenc: Use AV_FRAME_FILENAME_FLAGS_MULTIPLE, support tee:
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-04 23:22:54 +02:00
Michael Niedermayer
82a33c8d85 avformat: Add av_get_frame_filename2() and AV_FRAME_FILENAME_FLAGS_MULTIPLE
This will be used to allow writing file sequences using the tee output onto
multiple places in parallel

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-04 23:22:54 +02:00
James Almer
376d4b3c0d avformat: add a TTA Muxer
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-04 16:25:40 -03:00
James Almer
ce944e8489 avformat/tta: remove custom crc callback function
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-04 16:25:36 -03:00
James Almer
155f4e9630 avformat/avio: add a crc callback function for CRC-32 IEEE-LE
Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-04 16:25:32 -03:00
Michael Niedermayer
b1ce800372 avformat/teeproto: Support parsing protocol options
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-03 19:40:26 +02:00
Michael Niedermayer
c5cc3b08e5 avformat/oggdec: Fix integer overflow with invalid pts
If negative pts are possible for some codecs in ogg then the code needs to be
changed to use signed values.

Found-by: Thomas Guilbert <tguilbert@google.com>
Fixes: clusterfuzz_usan-2016-08-02
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-03 16:09:03 +02:00
Timothy Gu
58c7bf789f doxygen: Standardize root-level modules 2016-08-02 22:15:25 -07:00
Michael Niedermayer
35e7fc6030 avformat/tee: Factor parse_slave_options() out
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-02 20:22:55 +02:00
Carl Eugen Hoyos
8ee113afa1 lavf/rmdec: Do not return EIO on EOF.
Reported-by: applemax82
2016-08-02 16:16:31 +02:00
James Almer
f41048f6ec Merge commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c'
* commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c':
  h264: add H264_ prefix to the NAL unit types

Conflicts:
libavcodec/h264_parse.c
libavcodec/h264_parser.c
libavcodec/h264_slice.c
libavcodec/h264dec.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-01 15:11:05 -03:00
Michael Bradshaw
c9ae8be5a8 avformat/matroskaenc: fix Voids with size < 10
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-31 16:59:49 +02:00
Chris Cunningham
52ec4cc09b libavformat/matroskadec: Add test for seeking with codec delay.
Also cleanup parens for the skip_to_timecode check.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-30 01:02:41 +02:00
Michael Niedermayer
0219dc6c07 avformat/rmdec: Clear extradata when extradata_size is cleared
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-29 12:12:18 +02:00
Clément Bœsch
ecf65c30cf Merge commit '251cbb44003caf179fb17afbb8a6c56643c2a646'
* commit '251cbb44003caf179fb17afbb8a6c56643c2a646':
  h264: create a new header for common h264 definitions

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:13:44 +02:00
Clément Bœsch
15b26e88cb Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'
* commit '9df889a5f116c1ee78c2f239e0ba599c492431aa':
  h264: rename h264.[ch] to h264dec.[ch]

Merged-by: Clément Bœsch <u@pkh.me>
2016-07-29 11:01:36 +02:00
Stefano Sabatini
156b5bb9bf lavf/mpegtsenc: add special case for handling timed ID3 packets
Set the stream_id to 0xbd (private_stream_id_1). Tools seem to assume
that value, and this is consistent with MPEG TS specification (ITU-T
H.222.0 section 2.12.3).
2016-07-29 08:47:41 +02:00
softworkz
70c1647a35 avformat/matroskaenc: Write duration early during mkv_write_header (Rev #3)
Rev #2: Fixes doubled header writing, checked FATE running without errors
Rev #3: Fixed coding style

This commit addresses the following scenario:

we are using ffmpeg to transcode or remux mkv (or something else) to mkv. The result is being streamed on-the-fly to an HTML5 client (streaming starts while ffmpeg is still running). The problem here is that the client is unable to detect the duration because the duration is only written to the mkv at the end of the transcoding/remoxing process. In matroskaenc.c, the duration is only written during mkv_write_trailer but not during mkv_write_header.

The approach:

FFMPEG is currently putting quite some effort to estimate the durations of source streams, but in many cases the source stream durations are still left at 0 and these durations are nowhere mapped to or used for output streams. As much as I would have liked to deduct or estimate output durations based on input stream durations - I realized that this is a hard task (as Nicolas already mentioned in a previous conversation). It would involve changes to the duration calculation/estimation/deduction for input streams and propagating these durations to output streams or the output context in a correct way.
So I looked for a simple and small solution with better chances to get accepted. In webmdashenc.c I found that a duration is written during write_header and this duration is taken from the streams' metadata, so I decided for a similar approach.

And here's what it does:

At first it is checking the duration of the AVFormatContext. In typical cases this value is not set, but: It is set in cases where the user has specified a recording_time or an end_time via the -t or -to parameters.
Then it is looking for a DURATION metadata field in the metadata of the output context (AVFormatContext::metadata). This would only exist in case the user has explicitly specified a metadata DURATION value from the command line.
Then it is iterating all streams looking for a "DURATION" metadata (this works unless the option "-map_metadata -1" has been specified) and determines the maximum value.
The precendence is as follows: 1. Use duration of AVFormatContext - 2. Use explicitly specified metadata duration value - 3. Use maximum (mapped) metadata duration over all streams.

To test this:

1. With explicit recording time:
ffmpeg -i file:"src.mkv" -loglevel debug -t 01:38:36.000 -y "dest.mkv"

2. Take duration from metadata specified via command line parameters:
ffmpeg -i file:"src.mkv" -loglevel debug -map_metadata -1 -metadata Duration="01:14:33.00" -y "dest.mkv"

3. Take duration from mapped input metadata:
ffmpeg -i file:"src.mkv" -loglevel debug -y "dest.mkv"

Regression risk:

Very low IMO because it only affects the header while ffmpeg is still running. When ffmpeg completes the process, the duration is rewritten to the header with the usual value (same like without this commit).

Signed-off-by: SoftWorkz <softworkz@hotmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-28 02:06:55 +02:00
Anssi Hannula
04964ac311 avformat/hls: Fix missing streams in some cases with MPEG TS
HLS demuxer calls the subdemuxer avformat_find_stream_info() while
overriding the subdemuxer AVFMTCTX_NOHEADER flag by clearing it.
However, this prevents some streams in some MPEG TS streams from being
detected properly.

Simply removing the clearing of the flag would cause the inner
avformat_find_stream_info() call to take longer in some cases, without
a way to control it.

To fix the issue, do not clear the flag but propagate it to HLS demuxer.
To avoid the above-mentioned mandatory delay, the call to
avformat_find_stream_info() is dropped except in the HLS ID3 timestamped
case. The HLS demuxer user should be calling avformat_find_stream_info()
on the HLS demuxer if it wants to find the stream info.

The main streams are now created dynamically after read_header time if
the subdemuxer uses AVFMTCTX_NOHEADER (mpegts).

Subdemuxer avformat_find_stream_info() is still called for the HLS ID3
timestamped case as the HLS demuxer needs to know the packet durations
to properly interleave ID3 timestamped streams with MPEG TS streams on
sub-segment level.

Fixes ticket #4930.
2016-07-28 01:24:57 +03:00
Anssi Hannula
83db3c84fa avformat/hls: Move stream propagation to a separate function
Creation of main demuxer streams from subdemuxer streams is moved to
update_streams_from_subdemuxer() which can be called repeatedly.

There should be no functional changes.
2016-07-28 01:24:57 +03:00
Anssi Hannula
9884f17e34 avformat/hls: Use an array instead of stream offset for stream mapping
This will be useful when the amount of streams per subdemuxer is not
known at hls_read_header time in a following commit.
2016-07-28 01:24:57 +03:00
Anssi Hannula
4d85069e5d avformat/hls: Sync starting segment across variants on live streams
This will avoid a large time difference between variants in the most
common case.
2016-07-28 01:24:57 +03:00
Anssi Hannula
9cb30f7a88 avformat/hls: Fix regression with ranged media segments
Commit 81306fd4bdf ("hls: eliminate ffurl_* usage", merged in d0fc5de3a6)
changed the hls demuxer to use AVIOContext instead of URLContext for its
HTTP requests.

HLS demuxer uses the "offset" option of the http demuxer, requesting
the initial file offset for the I/O (http URLProtocol uses the "Range:"
HTTP header to try to accommodate that).

However, the code in libavformat/aviobuf.c seems to be doing its own
accounting for the current file offset (AVIOContext.pos), with the
assumption that the initial offset is always zero.

HLS demuxer does an explicit seek after open_url to account for cases
where the "offset" was not effective (due to the URL being a local file
or the HTTP server not obeying it), which should be a no-op in case the
file offset is already at that position.

However, since aviobuf.c code thinks the starting offset is 0, this
doesn't work properly.

This breaks retrieval of ranged media segments.

To fix the regression, just drop the seek call from the HLS demuxer when
the HTTP(S) protocol is used.
2016-07-28 01:24:57 +03:00
Anssi Hannula
60873bf992 avformat/utils: Fix find_stream_info not considering the extradata it found
Commit 9200514ad8 ("lavf: replace AVStream.codec with
AVStream.codecpar") merged in commit 6f69f7a8bf changed
avformat_find_stream_info() to put the extradata it got from
st->parser->parser->split() to st->internal->avctx instead of st->codec
(extradata in st->internal->avctx will be later copied to st->codecpar).

However, in the same function, the "is stream ready?" check was changed
to check for extradata in st->codecpar instead of st->codec, even
though st->codecpar is not yet updated at that point.

Extradata retrieved from split() is therefore not considered anymore,
and avformat_find_stream_info() will therefore needlessly continue
probing in some cases.

Fix that by checking for the extradata at st->internal->avctx where it
is actually put.
2016-07-28 01:24:57 +03:00
Xinzheng Zhang
ad14aab3b4 avformat/flvdec: parse keyframe before a\v stream was created add_keyframes_index() when stream created or keyframe parsed
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 19:29:55 +02:00
Xinzheng Zhang
cd141e71bd avformat/flvdec: splitting add_keyframes_index() out from parse_keyframes_index()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-27 19:29:55 +02:00
Luca Barbato
e85d38c20a librtmp: Avoid an infiniloop setting connection arguments
The exit condition was missing.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-07-26 12:05:29 -07:00
James Almer
be04c4aa00 avformt/matroskaenc: undo an accidental revert by commit 5d48e4ea
Commit 5d48e4eafa accidentally reverted changes
made to matroskaenc by commit 989a614b70.

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-26 15:22:32 -03:00
Kacper Michajłow
e947b75b1c libavformat/rtpdec_asf: zero initialize the AVIOContext struct
This fixes crash in avformat_open_input() when accessing
protocol_whitelist field.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-25 19:39:13 +02:00
James Almer
0c75bd8e3c avcodec/dnxhddata: move avpriv_dnxhd_parse_header_prefix to a header
It's a small and simple function that can be inlined.

This removes one private symbol and should reduce object dependencies with the next
major bump

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-25 12:19:39 -03:00
Jan Sebechlebsky
75bd5d3e2d avformat/tee: Rescale ts using av_packet_rescale_ts
This ensures that AV_NOPTS_VALUE value is handled
correctly.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-23 20:02:05 +02:00
Mark Reid
e47981dab7 libavformat/movenc: add dnxhr compatibility for apple players
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 13:54:12 +02:00
Chris Cunningham
d59820f6fe libavformat/matroskadec: fix unsigned overflow to improve seeking
When seeking a file where codec delay is greater than 0, the timecode
can become negative after offsetting by the codec delay. Failing to cast
to a signed int64 will cause the check against skip_to_timecode to evaluate
true for these negative values. This breaks the "skip_to" seek mechanism.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 10:32:28 +02:00
Michael Niedermayer
e83a01def3 avformat/teeproto: Fix memset sizeof
Found-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-22 10:47:34 +02:00
Michael Niedermayer
38cc5c298c avformat/mov: Do not allocate empty extradata
Fixes Ticket5723

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 21:55:18 +02:00
Mark Reid
541731488e libavformat/rawenc: add dnxhr raw format extension
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 04:15:15 +02:00
Jörn Heusipp
64131b87d6 libopenmpt: Add "date" to metadata.
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Jörn Heusipp
840df1f193 libopenmpt: set stream duration and fix time base
Fix the confusion around the used time base.

Check size returned from avio_size()

Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Josh de Kock
9134d2df5b libopenmpt: add subsong support
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
James Almer
120f34b6ac avformat/oggenc: add vp8 muxing support
Addresses ticket #5687

Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-20 22:32:48 -03:00
James Almer
66408fce49 avformat: add an Ogg Video muxer
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-20 22:32:43 -03:00
Michael Niedermayer
3af1aba2be avformat/mux: Fix some codecpar non uses
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-21 03:02:24 +02:00
James Almer
1582e306a4 avformat/avlanguage: make av_convert_lang_to() internal
The header was never installed and the function is only used in libavformat

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 21:43:14 -03:00
James Almer
b3820cabad avformat/oggenc: fix page duration calculation when granule differs from timestamp
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 21:12:18 -03:00
James Almer
5adfbd3918 avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-19 21:12:10 -03:00
Michael Niedermayer
64caafaeb1 avformat: Add tee protocol
Option passing support will be submitted seperately to the ML

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-19 18:41:19 +02:00
James Almer
d688f39dc4 cosmetics: fix some misspelled words
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-17 13:10:27 -03:00
Jörn Heusipp
f1eb6ddcb3 libavformat/libopenmpt: Fix memory leak in error path in read_header_openmpt().
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-17 16:20:46 +02:00
Jan Sebechlebsky
df9cc7f0a9 avformat/tee: Use ff_format_output_open() function
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:30:01 +02:00