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
7ae7c414
Commit
7ae7c414
authored
Apr 01, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vsrc_buffer: allow using a NULL buffer to signal EOF.
parent
9206ac80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
buffersrc.h
libavfilter/buffersrc.h
+1
-0
vsrc_buffer.c
libavfilter/vsrc_buffer.c
+19
-1
No files found.
libavfilter/buffersrc.h
View file @
7ae7c414
...
...
@@ -32,6 +32,7 @@
*
* @param buf buffer containing frame data to be passed down the filtergraph.
* This function will take ownership of buf, the user must not free it.
* A NULL buf signals EOF -- i.e. no more frames will be sent to this filter.
*/
int
av_buffersrc_buffer
(
AVFilterContext
*
s
,
AVFilterBufferRef
*
buf
);
...
...
libavfilter/vsrc_buffer.c
View file @
7ae7c414
...
...
@@ -35,6 +35,7 @@ typedef struct {
enum
PixelFormat
pix_fmt
;
AVRational
time_base
;
///< time_base to set in the output link
AVRational
pixel_aspect
;
int
eof
;
}
BufferSourceContext
;
#define CHECK_PARAM_CHANGE(s, c, width, height, format)\
...
...
@@ -50,6 +51,12 @@ int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame,
AVFilterBufferRef
*
buf
;
int
ret
;
if
(
!
buf
)
{
c
->
eof
=
1
;
return
0
;
}
else
if
(
c
->
eof
)
return
AVERROR
(
EINVAL
);
if
(
!
av_fifo_space
(
c
->
fifo
)
&&
(
ret
=
av_fifo_realloc2
(
c
->
fifo
,
av_fifo_size
(
c
->
fifo
)
+
sizeof
(
buf
)))
<
0
)
...
...
@@ -79,6 +86,12 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf)
BufferSourceContext
*
c
=
s
->
priv
;
int
ret
;
if
(
!
buf
)
{
c
->
eof
=
1
;
return
0
;
}
else
if
(
c
->
eof
)
return
AVERROR
(
EINVAL
);
if
(
!
av_fifo_space
(
c
->
fifo
)
&&
(
ret
=
av_fifo_realloc2
(
c
->
fifo
,
av_fifo_size
(
c
->
fifo
)
+
sizeof
(
buf
)))
<
0
)
...
...
@@ -160,6 +173,8 @@ static int request_frame(AVFilterLink *link)
AVFilterBufferRef
*
buf
;
if
(
!
av_fifo_size
(
c
->
fifo
))
{
if
(
c
->
eof
)
return
AVERROR_EOF
;
av_log
(
link
->
src
,
AV_LOG_ERROR
,
"request_frame() called with no available frame!
\n
"
);
return
AVERROR
(
EINVAL
);
...
...
@@ -177,7 +192,10 @@ static int request_frame(AVFilterLink *link)
static
int
poll_frame
(
AVFilterLink
*
link
)
{
BufferSourceContext
*
c
=
link
->
src
->
priv
;
return
!!
av_fifo_size
(
c
->
fifo
);
int
size
=
av_fifo_size
(
c
->
fifo
);
if
(
!
size
&&
c
->
eof
)
return
AVERROR_EOF
;
return
size
/
sizeof
(
AVFilterBufferRef
*
);
}
AVFilter
avfilter_vsrc_buffer
=
{
...
...
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