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
1dc42050
Commit
1dc42050
authored
Jul 15, 2012
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi: check all avfilter_ref_buffer() calls for errors.
parent
80e4ed27
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
100 additions
and
20 deletions
+100
-20
fifo.c
libavfilter/fifo.c
+3
-0
split.c
libavfilter/split.c
+13
-4
vf_delogo.c
libavfilter/vf_delogo.c
+7
-2
vf_frei0r.c
libavfilter/vf_frei0r.c
+8
-1
vf_gradfun.c
libavfilter/vf_gradfun.c
+7
-2
vf_overlay.c
libavfilter/vf_overlay.c
+3
-0
vf_pixdesctest.c
libavfilter/vf_pixdesctest.c
+7
-2
vf_scale.c
libavfilter/vf_scale.c
+11
-3
vf_select.c
libavfilter/vf_select.c
+5
-1
vf_transpose.c
libavfilter/vf_transpose.c
+5
-1
vf_vflip.c
libavfilter/vf_vflip.c
+3
-0
vf_yadif.c
libavfilter/vf_yadif.c
+9
-2
video.c
libavfilter/video.c
+6
-1
vsrc_color.c
libavfilter/vsrc_color.c
+8
-1
vsrc_movie.c
libavfilter/vsrc_movie.c
+5
-0
No files found.
libavfilter/fifo.c
View file @
1dc42050
...
...
@@ -169,6 +169,9 @@ static int return_audio_frame(AVFilterContext *ctx)
queue_pop
(
s
);
}
else
{
buf_out
=
avfilter_ref_buffer
(
head
,
AV_PERM_READ
);
if
(
!
buf_out
)
return
AVERROR
(
ENOMEM
);
buf_out
->
audio
->
nb_samples
=
link
->
request_samples
;
buffer_offset
(
link
,
head
,
link
->
request_samples
);
}
...
...
libavfilter/split.c
View file @
1dc42050
...
...
@@ -69,8 +69,11 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
int
i
,
ret
=
0
;
for
(
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
{
ret
=
ff_start_frame
(
ctx
->
outputs
[
i
],
avfilter_ref_buffer
(
picref
,
~
AV_PERM_WRITE
));
AVFilterBufferRef
*
buf_out
=
avfilter_ref_buffer
(
picref
,
~
AV_PERM_WRITE
);
if
(
!
buf_out
)
return
AVERROR
(
ENOMEM
);
ret
=
ff_start_frame
(
ctx
->
outputs
[
i
],
buf_out
);
if
(
ret
<
0
)
break
;
}
...
...
@@ -126,8 +129,14 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
int
i
,
ret
=
0
;
for
(
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
{
ret
=
ff_filter_samples
(
inlink
->
dst
->
outputs
[
i
],
avfilter_ref_buffer
(
samplesref
,
~
AV_PERM_WRITE
));
AVFilterBufferRef
*
buf_out
=
avfilter_ref_buffer
(
samplesref
,
~
AV_PERM_WRITE
);
if
(
!
buf_out
)
{
ret
=
AVERROR
(
ENOMEM
);
break
;
}
ret
=
ff_filter_samples
(
inlink
->
dst
->
outputs
[
i
],
buf_out
);
if
(
ret
<
0
)
break
;
}
...
...
libavfilter/vf_delogo.c
View file @
1dc42050
...
...
@@ -217,7 +217,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
static
int
start_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
inpicref
)
{
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterBufferRef
*
outpicref
=
NULL
;
AVFilterBufferRef
*
outpicref
=
NULL
,
*
for_next_filter
;
int
ret
=
0
;
if
(
inpicref
->
perms
&
AV_PERM_PRESERVE
)
{
...
...
@@ -235,7 +235,12 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
return
AVERROR
(
ENOMEM
);
}
ret
=
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
outpicref
,
~
0
));
for_next_filter
=
avfilter_ref_buffer
(
outpicref
,
~
0
);
if
(
for_next_filter
)
ret
=
ff_start_frame
(
outlink
,
for_next_filter
);
else
ret
=
AVERROR
(
ENOMEM
);
if
(
ret
<
0
)
{
avfilter_unref_bufferp
(
&
outpicref
);
return
ret
;
...
...
libavfilter/vf_frei0r.c
View file @
1dc42050
...
...
@@ -438,13 +438,20 @@ static int source_request_frame(AVFilterLink *outlink)
{
Frei0rContext
*
frei0r
=
outlink
->
src
->
priv
;
AVFilterBufferRef
*
picref
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
AVFilterBufferRef
*
buf_out
;
int
ret
;
picref
->
video
->
pixel_aspect
=
(
AVRational
)
{
1
,
1
};
picref
->
pts
=
frei0r
->
pts
++
;
picref
->
pos
=
-
1
;
ret
=
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
picref
,
~
0
));
buf_out
=
avfilter_ref_buffer
(
picref
,
~
0
);
if
(
!
buf_out
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
ret
=
ff_start_frame
(
outlink
,
buf_out
);
if
(
ret
<
0
)
goto
fail
;
...
...
libavfilter/vf_gradfun.c
View file @
1dc42050
...
...
@@ -183,7 +183,7 @@ static int config_input(AVFilterLink *inlink)
static
int
start_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
inpicref
)
{
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterBufferRef
*
outpicref
=
NULL
;
AVFilterBufferRef
*
outpicref
=
NULL
,
*
for_next_filter
;
int
ret
=
0
;
if
(
inpicref
->
perms
&
AV_PERM_PRESERVE
)
{
...
...
@@ -200,7 +200,12 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
return
AVERROR
(
ENOMEM
);
}
ret
=
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
outpicref
,
~
0
));
for_next_filter
=
avfilter_ref_buffer
(
outpicref
,
~
0
);
if
(
for_next_filter
)
ret
=
ff_start_frame
(
outlink
,
for_next_filter
);
else
ret
=
AVERROR
(
ENOMEM
);
if
(
ret
<
0
)
{
avfilter_unref_bufferp
(
&
outpicref
);
return
ret
;
...
...
libavfilter/vf_overlay.c
View file @
1dc42050
...
...
@@ -213,6 +213,9 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
AVFilterContext
*
ctx
=
inlink
->
dst
;
OverlayContext
*
over
=
ctx
->
priv
;
if
(
!
outpicref
)
return
AVERROR
(
ENOMEM
);
outpicref
->
pts
=
av_rescale_q
(
outpicref
->
pts
,
ctx
->
inputs
[
MAIN
]
->
time_base
,
ctx
->
outputs
[
0
]
->
time_base
);
...
...
libavfilter/vf_pixdesctest.c
View file @
1dc42050
...
...
@@ -55,7 +55,7 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
{
PixdescTestContext
*
priv
=
inlink
->
dst
->
priv
;
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterBufferRef
*
outpicref
;
AVFilterBufferRef
*
outpicref
,
*
for_next_filter
;
int
i
,
ret
=
0
;
outpicref
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
...
...
@@ -80,7 +80,12 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
priv
->
pix_desc
->
flags
&
PIX_FMT_PSEUDOPAL
)
memcpy
(
outpicref
->
data
[
1
],
outpicref
->
data
[
1
],
256
*
4
);
ret
=
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
outpicref
,
~
0
));
for_next_filter
=
avfilter_ref_buffer
(
outpicref
,
~
0
);
if
(
for_next_filter
)
ret
=
ff_start_frame
(
outlink
,
for_next_filter
);
else
ret
=
AVERROR
(
ENOMEM
);
if
(
ret
<
0
)
{
avfilter_unref_bufferp
(
&
outpicref
);
return
ret
;
...
...
libavfilter/vf_scale.c
View file @
1dc42050
...
...
@@ -256,11 +256,14 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
{
ScaleContext
*
scale
=
link
->
dst
->
priv
;
AVFilterLink
*
outlink
=
link
->
dst
->
outputs
[
0
];
AVFilterBufferRef
*
outpicref
;
AVFilterBufferRef
*
outpicref
,
*
for_next_filter
;
int
ret
=
0
;
if
(
!
scale
->
sws
)
{
return
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
picref
,
~
0
));
outpicref
=
avfilter_ref_buffer
(
picref
,
~
0
);
if
(
!
outpicref
)
return
AVERROR
(
ENOMEM
);
return
ff_start_frame
(
outlink
,
outpicref
);
}
scale
->
hsub
=
av_pix_fmt_descriptors
[
link
->
format
].
log2_chroma_w
;
...
...
@@ -281,7 +284,12 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
INT_MAX
);
scale
->
slice_y
=
0
;
ret
=
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
outpicref
,
~
0
));
for_next_filter
=
avfilter_ref_buffer
(
outpicref
,
~
0
);
if
(
for_next_filter
)
ret
=
ff_start_frame
(
outlink
,
for_next_filter
);
else
ret
=
AVERROR
(
ENOMEM
);
if
(
ret
<
0
)
{
avfilter_unref_bufferp
(
&
outpicref
);
return
ret
;
...
...
libavfilter/vf_select.c
View file @
1dc42050
...
...
@@ -233,6 +233,7 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
select
->
select
=
select_frame
(
inlink
->
dst
,
picref
);
if
(
select
->
select
)
{
AVFilterBufferRef
*
buf_out
;
/* frame was requested through poll_frame */
if
(
select
->
cache_frames
)
{
if
(
!
av_fifo_space
(
select
->
pending_frames
))
...
...
@@ -243,7 +244,10 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
sizeof
(
picref
),
NULL
);
return
0
;
}
return
ff_start_frame
(
inlink
->
dst
->
outputs
[
0
],
avfilter_ref_buffer
(
picref
,
~
0
));
buf_out
=
avfilter_ref_buffer
(
picref
,
~
0
);
if
(
!
buf_out
)
return
AVERROR
(
ENOMEM
);
return
ff_start_frame
(
inlink
->
dst
->
outputs
[
0
],
buf_out
);
}
return
0
;
...
...
libavfilter/vf_transpose.c
View file @
1dc42050
...
...
@@ -120,6 +120,7 @@ static int config_props_output(AVFilterLink *outlink)
static
int
start_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
picref
)
{
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
AVFilterBufferRef
*
buf_out
;
outlink
->
out_buf
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
...
...
@@ -135,7 +136,10 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
outlink
->
out_buf
->
video
->
pixel_aspect
.
den
=
picref
->
video
->
pixel_aspect
.
num
;
}
return
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
outlink
->
out_buf
,
~
0
));
buf_out
=
avfilter_ref_buffer
(
outlink
->
out_buf
,
~
0
);
if
(
!
buf_out
)
return
AVERROR
(
ENOMEM
);
return
ff_start_frame
(
outlink
,
buf_out
);
}
static
int
end_frame
(
AVFilterLink
*
inlink
)
...
...
libavfilter/vf_vflip.c
View file @
1dc42050
...
...
@@ -70,6 +70,9 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref)
AVFilterBufferRef
*
outpicref
=
avfilter_ref_buffer
(
inpicref
,
~
0
);
int
i
;
if
(
!
outpicref
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
int
vsub
=
i
==
1
||
i
==
2
?
flip
->
vsub
:
0
;
...
...
libavfilter/vf_yadif.c
View file @
1dc42050
...
...
@@ -224,14 +224,18 @@ static int start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
if
(
yadif
->
auto_enable
&&
!
yadif
->
cur
->
video
->
interlaced
)
{
yadif
->
out
=
avfilter_ref_buffer
(
yadif
->
cur
,
AV_PERM_READ
);
if
(
!
yadif
->
out
)
return
AVERROR
(
ENOMEM
);
avfilter_unref_bufferp
(
&
yadif
->
prev
);
if
(
yadif
->
out
->
pts
!=
AV_NOPTS_VALUE
)
yadif
->
out
->
pts
*=
2
;
return
ff_start_frame
(
ctx
->
outputs
[
0
],
yadif
->
out
);
}
if
(
!
yadif
->
prev
)
yadif
->
prev
=
avfilter_ref_buffer
(
yadif
->
cur
,
AV_PERM_READ
);
if
(
!
yadif
->
prev
&&
!
(
yadif
->
prev
=
avfilter_ref_buffer
(
yadif
->
cur
,
AV_PERM_READ
)))
return
AVERROR
(
ENOMEM
);
yadif
->
out
=
ff_get_video_buffer
(
ctx
->
outputs
[
0
],
AV_PERM_WRITE
|
AV_PERM_PRESERVE
|
AV_PERM_REUSE
,
link
->
w
,
link
->
h
);
...
...
@@ -282,6 +286,9 @@ static int request_frame(AVFilterLink *link)
if
(
ret
==
AVERROR_EOF
&&
yadif
->
next
)
{
AVFilterBufferRef
*
next
=
avfilter_ref_buffer
(
yadif
->
next
,
AV_PERM_READ
);
if
(
!
next
)
return
AVERROR
(
ENOMEM
);
next
->
pts
=
yadif
->
next
->
pts
*
2
-
yadif
->
cur
->
pts
;
start_frame
(
link
->
src
->
inputs
[
0
],
next
);
...
...
libavfilter/video.c
View file @
1dc42050
...
...
@@ -176,12 +176,17 @@ static int default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
outlink
=
inlink
->
dst
->
outputs
[
0
];
if
(
outlink
)
{
AVFilterBufferRef
*
buf_out
;
outlink
->
out_buf
=
ff_get_video_buffer
(
outlink
,
AV_PERM_WRITE
,
outlink
->
w
,
outlink
->
h
);
if
(
!
outlink
->
out_buf
)
return
AVERROR
(
ENOMEM
);
avfilter_copy_buffer_ref_props
(
outlink
->
out_buf
,
picref
);
return
ff_start_frame
(
outlink
,
avfilter_ref_buffer
(
outlink
->
out_buf
,
~
0
));
buf_out
=
avfilter_ref_buffer
(
outlink
->
out_buf
,
~
0
);
if
(
!
buf_out
)
return
AVERROR
(
ENOMEM
);
return
ff_start_frame
(
outlink
,
buf_out
);
}
return
0
;
}
...
...
libavfilter/vsrc_color.c
View file @
1dc42050
...
...
@@ -142,13 +142,20 @@ static int color_request_frame(AVFilterLink *link)
{
ColorContext
*
color
=
link
->
src
->
priv
;
AVFilterBufferRef
*
picref
=
ff_get_video_buffer
(
link
,
AV_PERM_WRITE
,
color
->
w
,
color
->
h
);
AVFilterBufferRef
*
buf_out
;
int
ret
;
picref
->
video
->
pixel_aspect
=
(
AVRational
)
{
1
,
1
};
picref
->
pts
=
color
->
pts
++
;
picref
->
pos
=
-
1
;
ret
=
ff_start_frame
(
link
,
avfilter_ref_buffer
(
picref
,
~
0
));
buf_out
=
avfilter_ref_buffer
(
picref
,
~
0
);
if
(
!
buf_out
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
ret
=
ff_start_frame
(
link
,
buf_out
);
if
(
ret
<
0
)
goto
fail
;
...
...
libavfilter/vsrc_movie.c
View file @
1dc42050
...
...
@@ -289,6 +289,11 @@ static int request_frame(AVFilterLink *outlink)
return
ret
;
outpicref
=
avfilter_ref_buffer
(
movie
->
picref
,
~
0
);
if
(
!
outpicref
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
ret
=
ff_start_frame
(
outlink
,
outpicref
);
if
(
ret
<
0
)
goto
fail
;
...
...
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