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
848a1e67
Commit
848a1e67
authored
Oct 02, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afade: use the name 's' for the pointer to the private context
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
0425fd7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
28 deletions
+28
-28
af_afade.c
libavfilter/af_afade.c
+28
-28
No files found.
libavfilter/af_afade.c
View file @
848a1e67
...
...
@@ -79,9 +79,9 @@ AVFILTER_DEFINE_CLASS(afade);
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
AudioFadeContext
*
afade
=
ctx
->
priv
;
AudioFadeContext
*
s
=
ctx
->
priv
;
if
(
INT64_MAX
-
afade
->
nb_samples
<
afade
->
start_sample
)
if
(
INT64_MAX
-
s
->
nb_samples
<
s
->
start_sample
)
return
AVERROR
(
EINVAL
);
return
0
;
...
...
@@ -202,38 +202,38 @@ FADE(s32, int32_t)
static
int
config_input
(
AVFilterLink
*
inlink
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AudioFadeContext
*
afade
=
ctx
->
priv
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
AudioFadeContext
*
s
=
ctx
->
priv
;
switch
(
inlink
->
format
)
{
case
AV_SAMPLE_FMT_DBL
:
afade
->
fade_samples
=
fade_samples_dbl
;
break
;
case
AV_SAMPLE_FMT_DBLP
:
afade
->
fade_samples
=
fade_samples_dblp
;
break
;
case
AV_SAMPLE_FMT_FLT
:
afade
->
fade_samples
=
fade_samples_flt
;
break
;
case
AV_SAMPLE_FMT_FLTP
:
afade
->
fade_samples
=
fade_samples_fltp
;
break
;
case
AV_SAMPLE_FMT_S16
:
afade
->
fade_samples
=
fade_samples_s16
;
break
;
case
AV_SAMPLE_FMT_S16P
:
afade
->
fade_samples
=
fade_samples_s16p
;
break
;
case
AV_SAMPLE_FMT_S32
:
afade
->
fade_samples
=
fade_samples_s32
;
break
;
case
AV_SAMPLE_FMT_S32P
:
afade
->
fade_samples
=
fade_samples_s32p
;
break
;
case
AV_SAMPLE_FMT_DBL
:
s
->
fade_samples
=
fade_samples_dbl
;
break
;
case
AV_SAMPLE_FMT_DBLP
:
s
->
fade_samples
=
fade_samples_dblp
;
break
;
case
AV_SAMPLE_FMT_FLT
:
s
->
fade_samples
=
fade_samples_flt
;
break
;
case
AV_SAMPLE_FMT_FLTP
:
s
->
fade_samples
=
fade_samples_fltp
;
break
;
case
AV_SAMPLE_FMT_S16
:
s
->
fade_samples
=
fade_samples_s16
;
break
;
case
AV_SAMPLE_FMT_S16P
:
s
->
fade_samples
=
fade_samples_s16p
;
break
;
case
AV_SAMPLE_FMT_S32
:
s
->
fade_samples
=
fade_samples_s32
;
break
;
case
AV_SAMPLE_FMT_S32P
:
s
->
fade_samples
=
fade_samples_s32p
;
break
;
}
if
(
afade
->
duration
)
afade
->
nb_samples
=
av_rescale
(
afade
->
duration
,
inlink
->
sample_rate
,
AV_TIME_BASE
);
if
(
afade
->
start_time
)
afade
->
start_sample
=
av_rescale
(
afade
->
start_time
,
inlink
->
sample_rate
,
AV_TIME_BASE
);
if
(
s
->
duration
)
s
->
nb_samples
=
av_rescale
(
s
->
duration
,
inlink
->
sample_rate
,
AV_TIME_BASE
);
if
(
s
->
start_time
)
s
->
start_sample
=
av_rescale
(
s
->
start_time
,
inlink
->
sample_rate
,
AV_TIME_BASE
);
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
buf
)
{
AudioFadeContext
*
afade
=
inlink
->
dst
->
priv
;
AudioFadeContext
*
s
=
inlink
->
dst
->
priv
;
AVFilterLink
*
outlink
=
inlink
->
dst
->
outputs
[
0
];
int
nb_samples
=
buf
->
nb_samples
;
AVFrame
*
out_buf
;
int64_t
cur_sample
=
av_rescale_q
(
buf
->
pts
,
(
AVRational
){
1
,
outlink
->
sample_rate
},
outlink
->
time_base
);
if
((
!
afade
->
type
&&
(
afade
->
start_sample
+
afade
->
nb_samples
<
cur_sample
))
||
(
afade
->
type
&&
(
cur_sample
+
afade
->
nb_samples
<
afade
->
start_sample
)))
if
((
!
s
->
type
&&
(
s
->
start_sample
+
s
->
nb_samples
<
cur_sample
))
||
(
s
->
type
&&
(
cur_sample
+
s
->
nb_samples
<
s
->
start_sample
)))
return
ff_filter_frame
(
outlink
,
buf
);
if
(
av_frame_is_writable
(
buf
))
{
...
...
@@ -245,22 +245,22 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
av_frame_copy_props
(
out_buf
,
buf
);
}
if
((
!
afade
->
type
&&
(
cur_sample
+
nb_samples
<
afade
->
start_sample
))
||
(
afade
->
type
&&
(
afade
->
start_sample
+
afade
->
nb_samples
<
cur_sample
)))
{
if
((
!
s
->
type
&&
(
cur_sample
+
nb_samples
<
s
->
start_sample
))
||
(
s
->
type
&&
(
s
->
start_sample
+
s
->
nb_samples
<
cur_sample
)))
{
av_samples_set_silence
(
out_buf
->
extended_data
,
0
,
nb_samples
,
av_frame_get_channels
(
out_buf
),
out_buf
->
format
);
}
else
{
int64_t
start
;
if
(
!
afade
->
type
)
start
=
cur_sample
-
afade
->
start_sample
;
if
(
!
s
->
type
)
start
=
cur_sample
-
s
->
start_sample
;
else
start
=
afade
->
start_sample
+
afade
->
nb_samples
-
cur_sample
;
start
=
s
->
start_sample
+
s
->
nb_samples
-
cur_sample
;
afade
->
fade_samples
(
out_buf
->
extended_data
,
buf
->
extended_data
,
nb_samples
,
av_frame_get_channels
(
buf
),
afade
->
type
?
-
1
:
1
,
start
,
afade
->
nb_samples
,
afade
->
curve
);
s
->
fade_samples
(
out_buf
->
extended_data
,
buf
->
extended_data
,
nb_samples
,
av_frame_get_channels
(
buf
),
s
->
type
?
-
1
:
1
,
start
,
s
->
nb_samples
,
s
->
curve
);
}
if
(
buf
!=
out_buf
)
...
...
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