Michael Niedermayer
198c8924c6
avformat/utils: Print verbose error message if stream count exceeds max_streams
...
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit f0bdd53871 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2017-02-03 15:59:14 +01:00
Michael Niedermayer
7dd1cc6076
avformat: Add max_streams option
...
This allows user apps to stop OOM due to excessive number of streams
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 1296f84495 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-12-10 22:42:03 +01:00
Michael Niedermayer
66e8f87ebc
avformat/utils: Check start/end before computing duration in update_stream_timings()
...
Fixes undefined behavior
Fixes: 637428.ogg
Found-by: Matt Wolenetz <wolenetz@google.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 90da187f1d )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-12-04 20:25:15 +01:00
Andreas Cadhalpun
0009cf348a
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 >
(cherry picked from commit a5b4476a60 )
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com >
2016-11-27 00:38:51 +01:00
Xinzheng Zhang
f2f7d49f41
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 >
(cherry picked from commit ecc04b4f2f )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-09-28 17:11:52 +02:00
Carl Eugen Hoyos
73b644cdee
lavf/utils: Avoid an overflow for huge negative durations.
...
Fixes ticket #5135 .
(cherry picked from commit 267da70ea8 )
2016-09-24 21:08:23 +02:00
Michael Niedermayer
1b47c278a6
avformat/utils: End probing if the expected codec surpasses AVPROBE_SCORE_STREAM_RETRY
...
Fixes Ticket5800
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit c75273310c )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-09-05 01:01:35 +02:00
Michael Niedermayer
7f864badc0
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 >
(cherry picked from commit c1ed78a591 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-06-05 02:40:31 +02:00
Michael Niedermayer
cc1e01d8b6
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 >
(cherry picked from commit 2be3007ed5 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-06-05 02:40:31 +02:00
Chris Cunningham
145b18ce9a
avformat/utils: Check negative bps before shifting in ff_get_pcm_codec_id()
...
Fixes: undefined shift.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 2875745d35 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-06-05 02:40:31 +02:00
Michael Niedermayer
e5d167149d
avformat/utils: Do not compute the bitrate from duration == 0
...
Fixes division by 0 in fate-acodec-ra144
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 635b2ec5f2 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-06-05 02:40:31 +02:00
Michael Niedermayer
79181b97d4
avformat/utils: Check bps before using it in a shift in ff_get_pcm_codec_id()
...
Fixes undefined shift
Fixes: usan_shift
Found-by: Thomas Guilbert <tguilbert@google.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit ea791c080d )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-06-05 02:40:30 +02:00
Michael Niedermayer
756f4b586a
avformat/utils: fix dts from pts code in compute_pkt_fields() during ascending delay
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit de1de49324 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-03-26 21:52:47 +01:00
Marton Balint
a573e6c103
avformat/utils: remove ff_iso8601_to_unix_time
...
Signed-off-by: Marton Balint <cus@passwd.hu >
2016-02-14 01:51:14 +01:00
Marton Balint
e942454daf
avformat/utils: add ff_parse_creation_time_metadata
...
Signed-off-by: Marton Balint <cus@passwd.hu >
2016-02-14 01:51:14 +01:00
Derek Buitenhuis
bc9a5965c8
Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'
...
This also deprecates our old duplicated callbacks.
* commit '9f61abc8111c7c43f49ca012e957a108b9cc7610':
lavf: allow custom IO for all files
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com >
2016-02-10 14:42:41 +00:00
Michael Niedermayer
1dba8371d9
avformat: add protocol_whitelist
...
Note to maintainers: update tools
Note to maintainers: set a default whitelist for your protocol
If that makes no sense then consider to set "none" and thus require the user to specify a white-list
for sub-protocols to be opened
Note, testing and checking for missing changes is needed
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-02-02 03:39:34 +01:00
Michael Niedermayer
a7305c780b
Print the whitelists if entities are not found on them
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-01-24 16:52:10 +01:00
Anton Khirnov
9f61abc811
lavf: allow custom IO for all files
...
Some (de)muxers open additional files beyond the main IO context.
Currently, they call avio_open() directly, which prevents the caller
from using custom IO for such streams.
This commit adds callbacks to AVFormatContext that default to
avio_open2()/avio_close(), but can be overridden by the caller. All
muxers and demuxers using AVIO are switched to using those callbacks
instead of calling avio_open()/avio_close() directly.
(de)muxers that use the URLProtocol layer directly instead of AVIO
remain unconverted for now. This should be fixed in later commits.
2016-01-24 16:45:32 +01:00
Michael Niedermayer
2039b3e751
avformat: Add integer fps from 31 to 60 to get_std_framerate()
...
Fixes Ticket 5106
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-01-09 15:21:34 +01:00
Hendrik Leppkes
b966a403dd
avcodec/utils: fix AVPacket lifetime in seek_frame_generic
...
Fixes ticket #5117
2016-01-02 09:27:51 +01:00
Rodger Combs
822e80fde3
lavf: add internal API to append a bsf to a stream's list
2015-12-28 08:40:37 -06:00
Rodger Combs
4caa3e1c6c
lavf: add API to apply a list of bsfs to a packet
2015-12-28 08:34:30 -06:00
Michael Niedermayer
676a93f2d8
avformat: Add av_program_add_stream_index()
...
This will be used by the subsequent commit(s)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2015-12-11 22:27:25 +01:00
Michael Niedermayer
cafb195604
avformat/utils: Fix "libavformat/utils.c:927:35: runtime error: signed integer overflow: -2450238577049583619 - 9223090561878065151 cannot be represented in type long long"
...
Fixes Mozilla bug 1229205
Found-by: Tyson Smith
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2015-12-04 00:44:06 +01:00
Nicolas George
3ab1e5a48c
lavf: add FFERROR_REDO to let demuxers return no packet.
2015-12-03 19:16:12 +01:00
Michael Niedermayer
ec7a3be11e
avformat/utils: Move end_time1 AV_NOPTS_VALUE Check after rescale
...
Fixes integer overflow
Fixes: 266ee543812e934f7b4a72923a2701d4/signal_sigabrt_7ffff6ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2015-12-03 00:13:27 +01:00
Michael Niedermayer
d872643cfe
avformat/utils: Check AVFormatContext->duration in compute_chapters_end() before use
...
Fixes integer overflow
Fixes: 266ee543812e934f7b4a72923a2701d4/signal_sigabrt_7ffff6ae7cc9_7322_85218d61759d461bdf7387180e8000c9.ogg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2015-12-03 00:13:27 +01:00
Matthieu Bouron
72eaf72623
lavf/utils: avoid decoding a frame to get the codec parameters
...
Avoid decoding a frame to get the codec parameters while the codec
supports FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM. This is particulary useful
to avoid decoding twice images (once in avformat_find_stream_info and
once when the actual decode is made).
2015-11-26 21:50:55 +01:00
Derek Buitenhuis
ad317c94c5
Merge commit '7f4ec4364bc4a73036660c1c6a3c4801db524e9e'
...
* commit '7f4ec4364bc4a73036660c1c6a3c4801db524e9e':
avformat: expose av_stream_new_side_data helper
Conflicts:
libavformat/internal.h
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com >
2015-11-22 17:19:10 +00:00
Timothy Gu
f2d9ae6e49
avformat/utils: Fix indentation
2015-11-20 21:33:46 -08:00
John Stebbins
7f4ec4364b
avformat: expose av_stream_new_side_data helper
...
Signed-off-by: Anton Khirnov <anton@khirnov.net >
2015-11-18 11:36:27 +01:00
Michael Niedermayer
1ef336e912
avformat/utils: Do not init parser if probing is unfinished
...
Fixes assertion failure
Fixes: 136f8b8d47af7892306625e597dee655/signal_sigabrt_7ffff6ae7cc9_8941_ab11bea57c84796418f481f873dc31ba.dvr_ms
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2015-11-15 23:42:24 +01:00
Rainer Hochecker
2d8c2f1a28
avformat/utils: estimate_timings_from_pts - increase retry counter, fixes invalid duration for ts files with hevc codec
...
Fixes a mpegts file with hevc that fails estimating duration. Increasing number of
retries fixes the issue.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2015-11-15 15:39:23 +01:00
Hendrik Leppkes
611c22140a
Merge commit '8de1ee9f725aa3c550f425bd3120bcd95d5b2ea8'
...
* commit '8de1ee9f725aa3c550f425bd3120bcd95d5b2ea8':
lavf: deprecate compute_pkt_fields2
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com >
2015-11-11 14:37:48 +01:00
Hendrik Leppkes
c03ffe1712
avformat/utils: re-factor freeing AVStreams
...
This matches the Libav signature and simplifies merging future changes.
2015-11-11 14:36:53 +01:00
Hendrik Leppkes
3df9ec5ce7
Merge commit 'aeda1121c91395d1f0d434bc7f227423aa2ff97d'
...
* commit 'aeda1121c91395d1f0d434bc7f227423aa2ff97d':
lavf: factor out freeing an AVStream
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com >
2015-11-10 18:42:08 +01:00
Hendrik Leppkes
de0e219a8a
Merge commit 'a0c71a575109f123978e345fa7eb4ac03cd4d3c3'
...
* commit 'a0c71a575109f123978e345fa7eb4ac03cd4d3c3':
lavf: initialize cur_dts to AV_NOPTS_VALUE for muxing
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com >
2015-11-10 18:23:22 +01:00
Anton Khirnov
8de1ee9f72
lavf: deprecate compute_pkt_fields2
...
All encoders set pts and dts properly now (and have been doing that for
a while), so there is no good reason to do any timestamp guessing in the
muxer.
The newly added AVStreamInternal will be later used for storing all the
private fields currently living in AVStream.
2015-11-09 07:50:55 +01:00
Anton Khirnov
aeda1121c9
lavf: factor out freeing an AVStream
...
It will be needed in other functions.
2015-11-08 11:49:23 +01:00
Anton Khirnov
a0c71a5751
lavf: initialize cur_dts to AV_NOPTS_VALUE for muxing
...
The reasoning for setting it to zero only applies to demuxing.
2015-11-08 11:48:47 +01:00
Hendrik Leppkes
55abb94b7d
avformat: unref packet after storing it in internal packet queue
...
Fixes a memory leak when using genpts
2015-11-02 09:03:56 +01:00
Hendrik Leppkes
b64fe49371
avformat: always unref the packet after parsing
...
This fixes a memory leak when side-data is present.
2015-11-02 09:03:56 +01:00
Hendrik Leppkes
54de179caa
Merge commit 'd584533cf38141172e20bae5436629ee17c8ce50'
...
* commit 'd584533cf38141172e20bae5436629ee17c8ce50':
avformat: Rework add_to_pktbuf
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com >
2015-10-29 14:06:11 +01:00
Hendrik Leppkes
c2f861ca42
Replace remaining occurances of av_free_packet with av_packet_unref
2015-10-27 14:35:30 +01:00
Hendrik Leppkes
7f5af80ba4
Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'
...
* commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457':
avpacket: Replace av_free_packet with av_packet_unref
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com >
2015-10-27 14:28:56 +01:00
Hendrik Leppkes
856b19d593
Merge commit 'a5d42043093a39636a1f4021a37dd9c612479f6f'
...
* commit 'a5d42043093a39636a1f4021a37dd9c612479f6f':
avformat: Always return ref-counted AVPacket
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com >
2015-10-27 14:12:27 +01:00
Luca Barbato
d584533cf3
avformat: Rework add_to_pktbuf
...
Make it return an error and check its return value when it is used.
Simplify the usage by calling `av_packet_ref` internally when needed.
2015-10-26 18:00:55 +01:00
Luca Barbato
ce70f28a17
avpacket: Replace av_free_packet with av_packet_unref
...
`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.
Deprecate `av_free_packet`.
2015-10-26 18:00:55 +01:00
Luca Barbato
a5d4204309
avformat: Always return ref-counted AVPacket
...
And drop the av_dup_packet from the input_thread.
2015-10-26 18:00:55 +01:00