Commit Graph

9137 Commits

Author SHA1 Message Date
Reimar Döffinger efa7f42020 Use the avstring.h locale-independent character type functions
Make sure the behavior does not change with the locale.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:36 +02:00
Martin Storsjö 8fbab7a6c8 rtpdec: Initialize some variables to silence compiler warnings
The warnings are false positives, older gcc versions (such as 4.5)
think the variables can be used uninitialized while they in
practice can't, while newer (4.6) gets it right.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-02 21:23:52 +02:00
Martin Storsjö c5a738ca4e flvdec: Check the return value of a malloc
The callers of this function can't report errors sanely. If this
one malloc fails, don't write the extradata byte, make sure we
try to malloc it the next time we're called instead, and make sure
we still consume the input data byte.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-02 00:39:37 +02:00
Martin Storsjö c91c63b538 flvdec: Don't read the VP6 header byte when setting codec type based on metadata
This header byte is only present when actually reading a VP6 frame,
not when reading the codec type field in the metadata. This
potential bug has been present since 5b54a90c.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-02 00:39:36 +02:00
Martin Storsjö 5c8696555a lavf: Add a fate test for the noproxy pattern matching
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-27 21:32:14 +02:00
Martin Storsjö de9cd1b173 lavf: Handle the environment variable no_proxy more properly
The handling of the environment variable no_proxy, present since
one of the initial commits (de6d9b6404), is inconsistent with
how many other applications and libraries interpret this
variable. Its bare presence does not indicate that the use of
proxies should be skipped, but it is some sort of pattern for
hosts that does not need using a proxy (e.g. for a local network).

As investigated by Rudolf Polzer, different libraries handle this
in different ways, some supporting IP address masks, some supporting
arbitrary globbing using *, some just checking that the pattern matches
the end of the hostname without regard for whether it actually is
the right domain or a domain that ends in the same string.

This simple logic should be pretty similar to the logic used by
lynx and curl.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-27 21:32:13 +02:00
Anton Khirnov 56daf10e03 mov: use the format context for logging.
CC:libav-stable@libav.org
2013-02-23 13:05:16 +01:00
Anton Khirnov 1ef0e8a6bf asfdec: do not assume every AVStream has a corresponding ASFStream
This won't be true for ID3 attached picture.

Also stop allocating now useless dummy ASFStreams for ASF native
attached pictures.
2013-02-09 18:57:21 +01:00
Vladimir Pantelic f5fac6f777 asfdec: support reading ID3v2 tags in ASF files
Yes, these files do exist

Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-02-09 18:57:21 +01:00
Vladimir Pantelic 84b721db36 asfdec: also read Metadata Library Object
In some ASF files this objects holds cover art and other tags. Compared to
Metadata Object it can also hold GUIDs, but we ignore these for now.

Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-02-09 18:57:21 +01:00
Vladimir Pantelic 61f9ad2dfc asfdec: read the full Metadata Object, not just aspect ratio information
Use the same get_tag()/get_value() as for the Extended Content Description
but handle the 16 bit vs 32 bit difference for type 2 (BOOL)

Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-02-09 18:57:21 +01:00
Vladimir Pantelic 36fab50e90 asfdec: silence a warning
Signed-off-by: Vladimir Pantelic <vladoman@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-02-09 18:57:21 +01:00
Diego Biurrun 48a4ffa722 asf: K&R formatting cosmetics 2013-02-06 09:48:51 +01:00
Diego Biurrun 6c1a7d07eb Use proper "" quotes for local header #includes 2013-02-01 12:51:15 +01:00
Anton Khirnov 9ec8971060 bink demuxer: set framerate. 2013-02-01 12:42:17 +01:00
Anton Khirnov 1730ca2eca bink demuxer: check malloc return value 2013-02-01 12:41:38 +01:00
Diego Biurrun 0f5b0b4178 avisynth: Change demuxer name to avoid conflicts with AVS 2013-01-31 11:19:22 +01:00
Martin Storsjö 61d36761ef movenc: Simplify code by using avio_wb24
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-30 13:45:45 +02:00
Anton Khirnov 729b37149c mvi: set framerate
This container does not store timestamps and thus supports CFR only.
2013-01-29 07:31:55 +01:00
Martin Storsjö 4a4a7e138c rtpenc_chain: Use the original AVFormatContext for getting payload type
In ff_rtp_get_payload_type, the AVFormatContext is used for checking
whether the payload_type or rtpflags options are set. In rtpenc_chain,
the rtpctx struct is a newly initialized struct where no options have
been set yet, so no options can be fetched from there.

All muxers that internally chain rtp muxers have the "rtpflags" field
that allows passing such options on (which is how this worked before
8034130e06), so this works just as intended.

This makes it possible to produce H263 in RFC2190 format with chained
RTP muxers.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-24 11:31:36 +02:00
Martin Storsjö 932117171f rtp: Make sure the output format pointer is set
Not sure if this actually happens, but we do the same check when
checking payload_type further above in the function, so it might
be needed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-24 11:31:35 +02:00
Martin Storsjö e90820d4f8 rtp: Make sure priv_data is set before reading it
This fixes crashes with muxing H263 into RTSP.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-23 23:30:58 +02:00
Xi Wang cf29f49d8a rtpenc: fix overflow checking in avc_mp4_find_startcode()
The check `start + res < start' is broken since pointer overflow is
undefined behavior in C.  Many compilers such as gcc/clang optimize
away this check.

Use `res > end - start' instead.  Also change `res' to unsigned int
to avoid signed left-shift overflow.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-23 13:51:29 +02:00
Xi Wang ecb918e5f0 rtmp: fix buffer overflows in ff_amf_tag_contents()
A negative `size' will bypass FFMIN().  In the subsequent memcpy() call,
`size' will be considered as a large positive value, leading to a buffer
overflow.

Change the type of `size' to unsigned int to avoid buffer overflow, and
simplify overflow checks accordingly. Also change a literal buffer
size to use sizeof, and limit the amount of data copied in another
memcpy call as well.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-23 13:51:28 +02:00
Xi Wang 3cff53369a rtmp: fix multiple broken overflow checks
Sanity checks like `data + size >= data_end || data + size < data' are
broken, because `data + size < data' assumes pointer overflow, which is
undefined behavior in C.  Many compilers such as gcc/clang optimize such
checks away.

Use `size < 0 || size >= data_end - data' instead.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-23 13:51:27 +02:00
Martin Storsjö ab587f39b2 rtpenc: Start the sequence numbers from a random offset
Expose the current sequence number via an AVOption - this can
be used both for setting the initial sequence number, or for
querying the current number.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-22 00:25:38 +02:00
Jindrich Makovicka 570a4a0189 avidec: use sensible error codes instead of -1
Use AVERROR_INVALIDDATA on invalid inputs, and AVERROR_EOF when no more
frames are available in an interleaved AVI.

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-21 16:02:40 +01:00
Martin Storsjö c9311f3e46 srtp: Move a variable to a local scope
This simplifies the code slightly.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:17:00 +02:00
Martin Storsjö ae01e8d295 srtp: Add tests for the crypto suite with 32/80 bit HMAC
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:13:43 +02:00
Martin Storsjö 3ef6d22e1b srtp: cosmetics: Use fewer lines for the test vectors
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:13:43 +02:00
Martin Storsjö b4bb1d493c srtp: Don't require more input data than what actually is needed
The theoretical minimum for a (not totally well formed) RTCP packet
is 8 bytes, so we shouldn't require 12 bytes as minimum input.

Also return AVERROR_INVALIDDATA instead of 0 if something that is
not a proper packet is given.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:13:43 +02:00
Martin Storsjö a2a991b2dd srtp: Improve the minimum encryption buffer size check
This clarifies where the limit number comes from, and only
requires exactly as much padding space as will be needed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:13:43 +02:00
Martin Storsjö e1d0b3d875 srtp: Add support for a few DTLS-SRTP related crypto suites
The main difference to the existing suites from RFC 4568 is
that the version with a 32 bit HMAC still uses 80 bit HMAC
for RTCP packets.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:13:35 +02:00
Martin Storsjö f53490cc0c rtpdec/srtp: Handle CSRC fields being present
This is untested in practice, but follows the spec.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:10:47 +02:00
Martin Storsjö a76bc3bc44 rtpdec: Check the return value from av_new_packet
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-21 00:08:19 +02:00
Martin Storsjö c6f1dc8e4c rtpdec: Move setting the parsing flags to the actual depacketizers
This gets rid of almost all the codec specific details from the
generic rtpdec code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:20:42 +02:00
Martin Storsjö a9c847c1ba rtpdec: Split handling of mpeg12 audio/video to a separate depacketizer
This also adds checking of mallocs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:20:22 +02:00
Martin Storsjö 2326558d52 rtpdec: Split mpegts parsing to a normal depacketizer
This gets rid of a number of special cases from the common rtpdec
code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:17:17 +02:00
Martin Storsjö d5bb8cc2dd rtpdec: Reorder payload handler registration alphabetically
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:16:04 +02:00
Martin Storsjö a717f99042 mpegts: Share the cleanup code between the demuxer and lavf-internal parser functions
The lavf-internal parser functions are used when receiving
mpegts over RTP. This fixes memory leaks in this setup.

The normal mpegts demuxer close function was updated in ec7d0d2e in
2004 to fix leaks, but the parsing function used for RTP wasn't
updated and has been leaking ever since.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:14:17 +02:00
Martin Storsjö 21f5c24b80 rtpdec_mpeg4: Return one AAC AU per AVPacket
This makes the returned data valid to stream copy into other
containers as well, not only for decoding straight away.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:12:38 +02:00
Luca Barbato 80ac87c13d lavc: support ZenoXVID custom tag
Looks like this kind of samples are produced by certain Russian
equipment.
2013-01-17 21:41:18 +01:00
Justin Ruggles b805c725a3 idcin: fix memleaks in idcin_read_packet()
Fixes fate-id-cin-video failures when running FATE with valgrind.
2013-01-16 12:21:35 -05:00
Martin Storsjö a7ba324413 rtpdec_mpeg4: Check the remaining amount of data before reading
This fixes possible buffer overreads.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-16 11:12:39 +02:00
Martin Storsjö 977d4a3b8a rtpdec_mpeg4: Check the return value from malloc
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 23:18:33 +02:00
Martin Storsjö 42364fcbca srtp: Mark a few variables as uninitialized
This squelches false positive warnings (with gcc) about them being
used uninitalized.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 23:18:08 +02:00
Martin Storsjö c2603aa25b lavf: Add a fate test for the SRTP functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 23:18:08 +02:00
Martin Storsjö 611bf39bde sdp: Include SRTP crypto params if using the srtp protocol
Also print port numbers for this protocol.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 11:55:29 +02:00
Martin Storsjö 2f3bada63e lavf: Add a protocol for SRTP encryption/decryption
This is mostly useful for encryption together with the RTP muxer,
but could also be set up as IO towards the peer with the SDP
demuxer with custom IO.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 11:55:10 +02:00
Martin Storsjö 424da30830 rtsp: Support decryption of SRTP signalled via RFC 4568 (SDES)
This only takes care of decrypting incoming packets; the outgoing
RTCP packets are not encrypted. This is enough for some use cases,
and signalling crypto keys for use with outgoing RTCP packets
doesn't fit as simply into the API. If the SDP demuxer is hooked
up with custom IO, the return packets can be encrypted e.g. via the
SRTP protocol.

If the SRTP keys aren't available within the SDP, the decryption
can be handled externally as well (when using custom IO).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-15 11:54:40 +02:00