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
ac44e52f
Commit
ac44e52f
authored
Mar 16, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/showwaves: make use of AV_OPT_TYPE_VIDEO_RATE
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
7aa9af51
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
18 deletions
+3
-18
avf_showwaves.c
libavfilter/avf_showwaves.c
+3
-18
No files found.
libavfilter/avf_showwaves.c
View file @
ac44e52f
...
...
@@ -41,7 +41,6 @@ enum ShowWavesMode {
typedef
struct
{
const
AVClass
*
class
;
int
w
,
h
;
char
*
rate_str
;
AVRational
rate
;
int
buf_idx
;
AVFrame
*
outpicref
;
...
...
@@ -55,8 +54,8 @@ typedef struct {
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
showwaves_options
[]
=
{
{
"rate"
,
"set video rate"
,
OFFSET
(
rate
_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"r"
,
"set video rate"
,
OFFSET
(
rate
_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"rate"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
,
FLAGS
},
{
"r"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
,
FLAGS
},
{
"size"
,
"set video size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
"600x240"
},
0
,
0
,
FLAGS
},
{
"s"
,
"set video size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
"600x240"
},
0
,
0
,
FLAGS
},
{
"n"
,
"set how many samples to show in the same point"
,
OFFSET
(
n
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
FLAGS
},
...
...
@@ -88,7 +87,6 @@ static av_cold void uninit(AVFilterContext *ctx)
{
ShowWavesContext
*
showwaves
=
ctx
->
priv
;
av_freep
(
&
showwaves
->
rate_str
);
av_frame_free
(
&
showwaves
->
outpicref
);
}
...
...
@@ -131,22 +129,9 @@ static int config_output(AVFilterLink *outlink)
AVFilterContext
*
ctx
=
outlink
->
src
;
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
ShowWavesContext
*
showwaves
=
ctx
->
priv
;
int
err
;
if
(
showwaves
->
n
&&
showwaves
->
rate_str
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Options 'n' and 'rate' cannot be set at the same time
\n
"
);
return
AVERROR
(
EINVAL
);
}
if
(
!
showwaves
->
n
)
{
if
(
!
showwaves
->
rate_str
)
showwaves
->
rate
=
(
AVRational
){
25
,
1
};
/* set default value */
else
if
((
err
=
av_parse_video_rate
(
&
showwaves
->
rate
,
showwaves
->
rate_str
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid frame rate: '%s'
\n
"
,
showwaves
->
rate_str
);
return
err
;
}
if
(
!
showwaves
->
n
)
showwaves
->
n
=
FFMAX
(
1
,
((
double
)
inlink
->
sample_rate
/
(
showwaves
->
w
*
av_q2d
(
showwaves
->
rate
)))
+
0
.
5
);
}
outlink
->
w
=
showwaves
->
w
;
outlink
->
h
=
showwaves
->
h
;
...
...
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