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
badbd241
Commit
badbd241
authored
Jul 10, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/aevalsrc: use AV_OPT_TYPE_DURATION
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
1e89f749
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
17 deletions
+5
-17
asrc_aevalsrc.c
libavfilter/asrc_aevalsrc.c
+5
-17
No files found.
libavfilter/asrc_aevalsrc.c
View file @
badbd241
...
@@ -58,8 +58,7 @@ typedef struct {
...
@@ -58,8 +58,7 @@ typedef struct {
AVExpr
*
expr
[
8
];
AVExpr
*
expr
[
8
];
char
*
exprs
;
char
*
exprs
;
int
nb_samples
;
///< number of samples per requested frame
int
nb_samples
;
///< number of samples per requested frame
char
*
duration_str
;
///< total duration of the generated audio
int64_t
duration
;
double
duration
;
uint64_t
n
;
uint64_t
n
;
double
var_values
[
VAR_VARS_NB
];
double
var_values
[
VAR_VARS_NB
];
}
EvalContext
;
}
EvalContext
;
...
@@ -73,8 +72,8 @@ static const AVOption aevalsrc_options[]= {
...
@@ -73,8 +72,8 @@ static const AVOption aevalsrc_options[]= {
{
"n"
,
"set the number of samples per requested frame"
,
OFFSET
(
nb_samples
),
AV_OPT_TYPE_INT
,
{.
i64
=
1024
},
0
,
INT_MAX
,
FLAGS
},
{
"n"
,
"set the number of samples per requested frame"
,
OFFSET
(
nb_samples
),
AV_OPT_TYPE_INT
,
{.
i64
=
1024
},
0
,
INT_MAX
,
FLAGS
},
{
"sample_rate"
,
"set the sample rate"
,
OFFSET
(
sample_rate_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"44100"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"sample_rate"
,
"set the sample rate"
,
OFFSET
(
sample_rate_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"44100"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"s"
,
"set the sample rate"
,
OFFSET
(
sample_rate_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"44100"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"s"
,
"set the sample rate"
,
OFFSET
(
sample_rate_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"44100"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"duration"
,
"set audio duration"
,
OFFSET
(
duration
_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"duration"
,
"set audio duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
-
1
},
-
1
,
INT64_MAX
,
FLAGS
},
{
"d"
,
"set audio duration"
,
OFFSET
(
duration
_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"d"
,
"set audio duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
-
1
},
-
1
,
INT64_MAX
,
FLAGS
},
{
"channel_layout"
,
"set channel layout"
,
OFFSET
(
chlayout_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"channel_layout"
,
"set channel layout"
,
OFFSET
(
chlayout_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"c"
,
"set channel layout"
,
OFFSET
(
chlayout_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"c"
,
"set channel layout"
,
OFFSET
(
chlayout_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
NULL
},
{
NULL
},
...
@@ -135,16 +134,6 @@ static int init(AVFilterContext *ctx)
...
@@ -135,16 +134,6 @@ static int init(AVFilterContext *ctx)
if
((
ret
=
ff_parse_sample_rate
(
&
eval
->
sample_rate
,
eval
->
sample_rate_str
,
ctx
)))
if
((
ret
=
ff_parse_sample_rate
(
&
eval
->
sample_rate
,
eval
->
sample_rate_str
,
ctx
)))
goto
end
;
goto
end
;
eval
->
duration
=
-
1
;
if
(
eval
->
duration_str
)
{
int64_t
us
=
-
1
;
if
((
ret
=
av_parse_time
(
&
us
,
eval
->
duration_str
,
1
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid duration: '%s'
\n
"
,
eval
->
duration_str
);
goto
end
;
}
eval
->
duration
=
(
double
)
us
/
1000000
;
}
eval
->
n
=
0
;
eval
->
n
=
0
;
end:
end:
...
@@ -162,7 +151,6 @@ static av_cold void uninit(AVFilterContext *ctx)
...
@@ -162,7 +151,6 @@ static av_cold void uninit(AVFilterContext *ctx)
eval
->
expr
[
i
]
=
NULL
;
eval
->
expr
[
i
]
=
NULL
;
}
}
av_freep
(
&
eval
->
chlayout_str
);
av_freep
(
&
eval
->
chlayout_str
);
av_freep
(
&
eval
->
duration_str
);
av_freep
(
&
eval
->
sample_rate_str
);
av_freep
(
&
eval
->
sample_rate_str
);
}
}
...
@@ -179,7 +167,7 @@ static int config_props(AVFilterLink *outlink)
...
@@ -179,7 +167,7 @@ static int config_props(AVFilterLink *outlink)
av_get_channel_layout_string
(
buf
,
sizeof
(
buf
),
0
,
eval
->
chlayout
);
av_get_channel_layout_string
(
buf
,
sizeof
(
buf
),
0
,
eval
->
chlayout
);
av_log
(
outlink
->
src
,
AV_LOG_VERBOSE
,
av_log
(
outlink
->
src
,
AV_LOG_VERBOSE
,
"sample_rate:%d chlayout:%s duration:%
f
\n
"
,
"sample_rate:%d chlayout:%s duration:%
"
PRId64
"
\n
"
,
eval
->
sample_rate
,
buf
,
eval
->
duration
);
eval
->
sample_rate
,
buf
,
eval
->
duration
);
return
0
;
return
0
;
...
@@ -204,7 +192,7 @@ static int request_frame(AVFilterLink *outlink)
...
@@ -204,7 +192,7 @@ static int request_frame(AVFilterLink *outlink)
EvalContext
*
eval
=
outlink
->
src
->
priv
;
EvalContext
*
eval
=
outlink
->
src
->
priv
;
AVFrame
*
samplesref
;
AVFrame
*
samplesref
;
int
i
,
j
;
int
i
,
j
;
double
t
=
eval
->
n
*
(
double
)
1
/
eval
->
sample_rate
;
int64_t
t
=
av_rescale
(
eval
->
n
,
AV_TIME_BASE
,
eval
->
sample_rate
)
;
if
(
eval
->
duration
>=
0
&&
t
>=
eval
->
duration
)
if
(
eval
->
duration
>=
0
&&
t
>=
eval
->
duration
)
return
AVERROR_EOF
;
return
AVERROR_EOF
;
...
...
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