summaryrefslogtreecommitdiff
path: root/libavutil/fifo.c
Commit message (Collapse)AuthorAge
* avutil/fifo: Don't include avutil.hAndreas Rheinhardt2022-02-24
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/fifo: fix a corner case in av_fifo_grow2()Anton Khirnov2022-02-15
| | | | | | | When the fifo is grown by exactly the current write offset, it would end up with offset_w = nb_elems. If av_fifo_write_from_cb() is called in such a state, the user callback would get callled with *nb_elems=0, which will then cause the write to return without writing anything.
* lavu/fifo: fix regressionHaihao Xiang2022-02-09
| | | | | | | | | | | offset_w might be updated after growing the FIFO Fix ticket #9630 Tested-by: U. Artie Eoff <ullysses.a.eoff@intel.com> Reviewed-by: mkver Reviewed-by: U. Artie Eoff <ullysses.a.eoff@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avutil/fifo: Deprecate old FIFO APIAnton Khirnov2022-02-07
| | | | | | | | Users should switch to the superior AVFifo API. Unfortunately AVFifoBuffer fields cannot be marked as deprecated because it would trigger a warning wherever fifo.h is #included, due to inlined av_fifo_peek2().
* lavu/fifo: add a flag for automatically growing the FIFO as neededAnton Khirnov2022-02-07
| | | | | This will not increase the FIFO beyond 1MB, unless the caller explicitly specifies otherwise.
* lavu/fifo: Add new AVFifo API based upon the notion of element sizeAnton Khirnov2022-02-07
| | | | | | | | | | | | | | | | | | Many AVFifoBuffer users operate on fixed-size elements (e.g. pointers), but the current FIFO API deals exclusively in bytes, requiring extra complexity in all these callers. Add a new AVFifo API creating a FIFO with an element size that may be larger than a byte. All operations on such a FIFO then operate on complete elements. This API does not reuse AVFifoBuffer and its API at all, but instead uses an opaque struct called AVFifo. The AVFifoBuffer API will be deprecated in a future commit once all of its users have been switched to the new API. Not reusing AVFifoBuffer also allowed to use the full range of size_t from the beginning.
* lavu/fifo: disallow overly large fifo sizesAnton Khirnov2022-02-07
| | | | | | | | | | | | | | | The API currently allows creating FIFOs up to - UINT_MAX: av_fifo_alloc(), av_fifo_realloc(), av_fifo_grow() - SIZE_MAX: av_fifo_alloc_array() However the usable limit is determined by - rndx/wndx being uint32_t - av_fifo_[size,space] returning int so no FIFO should be larger than the smallest of - INT_MAX - UINT32_MAX - SIZE_MAX (which should be INT_MAX an all commonly used platforms). Return an error on trying to allocate FIFOs larger than this limit.
* avutil/fifo: Use av_fifo_generic_peek_at() for av_fifo_generic_peek()Andreas Rheinhardt2022-02-07
| | | | | | | Avoids code duplication. It furthermore properly checks for buf_size to be > 0 before doing anything. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavu/fifo: return errors on trying to read/write too muchAnton Khirnov2022-01-10
| | | | | | | | | | Trying to write too much will currently overwrite previous data. Trying to read too much will either av_assert2() in av_fifo_drain() or return old data. Trying to peek too much will either av_assert2() in av_fifo_generic_peek_at() or return old data. Return an error code in all these cases, which is safer and more consistent.
* lavu/fifo: drop useless commentsAnton Khirnov2022-01-10
| | | | | This object was never intended to be thread-safe, so these carry no useful information.
* lavu/fifo: do not copy the whole fifo when reallocatingAnton Khirnov2022-01-10
| | | | | av_realloc() the buffer and only move the part of the ring buffer that needs it. Also avoids allocating a temporary fifo.
* lavu/fifo: simplify av_fifo_alloc()Anton Khirnov2022-01-10
| | | | Turn it into a wrapper around av_fifo_alloc_array().
* libavutil/fifo: Fix fifo grow stepJan Sebechlebsky2016-06-03
| | | | | | | | | Fifo was reallocating always to twice of the requested size. This fixes it to reallocate to requested size, or twice of the original size - whichever is greater. Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'Derek Buitenhuis2016-05-11
|\ | | | | | | | | | | | | | | * commit 'd12b5b2f135aade4099f4b26b0fe678656158c13': build: Split test programs off into separate files Some conversions done by: James Almer <jamrial@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * build: Split test programs off into separate filesDiego Biurrun2016-04-07
| | | | | | | | | | This avoids spurious library rebuilds when only the test program code is changed and simplifies the build system.
* | avutil/fifo: add function av_fifo_generic_peek_at()Zhang Rui2015-10-14
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil/fifo: Fix thread saftey of av_fifo_generic_peek()Michael Niedermayer2015-10-13
| | | | | | | | | | | | | | changing the context state and restoring it is not safe if another thread writes data into the fifo Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avfilter: add showfreqs filterPaul B Mahol2015-08-19
| |
* | avutil/fifo: Fix the case where func() returns less bytes than requested in ↵Zhang Rui2015-07-14
| | | | | | | | | | | | av_fifo_generic_write() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avutil: remove FF_CONST_AVUTIL53, its no longer neededMichael Niedermayer2014-11-24
| | | | | | | | | | | | version is 54 already Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavu/fifo: add av_fifo_alloc_array functionLukasz Marek2014-05-20
| | | | | | | | | | | | | | Allows to alloc fifo buffer by passing number of elements and size of element. Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
* | avutil/fifo: delay addition of const from ↵Michael Niedermayer2014-05-14
| | | | | | | | | | | | | | | | 78d3453c4a2efef9bc079e8f3458653beafcf990 until next major ABI bump This unbreaks API, for example audacity has more build errors due to this Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavu/fifo: add av_fifo_freep functionLukasz Marek2014-05-07
| | | | | | | | | | | | Function allows to free fifo and reset freed pointer. Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
* | lavu/fifo: add const to argumentsLukasz Marek2014-05-05
| | | | | | | | | | Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avutil/fifo: assert that theres enough data in the fifo on drain calls.Michael Niedermayer2013-09-03
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '6516632967da5e6bd7d6136e8678f826669ed26e'Michael Niedermayer2013-07-07
|\| | | | | | | | | | | | | | | | | | | | | | | * commit '6516632967da5e6bd7d6136e8678f826669ed26e': tests: Only run noproxy test if networking is enabled fifo: K&R formatting cosmetics Conflicts: libavformat/Makefile libavutil/fifo.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * fifo: K&R formatting cosmeticsLuca Barbato2013-07-06
| |
* | Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'Michael Niedermayer2012-12-05
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967': Remove pointless #undefs of previously forbidden functions. fate: Add dependencies for bmp, cdxl, dfa, mp3 Conflicts: doc/examples/muxing.c libavfilter/filtfmts.c libavutil/des.c libavutil/eval.c libavutil/log.c libavutil/parseutils.c tests/fate/mp3.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Remove pointless #undefs of previously forbidden functions.Anton Khirnov2012-12-04
| |
* | fifo: add av_fifo_grow()Michael Niedermayer2012-05-15
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | fifo: Make writes atomic.Michael Niedermayer2011-12-23
| | | | | | | | | | | | | | Prior to this a X bytes write could be seen as less than X bytes being available if the check was done at an unfortunate moment. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2011-08-26
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: fifo: add FIFO API test program, and fate test fifo: add av_fifo_peek2(), and deprecate av_fifo_peek() postprocess.c: filter name needs to be double 0 terminated doxygen: fix wrong comment syntax, //< vs. ///< doxygen: drop pointless star from pointer variable names Replace deprecated av_find_stream_info() by avformat_find_stream_info(). xmv: eliminate superfluous zeroing of zero data configure: fix typo in avconv dependency list Conflicts: configure doc/APIchanges libavutil/Makefile libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * fifo: add FIFO API test program, and fate testStefano Sabatini2011-08-26
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * Replace FFmpeg with Libav in licence headersMans Rullgard2011-03-19
| | | | | | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* | fifo: return AVERROR(ENOMEM) rather -1 in av_fifo_realloc2()Stefano Sabatini2011-08-14
| |
* | fifo: apply misc cosmetic fixesStefano Sabatini2011-08-14
| |
* | fifo: use av_freep()Michael Niedermayer2011-05-09
|/ | | | | | | With this change libavutil uses av_freep() everywhere where it makes sense. Remaining av_free() use in it has the used pointer become inaccessible quickly soo zeroing makes no sense. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Clarify non constness of src in av_fifo_generic_write()Michael Niedermayer2010-02-23
| | | | Originally committed as revision 21997 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Implement av_fifo_space().Olivier Guilyardi2009-04-02
| | | | | | Patch by Olivier Guilyardi list et samalyse DOT c0m. Originally committed as revision 18321 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Reorder arguments for av_fifo_generic_read to be more logical andReimar Döffinger2009-03-09
| | | | | | consistent with av_fifo_generic_write. Originally committed as revision 17914 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Add av_fifo_reset function to completely reset fifo state, which makesReimar Döffinger2009-03-09
| | | | | | it easier to reuse the fifo. Originally committed as revision 17901 to svn://svn.ffmpeg.org/ffmpeg/trunk
* indentMichael Niedermayer2009-03-09
| | | | Originally committed as revision 17897 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Remove more functions disabled by major version bump.Reimar Döffinger2009-03-08
| | | | Originally committed as revision 17876 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Replace all uses of the replaced av_fifo_read by av_fifo_generic_readReimar Döffinger2009-03-08
| | | | Originally committed as revision 17873 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Remove av_fifo_read, API is already broken and major version will be bumped ↵Reimar Döffinger2009-03-08
| | | | | | soon. Originally committed as revision 17870 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Allocate AVFifoBuffer through the fifo API to reduce future API/ABI issues.Michael Niedermayer2009-03-08
| | | | | | | Yes this breaks ABI/API but ive already broken it and will bump avutil major soon. Originally committed as revision 17869 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Comments to indicate where memory barriers may be needed.Michael Niedermayer2009-03-08
| | | | Originally committed as revision 17867 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Try to fix the 1 byte cannot be used issue.Michael Niedermayer2009-03-07
| | | | Originally committed as revision 17865 to svn://svn.ffmpeg.org/ffmpeg/trunk
* spelling/grammar/consistency review part IDiego Biurrun2009-01-28
| | | | Originally committed as revision 16840 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Drop deprecated av_fifo_write function with the next libavutil version bump.Diego Biurrun2009-01-25
| | | | Originally committed as revision 16782 to svn://svn.ffmpeg.org/ffmpeg/trunk