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
d0920da0
Commit
d0920da0
authored
Oct 27, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_join: switch to activate
Fixes #6780. Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
e6055af0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
47 deletions
+51
-47
af_join.c
libavfilter/af_join.c
+51
-47
No files found.
libavfilter/af_join.c
View file @
d0920da0
...
...
@@ -32,6 +32,7 @@
#include "audio.h"
#include "avfilter.h"
#include "formats.h"
#include "filters.h"
#include "internal.h"
typedef
struct
ChannelMap
{
...
...
@@ -78,34 +79,6 @@ static const AVOption join_options[] = {
AVFILTER_DEFINE_CLASS
(
join
);
static
int
try_push_frame
(
AVFilterContext
*
ctx
);
static
int
filter_frame
(
AVFilterLink
*
link
,
AVFrame
*
frame
)
{
AVFilterContext
*
ctx
=
link
->
dst
;
JoinContext
*
s
=
ctx
->
priv
;
int
i
,
j
;
for
(
i
=
0
;
i
<
ctx
->
nb_inputs
;
i
++
)
if
(
link
==
ctx
->
inputs
[
i
])
break
;
av_assert0
(
i
<
ctx
->
nb_inputs
);
av_assert0
(
!
s
->
input_frames
[
i
]);
s
->
input_frames
[
i
]
=
frame
;
/* request the same number of samples on all inputs */
/* FIXME that means a frame arriving asynchronously on a different input
will not have the requested number of samples */
if
(
i
==
0
)
{
int
nb_samples
=
s
->
input_frames
[
0
]
->
nb_samples
;
for
(
j
=
1
;
!
i
&&
j
<
ctx
->
nb_inputs
;
j
++
)
ctx
->
inputs
[
j
]
->
request_samples
=
nb_samples
;
}
return
try_push_frame
(
ctx
);
}
static
int
parse_maps
(
AVFilterContext
*
ctx
)
{
JoinContext
*
s
=
ctx
->
priv
;
...
...
@@ -220,9 +193,6 @@ static av_cold int join_init(AVFilterContext *ctx)
pad
.
name
=
av_strdup
(
name
);
if
(
!
pad
.
name
)
return
AVERROR
(
ENOMEM
);
pad
.
filter_frame
=
filter_frame
;
pad
.
needs_fifo
=
1
;
if
((
ret
=
ff_insert_inpad
(
ctx
,
i
,
&
pad
))
<
0
)
{
av_freep
(
&
pad
.
name
);
...
...
@@ -390,21 +360,6 @@ fail:
return
ret
;
}
static
int
join_request_frame
(
AVFilterLink
*
outlink
)
{
AVFilterContext
*
ctx
=
outlink
->
src
;
JoinContext
*
s
=
ctx
->
priv
;
int
i
;
/* get a frame on each input */
for
(
i
=
0
;
i
<
ctx
->
nb_inputs
;
i
++
)
{
AVFilterLink
*
inlink
=
ctx
->
inputs
[
i
];
if
(
!
s
->
input_frames
[
i
])
return
ff_request_frame
(
inlink
);
}
return
0
;
}
static
int
try_push_frame
(
AVFilterContext
*
ctx
)
{
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
...
...
@@ -420,6 +375,8 @@ static int try_push_frame(AVFilterContext *ctx)
return
0
;
nb_samples
=
FFMIN
(
nb_samples
,
s
->
input_frames
[
i
]
->
nb_samples
);
}
if
(
!
nb_samples
)
return
0
;
/* setup the output frame */
frame
=
av_frame_alloc
();
...
...
@@ -508,12 +465,58 @@ fail:
return
ret
;
}
static
int
activate
(
AVFilterContext
*
ctx
)
{
JoinContext
*
s
=
ctx
->
priv
;
int
i
,
ret
,
status
;
int
nb_samples
=
0
;
int64_t
pts
;
if
(
!
s
->
input_frames
[
0
])
{
ret
=
ff_inlink_consume_frame
(
ctx
->
inputs
[
0
],
&
s
->
input_frames
[
0
]);
if
(
ret
<
0
)
{
return
ret
;
}
else
if
(
ff_inlink_acknowledge_status
(
ctx
->
inputs
[
0
],
&
status
,
&
pts
))
{
ff_outlink_set_status
(
ctx
->
outputs
[
0
],
status
,
pts
);
return
0
;
}
else
{
if
(
ff_outlink_frame_wanted
(
ctx
->
outputs
[
0
])
&&
!
s
->
input_frames
[
0
])
{
ff_inlink_request_frame
(
ctx
->
inputs
[
0
]);
return
0
;
}
}
}
nb_samples
=
s
->
input_frames
[
0
]
->
nb_samples
;
for
(
i
=
1
;
i
<
ctx
->
nb_inputs
&&
nb_samples
>
0
;
i
++
)
{
if
(
s
->
input_frames
[
i
])
continue
;
if
(
ff_inlink_check_available_samples
(
ctx
->
inputs
[
i
],
nb_samples
)
>
0
)
{
ret
=
ff_inlink_consume_samples
(
ctx
->
inputs
[
i
],
nb_samples
,
nb_samples
,
&
s
->
input_frames
[
i
]);
if
(
ret
<
0
)
{
return
ret
;
}
else
if
(
ff_inlink_acknowledge_status
(
ctx
->
inputs
[
i
],
&
status
,
&
pts
))
{
ff_outlink_set_status
(
ctx
->
outputs
[
0
],
status
,
pts
);
return
0
;
}
}
else
{
if
(
ff_outlink_frame_wanted
(
ctx
->
outputs
[
0
]))
{
ff_inlink_request_frame
(
ctx
->
inputs
[
i
]);
return
0
;
}
}
}
return
try_push_frame
(
ctx
);
}
static
const
AVFilterPad
avfilter_af_join_outputs
[]
=
{
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
config_props
=
join_config_output
,
.
request_frame
=
join_request_frame
,
},
{
NULL
}
};
...
...
@@ -526,6 +529,7 @@ AVFilter ff_af_join = {
.
priv_class
=
&
join_class
,
.
init
=
join_init
,
.
uninit
=
join_uninit
,
.
activate
=
activate
,
.
query_formats
=
join_query_formats
,
.
inputs
=
NULL
,
.
outputs
=
avfilter_af_join_outputs
,
...
...
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