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
dabb993c
Commit
dabb993c
authored
Nov 28, 2012
by
Anton Khirnov
Committed by
Michael Niedermayer
Nov 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
f_setpts: switch to filter_frame
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
bb56436c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
+18
-22
f_setpts.c
libavfilter/f_setpts.c
+18
-22
No files found.
libavfilter/f_setpts.c
View file @
dabb993c
...
...
@@ -123,40 +123,37 @@ static int config_input(AVFilterLink *inlink)
#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
inpicref
)
static
int
filter_frame
(
AVFilterLink
*
inlink
,
AVFilterBufferRef
*
frame
)
{
SetPTSContext
*
setpts
=
inlink
->
dst
->
priv
;
int64_t
in_pts
=
frame
->
pts
;
double
d
;
AVFilterBufferRef
*
outpicref
=
avfilter_ref_buffer
(
inpicref
,
~
0
);
if
(
!
outpicref
)
return
AVERROR
(
ENOMEM
);
if
(
isnan
(
setpts
->
var_values
[
VAR_STARTPTS
]))
{
setpts
->
var_values
[
VAR_STARTPTS
]
=
TS2D
(
inpicref
->
pts
);
setpts
->
var_values
[
VAR_STARTT
]
=
TS2T
(
inpicref
->
pts
,
inlink
->
time_base
);
setpts
->
var_values
[
VAR_STARTPTS
]
=
TS2D
(
frame
->
pts
);
setpts
->
var_values
[
VAR_STARTT
]
=
TS2T
(
frame
->
pts
,
inlink
->
time_base
);
}
setpts
->
var_values
[
VAR_PTS
]
=
TS2D
(
inpicref
->
pts
);
setpts
->
var_values
[
VAR_T
]
=
TS2T
(
inpicref
->
pts
,
inlink
->
time_base
);
setpts
->
var_values
[
VAR_POS
]
=
inpicref
->
pos
==
-
1
?
NAN
:
inpicref
->
pos
;
setpts
->
var_values
[
VAR_PTS
]
=
TS2D
(
frame
->
pts
);
setpts
->
var_values
[
VAR_T
]
=
TS2T
(
frame
->
pts
,
inlink
->
time_base
);
setpts
->
var_values
[
VAR_POS
]
=
frame
->
pos
==
-
1
?
NAN
:
frame
->
pos
;
switch
(
inlink
->
type
)
{
case
AVMEDIA_TYPE_VIDEO
:
setpts
->
var_values
[
VAR_INTERLACED
]
=
inpicref
->
video
->
interlaced
;
setpts
->
var_values
[
VAR_INTERLACED
]
=
frame
->
video
->
interlaced
;
break
;
case
AVMEDIA_TYPE_AUDIO
:
setpts
->
var_values
[
VAR_NB_SAMPLES
]
=
inpicref
->
audio
->
nb_samples
;
setpts
->
var_values
[
VAR_NB_SAMPLES
]
=
frame
->
audio
->
nb_samples
;
break
;
}
d
=
av_expr_eval
(
setpts
->
expr
,
setpts
->
var_values
,
NULL
);
outpicref
->
pts
=
D2TS
(
d
);
frame
->
pts
=
D2TS
(
d
);
setpts
->
var_values
[
VAR_PREV_INPTS
]
=
TS2D
(
in
picref
->
pts
);
setpts
->
var_values
[
VAR_PREV_INT
]
=
TS2T
(
in
picref
->
pts
,
inlink
->
time_base
);
setpts
->
var_values
[
VAR_PREV_OUTPTS
]
=
TS2D
(
outpicref
->
pts
);
setpts
->
var_values
[
VAR_PREV_OUTT
]
=
TS2T
(
outpicref
->
pts
,
inlink
->
time_base
);
setpts
->
var_values
[
VAR_PREV_INPTS
]
=
TS2D
(
in
_
pts
);
setpts
->
var_values
[
VAR_PREV_INT
]
=
TS2T
(
in
_
pts
,
inlink
->
time_base
);
setpts
->
var_values
[
VAR_PREV_OUTPTS
]
=
TS2D
(
frame
->
pts
);
setpts
->
var_values
[
VAR_PREV_OUTT
]
=
TS2T
(
frame
->
pts
,
inlink
->
time_base
);
av_dlog
(
inlink
->
dst
,
"n:%"
PRId64
" interlaced:%d nb_samples:%d nb_consumed_samples:%d "
...
...
@@ -173,10 +170,9 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
setpts
->
var_values
[
VAR_N
]
+=
1
.
0
;
if
(
setpts
->
type
==
AVMEDIA_TYPE_AUDIO
)
{
setpts
->
var_values
[
VAR_NB_CONSUMED_SAMPLES
]
+=
inpicref
->
audio
->
nb_samples
;
return
ff_filter_frame
(
inlink
->
dst
->
outputs
[
0
],
outpicref
);
}
else
return
ff_start_frame
(
inlink
->
dst
->
outputs
[
0
],
outpicref
);
setpts
->
var_values
[
VAR_NB_CONSUMED_SAMPLES
]
+=
frame
->
audio
->
nb_samples
;
}
return
ff_filter_frame
(
inlink
->
dst
->
outputs
[
0
],
frame
);
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
...
...
@@ -222,7 +218,7 @@ static const AVFilterPad avfilter_vf_setpts_inputs[] = {
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
get_video_buffer
=
ff_null_get_video_buffer
,
.
config_props
=
config_input
,
.
start_frame
=
filter_frame
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
};
...
...
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