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
dcfe3292
Commit
dcfe3292
authored
Oct 08, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_rubberband: use ff_filter_process_command()
parent
9e883a14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
24 deletions
+9
-24
af_rubberband.c
libavfilter/af_rubberband.c
+9
-24
No files found.
libavfilter/af_rubberband.c
View file @
dcfe3292
...
...
@@ -43,10 +43,11 @@ typedef struct RubberBandContext {
#define OFFSET(x) offsetof(RubberBandContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define AT AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
static
const
AVOption
rubberband_options
[]
=
{
{
"tempo"
,
"set tempo scale factor"
,
OFFSET
(
tempo
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
01
,
100
,
A
},
{
"pitch"
,
"set pitch scale factor"
,
OFFSET
(
pitch
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
01
,
100
,
A
},
{
"tempo"
,
"set tempo scale factor"
,
OFFSET
(
tempo
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
01
,
100
,
A
T
},
{
"pitch"
,
"set pitch scale factor"
,
OFFSET
(
pitch
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
.
01
,
100
,
A
T
},
{
"transients"
,
"set transients"
,
OFFSET
(
transients
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
A
,
"transients"
},
{
"crisp"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
RubberBandOptionTransientsCrisp
},
0
,
0
,
A
,
"transients"
},
{
"mixed"
,
0
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
RubberBandOptionTransientsMixed
},
0
,
0
,
A
,
"transients"
},
...
...
@@ -200,30 +201,14 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
char
*
res
,
int
res_len
,
int
flags
)
{
RubberBandContext
*
s
=
ctx
->
priv
;
int
ret
;
if
(
!
strcmp
(
cmd
,
"tempo"
))
{
double
arg
;
sscanf
(
args
,
"%lf"
,
&
arg
);
if
(
arg
<
0
.
01
||
arg
>
100
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Tempo scale factor '%f' out of range
\n
"
,
arg
);
return
AVERROR
(
EINVAL
);
}
rubberband_set_time_ratio
(
s
->
rbs
,
1
.
/
arg
);
}
if
(
!
strcmp
(
cmd
,
"pitch"
))
{
double
arg
;
ret
=
ff_filter_process_command
(
ctx
,
cmd
,
args
,
res
,
res_len
,
flags
);
if
(
ret
<
0
)
return
ret
;
sscanf
(
args
,
"%lf"
,
&
arg
);
if
(
arg
<
0
.
01
||
arg
>
100
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Pitch scale factor '%f' out of range
\n
"
,
arg
);
return
AVERROR
(
EINVAL
);
}
rubberband_set_pitch_scale
(
s
->
rbs
,
arg
);
}
rubberband_set_time_ratio
(
s
->
rbs
,
1
.
/
s
->
tempo
);
rubberband_set_pitch_scale
(
s
->
rbs
,
s
->
pitch
);
return
0
;
}
...
...
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