Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
f8196759
Commit
f8196759
authored
May 14, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fifo: add av_fifo_grow()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
b9777797
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
avutil.h
libavutil/avutil.h
+1
-1
fifo.c
libavutil/fifo.c
+13
-0
fifo.h
libavutil/fifo.h
+11
-0
No files found.
libavutil/avutil.h
View file @
f8196759
...
...
@@ -153,7 +153,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 5
1
#define LIBAVUTIL_VERSION_MINOR 5
2
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
libavutil/fifo.c
View file @
f8196759
...
...
@@ -79,6 +79,19 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size)
return
0
;
}
int
av_fifo_grow
(
AVFifoBuffer
*
f
,
unsigned
int
size
)
{
unsigned
int
old_size
=
f
->
end
-
f
->
buffer
;
if
(
size
+
(
unsigned
)
av_fifo_size
(
f
)
<
size
)
return
AVERROR
(
EINVAL
);
size
+=
av_fifo_size
(
f
);
if
(
old_size
<
size
)
return
av_fifo_realloc2
(
f
,
FFMAX
(
size
,
2
*
size
));
return
0
;
}
// src must NOT be const as it can be a context for func that may need updating (like a pointer or byte counter)
int
av_fifo_generic_write
(
AVFifoBuffer
*
f
,
void
*
src
,
int
size
,
int
(
*
func
)(
void
*
,
void
*
,
int
))
{
...
...
libavutil/fifo.h
View file @
f8196759
...
...
@@ -102,6 +102,17 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
*/
int
av_fifo_realloc2
(
AVFifoBuffer
*
f
,
unsigned
int
size
);
/**
* Enlarge an AVFifoBuffer.
* In case of reallocation failure, the old FIFO is kept unchanged.
* The new fifo size may be larger than the requested size.
*
* @param f AVFifoBuffer to resize
* @param additional_space the amount of space in bytes to allocate in addition to av_fifo_size()
* @return <0 for failure, >=0 otherwise
*/
int
av_fifo_grow
(
AVFifoBuffer
*
f
,
unsigned
int
additional_space
);
/**
* Read and discard the specified amount of data from an AVFifoBuffer.
* @param f AVFifoBuffer to read from
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment