Commit Graph

7647 Commits

Author SHA1 Message Date
Alex Converse 8fb22c3d47 mov: Prevent illegal writes when chapter titles are very short. 2011-10-14 10:36:18 -07:00
John Brooks 2c4e08d893 riff: always generate a proper WAVEFORMATEX structure in ff_put_wav_header
The cbSize field should be included in all cases, even with PCM where
its value is ignored.

Fixes encoding PCM audio in Matroska for some players which insist on
a full WAVEFORMATEX structure for A_MS/ACM audio.

Since fate uses wav files for the audio test a larger number of tests
has changed checksums or shifted positions due to the 2 byte longer
wave header.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-14 13:28:58 +02:00
Diego Biurrun c4a378855e id3v2: reduce the scope of some non-globally-used symbols/structures 2011-10-13 23:20:37 +02:00
Diego Biurrun 3b78c180e4 id3v2: cosmetics: move some declarations before the places they are used 2011-10-13 23:20:35 +02:00
Justin Ruggles e32dfdaa8d shn: do not allow seeking in the raw shn demuxer.
The demuxer does not read the seektable, a parser is not possible without a
full decode, and no shorten decoder can handle random seeking because it needs
side info from the seektable.
2011-10-13 16:31:16 -04:00
Justin Ruggles b631fba936 avformat: add AVInputFormat flag AVFMT_NO_BYTE_SEEK.
This will prevent seeking by bytes for formats that cannot handle this.
2011-10-13 16:31:15 -04:00
Justin Ruggles 050e20aee6 avformat: update AVInputFormat allowed flags 2011-10-13 16:31:15 -04:00
Justin Ruggles 0041cdba98 avformat: don't unconditionally call ff_read_frame_flush() when trying to seek.
This prevents flushing the packet buffer when the input format does not
support seeking.
2011-10-13 16:31:15 -04:00
Anton Khirnov 145f741e11 AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_* 2011-10-12 16:51:16 +02:00
Anton Khirnov 3b3ea34655 Remove all uses of deprecated AVOptions API. 2011-10-12 16:51:16 +02:00
Anton Khirnov 641c7afe3c AVOptions: add new API for enumerating children.
This will allow the caller to enumerate child contexts in a generic way
and since the API is recursive, it also allows for deeper nesting (e.g.
AVFormatContext->AVIOContext->URLContext)

This will also allow the new setting/reading API to transparently apply
to children contexts.
2011-10-12 16:51:16 +02:00
Martin Storsjö cad0c375d9 flvenc: Write the right metadata entry count
No application rely on this count being correct as far as
I know, but if we write a nonzero count value, it might just
as well be the right one.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 15:25:58 +03:00
Martin Storsjö 76b0d03d82 rtsp: Request that dynamic rate is disabled
DSS enables this automatically if streaming VOD over TCP. If
enabled, the server feeds packets faster than realtime, screwing
up RTCP NTP based timestamps.

Also, DSS doesn't indicate that this was indicated, if it was
enabled automatically (although if it was requested to be enabled,
a header saying that it was enabled is added, but this isn't
added if it is enabled automatically), making it even harder
to detect and work around properly without explicitly asking
for it to be disabled(/enabled, if we were able to support it).

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:47 +03:00
Martin Storsjö 30eae32530 rtsp: Parse the x-Accept-Dynamic-Rate header
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:45 +03:00
Martin Storsjö bfc6db4477 rtpdec: Add ff_ prefix to all nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:12 +03:00
John Brooks 07b77fe387 rtpdec: Read the packet length for all RTCP packet types
This allows skipping past unsupported RTCP packet types, as
RFC 3550 section 6.1 mandates.

Currently this only has any practical effect if a sender puts
an unrecognized type before RTCP_BYE in a compounded packet, or
(incorrectly) does not put RTCP_SR first.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:37:42 +03:00
John Brooks 5d6ecf5345 rtpdec: Fix the minimum packet length for RTCP SR packets
We actually read 20 bytes of these packets.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:37:39 +03:00
Martin Storsjö 5e87222fd1 flvdec: Don't export metadata entries that aren't proper metadata
This avoids writing these entries doubly if transcoding from
flv to flv, since the muxer blindly writes any and all metadata
keys set, in addition to the fixed fields that the muxer
always writes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 10:19:47 +03:00
Martin Storsjö b204c46d9d flvdec: Split out setting of numeric fields from storing metadata
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 10:19:38 +03:00
Luca Barbato 30c3d976f1 mov: do not misreport empty stts
Return -1 instead of ENOMEM if entries is 0.
Fixes a av_malloc(0) crash in macosx.
2011-10-11 15:06:50 +02:00
Luca Barbato 5a7ba58657 mov: cosmetics, fix for and if spacing 2011-10-11 15:06:11 +02:00
Anton Khirnov c780b543e7 id3v2: fix NULL pointer dereference
Bug found by Laurent Aimar fenrir at videolan org
2011-10-11 14:56:41 +02:00
Raivo Hool 2804d32075 mov: read album_artist atom
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-10-11 14:56:41 +02:00
Raivo Hool dff4177546 mov: fix disc/track numbers and totals
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-10-11 14:56:41 +02:00
Justin Ruggles a7984a6a6d smacker: Separate audio flags from sample rates in smacker demuxer.
Makes the code easier to understand.
2011-10-11 07:48:16 -04:00
Laurent Aimar 79964745b3 4xmdemux: prevent use of uninitialized memory
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-10 21:37:35 +02:00
Laurent Aimar 6de33611c9 avsdemux: check for out of bound writes
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-10 21:36:12 +02:00
Laurent Aimar 76c6971a64 avsdemux: check for corrupted data
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-10 21:27:04 +02:00
Mans Rullgard 1703013cb7 avidec: fix signed overflow in avi_sync()
Keeping byte values read from the file as unsigned is consistent
with how they are subsequently used and avoids an undefined left
shift by 24 when bit 7 is set.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-10-10 17:49:13 +01:00
Alex Converse 0c46e958d1 mxfdec: Fix some buffer overreads caused by the misuse of AVPacket related functions. 2011-10-10 09:40:26 -07:00
Janne Grunau 2886f6759f avidec: simplify size parameter in memset() 2011-10-10 13:28:18 +02:00
Mans Rullgard a31e9f68a4 lavf: fix signed overflow in avformat_find_stream_info()
On the first iteration through this code, last_dts is always
INT64_MIN (AV_NOPTS_VALUE) and the subtraction overflows in
an invalid manner.  Although the result is only used if the
input values are valid, performing the subtraction is still
not allowed in a strict environment.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-10-08 20:04:22 +01:00
Alex Converse 98ef887a75 mpegps: Use av_get_packet() instead of poorly emulating it. 2011-10-07 17:04:14 -07:00
Laurent Aimar 1e3336de69 mpc8: Fix return value on EOF
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-07 16:25:30 +02:00
Laurent Aimar 1775b92fee segafilm: Check for memory allocation failures in segafilm demuxer.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-06 23:19:45 +02:00
Laurent Aimar 762ffa6861 segafilm: Fix potential division by 0 on corrupted streams in the demuxer
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-06 23:01:45 +02:00
Laurent Aimar 790f4dd5c9 Fixed segfault on corrupted sega streams in the demuxer.
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-06 22:32:02 +02:00
Anton Khirnov a4ea00d021 lavc/lavf: use unique private classes.
This is needed by the new AVOptions API.
2011-10-05 07:52:30 +02:00
Diego Biurrun 12bd8532cf Synchronize various 4CCs and codec tags from FFmpeg. 2011-10-04 11:58:53 +02:00
Justin Ruggles fc2dd2c7ac ogg/celt: do not set sample_fmt in the demuxer 2011-10-03 21:23:22 -04:00
Anton Khirnov 60df6b0048 id3v2: remove pointless casts 2011-10-03 13:06:51 +02:00
Anton Khirnov d2961e4ebf id3v2: read TXXX frames with two calls to decode_str() instead of one.
Read the key in the first, value in the second.

This allows to avoid pointless strdups and simplify decode_str() by
dropping two of its parameters.
2011-10-03 13:06:51 +02:00
Anton Khirnov 1e18d32d01 id3v2: don't discard the whole tag when encountering empty frames.
While they're technically invalid, it's better to skip them and try to
read the rest of the tag.
2011-10-03 13:06:41 +02:00
Martin Storsjö e81e5e8ad2 lavf: Avoid using av_malloc(0) in av_dump_format
On OS X, av_malloc(0) returns pointers that cause crashes when
freed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-30 22:31:30 +03:00
Kieran Kunhya d4a544cbc4 latmenc: Set latmBufferFullness to largest value to indicate it is not used
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-09-30 11:17:27 +02:00
Alex Converse fe21f78d2b mpeg probe: check the 2/4-bit synchronization value found after a pack_start_code. 2011-09-29 09:45:57 -07:00
Kieran Kunhya 32dfd8ca65 latmenc: Fix private options
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-28 15:49:07 +03:00
Michael Niedermayer 77d2ef13a8 Fix memory (re)allocation in matroskadec.c, related to MSVR-11-0080.
Whitespace of the patch cleaned up by Aurel
Some of the issues have been reported by Steve Manzuik / Microsoft Vulnerability Research (MSVR)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

(cherry picked from commit 956c901c68)

Further suggestions from Kostya <kostya.shishkov@gmail.com> have been
implemented by Reinhard Tartler <siretart@tauware.de>

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2011-09-27 23:14:05 +02:00
Anton Khirnov c7a63a521b matroskaenc: write attachments. 2011-09-27 15:26:36 +02:00
Anton Khirnov 98cfe22b5c matroskadec: export mimetype of attachments as metadata. 2011-09-27 15:26:36 +02:00
Rafaël Carré 1430ae44e8 rtp: Simplify ff_rtp_get_payload_type
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-26 21:55:27 +03:00
Rafaël Carré 9152880e95 rtpenc: Add a payload type private option
Specifying the payload type is useful when the type number has
already been negotiated before creating the stream, for example
in SIP protocol.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-26 21:54:57 +03:00
Rafaël Carré 142887741f rtp: Correct ff_rtp_get_payload_type documentation
Since 0c378ea1f, it can't fail anymore.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-26 21:54:14 +03:00
Nicolas George 4ca59d1948 oggdec: add support for Xiph's CELT codec
This patch also introduces CODEC_ID_CELT.

Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-09-26 13:51:29 +02:00
Justin Ruggles b15a9888a8 sol: return error if av_get_packet() fails.
This prevents sending a packet with data=NULL size=AVERROR_EOF.
2011-09-25 16:53:49 -04:00
Mans Rullgard bb416bd68c lavf: do not set codec_tag for rawvideo
If the demuxer did not set a codec_tag, there is none and
inventing one makes no sense.  This change stops the rawvideo
"decoder" over-writing user-supplied pixfmt with one derived
from the codec_tag.  The pixfmt-codec_tag-pixfmt round-trip
is lossy since several pixfmts map to the same codec_tag.

This fixes fate-lavf-pixfmt with avfilter disabled.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-09-25 14:07:21 +01:00
Michael Niedermayer a246cefa75 flvdec: Check for overflow before allocating arrays
On allocation, the array length is multiplied by sizeof(int64_t),
this prevents the multiplication from overflowing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-25 12:55:21 +03:00
Laurent Aimar 2b4e49d428 flvdec: Fix invalid pointer deferences when parsing index
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-24 18:08:39 +03:00
Diego Biurrun 30b4ee7901 Use explicit struct initializers for AVOutputFormat/AVInputFormat declarations. 2011-09-24 12:11:17 +02:00
Alex Converse 9fba8ebe0a mpegps: Handle buffer exhaustion when reading packets. 2011-09-23 16:36:16 -07:00
Rafaël Carré 0c378ea1f7 rtp: factorize dynamic payload type fallback
Move the identical code in rtp_write_header() and
ff_sdp_write_media() inside ff_rtp_get_payload_type()

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-23 22:00:24 +02:00
Martin Storsjö bafff1668c flvdec: Ignore the index if it's from a creator known to be different
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-23 20:59:48 +03:00
Diego Biurrun 5cc2530fc2 prores: mark prores as intra-only in libavformat/utils.c:is_intra_only() 2011-09-23 01:42:14 +02:00
Janne Grunau dcb9f6a20d Add LATM demuxer
This is a raw demuxer for the AAC LATM decoder and thus limited to
single stream LOAS.
2011-09-22 20:39:24 +02:00
Justin Ruggles 1993c6849c 8svx/iff: fix decoding of compressed stereo 8svx files.
Make the iff demuxer send the whole audio chunk to the decoder as a
single packet and move stereo interleaving from the iff demuxer to the
decoder.

Based on a patch by Stefano Sabatini.
git.videolan.org/ffmpeg.git
commit e280a4da2a
2011-09-22 14:11:34 -04:00
Alex Converse 1c2e07b811 mp4: Don't read an empty Decoder Config Descriptor 2011-09-22 10:09:04 -07:00
Martin Storsjö b14629e5ea rtmp: Make the input FLV parser handle data cut at any point
This makes the RTMP writing code able to handle FLV data
fed in arbitrarily small or large chunks, with multiple
consecutive packets in one write call, or having the FLV
packet header split over numerous write calls.

When used in conjunction with the flv muxer, the AVIO buffer
size still needs to be large enough to fit the initial metadata
packet though, since the size of that packet is written with a
seekback.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-22 10:36:16 +03:00
Alex Converse 05fc9e40a4 swfdec: Add support for sample_rate_code 0 (5512 Hz) 2011-09-21 09:42:35 -07:00
Anton Khirnov 609a2fa1fa Remove some forgotten AVCodecContext.palctrl usage. 2011-09-21 13:51:53 +02:00
Diego Biurrun 35a6855868 Fix av_dlog invocations with wrong or missing logging context.
This fixes build failures with -DDEBUG in CPPFLAGS.
2011-09-21 09:57:32 +02:00
David Goldwich 61f4387d39 oma: support for encrypted files
Signed-off-by: David Goldwich <david.goldwich@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-21 08:33:15 +02:00
David Goldwich 7a019dffe5 id3v2: add support for non-text and GEOB type tag frames
This extends the ID3v2 parser to allow for reading of non-text (i.e.
other than T***) meta tag frames providing a ff_id3v2_read_all()
function. An additional data structure 'ID3v2ExtraMeta' is introduced
for these tags since AVDictionary is string oriented and unsuitable
for binary data.

A parser for tag frames of type GEOB is implemented, which is needed
to extract keyring information from encrypted OMA files. GEOB data
is parsed into 'ID3v2ExtraMetaGEOB' data structures.

The routine to decode characters from different encodings to UTF-8,
formerly part of the read_ttag() function, is moved to its own
function. Because some tag frames contain subparts of unknown length,
the function is now also able to read until a null character is found.
In addition, the function now takes care of allocating a buffer long
enough to hold the decoded characters.

Signed-off-by: David Goldwich <david.goldwich@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-21 08:28:21 +02:00
Martin Storsjö 3ffe32eb96 rtmp: Don't blindly skip the 4 trailer bytes from the FLV packets
If not enough bytes are available, keep track of them and skip
them on next call.

In practice, if these trailer bytes are written in a separate
call, there is no other data written in this call, making it
fall into the "FLV packet too small" case currently - working,
but not as intended.

This patch makes the code more robust, handling all cases
except for having the FLV packet header split over multiple
write calls.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-20 16:23:48 +03:00
Chiranjeevi Melam a14c784210 rtmp: Handle FLV packets written in more than one write call
If the FLV packet is larger than the AVIO buffer, a partial
FLV packet will be flushed to the RTMP protocol.

This commit handles the most common cases of FLV packets
being written in more than one call.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-20 16:23:46 +03:00
Anton Khirnov c92a2a4eb8 movenc: fix NULL reference in mov_write_tkhd_tag
st may be NULL when there are more mov streams than AVStreams, e.g. when
chapters are present.
2011-09-19 16:44:42 +02:00
Laurent Aimar f06068bbd6 rmdec: Reject invalid deinterleaving parameters
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-19 15:45:22 +03:00
Laurent Aimar 3e033da847 rmdec: use the deinterleaving mode and not the codec when creating audio packets.
It prevents crashes due to non initialized fields.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-19 12:37:31 +02:00
David Goldwich 63d64228a7 lavf: Fix context pointer in av_open_input_stream when avformat_open_input fails
Signed-off-by: David Goldwich <david.goldwich@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-19 12:03:56 +02:00
Laurent Aimar 0e7efb9d23 oggdec: fix out of bound write in the ogg demuxer
Between ogg_save() and ogg_restore() calls, the number of streams
could have been reduced.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-17 09:41:02 -07:00
Anton Khirnov 7574cacbd5 movenc: create an alternate group for each media type
Partially fixes bug 44.
2011-09-17 08:42:30 +02:00
Anton Khirnov 85d982f1e2 rawdec: refactor private option for raw video demuxers
pixel_format/video_size only apply to 'rawvideo' (==uncompressed) demuxer
and make no sense for the other raw (== containerless) demuxers. Keep
only the framerate option for those.

Also use unique classes for all raw video demuxers
2011-09-17 06:43:09 +02:00
Anton Khirnov 34d2bf30a0 pcmdec: use unique classes for all pcm demuxers. 2011-09-17 06:42:32 +02:00
Anton Khirnov d906f49aa8 rawdec: g722 is always 1 channel/16kHz 2011-09-17 06:42:17 +02:00
Laurent Aimar b59efc9434 Fixed size given to init_get_bits().
init_get_bits() takes a number of bits and not a number of bytes as
its size argument.

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2011-09-15 13:23:04 -07:00
Dustin Brody d7d2f0e63c matroskadec: fix typo.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-15 09:34:38 +02:00
Dustin Brody 4a9628f276 matroskadec: bail on parsing of incorrect seek index segments
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-15 09:34:16 +02:00
Alex Converse 940173d4d1 lavf utils: Remove write-only variable 2011-09-14 10:35:46 -07:00
Alex Converse 4439caa482 lavf utils: Rename shadowing variable 2011-09-14 10:35:42 -07:00
Laurent Aimar a92d0fa5d2 Fixed off by one packet size allocation in the smacker demuxer.
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-12 23:44:51 +03:00
Laurent Aimar e055932f56 Check for invalid packet size in the smacker demuxer.
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-12 23:43:52 +03:00
Laurent Aimar 273aab99bf ape demuxer: fix segfault on memory allocation failure.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-12 21:12:31 +02:00
Kostya Shishkov 47a8589f7b smacker demuxer: handle possible av_realloc() failure.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-12 15:51:21 +02:00
Georgi Chorbadzhiyski f1f15c3c1a mpegts: improve error reporting
When reporting continuity error show pid, expected and received cc.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-11 09:27:13 -04:00
Aviad Rozenhek 162f1fbc14 mpegts: on seek, reset the cc for all PIDs
Prevent false positive continuity counter error logs.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-11 09:26:21 -04:00
Diego Biurrun 6376362d15 Employ FF_ARRAY_ELEMS instead of manually calculating array length. 2011-09-08 15:57:14 +02:00
Michael Niedermayer 5ea091fb5a rtpdec_asf: Fix integer underflow that could allow remote code execution
Fixes MSVR-11-0088.
Credit:  Jeong Wook Oh of Microsoft and Microsoft Vulnerability Research (MSVR)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-07 23:33:53 +03:00
Kieran Kunhya 0ca36b4de7 Add LATM muxer
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-09-07 12:57:55 +02:00
Anton Khirnov 9c684feadc libx264: add 'direct-pred' private option
Deprecate AVCodecContext.directpred
2011-09-07 07:27:55 +02:00
Anton Khirnov 0635a8aa21 libx264: add 'partitions' private option
Deprecate AVCodecContext.partitions.
2011-09-07 07:27:18 +02:00
Stefan Fritsch 346ea9e222 http: Consider the stream as seekable if the reply contains Accept-Ranges: bytes
The initial request contains "Range: 0-", which servers normally
have responded with "HTTP/1.1 206 Partial Content" reply with
a Content-Range header, which was used as indicator for seekability.

Apache, since 2.2.20, responds with "HTTP/1.1 200 OK" for these
requests, which is more friendly to caches and proxies, but the
seekability still is indicated via the Accept-Ranges: bytes header.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-04 11:28:53 +02:00