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
32824707
Commit
32824707
authored
Mar 07, 2022
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_channelsplit: switch to activate()
parent
a1f2e42e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
18 deletions
+61
-18
af_channelsplit.c
libavfilter/af_channelsplit.c
+61
-18
No files found.
libavfilter/af_channelsplit.c
View file @
32824707
...
...
@@ -30,6 +30,7 @@
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "internal.h"
...
...
@@ -131,38 +132,79 @@ static int query_formats(AVFilterContext *ctx)
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
in
link
,
AVFrame
*
buf
)
static
int
filter_frame
(
AVFilterLink
*
out
link
,
AVFrame
*
buf
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterContext
*
ctx
=
outlink
->
src
;
ChannelSplitContext
*
s
=
ctx
->
priv
;
int
i
,
ret
=
0
;
const
int
i
=
FF_OUTLINK_IDX
(
outlink
)
;
for
(
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
{
AVFrame
*
buf_out
=
av_frame_clone
(
buf
);
AVFrame
*
buf_out
=
av_frame_clone
(
buf
);
if
(
!
buf_out
)
return
AVERROR
(
ENOMEM
);
if
(
!
buf_out
)
{
ret
=
AVERROR
(
ENOMEM
);
break
;
}
buf_out
->
data
[
0
]
=
buf_out
->
extended_data
[
0
]
=
buf_out
->
extended_data
[
s
->
map
[
i
]];
buf_out
->
channel_layout
=
av_channel_layout_extract_channel
(
buf
->
channel_layout
,
s
->
map
[
i
]);
buf_out
->
channels
=
1
;
return
ff_filter_frame
(
ctx
->
outputs
[
i
],
buf_out
);
}
static
int
activate
(
AVFilterContext
*
ctx
)
{
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
int
status
,
ret
;
AVFrame
*
in
;
int64_t
pts
;
for
(
int
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
{
FF_FILTER_FORWARD_STATUS_BACK_ALL
(
ctx
->
outputs
[
i
],
ctx
);
}
buf_out
->
data
[
0
]
=
buf_out
->
extended_data
[
0
]
=
buf_out
->
extended_data
[
s
->
map
[
i
]];
buf_out
->
channel_layout
=
av_channel_layout_extract_channel
(
buf
->
channel_layout
,
s
->
map
[
i
]);
buf_out
->
channels
=
1
;
ret
=
ff_inlink_consume_frame
(
inlink
,
&
in
);
if
(
ret
<
0
)
return
ret
;
if
(
ret
>
0
)
{
for
(
int
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
{
if
(
ff_outlink_get_status
(
ctx
->
outputs
[
i
]))
continue
;
ret
=
filter_frame
(
ctx
->
outputs
[
i
],
in
);
if
(
ret
<
0
)
break
;
}
ret
=
ff_filter_frame
(
ctx
->
outputs
[
i
],
buf_out
);
av_frame_free
(
&
in
);
if
(
ret
<
0
)
break
;
return
ret
;
}
av_frame_free
(
&
buf
);
return
ret
;
if
(
ff_inlink_acknowledge_status
(
inlink
,
&
status
,
&
pts
))
{
for
(
int
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
{
if
(
ff_outlink_get_status
(
ctx
->
outputs
[
i
]))
continue
;
ff_outlink_set_status
(
ctx
->
outputs
[
i
],
status
,
pts
);
}
return
0
;
}
for
(
int
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
{
if
(
ff_outlink_get_status
(
ctx
->
outputs
[
i
]))
continue
;
if
(
ff_outlink_frame_wanted
(
ctx
->
outputs
[
i
]))
{
ff_inlink_request_frame
(
inlink
);
return
0
;
}
}
return
FFERROR_NOT_READY
;
}
static
const
AVFilterPad
avfilter_af_channelsplit_inputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
filter_frame
=
filter_frame
,
},
};
...
...
@@ -172,6 +214,7 @@ const AVFilter ff_af_channelsplit = {
.
priv_size
=
sizeof
(
ChannelSplitContext
),
.
priv_class
=
&
channelsplit_class
,
.
init
=
init
,
.
activate
=
activate
,
FILTER_INPUTS
(
avfilter_af_channelsplit_inputs
),
.
outputs
=
NULL
,
FILTER_QUERY_FUNC
(
query_formats
),
...
...
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