Commit Graph

18452 Commits

Author SHA1 Message Date
Derek Buitenhuis bdcf2b6af6 Merge commit '1d62ee38894afb696674db78cee8f8d89204a8fe'
* commit '1d62ee38894afb696674db78cee8f8d89204a8fe':
  movenc: Add a unit test for signaling of the track start times

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-18 16:43:32 +00:00
Derek Buitenhuis 3e0daf0716 Merge commit 'bef3b1f59f036aba4a5fe599b2480f6bd9e6b280'
* commit 'bef3b1f59f036aba4a5fe599b2480f6bd9e6b280':
  movenc: Allow setting start_dts/start_cts before writing actual packets

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-18 16:40:16 +00:00
Derek Buitenhuis e73a4d8491 movenc-test: Pad the packet data start with 0s
This way, it never starts with 0xFFF0, and never trips the
ADTS "Detection" code in movenc.c.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-18 16:37:58 +00:00
Michael Niedermayer 3a4d8281c6 avformat/genh: Fix tools/probetest failure
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-18 14:45:51 +01:00
Bryan Huh 0be48dd9bb avformat/dashenc: Add framerate to dash manifest
DASH manifest should have framerate specified as an attribute in the
AdaptationSet element and Representation elements. Though ISO/IEC
23009-1:2014 doesn't seem to define frameRate as a required attribute,
it is at least optional, and DASH-IF IOP 3.0 seems to require it. See
section 3.2.4 of http://dashif.org/w/2015/04/DASH-IF-IOP-v3.0.pdf

In the event that avg_frame_rate is not set in the muxer, we ignore the
frameRate tag altogther.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-18 14:46:35 +01:00
Paul B Mahol 35bbc1955a avformat: add IVR demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-18 12:54:02 +01:00
John Stebbins ca489564ae movenc: add fallback audio track tref support
This feature allows making associations between audio tracks
that apple players recognize.  E.g. when an ac3 track has a
tref that points to an aac track, devices that don't support
ac3 will automatically fall back to the aac track.

Apple used to *guess* these associations, but new products
(AppleTV 4) no longer guess and this association can only
be made explicitly now using the "fall" tref.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-11-18 11:38:03 +01: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
Anton Khirnov 21ab6fd01b lavf: document that passing valid timestamps to muxers is now mandatory
Also, extend the documentation about setting timestamps.
2015-11-18 11:31:40 +01:00
Ganesh Ajjanagadde 3fb32ae2cf avformat/rtpdec_mpa_robust: change assignment to inequality test in conditional
In the spirit of commit 8199908fdf, likely
typo originally.

Found by enabling -Wparentheses on clang 3.7 and running a manual audit.
To the best of my knowledge, no such instances remain.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-17 16:30:15 -05:00
Michael Niedermayer a5034b324c avformat/matroskadec: Check subtitle stream before dereferencing
Unrecognized streams are not allocated
Fixes: flicker-1.color1.vp91447030769.08.webm

Found-by: Chris Cunningham <chcunningham@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-17 19:02:28 +01:00
Derek Buitenhuis f6e5b17abb Merge commit '3eeb7edfc2a1157b7b0e0ce21ac2cd44d55d405b'
* commit '3eeb7edfc2a1157b7b0e0ce21ac2cd44d55d405b':
  movenc: Add a unit test for frag_discont with edit lists

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-17 14:57:20 +00:00
Derek Buitenhuis 6c9fb32ae4 Merge commit '09e431b9e3674804172e7b0a0f865b65ec09739a'
* commit '09e431b9e3674804172e7b0a0f865b65ec09739a':
  movenc: Assume streams starting at pts=0 for discontinuous fragments with editlists

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-17 14:55:22 +00:00
James Almer 9e3b39ed69 avformat/movenc-test: fix copyright header
Signed-off-by: James Almer <jamrial@gmail.com>
2015-11-16 20:54:30 -03:00
Derek Buitenhuis 61344c04ca Merge commit '59e8ec0aa8ab174701d01a3bfe96fedd0b7fcead'
All diferences in unit tests have been acounted for.

* commit '59e8ec0aa8ab174701d01a3bfe96fedd0b7fcead':
  movenc: Add an API unit test for fragmenting options/calls

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-16 16:19:27 +00:00
Ganesh Ajjanagadde 8adff79b6d avformat/mov: remove redundant assignment
This is possibly undefined behavior based on sequence point rules, but I
have not studied the spec at that level of detail.

Fixes: CID 1338321.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-16 07:42:48 -05:00
Ganesh Ajjanagadde f0197e1637 avformat/mov: fix memory leak
Fixes: CID 1338328.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-16 07:41:33 -05:00
Bryan Huh a01ba7f579 avformat/aviobuf: Simplify avio_read() and avio_seek()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 12:14:03 +01:00
Bryan Huh a01c24e8c5 avformat/aviobuf: Improve readability of aviobuf (Add comments and docs)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 12:14:03 +01:00
Hagen Schmidt 7bf465abf3 mpegtsenc: add vc-1 support to MPEG-TS muxer (ticket 2141)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 00:34:12 +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 4c8d86eb18 avformat: implement SChannel SSP TLS protocol
This implementation does not support TLS listen sockets and loading
CA/Certs from files.

The Windows API does not support loading PEM certs, and would either
require a manual loader or instead be limited to loading Windows PFX
certificates

TLS listen sockets would have to be implemented quite separately, as many
of the APIs are different for server-mode (as opposed to client mode).
2015-11-14 14:31:58 +01:00
Michael Niedermayer 2fb6e1e754 segafilm: Fix current_sample after seeking and avio_seek return type
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-14 03:39:44 +01:00
Martin Storsjö 62b4a6f1b9 rtmpcrypt: Provide the xtea keys in little endian format for consistency
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-13 21:54:04 +02:00
Martin Storsjö 588b6215b4 rtmpcrypt: Do the xtea decryption in little endian mode
The XTEA algorithm operates on 32 bit numbers, not on byte sequences.
The XTEA implementation in libavutil is written assuming big endian
numbers, while the rtmpe signature encryption assumes little endian.

This fixes rtmpe communication with rtmpe servers that use signature
type 8 (XTEA), e.g. crunchyroll.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-13 21:53:57 +02:00
Bryan Huh d07585f04a avformat/async: Fix bug where async could not recover after seek to eof
When async issues its inner seek via ffurl_seek, it treats failures as
EOF being reached. This is not consistent with the behavior of other
protocols (e.g. http, cache) which continue to tolerate reads after
failed seeks, and therefore does not interact correctly with them.

A common pattern where this manifests itself is where avio_seek is
called with pos to be the end-of-file - the http range-request would
fail here, and async would set io_eof_reached to 1. The background
thread would then refuse to read more bytes, and subsequent reads would
only empty the fifo and end in an error.

Presumably the code may have expected subsequent seeks to unset the
io_eof_reached but this is not guaranteed to be true - a subsequent seek
that lands in the AVIOContext's buffer (the fact that the
previously-failed avio_seek leaves the AVIOContext's buffer intact also
suggests that follow-up reads are expected to be tolerated) would not be
issued to the async_seek function, and when that buffer is drained only
async_read calls would follow, leading to the same error just described.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-13 12:43:22 +01:00
Michael Niedermayer 5324109dd7 avformat/segafilm: Fix current_sample after seeking and avio_seek return type
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-12 23:37:21 +01:00
Michael Niedermayer 0106a20aea avformat/mux: Rename compute_pkt_fields2(), the name is absolutely terrible
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-12 23:06:32 +01:00
Vittorio Giovara b5f963bfec mov: Drop dref when unable to parse
Some entries might be either empty or contain types we do not parse
(eg. 'url '). In both cases, if an 'alis' is not the first entry,
external references are not loaded, so make sure that the array starts
with an 'alis' dref.
2015-11-12 04:39:14 +01:00
Vittorio Giovara 303f931938 mov: Correctly store dref paths
Rather than reading the alternate absolute path version from dref
type 18, make sure that 0s are considered as '/'. These values are
sometimes present in the full path, and are mistakenly interpreted as
line terminators othewise.

With the correct handling of this dref type, parsing type 18 is not
needed any more.
2015-11-12 04:39:14 +01:00
Carl Eugen Hoyos 73b0324913 aiff: Support demuxing G.722 streams 2015-11-12 04:39:14 +01:00
Paul B Mahol 5f2c8315b3 thp: set duration for audio stream too
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-12 04:39:14 +01:00
Martin Storsjö 1d62ee3889 movenc: Add a unit test for signaling of the track start times
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-11 22:53:42 +02:00
Martin Storsjö bef3b1f59f movenc: Allow setting start_dts/start_cts before writing actual packets
By writing a zero-sized packet, the caller can communicate the
start_dts/start_cts for the stream without actually writing
the first packet.

This allows doing random-access writing of fragments when the
start dts of the stream isn't zero, so that the edit list in the moov
is written based on timestamps from the nominal start time signaled
via the zero-sized packet, while the first proper packet written
corresponds to a later fragment.

To avoid potential unexpected behaviour, empty packets only set
start_dts if the frag_discont flag is set.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-11 22:53:31 +02:00
Martin Storsjö 3eeb7edfc2 movenc: Add a unit test for frag_discont with edit lists
This tests the case where the muxer correctly guesses that a stream
starts at pts=0.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-11 22:52:53 +02:00
Martin Storsjö 09e431b9e3 movenc: Assume streams starting at pts=0 for discontinuous fragments with editlists
This allows producing fragments discontinously where the video
stream has b-frames (but starts at pts=0), but doesn't work for the
cases with audio with preroll.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-11 22:52:36 +02:00
Hendrik Leppkes 9ffc61b125 Merge commit '8ad5124b7ecf7f727724e270a7b4bb8c7bcbf6a4'
* commit '8ad5124b7ecf7f727724e270a7b4bb8c7bcbf6a4':
  movenc: Automatically flush after writing the initial moov

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-11 15:03:36 +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
Paul B Mahol 2905c51204 avformat/rsd: XMA2 is actually stored, not XMA1
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-11 09:31:44 +01:00
Bryan Huh 85e3c31fd5 avformat/mov: Add option to ignore chapters during parsing
Chapter-indexing can be expensive since chapters may be interspersed
throughout the entire file and may require many seeks - especially
costly when consuming a video over a remote protocol like http.
Furthermore it is often unnecessary, especially when only trying to get
video info (e.g. via ffprobe).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-10 23:45:19 +01:00
Michael Niedermayer d9726893f3 avformat/mxfenc: Only store user comment related tags when needed
Also support disabling them as they seem to cause problems to some
Users. They are also not allowed in IRT D-10 thus the default for
mxf_d10 is not to write them

This also decreases the filesize when no user comment are stored

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-10 23:27:51 +01:00
Andreas Cadhalpun 7b67fe20f6 brstm: reject negative sample rate
A negative sample rate causes assertion failures in av_rescale_rnd.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-10 22:06:26 +01:00
Martin Storsjö 59e8ec0aa8 movenc: Add an API unit test for fragmenting options/calls
Contrary to the normal fate tests that run via avconv, this tests
nontrivial call sequences that are only doable via the API
(mainly for different corner cases when using the muxer for
segmenting).

The test muxes fake packet data (with extradata that looks
enough like proper data to make the file be viewable with e.g.
boxdumper) and checks the hash of the produced files. The test also
verifies that fragments produced via different call sequences remain
identical (to avoid e.g. updating the output hashes and suddenly
having fragments that used to be identical suddenly diverging), for
fragments written with frag_discont and/or delay_moov.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-10 21:50:25 +02:00
Martin Storsjö 8ad5124b7e movenc: Automatically flush after writing the initial moov
In most other cases when writing fragmented mp4 files, the output
IO context is flushed after each fragment. Also flush it after
writing the initial moov, to have it behave in the same way.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-10 21:46:03 +02:00
Paul B Mahol 4e583eda5f avformat/wavdec: allow data chunk to be before fmt/xma2 chunk
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-10 19:42:21 +01:00
Paul B Mahol a0f75c46d3 avformat/wavdec: parse XMA2 tag
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-10 19:42:21 +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
Hendrik Leppkes 42a088784b Merge commit '563e6d860391bac0511984e5c0842320b5c94d2d'
* commit '563e6d860391bac0511984e5c0842320b5c94d2d':
  segafilm: drop the "song and dance" for cinepak

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-10 18:18:05 +01:00
Hendrik Leppkes b3453f44ed Merge commit 'c012c6f1a8b34828a7870dc1854422934f14b79a'
* commit 'c012c6f1a8b34828a7870dc1854422934f14b79a':
  segafilm: implement seeking

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-10 18:16:11 +01:00
Hendrik Leppkes df06cb5611 Merge commit 'f128b8e19ac7f702adae899ab91cc1e80f238761'
* commit 'f128b8e19ac7f702adae899ab91cc1e80f238761':
  mov: detect cover art pictures by content

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-10 18:01:36 +01:00
Hendrik Leppkes b40e43c5c4 Merge commit '452d659aa4a742106c70ffe9ef3df47ef5b81ea6'
* commit '452d659aa4a742106c70ffe9ef3df47ef5b81ea6':
  msnwc_tcp: Use the correct return values

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-10 17:56:14 +01:00
Hendrik Leppkes 618817b6a8 Merge commit 'f8d10511fef0bb3265f2d7bdfd38f90f60731d80'
* commit 'f8d10511fef0bb3265f2d7bdfd38f90f60731d80':
  cosmetics: msnwc_tcp: Reformat

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-10 17:55:25 +01:00
Hendrik Leppkes 2e82d51714 Merge commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768'
* commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768':
  msnwc_tcp: Correctly report failure

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-10 17:54:06 +01:00
Timothy Gu 480bad7c6d avformat: Add v210[x] demuxer
Allows one to do:

    ffmpeg -s 1920x1080          -i blah.v210 ...
    ffmpeg -s 1920x1080 -f v210x -i blah.yuv10 ...

Fixes #1869.

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
2015-11-09 20:44:25 -08:00
Bryan Huh 72f9a6349c avformat/cache: Avoid int-overflow in cache compare function
cache protocol indexes its cache using AVTreeNodes which require a cmp
function for inserting and searching new cache-entries. This cmp
function expects a 32-bit int return value (negative, zero, or positive)
but the cache cmp function returns an int64_t which can overflow the
int, giving negative numbers for when it should be positive, vice versa.
This manifests itself only for very large files (e.g. 4GB+)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-09 19:25:05 +01:00
Paul B Mahol 0cfd4a993f avformat/rsd: add XMA support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-09 10:41:38 +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
Michael Niedermayer 183720eb6e avformat/segafilm: Only add index entries when the stream exists
Fixes null pointer dereference
Fixes: cb02dfb163ac833c04cace3d7e35b160/signal_sigsegv_e55c49_6326_8f25619fc86a00b303c57b7778baf70a.cpk

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-07 14:09:17 +01:00
Andreas Cadhalpun db374790c7 jvdec: avoid unsigned overflow in comparison
The return type of strlen is size_t, i.e. unsigned, so if pd->buf_size
is 3, the right side overflows leading to a wrong result of the
comparison and subsequently a heap buffer overflow.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-11-07 13:13:35 +01:00
Michael Niedermayer 563e6d8603 segafilm: drop the "song and dance" for cinepak
This seems not to do anything any more since a long time, and removing
it avoids using uninitialized memory. Also change the error value
forwarding as done everywhere else.

Partly fixes: msan_uninit-mem_7fb7d24780d0_2744_R03T.CAK
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-11-06 21:55:15 +01:00
Paul B Mahol c012c6f1a8 segafilm: implement seeking
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-11-06 21:55:15 +01:00
Paul B Mahol 1e791ee3aa segafilm: set video and audio stream duration
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-11-06 21:55:15 +01:00
Paul B Mahol b456ece557 XMA1 and XMA2 stereo decoders
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-06 13:45:50 +01:00
Sebastian Dröge 7d6a4797f1 mpegtsenc: Implement writing of Opus trim_start/trim_end control values
Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 03:33:17 +01:00
Sebastian Dröge 01509cdf92 mpegtsenc: Add support for muxing Opus in MPEG-TS
Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Previous version reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 03:32:40 +01:00
Michael Niedermayer 79c4a338e4 avformat/xmv: Discard remainder of packet on error
Fixes infinite loop
Fixes: 9c48ae2680c5f23bca3d20ff0f325fd8/asan_generic_4c254d_1374_993f1e5967dd6f844b8d72f978ce2a6c.pss

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 02:24:01 +01:00
Michael Niedermayer 9b6fac11da avformat/xmv: factor return check out of if/else
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 02:11:01 +01:00
Michael Niedermayer 3692d859f4 avformat/mpegts: Only start probing data streams within probe_packets
Fixes assertion failure
Fixes: 4321db8ac331f5967ebfbfe80ce5eb78/signal_sigabrt_7ffff6ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 17:06:02 +01:00
Bryan Huh d917f25658 avformat/cache: Use int64_t to avoid int overflow in cache_read
Fixes an issue where an int64_t ffurl_seek return-value was being stored
in an int (32-bit) "r" variable, leading to integer overflow when seeking
into a large file (>2GB), and ultimately a "Failed to perform internal
seek" error mesage.

To test, try running `ffprobe 'cache:http://<something>'` on a file that
is ~3GB large, whose moov atom is at the end of the file

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-04 03:59:17 +01:00
Ganesh Ajjanagadde 92e483f8ed all: use FFDIFFSIGN to resolve possible undefined behavior in comparators
FFDIFFSIGN was created explicitly for this purpose, since the common
return a - b idiom is unsafe regarding overflow on signed integers. It
optimizes to branchless code on common compilers.

FFDIFFSIGN also has the subjective benefit of being easier to read due
to lack of ternary operators.

Tested with FATE.

Things not covered by this are unsigned integers, for which overflows
are well defined, and also places where overflow is clearly impossible,
e.g an instance where the a - b was being done on 24 bit values.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-03 16:28:30 -05:00
wm4 f128b8e19a mov: detect cover art pictures by content
I've got some m4a samples that had jpeg cover art marked as png. Since
these files were supposedly written by iTunes, and other software can
read it (e.g. clementine does), this should be worked around.

Since png has a very simple to detect header, while it's apparently a
real pain to detect jpeg in the general case, try to detect png and
assume jpeg otherwise. Not bothering with bmp, as I have no test case.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-11-03 15:03:12 +01:00
Paul B Mahol cb7a00da21 avformat: add acm demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-03 12:26:09 +01:00
Luca Barbato 452d659aa4 msnwc_tcp: Use the correct return values
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-11-02 16:27:42 +01:00
Luca Barbato f8d10511fe cosmetics: msnwc_tcp: Reformat
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-11-02 16:27:31 +01:00
Luca Barbato 4dfbc7a755 msnwc_tcp: Correctly report failure
And prevent a memory leak

CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-11-02 16:26:37 +01:00
Derek Buitenhuis 9ae73d0644 hlsenc: Only write PAT/PMT once per segment
This saves a lot of muxing overhead, especially on lower bitrate
segments.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-02 14:35:28 +00:00
Luca Barbato 1e7ff5ac69 nut: Use the correct codec_tag when multiple are available
Some codecs use the codec_tag to signal specific information and
picking the first one would lead to a broken file.

Bug-Id: 883
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-11-02 12:10:38 +01:00
Hendrik Leppkes 6b5d6c93dd Merge commit '00b62968d079e63bf22028f253ac297292436ebe'
* commit '00b62968d079e63bf22028f253ac297292436ebe':
  os_support: Don't try to return the service name as a string in getnameinfo

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-02 11:43:50 +01:00
Paul B Mahol 85a5cdb4fa avformat/segafilm: set video stream duration
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 10:53:06 +01:00
Paul B Mahol 0cb09b0511 avformat/segafilm: set audio stream duration
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 10:53:05 +01:00
Paul B Mahol e6cccf9daa avformat/segafilm: implement seeking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 10:53:05 +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
Paul B Mahol 83d20a6a7e avformat/ipmovie: add context to av_log()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 09:00:53 +01:00
Paul B Mahol c293ef258c avformat/ipmovie: put video decoding_map_size into packet and use it in decoder
The size of decoding map can differ from one calculated
internally, producing artifacts while decoding video.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-02 08:44:05 +01:00
Michael Niedermayer 58346f6a29 avformat/icecast: Initialize .str based default for AV_OPT_TYPE_STRING types
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-31 22:37:53 +01:00
Michael Niedermayer 4d76e89c18 avformat/http: Initialize .str based default for AV_OPT_TYPE_STRING types
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-31 22:37:53 +01:00
Ganesh Ajjanagadde 47af5db721 all: fix enum definition for large values
ISO C restricts enumerator values to the range of int. Thus (for instance) 0x80000000
unfortunately does not work, and throws a warning with -Wpedantic on
clang 3.7.

This fixes it by using alternative expressions that result in identical
values but do not have this issue.

Tested with FATE.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-30 15:06:19 -04:00
Vittorio Giovara f53583ea6e omadec: Fix position of opening parenthesis 2015-10-30 12:46:56 +01:00
Martin Storsjö 00b62968d0 os_support: Don't try to return the service name as a string in getnameinfo
Some systems may be lacking getservbyport; the previous ifdef wasn't
quite enough since it still assumed that struct servent was defined,
as pointed out by Clément Gregoire.

Simply remove the possibility to return non-numeric services in
getnameinfo; no caller of getnameinfo within libavformat
currently try to use getnameinfo for retrieving the port number without
NI_NUMERICSERV, and falling back on getservbyport may be non-threadsafe.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-10-30 10:03:58 +02:00
Michael Niedermayer 203dc14693 avformat/3dostr: Remove redundant ;
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-30 03:02:41 +01:00
Michael Niedermayer a7af002b5f avformat/oggparseogm: Enable parser for mpeg4
Fixes regression with iJi.ogv

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-30 02:31:49 +01:00
Andreas Cadhalpun 41455dca60 avformat: stop exporting ffurl_read_complete, ffurl_seek and ffurl_size
They are not in public headers and not used outside of libavformat.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-29 23:48:13 +01:00
Paul B Mahol 48f0d3accc avformat: add DC STR demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-29 21:26:43 +01:00
Paul B Mahol af3f793f60 avcodec: add ADPCM AICA decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-29 21:26:43 +01:00
Paul B Mahol e99321a3b6 avformat: add 3dostr demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-29 21:26:43 +01:00
Hendrik Leppkes 87a6f532b4 Merge commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6'
* commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6':
  avpacket: Deprecate av_dup_packet

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-29 14:16:44 +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
Michael Niedermayer 232b8a5a43 avformat/img2enc: re enable atomic writes with split planes
They work now after fixing the implementation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-28 02:29:51 +01:00
Michael Niedermayer 1b82a0052c avformat/img2enc: Fix img2enc atomic implementation to work with split planes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-27 21:28:23 +01:00
Michael Niedermayer 9ec2b9fce1 avformat/img2enc: Disable rename&atomic writing for non file protocol and split planes
For protocols other than local files ff_rename() is not implemented
For split planes support the implementation is simply wrong

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-27 20:44:46 +01:00
Hendrik Leppkes 6255bf3d0d mpegts: Fix FATE seek test 2015-10-27 15:42:59 +01:00
Hendrik Leppkes 75c3e54d1c asfdec: fix FATE seek test 2015-10-27 15:29:12 +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
Hendrik Leppkes 8b3228a329 Merge commit '533a6198505edd1379e1cd722852350ae4a85acc'
* commit '533a6198505edd1379e1cd722852350ae4a85acc':
  innoHeim/Rsupport Screen Capture Codec decoder

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 13:58:44 +01:00
Paul B Mahol a66243a201 avformat/aiff: add ADP4 DVI ADPCM support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-27 13:41:54 +01:00
Hendrik Leppkes b95b8e5a22 Merge commit '18f9308e6a96bbeb034ee5213a6d41e0b6c2ae74'
* commit '18f9308e6a96bbeb034ee5213a6d41e0b6c2ae74':
  mpjpeg: Cope with multipart lacking the initial CRLF

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 12:55:51 +01:00
Hendrik Leppkes 7daac50067 Merge commit '22f4d9c303ede1a240538fd105c97047db40dc86'
* commit '22f4d9c303ede1a240538fd105c97047db40dc86':
  img2enc: Make sure the images are atomically written

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 12:50:56 +01:00
Hendrik Leppkes 368e521646 Merge commit '5ea5a24eb70646a9061b85af407fcbb5dd4f89fd'
* commit '5ea5a24eb70646a9061b85af407fcbb5dd4f89fd':
  movenc: Honor flush requests with delay_moov, when some tracks lack samples

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 12:46:21 +01:00
Hendrik Leppkes 12e95d156a Merge commit 'e02dcdf6bb6835ef4b49986b85a67efcb3495a7f'
* commit 'e02dcdf6bb6835ef4b49986b85a67efcb3495a7f':
  rtsp: Allow $ as interleaved packet indicator before a complete response header

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 12:41:37 +01:00
AppChecker 8199908fdf fix: assigning instead of comparing
Signed-off-by: AppChecker <support.appc@cnpo.ru>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-27 12:11:38 +01:00
Timothy Gu b9cd3e1add srtenc: Reindent 2015-10-26 23:24:45 -07:00
Luca Barbato 9b56d5c114 avpacket: Deprecate av_dup_packet
As documented, `av_dup_packet` is broken by design, `av_packet_ref`
matches the AVFrame ref-counted API and can be safely used instead.
2015-10-26 18:00:55 +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
Tinglin Liu 9ea812692c mov: Add support parsing QuickTime Metadata Keys.
The Apple dev specification:
    https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html

Basically the structure is like:
    |--meta
    |----hdlr
    |----keys
    |----ilst

1) The handler type in the metadata handler atom is ‘mdta’.
2) The key and value are stored separately for each key-value pair.
   The 'keys' atom stores the key table, while 'ilst' atom stores the
   values corresponding to the indices in the key table.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-26 14:32:05 +00:00
Paul B Mahol ff1e44b01e avformat/thp: set duration for audio stream too
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-26 10:08:01 +01:00
Paul B Mahol 035ae3c009 avcodec: add SDX2 DPCM decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-26 10:08:01 +01:00
Carl Eugen Hoyos 6498b34bba lavf/xwma: Support wmapro.
Fixes ticket #4963.
2015-10-25 17:37:17 +01:00
Paul B Mahol f7751a5e53 avformat/aiffdec: give friendly message if compressed codec tag is unsupported
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-25 14:07:03 +01:00
Paul B Mahol 1f36b43c28 doc/general: update after recent additions
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-25 11:54:17 +01:00
Paul B Mahol 6f3ba23ae0 avformat: add xvag demuxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-25 11:05:56 +01:00
Ganesh Ajjanagadde 7c8fcbbde3 avutil/tree: add additional const qualifier to the comparator
libc's qsort comparator has a const qualifier on both arguments. This
adds a missing const qualifier to exactly match the comparator API.

Existing usages of av_tree_find, av_tree_insert are appropriately
modified: type signature changes of the comparators, and removal of
unnecessary void * casts of function pointers.

Reviewed-by: Henrik Gramner <henrik@gramner.com>
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-24 20:38:07 -04:00
Ganesh Ajjanagadde 4c96985af1 all: remove some casts of function pointer to void *
These casts are unnecessary, and may safely be removed.
Found by enabling -Wpedantic on clang 3.7.

Tested with FATE.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-24 15:14:59 -04:00
Carl Eugen Hoyos a3bed3f3e1 lavf/ingenientdec: Add a probe function. 2015-10-24 13:28:32 +02:00
Paul B Mahol daabc59c64 avformat/genh: add ADPCM IMA DVI support
Our decoder have wrong name.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-23 21:12:17 +02:00
Paul B Mahol a03fe8adba avformat/ads: extend format long description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-23 19:16:17 +02:00
Paul B Mahol dfc64f4ddf avformat/svag: extend format long description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-23 19:12:32 +02:00
Paul B Mahol dd456245b6 avformat/msf: extend format long description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-23 19:06:14 +02:00
Vittorio Giovara 533a619850 innoHeim/Rsupport Screen Capture Codec decoder
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-10-23 14:56:43 +02:00
Luca Barbato 18f9308e6a mpjpeg: Cope with multipart lacking the initial CRLF
Some server in the wild do not put the boundary at a newline
as rfc1347 7.2.1 states.
Cope with that by reading a line and if it is not empty reading
a second one.

Reported-By: bitingsock
2015-10-23 11:56:38 +02:00
Luca Barbato 22f4d9c303 img2enc: Make sure the images are atomically written
Users that want to generate a live-preview and serve it
would otherwise get partial images.
2015-10-23 11:55:14 +02:00
Michael Niedermayer 573334da82 avformat/mov: Autodetect mp3s which need parsing
mp3 packets all have the same duration and number of samples
if their duration indicated in the container varies then thats an
indication that they are not 1 mp3 packet each.
If this autodetection fails for some case then please contact us
and provide a testcase.

Fixes Ticket4938
2015-10-23 11:01:43 +02:00
Martin Storsjö 5ea5a24eb7 movenc: Honor flush requests with delay_moov, when some tracks lack samples
This also makes sure that a fragmented file without the empty_moov
flag (i.e. with a non-empty initial moov fragment) actually gets
written, if some of the tracks turn out to not have any samples.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-10-23 10:37:49 +03:00
Martin Storsjö e02dcdf6bb rtsp: Allow $ as interleaved packet indicator before a complete response header
Some RTSP servers ("HiIpcam/V100R003 VodServer/1.0.0") respond to
our keepalive GET_PARAMETER request by a truncated RTSP header
(lacking the final empty line to indicate a complete response
header). Prior to 764ec70149, this worked just fine since we
reacted to the $ as interleaved packet indicator anywhere.

Since $ is a valid character within the response header lines,
764ec70149 changed it to be ignored there. But to keep
compatibility with such broken servers, we need to at least
allow reacting to it at the start of lines.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-10-23 10:31:55 +03:00
Ganesh Ajjanagadde 8507b98c10 avfilter,swresample,swscale: use fabs, fabsf instead of FFABS
It is well known that fabs and fabsf are at least as fast and sometimes
faster than the FFABS macro, at least on the gcc+glibc combination.
For instance, see the reference:
http://patchwork.sourceware.org/patch/6735/.
This was a patch to glibc in order to remove their usages of a macro.

The reason essentially boils down to fabs using the __builtin_fabs of
the compiler, while FFABS needs to infer to not use a branch and to
simply change the sign bit. Usually the inference works, but sometimes
it does not. This may be easily checked by looking at the asm.

This also has the added benefit of reducing macro usage, which has
problems with side-effects.

Note that avcodec is not handled here, as it is huge and
most things there are integer arithmetic anyway.

Tested with FATE.

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-22 16:13:26 -04:00
Hendrik Leppkes 470204218f Merge commit 'f890677d05bc4e8b494a73373ab4cc19791bf884'
* commit 'f890677d05bc4e8b494a73373ab4cc19791bf884':
  Replace any remaining avpicture function with imgutils

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-22 20:48:54 +02:00
Peter Ross cdfc61de4e libavformat/electronicarts: also demux mpeg audio layer 2
Signed-off-by: Peter Ross <pross@xvid.org>

http://wiki.multimedia.cx/index.php?title=Electronic_Arts_SCxl
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-22 12:08:05 +02:00
Carl Eugen Hoyos c52c78cc56 lavf/mpjpegdec: Return 0 if an allocation inside the probe function fails. 2015-10-22 11:19:45 +02:00
Paul B Mahol 6debfce6a3 avformat/electronicarts: fix demuxing of certain eam files
Such files have gaps between header chunks.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-22 11:01:00 +02:00
Paul B Mahol 0d7c027483 avformat/electronicarts: support ADPCM PSX
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-22 11:01:00 +02:00
Alexis Ballier 12628e3369 libavformat/mxfdec.c: Report dark metadata keys only when they match no parser at all, not everytime they fail to match one.
Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-22 00:53:35 +02:00