Commit Graph

1793 Commits

Author SHA1 Message Date
James Almer
0b8df0ce48 avformat/utils: add missing brackets around arguments in av_realloc() call
Found-by: Neil Birkbeck <neil.birkbeck@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 23:02:20 -03:00
James Almer
0ffea35657 avformat/utils: check for overflow before reallocating side data
This makes av_stream_add_side_data() consistent with av_packet_add_side_data().

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-19 20:11:50 -03:00
James Almer
2ab50647ff avformat/utils: add av_stream_add_side_data()
Functionally similar to av_packet_add_side_data(). Allows the use of an
already allocated buffer as stream side data.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-18 22:17:13 -03:00
Andreas Cadhalpun
f84ae3f04a avformat: close parser if codec changed
The parser depends on the codec and thus must not be used with a different one.
If it is, the 'avctx->codec_id == s->parser->codec_ids[0] ...' assert in
av_parser_parse2 gets triggered.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-02 22:19:14 +01:00
Michael Niedermayer
2b09a3ad19 Revert "img2 encoder: allow %t in filename, based on patch from Yuval Adam"
breaks API

Found-by: jamrial
This reverts commit 1a956c64c8.
2016-11-01 23:03:24 +01:00
rogerdpack
1a956c64c8 img2 encoder: allow %t in filename, based on patch from Yuval Adam
Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-01 22:29:23 +01:00
Michael Niedermayer
077939626e avformat/flvdec: Fix regression loosing streams
Fixes: unknown_video.flv

Found-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-28 12:31:01 +02:00
Michael Niedermayer
38e5a4f3bb Revert "avformat/utils: Discard huge timestamps which would cause overflows if used in basic computations"
Some people seem to oppose this the patch seems to have been missed for a month on the ML
lets restart the discussion and solve this after the release

This reverts commit e936c8d176.
2016-10-26 20:31:04 +02:00
Michael Niedermayer
e936c8d176 avformat/utils: Discard huge timestamps which would cause overflows if used in basic computations
Allowing larger timestamps makes it impossible to calculate basic things like the
difference of 2 timestamps or their sum without checking each individual computation for
overflow.
This should avoid a significant number of overflow checks

Fixes Ticket5136

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-26 19:46:00 +02:00
Andreas Cadhalpun
a5b4476a60 avformat: prevent triggering request_probe assert in ff_read_packet
If probe_codec is called with pkt == NULL, it sets probe_packets to 0
and request_probe to -1.
However, request_probe can change when calling s->iformat->read_packet
and thus a probe_packets value of 0 doesn't guarantee a request_probe
value of -1.
In that case calling probe_codec again is necessary to prevent
triggering the assert.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-19 23:13:28 +02:00
Michael Niedermayer
987690799d avformat/utils: Update codec_id before using it in the parser init
Fixes assertion failure

Fixes: input.avi

Found-by: 连一汉 <lianyihan@360.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-10-10 00:58:16 +02:00
Rodger Combs
a6bce3ca90
lavf/utils: avoid using programs for duration when there's only one
This allows us to be more selective about the streams we derive durations from
(specifically, ignoring text streams with outlier end times) in the common case
2016-10-06 01:36:05 -05:00
Rodger Combs
4c9c4fe8b2
lavf/utils: ignore outlier subtitle and data stream end times as well 2016-10-06 01:36:05 -05:00
James Almer
f0b6f7253f avformat: add av_stream_get_codec_timebase()
This will allow ffmpeg.c to stop using AVStream.codec in some cases

Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-27 10:42:39 -03:00
Carl Eugen Hoyos
267da70ea8 lavf/utils: Avoid an overflow for huge negative durations.
Fixes ticket #5135.
2016-09-24 21:01:46 +02:00
Timo Rothenpieler
9777ba33f5 avformat/utils: avoid using marked decoders for probing
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-23 11:16:26 +02:00
Timo Rothenpieler
6d9a46e884 avformat/utils: force native h264 decoder for probing
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-22 13:16:00 +02:00
Clément Bœsch
955b818cf9 ffmpeg: switch to codecpar
This commit is largely based on commit 15e84ed3 from Anton Khirnov
<anton@khirnov.net> which was previously skipped in bbf5ef9d.

There are still a bunch of things raising codecpar related warnings that
need fixing, such as:
- the use of codec->debug in the interactive debug mode
- read_ffserver_streams(): it's probably broken now but there is no test
- lowres stuff
- codec copy apparently required by bitstream filters

The matroska references are updated because they now properly forward
the field_order (previously unknown, now progressive).

Thanks to James Almer for fixing a bunch of FATE issues in this commit.

Signed-off-by: Clément Bœsch <clement@stupeflix.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-21 15:39:28 +02:00
Sasi Inguva
b518d809f1 lavf/utils: Support av_index_search_timestamp in case of AVIndexEntry with discarded packets.
Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-19 19:51:13 +02:00
Xinzheng Zhang
ecc04b4f2f avformat/utils: fix timebase error in avformat_seek_file()
When there is only one stream and stream_index has not specified,
The ts has been transferd by the timebase of stream0 without modifying the stream_index
In this condation it cause seek failure.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-14 15:50:07 +02:00
Clément Bœsch
415f907ce8 lavf/utils: add missing ismv in MOV-like formats 2016-09-14 10:00:08 +02:00
Clément Bœsch
9112822e71 lavf/utils: simplify matching MOV-like formats 2016-09-14 09:59:22 +02:00
Clément Bœsch
ae1dd0c9a6 lavf: add avformat_transfer_internal_stream_timing_info() and use it in ffmpeg
In lavf we have access to st->internal->avctx so it's a better place
than in ffmpeg*.c and will allow moving to codecpar.
2016-09-14 09:57:55 +02:00
Michael Niedermayer
207d78176f avformat: Export ticks_per_frame in st->codec
Fixes regressions with stream copy and output timebase/fps being twice as fine as needed
Makes the timebase and ticks per frame handled identical which should make the
code easier to understand and work with. It does not solve the problem without
st->codec access

Suggested-by: Hendrik Leppkes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-07 11:11:56 +02:00
James Almer
dc7e5adbc0 avformat/utils: fix a codecpar non use
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-27 11:21:12 -03:00
Michael Niedermayer
c75273310c avformat/utils: End probing if the expected codec surpasses AVPROBE_SCORE_STREAM_RETRY
Fixes Ticket5800

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-27 01:53:18 +02:00
Erkki Seppälä
9d5ea8de56 libavformat/utils: added ability to probe AVMEDIA_TYPE_DATA format
Now force_codec_ids supports AVMEDIA_TYPE_DATA and
avformat_query_codec accepts data codecs as well in addition to video,
audio and subtitle tracks.

Signed-off-by: Erkki Seppälä <erkki.seppala.ext@nokia.com>
Signed-off-by: OZOPlayer <OZOPL@nokia.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-23 13:07:30 +02:00
Paul B Mahol
fc600eff63 avcodec: add 64-bit signed pcm codec 2016-08-18 15:30:05 +02:00
Marton Balint
b72a7b96f8 avformat: factorize iso 8601 timestamp writer to a dictionary avutil function
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-08-17 23:45:41 +02:00
Clément Bœsch
ffd71c9c5c lavf: mark stream as const pointer in av_stream_get_side_data() for next bump 2016-08-17 16:32:09 +02:00
Clément Bœsch
b2016189db lavf/utils: add some const to pointers parameters in a few functions 2016-08-17 16:17:42 +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
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
Jan Sebechlebsky
6a3515a5a4 avformat/utils: Add ff_format_output_open() function
Add ff_format_output_open utility function to wrap
io_open callback of AVFormatContext structure.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:29:44 +02:00
Jan Sebechlebsky
1732d89403 avformat/utils: Add ff_stream_encode_params_copy()
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:15:00 +02:00
Hendrik Leppkes
c2e13d2ecd avformat/utils: update deprecated AVStream->codec when the context is updated
This ensures the AVStream->codec entry is kept in sync when new streams are
discovered mid-playback or changes to the context occur from other sources.

Fixes trac 5678.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 17:43:01 +02:00
Rodger Combs
af7e2734b9
lavf: update auto-bsf to new BSF API 2016-06-25 15:50:04 -05:00
Rodger Combs
150e5e13b1
lavf: deprecate av_apply_bitstream_filters 2016-06-25 15:50:03 -05:00
Clément Bœsch
8ca78d0fef lavf/utils: fix const warning at a find_decoder() call 2016-06-25 13:38:53 +02:00
Michael Niedermayer
99c3c3237b avformat/utils: Use internal->avctx for bitrate in estimate_timings_from_bit_rate() if needed
The internal avctx bitrate is copied into codecpar after estimate_timings()

Fixes Ticket5646

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-22 14:16:58 +02:00
Michael Niedermayer
4fecb97fd3 avformat/utils: change bit_rate to 64 bit in estimate_timings_from_bit_rate()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-22 14:16:58 +02:00
Aman Gupta
ddffafc0b0 avformat/utils: in debug mode, print number of streams found before avformat_find_stream_info()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-14 21:37:21 +02:00
Stefano Sabatini
4b5620446a lavf/utils: fix timestamp trace log in estimate_timings() function
Use the correct timebase, also replace "stream" with "format" in the
context of the format.
2016-06-14 12:11:04 +02:00
Michael Niedermayer
60de31e98c avformat/utils: Export coded dimensions unconditionally
This fixes a API regression
Probably fixes Ticket5451

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-13 13:07:55 +02:00
Michael Niedermayer
6826f16e4a avformat/utils: Do not overwrite, but use sample_fmt from context
Fixes Ticket 3759

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-09 19:32:56 +02:00
Michael Niedermayer
218bb8b3f3 avformat/utils: Open decoder even if there are no packets if parameters are missing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-09 19:32:56 +02:00
Michael Niedermayer
2a70e78a28 avformat/utils: Initialize st in loop
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-09 19:32:56 +02:00
Michael Niedermayer
ad72d7d299 avformat: Copy properties from internal context
Fixes Ticket5467 "Lossless j2k information no longer shown"

Based on suggestion by Hendrik Leppkes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-02 16:57:49 +02:00
Michael Niedermayer
c1ed78a591 avformat/utils: avoid overflow in compute_chapters_end() with huge durations
Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-29 00:25:21 +02:00
Michael Niedermayer
2be3007ed5 avformat/utils: avoid overflow in update_stream_timings() with huge durations
Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-29 00:14:02 +02:00