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
27ce858c
Commit
27ce858c
authored
Mar 13, 2013
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/showspectrum: raise filter_frame() error.
parent
df5be5e2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
avf_showspectrum.c
libavfilter/avf_showspectrum.c
+13
-8
No files found.
libavfilter/avf_showspectrum.c
View file @
27ce858c
...
@@ -242,7 +242,7 @@ static int config_output(AVFilterLink *outlink)
...
@@ -242,7 +242,7 @@ static int config_output(AVFilterLink *outlink)
return
0
;
return
0
;
}
}
inline
static
void
push_frame
(
AVFilterLink
*
outlink
)
inline
static
int
push_frame
(
AVFilterLink
*
outlink
)
{
{
ShowSpectrumContext
*
showspectrum
=
outlink
->
src
->
priv
;
ShowSpectrumContext
*
showspectrum
=
outlink
->
src
->
priv
;
...
@@ -252,7 +252,7 @@ inline static void push_frame(AVFilterLink *outlink)
...
@@ -252,7 +252,7 @@ inline static void push_frame(AVFilterLink *outlink)
showspectrum
->
filled
=
0
;
showspectrum
->
filled
=
0
;
showspectrum
->
req_fullfilled
=
1
;
showspectrum
->
req_fullfilled
=
1
;
ff_filter_frame
(
outlink
,
av_frame_clone
(
showspectrum
->
outpicref
));
return
ff_filter_frame
(
outlink
,
av_frame_clone
(
showspectrum
->
outpicref
));
}
}
static
int
request_frame
(
AVFilterLink
*
outlink
)
static
int
request_frame
(
AVFilterLink
*
outlink
)
...
@@ -273,6 +273,7 @@ static int request_frame(AVFilterLink *outlink)
...
@@ -273,6 +273,7 @@ static int request_frame(AVFilterLink *outlink)
static
int
plot_spectrum_column
(
AVFilterLink
*
inlink
,
AVFrame
*
insamples
,
int
nb_samples
)
static
int
plot_spectrum_column
(
AVFilterLink
*
inlink
,
AVFrame
*
insamples
,
int
nb_samples
)
{
{
int
ret
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
ShowSpectrumContext
*
showspectrum
=
ctx
->
priv
;
ShowSpectrumContext
*
showspectrum
=
ctx
->
priv
;
...
@@ -455,7 +456,9 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples, int nb
...
@@ -455,7 +456,9 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFrame *insamples, int nb
av_rescale_q
(
showspectrum
->
consumed
,
av_rescale_q
(
showspectrum
->
consumed
,
(
AVRational
){
1
,
inlink
->
sample_rate
},
(
AVRational
){
1
,
inlink
->
sample_rate
},
outlink
->
time_base
);
outlink
->
time_base
);
push_frame
(
outlink
);
ret
=
push_frame
(
outlink
);
if
(
ret
<
0
)
return
ret
;
}
}
return
add_samples
;
return
add_samples
;
...
@@ -465,17 +468,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
...
@@ -465,17 +468,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
{
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
ShowSpectrumContext
*
showspectrum
=
ctx
->
priv
;
ShowSpectrumContext
*
showspectrum
=
ctx
->
priv
;
int
left_samples
=
insamples
->
nb_samples
;
int
ret
=
0
,
left_samples
=
insamples
->
nb_samples
;
showspectrum
->
consumed
=
0
;
showspectrum
->
consumed
=
0
;
while
(
left_samples
)
{
while
(
left_samples
)
{
const
int
added_samples
=
plot_spectrum_column
(
inlink
,
insamples
,
left_samples
);
int
ret
=
plot_spectrum_column
(
inlink
,
insamples
,
left_samples
);
showspectrum
->
consumed
+=
added_samples
;
if
(
ret
<
0
)
left_samples
-=
added_samples
;
break
;
showspectrum
->
consumed
+=
ret
;
left_samples
-=
ret
;
}
}
av_frame_free
(
&
insamples
);
av_frame_free
(
&
insamples
);
return
0
;
return
ret
;
}
}
static
const
AVFilterPad
showspectrum_inputs
[]
=
{
static
const
AVFilterPad
showspectrum_inputs
[]
=
{
...
...
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