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
e1a8df70
Commit
e1a8df70
authored
May 17, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/aevalsrc: add option channel_layout
Allow to explicitly specify the channel layout to select.
parent
cfde7395
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
7 deletions
+40
-7
filters.texi
doc/filters.texi
+14
-2
asrc_aevalsrc.c
libavfilter/asrc_aevalsrc.c
+25
-4
version.h
libavfilter/version.h
+1
-1
No files found.
doc/filters.texi
View file @
e1a8df70
...
...
@@ -606,8 +606,9 @@ audio signal.
It accepts the syntax: @var{exprs}[::@var{options}].
@var{exprs} is a list of expressions separated by ":", one for each
separate channel. The output channel layout depends on the number of
provided expressions, up to 8 channels are supported.
separate channel. In case the @var{channel_layout} is not
specified, the selected channel layout depends on the number of
provided expressions.
@var{options} is an optional sequence of @var{key}=@var{value} pairs,
separated by ":".
...
...
@@ -616,6 +617,10 @@ The description of the accepted options follows.
@table @option
@item channel_layout, c
Set the channel layout. The number of channels in the specified layout
must be equal to the number of specified expressions.
@item duration, d
Set the minimum duration of the sourced audio. See the function
@code{av_parse_time()} for the accepted format.
...
...
@@ -666,6 +671,13 @@ Generate a sin signal with frequency of 440 Hz, set sample rate to
aevalsrc="sin(440*2*PI*t)::s=8000"
@end example
@item
Generate a two channels signal, specify the channel layout (Front
Center + Back Center) explicitly:
@example
aevalsrc="sin(420*2*PI*t):cos(430*2*PI*t)::c=FC|BC"
@end example
@item
Generate white noise:
@example
...
...
libavfilter/asrc_aevalsrc.c
View file @
e1a8df70
...
...
@@ -52,6 +52,7 @@ typedef struct {
char
*
sample_rate_str
;
int
sample_rate
;
int64_t
chlayout
;
char
*
chlayout_str
;
int
nb_channels
;
int64_t
pts
;
AVExpr
*
expr
[
8
];
...
...
@@ -72,6 +73,8 @@ static const AVOption eval_options[]= {
{
"s"
,
"set the sample rate"
,
OFFSET
(
sample_rate_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"44100"
},
CHAR_MIN
,
CHAR_MAX
},
{
"duration"
,
"set audio duration"
,
OFFSET
(
duration_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
"d"
,
"set audio duration"
,
OFFSET
(
duration_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
"channel_layout"
,
"set channel layout"
,
OFFSET
(
chlayout_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
"c"
,
"set channel layout"
,
OFFSET
(
chlayout_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
NULL
},
};
...
...
@@ -111,9 +114,28 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
}
buf
=
NULL
;
}
eval
->
nb_channels
=
i
;
if
(
bufptr
&&
(
ret
=
av_set_options_string
(
eval
,
bufptr
,
"="
,
":"
))
<
0
)
goto
end
;
if
(
eval
->
chlayout_str
)
{
int
n
;
ret
=
ff_parse_channel_layout
(
&
eval
->
chlayout
,
eval
->
chlayout_str
,
ctx
);
if
(
ret
<
0
)
goto
end
;
n
=
av_get_channel_layout_nb_channels
(
eval
->
chlayout
);
if
(
n
!=
eval
->
nb_channels
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Mismatch between the specified number of channels '%d' "
"and the number of channels '%d' in the specified channel layout '%s'
\n
"
,
eval
->
nb_channels
,
n
,
eval
->
chlayout_str
);
ret
=
AVERROR
(
EINVAL
);
goto
end
;
}
}
else
{
/* guess channel layout from nb expressions/channels */
eval
->
nb_channels
=
i
;
eval
->
chlayout
=
av_get_default_channel_layout
(
eval
->
nb_channels
);
if
(
!
eval
->
chlayout
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid number of channels '%d' provided
\n
"
,
...
...
@@ -121,9 +143,7 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
ret
=
AVERROR
(
EINVAL
);
goto
end
;
}
if
(
bufptr
&&
(
ret
=
av_set_options_string
(
eval
,
bufptr
,
"="
,
":"
))
<
0
)
goto
end
;
}
if
((
ret
=
ff_parse_sample_rate
(
&
eval
->
sample_rate
,
eval
->
sample_rate_str
,
ctx
)))
goto
end
;
...
...
@@ -153,6 +173,7 @@ static void uninit(AVFilterContext *ctx)
av_expr_free
(
eval
->
expr
[
i
]);
eval
->
expr
[
i
]
=
NULL
;
}
av_freep
(
&
eval
->
chlayout_str
);
av_freep
(
&
eval
->
duration_str
);
av_freep
(
&
eval
->
sample_rate_str
);
}
...
...
libavfilter/version.h
View file @
e1a8df70
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 74
#define LIBAVFILTER_VERSION_MICRO 10
0
#define LIBAVFILTER_VERSION_MICRO 10
1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
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