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
d9a52b0b
Commit
d9a52b0b
authored
Jan 14, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/f_drawgraph: add rate/r option
parent
9e01f171
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
filters.texi
doc/filters.texi
+3
-0
f_drawgraph.c
libavfilter/f_drawgraph.c
+22
-1
No files found.
doc/filters.texi
View file @
d9a52b0b
...
...
@@ -9321,6 +9321,9 @@ Set size of graph video. For the syntax of this option, check the
@ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
The default value is @code{900x256}.
@item rate, r
Set the output frame rate. Default value is @code{25}.
The foreground color expressions can use the following variables:
@table @option
@item MIN
...
...
libavfilter/f_drawgraph.c
View file @
d9a52b0b
...
...
@@ -40,6 +40,7 @@ typedef struct DrawGraphContext {
int
mode
;
int
slide
;
int
w
,
h
;
AVRational
frame_rate
;
AVFrame
*
out
;
int
x
;
...
...
@@ -48,6 +49,7 @@ typedef struct DrawGraphContext {
float
*
values
[
4
];
int
values_size
[
4
];
int
nb_values
;
int64_t
prev_pts
;
}
DrawGraphContext
;
#define OFFSET(x) offsetof(DrawGraphContext, x)
...
...
@@ -77,6 +79,8 @@ static const AVOption drawgraph_options[] = {
{
"picture"
,
"display graph in single frame"
,
OFFSET
(
slide
),
AV_OPT_TYPE_CONST
,
{.
i64
=
4
},
0
,
0
,
FLAGS
,
"slide"
},
{
"size"
,
"set graph size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
"900x256"
},
0
,
0
,
FLAGS
},
{
"s"
,
"set graph size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
"900x256"
},
0
,
0
,
FLAGS
},
{
"rate"
,
"set video rate"
,
OFFSET
(
frame_rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
INT_MAX
,
FLAGS
},
{
"r"
,
"set video rate"
,
OFFSET
(
frame_rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
INT_MAX
,
FLAGS
},
{
NULL
}
};
...
...
@@ -159,6 +163,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
AVDictionary
*
metadata
;
AVDictionaryEntry
*
e
;
AVFrame
*
out
=
s
->
out
;
AVFrame
*
clone
=
NULL
;
int64_t
in_pts
,
out_pts
;
int
i
;
if
(
s
->
slide
==
4
&&
s
->
nb_values
>=
s
->
values_size
[
0
]
/
sizeof
(
float
))
{
...
...
@@ -309,12 +315,24 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
s
->
nb_values
++
;
s
->
x
++
;
in_pts
=
in
->
pts
;
av_frame_free
(
&
in
);
if
(
s
->
slide
==
4
)
return
0
;
return
ff_filter_frame
(
outlink
,
av_frame_clone
(
s
->
out
));
out_pts
=
av_rescale_q
(
in_pts
,
inlink
->
time_base
,
outlink
->
time_base
);
if
(
out_pts
==
s
->
prev_pts
)
return
0
;
clone
=
av_frame_clone
(
s
->
out
);
if
(
!
clone
)
return
AVERROR
(
ENOMEM
);
clone
->
pts
=
s
->
prev_pts
=
out_pts
;
return
ff_filter_frame
(
outlink
,
clone
);
}
static
int
request_frame
(
AVFilterLink
*
outlink
)
...
...
@@ -406,6 +424,9 @@ static int config_output(AVFilterLink *outlink)
outlink
->
w
=
s
->
w
;
outlink
->
h
=
s
->
h
;
outlink
->
sample_aspect_ratio
=
(
AVRational
){
1
,
1
};
outlink
->
frame_rate
=
s
->
frame_rate
;
outlink
->
time_base
=
av_inv_q
(
outlink
->
frame_rate
);
s
->
prev_pts
=
AV_NOPTS_VALUE
;
return
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