Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
89310335
Commit
89310335
authored
May 22, 2024
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/asubprocess: allow setting command as filter parameter
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
1e4460c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
af_asubprocess.c
libavfilter/af_asubprocess.c
+21
-11
No files found.
libavfilter/af_asubprocess.c
View file @
89310335
...
...
@@ -200,7 +200,7 @@ enum {
typedef
struct
AndioWMarkContext
{
const
AVClass
*
class
;
double
strength
;
const
char
*
command
;
int
fd
;
int
state
;
...
...
@@ -208,21 +208,31 @@ typedef struct AndioWMarkContext {
SP
*
sp
;
int
nb_samples
;
int
eof
;
}
A
udioWMark
Context
;
}
A
SubProcess
Context
;
#define OFFSET(x) offsetof(A
udioWMark
Context, x)
#define OFFSET(x) offsetof(A
SubProcess
Context, x)
#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
static
const
AVOption
asubprocess_options
[]
=
{
{
"
strength"
,
"set watermarking strength"
,
OFFSET
(
strength
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
10
},
1
,
100
,
A
},
{
"
command"
,
"set command to run as subprocess"
,
OFFSET
(
command
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
A
},
{
NULL
},
};
AVFILTER_DEFINE_CLASS
(
asubprocess
);
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
ASubProcessContext
*
s
=
ctx
->
priv
;
if
(
!
s
->
command
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"No command provided
\n
"
);
return
AVERROR
(
EINVAL
);
}
return
0
;
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
A
udioWMark
Context
*
s
=
ctx
->
priv
;
A
SubProcess
Context
*
s
=
ctx
->
priv
;
printf
(
"TODO: uninit
\n
"
);
#if 0
...
...
@@ -234,9 +244,8 @@ static av_cold void uninit(AVFilterContext *ctx)
static
int
config_input
(
AVFilterLink
*
inlink
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AudioWMarkContext
*
s
=
ctx
->
priv
;
// TODO: use inlink->sample_rate, inlink->ch_layout.nb_channels
s
->
sp
=
sp_new
(
"audiowmark -q add - - f0"
);
ASubProcessContext
*
s
=
ctx
->
priv
;
s
->
sp
=
sp_new
(
s
->
command
);
int
bit_depth
=
16
;
int
sample_rate
=
inlink
->
sample_rate
;
int
nb_channels
=
inlink
->
ch_layout
.
nb_channels
;
...
...
@@ -285,7 +294,7 @@ static int config_input(AVFilterLink *inlink)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
in
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
A
udioWMark
Context
*
s
=
ctx
->
priv
;
A
SubProcess
Context
*
s
=
ctx
->
priv
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFrame
*
out
;
int
ret
=
0
,
nb_samples
;
...
...
@@ -394,7 +403,7 @@ static int activate(AVFilterContext *ctx)
{
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
A
udioWMark
Context
*
s
=
ctx
->
priv
;
A
SubProcess
Context
*
s
=
ctx
->
priv
;
AVFrame
*
in
=
NULL
;
int64_t
pts
;
int
status
,
ret
;
...
...
@@ -454,8 +463,9 @@ static const AVFilterPad asubprocess_inputs[] = {
const
AVFilter
ff_af_asubprocess
=
{
.
name
=
"asubprocess"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Filter audio stream with subprocess."
),
.
priv_size
=
sizeof
(
A
udioWMark
Context
),
.
priv_size
=
sizeof
(
A
SubProcess
Context
),
.
priv_class
=
&
asubprocess_class
,
.
init
=
init
,
.
uninit
=
uninit
,
.
activate
=
activate
,
FILTER_INPUTS
(
asubprocess_inputs
),
...
...
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