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
e509df4b
Commit
e509df4b
authored
Feb 26, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_compand: error checks from libavfilter/af_compand_fork.c
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
4b879751
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
af_compand.c
libavfilter/af_compand.c
+20
-2
No files found.
libavfilter/af_compand.c
View file @
e509df4b
...
@@ -183,6 +183,7 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)
...
@@ -183,6 +183,7 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)
const
int
nb_samples
=
frame
->
nb_samples
;
const
int
nb_samples
=
frame
->
nb_samples
;
AVFrame
*
out_frame
;
AVFrame
*
out_frame
;
int
chan
,
i
;
int
chan
,
i
;
int
err
;
if
(
av_frame_is_writable
(
frame
))
{
if
(
av_frame_is_writable
(
frame
))
{
out_frame
=
frame
;
out_frame
=
frame
;
...
@@ -192,7 +193,12 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)
...
@@ -192,7 +193,12 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)
av_frame_free
(
&
frame
);
av_frame_free
(
&
frame
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
av_frame_copy_props
(
out_frame
,
frame
);
err
=
av_frame_copy_props
(
out_frame
,
frame
);
if
(
err
<
0
)
{
av_frame_free
(
&
out_frame
);
av_frame_free
(
&
frame
);
return
err
;
}
}
}
for
(
chan
=
0
;
chan
<
channels
;
chan
++
)
{
for
(
chan
=
0
;
chan
<
channels
;
chan
++
)
{
...
@@ -223,6 +229,7 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
...
@@ -223,6 +229,7 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
const
int
nb_samples
=
frame
->
nb_samples
;
const
int
nb_samples
=
frame
->
nb_samples
;
int
chan
,
i
,
av_uninit
(
dindex
),
oindex
,
av_uninit
(
count
);
int
chan
,
i
,
av_uninit
(
dindex
),
oindex
,
av_uninit
(
count
);
AVFrame
*
out_frame
=
NULL
;
AVFrame
*
out_frame
=
NULL
;
int
err
;
if
(
s
->
pts
==
AV_NOPTS_VALUE
)
{
if
(
s
->
pts
==
AV_NOPTS_VALUE
)
{
s
->
pts
=
(
frame
->
pts
==
AV_NOPTS_VALUE
)
?
0
:
frame
->
pts
;
s
->
pts
=
(
frame
->
pts
==
AV_NOPTS_VALUE
)
?
0
:
frame
->
pts
;
...
@@ -250,7 +257,12 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
...
@@ -250,7 +257,12 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
av_frame_free
(
&
frame
);
av_frame_free
(
&
frame
);
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
}
}
av_frame_copy_props
(
out_frame
,
frame
);
err
=
av_frame_copy_props
(
out_frame
,
frame
);
if
(
err
<
0
)
{
av_frame_free
(
&
out_frame
);
av_frame_free
(
&
frame
);
return
err
;
}
out_frame
->
pts
=
s
->
pts
;
out_frame
->
pts
=
s
->
pts
;
s
->
pts
+=
av_rescale_q
(
nb_samples
-
i
,
s
->
pts
+=
av_rescale_q
(
nb_samples
-
i
,
(
AVRational
){
1
,
inlink
->
sample_rate
},
(
AVRational
){
1
,
inlink
->
sample_rate
},
...
@@ -317,6 +329,7 @@ static int config_output(AVFilterLink *outlink)
...
@@ -317,6 +329,7 @@ static int config_output(AVFilterLink *outlink)
double
radius
=
s
->
curve_dB
*
M_LN10
/
20
;
double
radius
=
s
->
curve_dB
*
M_LN10
/
20
;
int
nb_attacks
,
nb_decays
,
nb_points
;
int
nb_attacks
,
nb_decays
,
nb_points
;
char
*
p
,
*
saveptr
=
NULL
;
char
*
p
,
*
saveptr
=
NULL
;
const
int
channels
=
outlink
->
channels
;
int
new_nb_items
,
num
;
int
new_nb_items
,
num
;
int
i
;
int
i
;
int
err
;
int
err
;
...
@@ -326,6 +339,11 @@ static int config_output(AVFilterLink *outlink)
...
@@ -326,6 +339,11 @@ static int config_output(AVFilterLink *outlink)
count_items
(
s
->
decays
,
&
nb_decays
);
count_items
(
s
->
decays
,
&
nb_decays
);
count_items
(
s
->
points
,
&
nb_points
);
count_items
(
s
->
points
,
&
nb_points
);
if
(
channels
<=
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid number of channels: %d
\n
"
,
channels
);
return
AVERROR
(
EINVAL
);
}
if
((
nb_attacks
>
outlink
->
channels
)
||
(
nb_decays
>
outlink
->
channels
))
{
if
((
nb_attacks
>
outlink
->
channels
)
||
(
nb_decays
>
outlink
->
channels
))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Number of attacks/decays bigger than number of channels.
\n
"
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Number of attacks/decays bigger than number of channels.
\n
"
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
...
...
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