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
7df808ea
Commit
7df808ea
authored
Oct 19, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/settb: switch to activate
Now correctly updates EOF timestamp.
parent
8732eb12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
7 deletions
+44
-7
settb.c
libavfilter/settb.c
+44
-7
No files found.
libavfilter/settb.c
View file @
7df808ea
...
...
@@ -34,6 +34,7 @@
#include "libavutil/rational.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"
#include "video.h"
...
...
@@ -104,22 +105,58 @@ static int config_output_props(AVFilterLink *outlink)
return
0
;
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
static
int
64_t
rescale_pts
(
AVFilterLink
*
inlink
,
AVFilterLink
*
outlink
,
int64_t
orig_pts
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
]
;
int64_t
new_pts
=
orig_pts
;
if
(
av_cmp_q
(
inlink
->
time_base
,
outlink
->
time_base
))
{
int64_t
orig_pts
=
frame
->
pts
;
frame
->
pts
=
av_rescale_q
(
frame
->
pts
,
inlink
->
time_base
,
outlink
->
time_base
);
new_pts
=
av_rescale_q
(
orig_pts
,
inlink
->
time_base
,
outlink
->
time_base
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
"tb:%d/%d pts:%"
PRId64
" -> tb:%d/%d pts:%"
PRId64
"
\n
"
,
inlink
->
time_base
.
num
,
inlink
->
time_base
.
den
,
orig_pts
,
outlink
->
time_base
.
num
,
outlink
->
time_base
.
den
,
frame
->
pts
);
outlink
->
time_base
.
num
,
outlink
->
time_base
.
den
,
new_
pts
);
}
return
new_pts
;
}
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFrame
*
frame
)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
frame
->
pts
=
rescale_pts
(
inlink
,
outlink
,
frame
->
pts
);
return
ff_filter_frame
(
outlink
,
frame
);
}
static
int
activate
(
AVFilterContext
*
ctx
)
{
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
AVFrame
*
in
;
int
status
;
int64_t
pts
;
int
ret
;
FF_FILTER_FORWARD_STATUS_BACK
(
outlink
,
inlink
);
ret
=
ff_inlink_consume_frame
(
inlink
,
&
in
);
if
(
ret
<
0
)
return
ret
;
if
(
ret
>
0
)
return
filter_frame
(
inlink
,
in
);
if
(
ff_inlink_acknowledge_status
(
inlink
,
&
status
,
&
pts
))
{
ff_outlink_set_status
(
outlink
,
status
,
rescale_pts
(
inlink
,
outlink
,
pts
));
return
0
;
}
FF_FILTER_FORWARD_WANTED
(
outlink
,
inlink
);
return
FFERROR_NOT_READY
;
}
#if CONFIG_SETTB_FILTER
DEFINE_OPTIONS
(
settb
,
VIDEO
);
...
...
@@ -129,7 +166,6 @@ static const AVFilterPad avfilter_vf_settb_inputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
};
...
...
@@ -150,6 +186,7 @@ AVFilter ff_vf_settb = {
.
priv_class
=
&
settb_class
,
.
inputs
=
avfilter_vf_settb_inputs
,
.
outputs
=
avfilter_vf_settb_outputs
,
.
activate
=
activate
,
};
#endif
/* CONFIG_SETTB_FILTER */
...
...
@@ -162,7 +199,6 @@ static const AVFilterPad avfilter_af_asettb_inputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
};
...
...
@@ -183,5 +219,6 @@ AVFilter ff_af_asettb = {
.
inputs
=
avfilter_af_asettb_inputs
,
.
outputs
=
avfilter_af_asettb_outputs
,
.
priv_class
=
&
asettb_class
,
.
activate
=
activate
,
};
#endif
/* CONFIG_ASETTB_FILTER */
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