Commit Graph

190 Commits

Author SHA1 Message Date
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Luca Barbato 252d6200c3 avio: Add avio_put_str16be 2015-06-07 10:14:45 +02:00
Vittorio Giovara bff0349d9d avio: Add avio_read wrapper to simplify error checking
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-05-31 13:05:13 +02:00
Diego Biurrun b97f427fb5 lavf: Explicitly convert types at function pointer assignment
This fixes a number of "assignment from incompatible pointer type" warnings.
2015-03-11 23:53:13 +01:00
Martin Storsjö c86d8aed74 avio: Rename avclass symbols relating to avio
Don't prefix them ffio_url, which is misleading, sounding too
much like the urlprotocol layer (like ffurl_*).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:07:04 +02:00
Martin Storsjö 8a273a7460 avio: Add an internal utility function for freeing dynamic buffers
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:41 +02:00
Luca Barbato 3c18a7b188 avio: Do not consider the end-of-buffer position valid
Trigger a refill if the seek action moves the pointer
at the end of the buffer.

Before this patch the read action following the seek would trigger
the refill, while write action would write outside the buffer.

In the Libav codebase few muxers seek forward outside of what
already has been written so it is quite unlikely to experience
the problem with the default buffer size.

CC: libav-stable@libav.org
2015-01-28 16:28:10 +01:00
Vittorio Giovara d7f530b0d6 aviobuf: check context before using it
Avoid a possible null pointer dereference.

CC: libav-stable@libav.org
Bug-Id: CID 1135769
2014-10-20 10:38:38 +01:00
Alessandro Ghedini 32d05934ab mp3dec: decode more data from Info header
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-04-17 20:08:19 +02:00
Martin Storsjö d07b51bf07 aviobuf: Handle a NULL buffer in avio_close_dyn_buf
This simplifies proper error handling in rtsp.c/rtspdec.c. When
broadcasting over RTSP in TCP mode, the AVIOContext is closed and
recreated for each sent packet, and if the recreation fails, we might
try to close a NULL buffer when freeing things at the end.

Previously, if recreating the buffer in rtspdec.c failed, this would
crash later due to trying to close a NULL buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-11-01 09:56:27 +02:00
Martin Storsjö d872fb0f7f lavf: Reset the entry count and allocation size variables on av_reallocp failures
When av_reallocp fails, the associated variables that keep track of
the number of elements in the array (and in some cases, the
separate number of allocated elements) need to be reset.

Not all of these might technically be needed, but it's better to
reset them if in doubt, to make sure variables don't end up
conflicting.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-26 23:14:03 +03:00
Martin Storsjö 3627ce2f1d aviobuf: Add functions for null buffers
Null buffers are useful for simulating writing to a real buffer
for the sake of measuring how many bytes are written.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-19 22:42:37 +03:00
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
Ben Avison 5afe1d2791 avio: Add const qualifiers to ffio_read_indirect
This provides at least some protection against potential accidental
corruption of AVIO buffer workspace.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-08 11:09:00 +03:00
Ben Avison daf1e0d3de avio: Add an internal function for reading without copying
As long as there is enough contiguous data in the avio buffer,
just return a pointer to it instead of copying it to the caller
provided buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-05 15:14:25 +03:00
Hendrik Schreiber b512360184 avio: Don't set the seekable flag if no seek function is provided
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-26 21:46:18 +03:00
Martin Storsjö 53c25ee073 aviobuf: Discard old buffered, previously read data in ffio_read_partial
This makes RTP custom IO work properly with pure read-only
AVIOContexts as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-03 15:17:10 +02:00
Martin Storsjö a0b7e28907 aviobuf: Partial support for reading in read/write contexts
So far, aviocontexts are used either in pure-read or pure-write
mode - full read/write mode doesn't work well (and implementing it
is a much larger, not totally trivial change).

This patch allows using avio_read and ffio_read_partial on
read/write aviocontexts, where the read operations are passed
through directly unbuffered, while writes are buffered as usual.

This is enough to support the operations needed by packet based
data transfer like in udp/rtp, where aviocontext is the only
public API for hooking up custom IO.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-03 15:14:09 +02:00
Diego Biurrun 511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Luca Barbato 1dd1c1c884 avio: K&R cosmetic formatting 2012-12-09 09:45:45 +01:00
Martin Storsjö b760ffdd07 aviobuf: Remove a senseless ifdef in avio_seek
This seemed to assume that one never used writing avio unless
muxers or networking was enabled.

This ifdef is a remnant since 8fa641f8.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-18 01:44:05 +03:00
Luca Barbato b522000e9b avio: introduce avio_closep 2012-10-10 18:56:55 +02:00
Stefano Sabatini 5d1203f063 avio: flush the internal buffer in avio_close()
This is consistent with stdio, and thus what people would naturally
expect.
2012-09-15 18:24:49 +02:00
Luca Barbato 3093939077 avio: make avio_close NULL the freed buffer 2012-09-04 15:04:46 +02:00
Luca Barbato e1e146a2d1 avio: make avio_close(NULL) a no-op
Its behaviour in line with ffurl_close(NULL).
2012-04-27 14:03:43 -07:00
Anton Khirnov 2439f2ca82 lavf: remove disabled FF_API_OLD_AVIO cruft 2012-01-27 10:52:42 +01:00
Diego Biurrun 3dc99a18d4 cosmetics: drop some pointless parentheses 2012-01-07 22:13:07 +01:00
Janne Grunau a2d1d21629 avio: exit early in fill_buffer without read_packet
Fixes an invalid free() with ass in avi. The sample in bug 98 passes
parts of AVPacket.data as buffer for the AVIOContext. Since the packet
is quite large fill_buffer tries to reallocate the buffer before doing
nothing. Fixes bug 98.
2012-01-04 11:18:24 +01:00
Martin Storsjö 1dee0aca74 avio: add avio_open2, taking an interrupt callback and options
The interrupt callback has to be passed in during opening (setting it
after opening isn't enough), since a blocking open couldn't be
interrupted otherwise.

Options are passed down to procotols and also need to be available
during open() in most cases.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-11-13 13:17:04 +01:00
Anton Khirnov ddffc2fdc3 avio: add support for passing options to protocols.
Not used anywhere yet, support for passing options from avio_open() will
follow.
2011-11-13 13:14:39 +01:00
Martin Storsjö 6f1b7b3944 avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
Change all uses of these function to pass the relevant
callback on.
2011-11-13 13:12:17 +01:00
Diego Biurrun 124e28847b Remove some stray unnecessary ffmpeg references. 2011-11-02 10:42:54 +01:00
Alex Converse ab2940691b avio: Check for invalid buffer length. 2011-10-16 23:56:21 -07:00
Anton Khirnov c3bec4cd13 avio: don't replicate avio_alloc_context functionality. 2011-07-15 20:04:46 +02:00
Can Wu 9e2dabed4a avio: check AVIOContext malloc failure
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-05-21 13:42:50 +02:00
Stefano Sabatini 59d96941f0 avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
Make AVIO_FLAG_ access constants work as flags, and in particular fix
the behavior of functions (such as avio_check()) which expect them to
be flags rather than modes.

This breaks API.
2011-04-19 19:47:58 +02:00
Anton Khirnov 468644f6c1 lavf: remove FF_API_URL_RESETBUF cruft 2011-04-19 18:28:38 +02:00
Anton Khirnov ff1ec0c3f8 avio: undeprecate av_url_read_fseek/fpause under nicer names
It seems their replacements won't be ready anytime soon.
2011-04-12 19:17:05 +02:00
Anton Khirnov f87b1b373a avio: AVIO_ prefixes for URL_ open flags. 2011-04-07 18:07:16 +02:00
Anton Khirnov 668438a31e avio: always compile dyn_buf functions
Fixes build with --disable-muxers --disable-network.

Thanks to Hendrik Leppkes for noticing.
2011-04-05 19:32:14 +02:00
Anton Khirnov 5958df341d avio: deprecate url_max_packet_size().
URLContext.max_packet_size should be used directly.
2011-04-04 17:45:20 +02:00
Anton Khirnov e52a9145c8 avio: make url_close() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 58a48c6511 avio: make url_seek() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 925e908bc7 avio: make url_write() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov bc371aca46 avio: make url_read() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 0589da0aa5 avio: make url_open() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 8bea72f7eb avio: simplify url_open_dyn_buf_internal by using avio_alloc_context() 2011-04-03 23:33:51 +02:00
Anton Khirnov 724f6a0fa4 avio: make url_fdopen internal.
The unbuffered URLContext API will be made private, so there's no point
in this function being public.
2011-04-03 22:47:39 +02:00
Anton Khirnov 403ee835e7 avio: make url_open_dyn_packet_buf internal.
It doesn't look fit to be a part of the public API.

Adding a temporary hack to ffserver to be able to use it, should be
cleaned up when somebody is up for it.
2011-04-03 22:47:32 +02:00
Anton Khirnov 6dc7d80de7 avio: avio_ prefix for url_close_dyn_buf 2011-04-03 22:47:05 +02:00