summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
Commit message (Collapse)AuthorAge
* avio: Allow custom IO users to get labels for the output bytestreamMartin Storsjö2016-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows callers with avio write callbacks to get the bytestream positions that correspond to keyframes, suitable for live streaming. In the simplest form, a caller could expect that a header is written to the bytestream during the avformat_write_header, and the data output to the avio context during e.g. av_write_frame corresponds exactly to the current packet passed in. When combined with av_interleaved_write_frame, and with muxers that do buffering (most muxers that do some sort of fragmenting or clustering), the mapping from input data to bytestream positions is nontrivial. This allows callers to get directly information about what part of the bytestream is what, without having to resort to assumptions about the muxer behaviour. One keyframe/fragment/block can still be split into multiple (if they are larger than the aviocontext buffer), which would call the callback with e.g. AVIO_DATA_MARKER_SYNC_POINT, followed by AVIO_DATA_MARKER_UNKNOWN for the second time it is called with the following data. Signed-off-by: Martin Storsjö <martin@martin.st>
* avio: Copy URLContext generic options into child URLContextsMartin Storsjö2016-03-24
| | | | | | | | | | | | | | | Since all URLContexts have the same AVOptions, such AVOptions will be applied on the outermost context only and removed from the dict, while they probably make sense on all contexts. This makes sure that rw_timeout gets propagated to the innermost URLContext (to make sure it gets passed to the tcp protocol, when opening a http connection for instance). Alternatively, such matching options would be kept in the dict and only removed after the ffurl_connect call. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavf: add a protocol whitelist/blacklist for file opened internallyAnton Khirnov2016-02-22
| | | | | | | | Should make the default behaviour safer for careless callers that open random untrusted files. Bug-Id: CVE-2016-1897 Bug-Id: CVE-2016-1898
* urlprotocol: receive a list of protocols from the callerAnton Khirnov2016-02-22
| | | | | This way, the decisions about which protocols are available for use in any given situations can be delegated to the caller.
* aviobuf: add a private data struct for avio_open()ed contextsAnton Khirnov2016-02-22
| | | | It will be useful in the following commits.
* lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-27
| | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* avio: Add avio_put_str16beLuca Barbato2015-06-07
|
* avio: Add avio_read wrapper to simplify error checkingVittorio Giovara2015-05-31
| | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* lavf: Explicitly convert types at function pointer assignmentDiego Biurrun2015-03-11
| | | | This fixes a number of "assignment from incompatible pointer type" warnings.
* avio: Rename avclass symbols relating to avioMartin Storsjö2015-02-28
| | | | | | | 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>
* avio: Add an internal utility function for freeing dynamic buffersMartin Storsjö2015-02-24
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* avio: Do not consider the end-of-buffer position validLuca Barbato2015-01-28
| | | | | | | | | | | | | | 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
* aviobuf: check context before using itVittorio Giovara2014-10-20
| | | | | | | Avoid a possible null pointer dereference. CC: libav-stable@libav.org Bug-Id: CID 1135769
* mp3dec: decode more data from Info headerAlessandro Ghedini2014-04-17
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* aviobuf: Handle a NULL buffer in avio_close_dyn_bufMartin Storsjö2013-11-01
| | | | | | | | | | | | 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>
* lavf: Reset the entry count and allocation size variables on av_reallocp ↵Martin Storsjö2013-09-26
| | | | | | | | | | | | | | 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>
* aviobuf: Add functions for null buffersMartin Storsjö2013-09-19
| | | | | | | 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>
* avformat: Use av_reallocp() where suitableAlexandra Khirnova2013-09-18
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* avio: Add const qualifiers to ffio_read_indirectBen Avison2013-08-08
| | | | | | | This provides at least some protection against potential accidental corruption of AVIO buffer workspace. Signed-off-by: Martin Storsjö <martin@martin.st>
* avio: Add an internal function for reading without copyingBen Avison2013-08-05
| | | | | | | | 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>
* avio: Don't set the seekable flag if no seek function is providedHendrik Schreiber2013-07-26
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* aviobuf: Discard old buffered, previously read data in ffio_read_partialMartin Storsjö2013-01-03
| | | | | | | This makes RTP custom IO work properly with pure read-only AVIOContexts as well. Signed-off-by: Martin Storsjö <martin@martin.st>
* aviobuf: Partial support for reading in read/write contextsMartin Storsjö2013-01-03
| | | | | | | | | | | | | | | | 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>
* miscellaneous typo fixesDiego Biurrun2012-12-21
|
* avio: K&R cosmetic formattingLuca Barbato2012-12-09
|
* aviobuf: Remove a senseless ifdef in avio_seekMartin Storsjö2012-10-18
| | | | | | | | | 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>
* avio: introduce avio_closepLuca Barbato2012-10-10
|
* avio: flush the internal buffer in avio_close()Stefano Sabatini2012-09-15
| | | | | This is consistent with stdio, and thus what people would naturally expect.
* avio: make avio_close NULL the freed bufferLuca Barbato2012-09-04
|
* avio: make avio_close(NULL) a no-opLuca Barbato2012-04-27
| | | | Its behaviour in line with ffurl_close(NULL).
* lavf: remove disabled FF_API_OLD_AVIO cruftAnton Khirnov2012-01-27
|
* cosmetics: drop some pointless parenthesesDiego Biurrun2012-01-07
|
* avio: exit early in fill_buffer without read_packetJanne Grunau2012-01-04
| | | | | | | 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.
* avio: add avio_open2, taking an interrupt callback and optionsMartin Storsjö2011-11-13
| | | | | | | | | | | 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>
* avio: add support for passing options to protocols.Anton Khirnov2011-11-13
| | | | | Not used anywhere yet, support for passing options from avio_open() will follow.
* avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_allocMartin Storsjö2011-11-13
| | | | | Change all uses of these function to pass the relevant callback on.
* Remove some stray unnecessary ffmpeg references.Diego Biurrun2011-11-02
|
* avio: Check for invalid buffer length.Alex Converse2011-10-16
|
* avio: don't replicate avio_alloc_context functionality.Anton Khirnov2011-07-15
|
* avio: check AVIOContext malloc failureCan Wu2011-05-21
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbolsStefano Sabatini2011-04-19
| | | | | | | | 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.
* lavf: remove FF_API_URL_RESETBUF cruftAnton Khirnov2011-04-19
|
* avio: undeprecate av_url_read_fseek/fpause under nicer namesAnton Khirnov2011-04-12
| | | | It seems their replacements won't be ready anytime soon.
* avio: AVIO_ prefixes for URL_ open flags.Anton Khirnov2011-04-07
|
* avio: always compile dyn_buf functionsAnton Khirnov2011-04-05
| | | | | | Fixes build with --disable-muxers --disable-network. Thanks to Hendrik Leppkes for noticing.
* avio: deprecate url_max_packet_size().Anton Khirnov2011-04-04
| | | | URLContext.max_packet_size should be used directly.
* avio: make url_close() internal.Anton Khirnov2011-04-04
|
* avio: make url_seek() internal.Anton Khirnov2011-04-04
|
* avio: make url_write() internal.Anton Khirnov2011-04-04
|
* avio: make url_read() internal.Anton Khirnov2011-04-04
|