Commit Graph

56 Commits

Author SHA1 Message Date
Jan Sebechlebsky 0e84eee719 libavutil/fifo: Fix fifo grow step
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>
2016-06-03 14:49:56 +02:00
Derek Buitenhuis 96d616052b Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'
* 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>
2016-05-11 19:13:03 +01:00
Diego Biurrun d12b5b2f13 build: Split test programs off into separate files
This avoids spurious library rebuilds when only the test program
code is changed and simplifies the build system.
2016-04-07 16:14:42 +02:00
Zhang Rui 87ff61b9ab avutil/fifo: add function av_fifo_generic_peek_at()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-14 20:23:58 +02:00
Michael Niedermayer 147b12162d avutil/fifo: Fix thread saftey of av_fifo_generic_peek()
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>
2015-10-13 19:08:42 +02:00
Paul B Mahol 2fa019958b avfilter: add showfreqs filter 2015-08-19 16:15:13 +00:00
Zhang Rui fcbea93cf8 avutil/fifo: Fix the case where func() returns less bytes than requested in av_fifo_generic_write()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-14 17:28:55 +02:00
Michael Niedermayer 5182a2a235 avutil: remove FF_CONST_AVUTIL53, its no longer needed
version is 54 already

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-24 02:22:19 +01:00
Lukasz Marek 7336e39f3c lavu/fifo: add av_fifo_alloc_array function
Allows to alloc fifo buffer by passing
number of elements and size of element.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-05-20 00:00:44 +02:00
Michael Niedermayer acb6f3af4f avutil/fifo: delay addition of const from 78d3453c4a 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>
2014-05-14 15:44:01 +02:00
Lukasz Marek 351f6118c7 lavu/fifo: add av_fifo_freep function
Function allows to free fifo and reset freed pointer.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-05-07 23:39:42 +02:00
Lukasz Marek 78d3453c4a lavu/fifo: add const to arguments
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-05 17:32:24 +02:00
Michael Niedermayer cc84f30402 avutil/fifo: assert that theres enough data in the fifo on drain calls.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-03 03:11:35 +02:00
Michael Niedermayer 7bd417c22a Merge commit '6516632967da5e6bd7d6136e8678f826669ed26e'
* 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>
2013-07-07 11:26:28 +02:00
Luca Barbato 73142e7533 fifo: K&R formatting cosmetics 2013-07-06 14:28:06 +02:00
Michael Niedermayer 99efd59626 Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'
* 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>
2012-12-05 13:34:45 +01:00
Anton Khirnov cb45553f57 Remove pointless #undefs of previously forbidden functions. 2012-12-04 21:40:22 +01:00
Michael Niedermayer f8196759b4 fifo: add av_fifo_grow()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-15 18:08:32 +02:00
Michael Niedermayer 9eb0d8bab1 fifo: Make writes atomic.
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>
2011-12-23 00:18:36 +01:00
Michael Niedermayer 094a496818 Merge remote-tracking branch 'qatar/master'
* 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>
2011-08-26 23:18:54 +02:00
Stefano Sabatini 1717ba0cdd fifo: add FIFO API test program, and fate test
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-08-26 20:54:36 +02:00
Stefano Sabatini 2e81bb5e92 fifo: return AVERROR(ENOMEM) rather -1 in av_fifo_realloc2() 2011-08-14 01:56:28 +02:00
Stefano Sabatini f1b29223e6 fifo: apply misc cosmetic fixes 2011-08-14 01:56:28 +02:00
Michael Niedermayer 1735440773 fifo: use av_freep()
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>
2011-05-09 21:23:45 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Michael Niedermayer fc323a5480 Clarify non constness of src in av_fifo_generic_write()
Originally committed as revision 21997 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-23 12:14:13 +00:00
Olivier Guilyardi 7b09db3522 Implement av_fifo_space().
Patch by Olivier Guilyardi list et samalyse DOT c0m.

Originally committed as revision 18321 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-04-02 23:22:19 +00:00
Reimar Döffinger 3898eed890 Reorder arguments for av_fifo_generic_read to be more logical and
consistent with av_fifo_generic_write.

Originally committed as revision 17914 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-09 17:47:47 +00:00
Reimar Döffinger 32b936d0c3 Add av_fifo_reset function to completely reset fifo state, which makes
it easier to reuse the fifo.

Originally committed as revision 17901 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-09 09:26:32 +00:00
Michael Niedermayer c900635fd9 indent
Originally committed as revision 17897 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-09 03:39:58 +00:00
Reimar Döffinger fe4032b66a Remove more functions disabled by major version bump.
Originally committed as revision 17876 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-08 15:02:12 +00:00
Reimar Döffinger c957c85426 Replace all uses of the replaced av_fifo_read by av_fifo_generic_read
Originally committed as revision 17873 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-08 14:42:11 +00:00
Reimar Döffinger cddcf8c60f Remove av_fifo_read, API is already broken and major version will be bumped soon.
Originally committed as revision 17870 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-08 14:21:56 +00:00
Michael Niedermayer 41dd680dd8 Allocate AVFifoBuffer through the fifo API to reduce future API/ABI issues.
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
2009-03-08 14:16:55 +00:00
Michael Niedermayer a936475949 Comments to indicate where memory barriers may be needed.
Originally committed as revision 17867 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-08 00:45:45 +00:00
Michael Niedermayer 0a71e78ce4 Try to fix the 1 byte cannot be used issue.
Originally committed as revision 17865 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-07 21:02:08 +00:00
Diego Biurrun 89c9ff504b spelling/grammar/consistency review part I
Originally committed as revision 16840 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-28 00:16:05 +00:00
Diego Biurrun 5090122f90 Drop deprecated av_fifo_write function with the next libavutil version bump.
Originally committed as revision 16782 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-25 19:22:47 +00:00
Stefano Sabatini b76e3424ca Cosmetics: remove a redundant and misplaced doxy.
Originally committed as revision 14856 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-19 22:17:13 +00:00
Stefano Sabatini e8e2b2ef17 Deprecate av_fifo_realloc(). av_fifo_realloc2() should be used instead.
Originally committed as revision 14855 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-19 22:15:05 +00:00
Stefano Sabatini 8257b835cf Implement av_fifo_realloc2().
Originally committed as revision 14846 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-19 18:43:34 +00:00
Michael Niedermayer fa3b98182d Ensure that one can store X bytes in a fifo of size X.
Fixed issue417.

Originally committed as revision 13405 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-05-25 23:04:09 +00:00
Michael Niedermayer 0871ae1a93 Make av_fifo*_read() ignore the available amount of data.
This is more efficient as in practice the check is redundant most of the
time. Callers which do not know if enough data is available have to check
it with av_fifo_size(). Doing the check in *read() means the caller has
no choice to skip the check when its known to be redundant.
Also the return value was never documented in a public header so
changing it should not break the API. Besides this fixes the case where
read() failed on a 100% full fifo.

Originally committed as revision 13404 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-05-25 22:20:39 +00:00
Benoit Fouet 95c76e1180 cosmetics (by Björn Axelsson)
Originally committed as revision 12774 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-09 11:36:50 +00:00
Björn Axelsson 49cec1998a Add a generic write function to av_fifo.
Patch by Björn Axelsson: bjorn axelsson intinor se
Original thread: [FFmpeg-devel] [RFC][PATCH] av_fifo_write_from_bytestream()
Date: 04/03/2008 12:14 PM

Originally committed as revision 12773 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-04-09 11:35:16 +00:00
Michael Niedermayer 50b4468598 change while loops to do-while as the condition is true the first time and the check just wastes cpu cycles
Originally committed as revision 7576 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-01-18 00:22:24 +00:00
Michael Niedermayer 4497712f09 simpler branch structure in init (16 bytes smaller object file)
Originally committed as revision 7575 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-01-17 20:14:02 +00:00
Michael Niedermayer be65b41f90 doxygenize
Originally committed as revision 7574 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-01-17 20:12:12 +00:00
Michael Niedermayer 3da97cfdfc avoid code duplication
Originally committed as revision 7573 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-01-17 20:11:23 +00:00
Michael Niedermayer 0726982cdb better to set things to NULL instead of random in case of out of mem
Originally committed as revision 7572 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-01-17 20:06:38 +00:00