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
4ab4793c
Commit
4ab4793c
authored
Jan 31, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/avf_showfreqs: properly handle pts
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
58313f2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
avf_showfreqs.c
libavfilter/avf_showfreqs.c
+17
-2
No files found.
libavfilter/avf_showfreqs.c
View file @
4ab4793c
...
...
@@ -154,6 +154,15 @@ static int query_formats(AVFilterContext *ctx)
return
0
;
}
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
ShowFreqsContext
*
s
=
ctx
->
priv
;
s
->
pts
=
AV_NOPTS_VALUE
;
return
0
;
}
static
int
config_output
(
AVFilterLink
*
outlink
)
{
AVFilterContext
*
ctx
=
outlink
->
src
;
...
...
@@ -423,8 +432,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVFilterContext
*
ctx
=
inlink
->
dst
;
ShowFreqsContext
*
s
=
ctx
->
priv
;
AVFrame
*
fin
=
NULL
;
int
consumed
=
0
;
int
ret
=
0
;
if
(
s
->
pts
==
AV_NOPTS_VALUE
)
s
->
pts
=
in
->
pts
-
av_audio_fifo_size
(
s
->
fifo
);
av_audio_fifo_write
(
s
->
fifo
,
(
void
**
)
in
->
extended_data
,
in
->
nb_samples
);
while
(
av_audio_fifo_size
(
s
->
fifo
)
>=
s
->
win_size
)
{
fin
=
ff_get_audio_buffer
(
inlink
,
s
->
win_size
);
...
...
@@ -433,8 +446,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
goto
fail
;
}
fin
->
pts
=
s
->
pts
;
s
->
pts
+=
s
->
hop_size
;
fin
->
pts
=
s
->
pts
+
consumed
;
consumed
+=
s
->
hop_size
;
ret
=
av_audio_fifo_peek
(
s
->
fifo
,
(
void
**
)
fin
->
extended_data
,
s
->
win_size
);
if
(
ret
<
0
)
goto
fail
;
...
...
@@ -447,6 +460,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
}
fail:
s
->
pts
=
AV_NOPTS_VALUE
;
av_frame_free
(
&
fin
);
av_frame_free
(
&
in
);
return
ret
;
...
...
@@ -491,6 +505,7 @@ static const AVFilterPad showfreqs_outputs[] = {
AVFilter
ff_avf_showfreqs
=
{
.
name
=
"showfreqs"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Convert input audio to a frequencies video output."
),
.
init
=
init
,
.
uninit
=
uninit
,
.
query_formats
=
query_formats
,
.
priv_size
=
sizeof
(
ShowFreqsContext
),
...
...
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