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
62d36abe
Commit
62d36abe
authored
Mar 26, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/mptestsrc: make use of AV_OPT_TYPE_VIDEO_RATE
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
401f9c95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
16 deletions
+8
-16
vsrc_mptestsrc.c
libavfilter/vsrc_mptestsrc.c
+8
-16
No files found.
libavfilter/vsrc_mptestsrc.c
View file @
62d36abe
...
...
@@ -53,18 +53,18 @@ enum test_type {
typedef
struct
MPTestContext
{
const
AVClass
*
class
;
unsigned
int
frame_nb
;
AVRational
time_bas
e
;
AVRational
frame_rat
e
;
int64_t
pts
,
max_pts
;
int
hsub
,
vsub
;
char
*
size
,
*
rate
,
*
duration
;
char
*
size
,
*
duration
;
enum
test_type
test
;
}
MPTestContext
;
#define OFFSET(x) offsetof(MPTestContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
mptestsrc_options
[]
=
{
{
"rate"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_STRING
,
{.
str
=
"25"
},
0
,
0
,
FLAGS
},
{
"r"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_STRING
,
{.
str
=
"25"
},
0
,
0
,
FLAGS
},
{
"rate"
,
"set video rate"
,
OFFSET
(
frame_rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
,
FLAGS
},
{
"r"
,
"set video rate"
,
OFFSET
(
frame_rate
),
AV_OPT_TYPE_VIDEO_RATE
,
{.
str
=
"25"
},
0
,
0
,
FLAGS
},
{
"duration"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
{
"d"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
FLAGS
},
...
...
@@ -259,7 +259,6 @@ static void ring2_test(uint8_t *dst, int dst_linesize, int off)
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
MPTestContext
*
test
=
ctx
->
priv
;
AVRational
frame_rate_q
;
int64_t
duration
=
-
1
;
int
ret
;
...
...
@@ -269,26 +268,19 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if
((
ret
=
(
av_set_options_string
(
test
,
args
,
"="
,
":"
)))
<
0
)
return
ret
;
if
((
ret
=
av_parse_video_rate
(
&
frame_rate_q
,
test
->
rate
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid frame rate: '%s'
\n
"
,
test
->
rate
);
return
ret
;
}
if
((
test
->
duration
)
&&
(
ret
=
av_parse_time
(
&
duration
,
test
->
duration
,
1
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid duration: '%s'
\n
"
,
test
->
duration
);
return
ret
;
}
test
->
time_base
.
num
=
frame_rate_q
.
den
;
test
->
time_base
.
den
=
frame_rate_q
.
num
;
test
->
max_pts
=
duration
>=
0
?
av_rescale_q
(
duration
,
AV_TIME_BASE_Q
,
test
->
time_base
)
:
-
1
;
av_rescale_q
(
duration
,
AV_TIME_BASE_Q
,
av_inv_q
(
test
->
frame_rate
)
)
:
-
1
;
test
->
frame_nb
=
0
;
test
->
pts
=
0
;
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"rate:%d/%d duration:%f
\n
"
,
frame_rate_q
.
num
,
frame_rate_q
.
den
,
duration
<
0
?
-
1
:
test
->
max_pts
*
av_q2d
(
test
->
time_base
));
test
->
frame_rate
.
num
,
test
->
frame_rate
.
den
,
duration
<
0
?
-
1
:
test
->
max_pts
*
av_q2d
(
av_inv_q
(
test
->
frame_rate
)
));
init_idct
();
return
0
;
...
...
@@ -305,7 +297,7 @@ static int config_props(AVFilterLink *outlink)
outlink
->
w
=
WIDTH
;
outlink
->
h
=
HEIGHT
;
outlink
->
time_base
=
test
->
time_base
;
outlink
->
time_base
=
av_inv_q
(
test
->
frame_rate
)
;
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