Commit Graph

9453 Commits

Author SHA1 Message Date
Alexandra Khirnova 5626f994f2 avformat: Use av_reallocp() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-18 18:28:38 +02:00
Martin Storsjö 0f310a6f33 rmdec: Validate the fps value
Abort if it is invalid if strict error checking has been requested.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-18 11:30:06 +03:00
Martin Storsjö e7bf085b78 movenc: Add an option for omitting the tfhd base offset
This makes the output fragments independent of their position in
the output stream, making the output work better when streamed.

QuickTime Player doesn't support fragmented mp4 without the base
data offset, though.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 23:30:31 +03:00
Martin Storsjö a4adabb460 movenc: Write the moof atom in two passes
This is a bit more work, but avoids having to fill in
the data offset field afterwards instead of directly when
the rest of the trun atom is written.

This simplifies future cases where this field needs to be set to
something different.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 23:25:46 +03:00
Josh Allmann 8583b14252 rtmp: Support reading interleaved chunks.
A given packet won't always come in contiguously; sometimes
they may be broken up on chunk boundaries by packets of another
channel.

This support primarily involves tracking information about the
data that's been read, so the reader can pick up where it left
off for a given channel.

As a side effect, we no longer over-report the bytes read if
(toread = MIN(size, chunk_size)) == size

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 23:19:11 +03:00
Martin Storsjö d4c2a3740f xmv: Add more sanity checks for parameters read from the bitstream
Since the number of channels is multiplied by 36 and assigned to
to a uint16_t, make sure this calculation didn't overflow. (In
certain cases the calculation could overflow leaving the
truncated block_align at 0, leading to divisions by zero later.)

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 20:09:25 +03:00
Martin Storsjö dc4acc8200 rtmpproto: Extend a comment to explain the prev_pkt arrays roles
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 20:09:25 +03:00
Martin Storsjö 647d655d19 rtmpproto: Consistently use the right prev_pkt array
prev_pkt[0] is used for input packets, while prev_pkt[1] is
used for output.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 20:09:24 +03:00
Martin Storsjö 0d3784396b rtmpproto: Check for the right return code
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 20:09:22 +03:00
Martin Storsjö 7f8d41eb09 mov: Don't use a negative duration for setting other fields
Some files have the duration set to -1 in the mdhd atom, more
or less legitimately. (We produce such files ourselves, for the
initial duration in fragmented mp4 files.)

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:33:37 +03:00
Martin Storsjö 19b9659f31 oggparseogm: Convert to use bytestream2
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:33:37 +03:00
Martin Storsjö 569d18aa9d matroskadec: Verify realaudio codec parameters
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:22:30 +03:00
Josh Allmann f8d1bb6723 rtmp: rename main_channel_id to stream_id.
This more closely corresponds to the usage of the field.
Its usage here is unrelated to the channel ID.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:03:36 +03:00
Josh Allmann d4aef99780 rtmp: Follow Flash player numbering for channels.
Channel 4 is typically used by the Flash player to transmit
audio, channel 6 for video, and various stream-specific invokes
get sent over channel 8, which is designated the source channel.

This more closely matches the behavior of the Flash player,
including the transmission of play requests over channel 8.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:03:36 +03:00
Josh Allmann 120af23cd5 rtmp: Send video on a separate channel.
Sending non-monotonic packets (e.g. when the audio and video
streams are monotonic within themselves but not muxed
monotonically) will lead to negative values the RTMP timestamp
field (where timestamps are transmitted only as deltas for each
channel), and this delta can end up being incorrectly written as
a large unsigned number.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:03:36 +03:00
Alexandra Khirnova 68b4677420 lavf: Make probe_codec return an error code
This allows handling errors from av_realloc properly.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 22:28:23 +03:00
Clément Bœsch 7308439158 lavf: Don't explicitly flush after each written packet in muxers
Since 596e5d4783, this is not necessary anymore. It also allows to
actually disable the flushing, improving write performance (but
possibly giving worse latency in real-time streaming).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 22:17:33 +03:00
Luca Barbato 596e5d4783 lavf: Add a flag to enable/disable per-packet flushing
This is enabled by default and can be disabled with
"-fflags -flush_packets".

Inspired by a patch from Nicolas George <nicolas.george@normalesup.org>.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 22:11:08 +03:00
Luca Barbato 0a9425d7cf flv: Do not export datastream as metadata
It is used internally.
2013-09-16 19:36:37 +02:00
Luca Barbato 92ed83e393 rtmp: Store all the notify messages
The onTextData is used to implement text data streams in flv.
2013-09-16 19:36:37 +02:00
Luca Barbato fe0337e89b rtmp: Do not send the first field twice within the handshake 2013-09-16 19:36:37 +02:00
Luca Barbato 666ed7eda1 rtmp: Drop an unneeded warning
Apparently a widely used streaming server requires that the second
field always presents a version during C1 phase.
2013-09-16 19:36:37 +02:00
Luca Barbato ffb7669e47 rtmp: Support play method in listen mode 2013-09-16 19:36:37 +02:00
Luca Barbato 97d35fa89f rtmp: Factor out publish specific code
Will be reused for supporting play.
2013-09-16 19:36:37 +02:00
Martin Storsjö 5bbfe193a0 vocdec: Don't update codec parameters mid-stream
If we really want to support parameter changes, they need to be
signalled along with the AVPackets as parameter change side data,
not just changing the AVCodecContext parameters when a packet
is demuxed (since there may be other earlier packets yet undecoded).

Something similar was already done for the sample rate in 0883109b2,
but some parameters were left changeable.

This avoids having to recheck the channel count for validity for
each decoded frame in (ad)pcm decoders, unless the decoders
explicitly say that they accept parameter changes.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 11:04:52 +03:00
Martin Storsjö 0ef1660a63 sierravmd: Do sanity checking of frame sizes
Limit the size to INT_MAX/2 (for simplicity) to be sure that
size + BYTES_PER_FRAME_RECORD won't overflow.

Also factorize other existing error return paths.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 11:04:52 +03:00
Martin Storsjö 342c43d154 omadec: Properly check lengths before incrementing the position
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 11:04:52 +03:00
Alexandra Khirnova 00a63bfb87 matroskaenc: Fix stray pointers left over from av_reallocp_array refactoring
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-12 13:16:15 +02:00
Vittorio Giovara c0779a67e8 mp3: add .mpa extension
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-12 13:16:15 +02:00
Martin Storsjö 17d57848fc mpc8: Make sure the first stream exists before parsing the seek table
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-12 10:54:27 +03:00
Martin Storsjö 459f2b393a mpc8: Check the seek table size parsed from the bitstream
Limit the size to INT_MAX/2 (for simplicity) to be sure that
size + FF_INPUT_BUFFER_PADDING_SIZE won't overflow.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-12 10:54:05 +03:00
Martin Storsjö 183b9d843a ape: Don't allow the seektable to be omitted
The seektable is required for filling in ape->frames[i].pos
further down.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-12 10:53:25 +03:00
Martin Storsjö 710b0e2702 smacker: Avoid integer overflow when allocating packets
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-11 20:19:43 +03:00
Martin Storsjö 8d928023f9 smacker: Don't return packets in unallocated streams
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-11 20:19:12 +03:00
Martin Storsjö 48d6556dd4 dsicin: Add some basic sanity checks for fields read from the file
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-11 20:18:55 +03:00
Alexandra Khirnova f369b9356c avformat: Use av_reallocp_array() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-10 12:38:32 +02:00
Martin Storsjö bdf990425e movenc: Simplify setting the fragmentation flag
This makes sure the faststart vs fragmentation check works as
intended when fragmentation is enabled due to using the ismv mode.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-09 23:58:33 +03:00
Martin Storsjö 8b524ab0c4 movenc: Add a warning message if conflicting options have been specified
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-09 23:57:41 +03:00
Martin Storsjö a6a4596e12 tcp: Explicitly convert a pointer to a boolean integer
This fixes warnings about making integers from pointers without
a cast, and avoids the theoretical case where the lower 32 bits of
the pointer would all be zero where the implicit cast wouldn't give
the right result.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-09 23:57:04 +03:00
Anton Khirnov 26f027fba1 lavf: fix the comparison in an overflow check
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-07 11:52:40 +02:00
Luca Barbato 7ee191cab0 dv: Add a guard to not overread the ppcm array
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-09-07 11:18:01 +02:00
Diego Biurrun c16ddcc90b avisynth: K&R formatting cosmetics 2013-09-06 11:13:36 +02:00
Diego Biurrun 97b052e568 avisynth: Add missing #include for NULL_IF_CONFIG_SMALL 2013-09-06 09:09:07 +02:00
John Stebbins 26b241c079 matroskaenc: Allow chapters to be written in trailer
This allows creation of frame accurate chapter marks from sources like
DVD and BD where the precise chapter location is not known until the
chapter mark has been reached during reading.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-09-04 20:30:43 +02:00
Martin Storsjö d719981273 4xm: Check that the read track value is non-negative
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-03 22:57:36 +03:00
Martin Storsjö 5bcd3ae5b1 matroskadec: Check that .lang was allocated and set before reading it
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-03 22:57:15 +03:00
Martin Storsjö 0fbda03e5c movenc: Don't flush after each written packet
This should improve write performance quite significantly.
---
Tested with both writing a normal mp4, by using the faststart
feature and writing a fragmented mp4 file; all turn out with the
same md5sum as before.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-03 10:36:17 +03:00
Diego Biurrun 7df9e693a3 cosmetics: Fix ATRAC codec name spelling 2013-09-02 21:38:57 +02:00
Anton Khirnov 488b2984fe ape demuxer: check for EOF in potentially long loops
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-09-02 19:28:55 +02:00
Anton Khirnov a7c1689ded 4xm: check that bits per sample is strictly positive
Avoids a divide by zero.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-09-02 19:28:47 +02:00