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
fe447c06
Commit
fe447c06
authored
Oct 05, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/avf_showspectrum: add zoom mode to showspectrumpic
parent
3e687be4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
filters.texi
doc/filters.texi
+6
-0
avf_showspectrum.c
libavfilter/avf_showspectrum.c
+11
-2
No files found.
doc/filters.texi
View file @
fe447c06
...
...
@@ -20872,6 +20872,12 @@ Draw time and frequency axes and legends. Default is enabled.
@item rotation
Set color rotation, must be in [-1.0, 1.0] range.
Default value is @code{0}.
@item start
Set start frequency from which to display spectrogram. Default is @code{0}.
@item stop
Set stop frequency to which to display spectrogram. Default is @code{0}.
@end table
@subsection Examples
...
...
libavfilter/avf_showspectrum.c
View file @
fe447c06
...
...
@@ -1128,6 +1128,8 @@ static const AVOption showspectrumpic_options[] = {
{
"gain"
,
"set scale gain"
,
OFFSET
(
gain
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
128
,
FLAGS
},
{
"legend"
,
"draw legend"
,
OFFSET
(
legend
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
1
},
0
,
1
,
FLAGS
},
{
"rotation"
,
"color rotation"
,
OFFSET
(
rotation
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
},
-
1
,
1
,
FLAGS
},
{
"start"
,
"start frequency"
,
OFFSET
(
start
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT32_MAX
,
FLAGS
},
{
"stop"
,
"stop frequency"
,
OFFSET
(
stop
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT32_MAX
,
FLAGS
},
{
NULL
}
};
...
...
@@ -1240,6 +1242,11 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
drawtext
(
s
->
outpicref
,
2
,
outlink
->
h
-
10
,
"CREATED BY LIBAVFILTER"
,
0
);
drawtext
(
s
->
outpicref
,
outlink
->
w
-
2
-
strlen
(
text
)
*
10
,
outlink
->
h
-
10
,
text
,
0
);
if
(
s
->
stop
)
{
char
*
text
=
av_asprintf
(
"Zoom: %d Hz - %d Hz"
,
s
->
start
,
s
->
stop
);
drawtext
(
s
->
outpicref
,
outlink
->
w
-
2
-
strlen
(
text
)
*
10
,
3
,
text
,
0
);
av_freep
(
&
text
);
}
av_freep
(
&
text
);
...
...
@@ -1283,7 +1290,8 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
dst
[
x
]
=
200
;
}
for
(
y
=
0
;
y
<
h
;
y
+=
40
)
{
float
hertz
=
y
*
(
inlink
->
sample_rate
/
2
)
/
(
float
)(
1
<<
(
int
)
ceil
(
log2
(
h
)));
float
range
=
s
->
stop
?
s
->
stop
-
s
->
start
:
inlink
->
sample_rate
/
2
;
float
hertz
=
s
->
start
+
y
*
range
/
(
float
)(
1
<<
(
int
)
ceil
(
log2
(
h
)));
char
*
units
;
if
(
hertz
==
0
)
...
...
@@ -1348,7 +1356,8 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink)
dst
[
x
]
=
200
;
}
for
(
x
=
0
;
x
<
w
-
79
;
x
+=
80
)
{
float
hertz
=
x
*
(
inlink
->
sample_rate
/
2
)
/
(
float
)(
1
<<
(
int
)
ceil
(
log2
(
w
)));
float
range
=
s
->
stop
?
s
->
stop
-
s
->
start
:
inlink
->
sample_rate
/
2
;
float
hertz
=
s
->
start
+
x
*
range
/
(
float
)(
1
<<
(
int
)
ceil
(
log2
(
w
)));
char
*
units
;
if
(
hertz
==
0
)
...
...
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