Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
7b3eb745
Commit
7b3eb745
authored
Feb 25, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vsrc_testsrc: switch to an AVOptions-based system.
parent
a42d6e6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
20 deletions
+13
-20
filters.texi
doc/filters.texi
+1
-2
vsrc_testsrc.c
libavfilter/vsrc_testsrc.c
+12
-18
No files found.
doc/filters.texi
View file @
7b3eb745
...
@@ -2466,8 +2466,7 @@ The @code{testsrc} source generates a test video pattern, showing a
...
@@ -2466,8 +2466,7 @@ The @code{testsrc} source generates a test video pattern, showing a
color pattern, a scrolling gradient and a timestamp. This is mainly
color pattern, a scrolling gradient and a timestamp. This is mainly
intended for testing purposes.
intended for testing purposes.
Both sources accept an optional sequence of @var{key}=@var{value} pairs,
The sources accept the following options:
separated by ":". The description of the accepted options follows.
@table @option
@table @option
...
...
libavfilter/vsrc_testsrc.c
View file @
7b3eb745
...
@@ -60,31 +60,25 @@ typedef struct {
...
@@ -60,31 +60,25 @@ typedef struct {
}
TestSourceContext
;
}
TestSourceContext
;
#define OFFSET(x) offsetof(TestSourceContext, x)
#define OFFSET(x) offsetof(TestSourceContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
testsrc_options
[]
=
{
static
const
AVOption
testsrc_options
[]
=
{
{
"size"
,
"set video size"
,
OFFSET
(
size
),
AV_OPT_TYPE_STRING
,
{.
str
=
"320x240"
}},
{
"size"
,
"set video size"
,
OFFSET
(
size
),
AV_OPT_TYPE_STRING
,
{.
str
=
"320x240"
}
,
.
flags
=
FLAGS
},
{
"s"
,
"set video size"
,
OFFSET
(
size
),
AV_OPT_TYPE_STRING
,
{.
str
=
"320x240"
}},
{
"s"
,
"set video size"
,
OFFSET
(
size
),
AV_OPT_TYPE_STRING
,
{.
str
=
"320x240"
}
,
.
flags
=
FLAGS
},
{
"rate"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_STRING
,
{.
str
=
"25"
},
},
{
"rate"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_STRING
,
{.
str
=
"25"
},
.
flags
=
FLAGS
},
{
"r"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_STRING
,
{.
str
=
"25"
},
},
{
"r"
,
"set video rate"
,
OFFSET
(
rate
),
AV_OPT_TYPE_STRING
,
{.
str
=
"25"
},
.
flags
=
FLAGS
},
{
"duration"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
},
{
"duration"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
.
flags
=
FLAGS
},
{
"sar"
,
"set video sample aspect ratio"
,
OFFSET
(
sar
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
1
},
0
,
INT_MAX
},
{
"sar"
,
"set video sample aspect ratio"
,
OFFSET
(
sar
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
1
},
0
,
INT_MAX
,
FLAGS
},
{
NULL
},
{
NULL
},
};
};
static
av_cold
int
init_common
(
AVFilterContext
*
ctx
,
const
char
*
args
)
static
av_cold
int
init_common
(
AVFilterContext
*
ctx
)
{
{
TestSourceContext
*
test
=
ctx
->
priv
;
TestSourceContext
*
test
=
ctx
->
priv
;
AVRational
frame_rate_q
;
AVRational
frame_rate_q
;
int64_t
duration
=
-
1
;
int64_t
duration
=
-
1
;
int
ret
=
0
;
int
ret
=
0
;
av_opt_set_defaults
(
test
);
if
((
ret
=
(
av_set_options_string
(
test
,
args
,
"="
,
":"
)))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error parsing options string: '%s'
\n
"
,
args
);
return
ret
;
}
if
((
ret
=
av_parse_video_size
(
&
test
->
w
,
&
test
->
h
,
test
->
size
))
<
0
)
{
if
((
ret
=
av_parse_video_size
(
&
test
->
w
,
&
test
->
h
,
test
->
size
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid frame size: '%s'
\n
"
,
test
->
size
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid frame size: '%s'
\n
"
,
test
->
size
);
return
ret
;
return
ret
;
...
@@ -338,9 +332,8 @@ static av_cold int test_init(AVFilterContext *ctx, const char *args)
...
@@ -338,9 +332,8 @@ static av_cold int test_init(AVFilterContext *ctx, const char *args)
{
{
TestSourceContext
*
test
=
ctx
->
priv
;
TestSourceContext
*
test
=
ctx
->
priv
;
test
->
class
=
&
testsrc_class
;
test
->
fill_picture_fn
=
test_fill_picture
;
test
->
fill_picture_fn
=
test_fill_picture
;
return
init_common
(
ctx
,
args
);
return
init_common
(
ctx
);
}
}
static
int
test_query_formats
(
AVFilterContext
*
ctx
)
static
int
test_query_formats
(
AVFilterContext
*
ctx
)
...
@@ -366,6 +359,7 @@ AVFilter avfilter_vsrc_testsrc = {
...
@@ -366,6 +359,7 @@ AVFilter avfilter_vsrc_testsrc = {
.
name
=
"testsrc"
,
.
name
=
"testsrc"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Generate test pattern."
),
.
description
=
NULL_IF_CONFIG_SMALL
(
"Generate test pattern."
),
.
priv_size
=
sizeof
(
TestSourceContext
),
.
priv_size
=
sizeof
(
TestSourceContext
),
.
priv_class
=
&
testsrc_class
,
.
init
=
test_init
,
.
init
=
test_init
,
.
query_formats
=
test_query_formats
,
.
query_formats
=
test_query_formats
,
...
@@ -450,9 +444,8 @@ static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args)
...
@@ -450,9 +444,8 @@ static av_cold int rgbtest_init(AVFilterContext *ctx, const char *args)
{
{
TestSourceContext
*
test
=
ctx
->
priv
;
TestSourceContext
*
test
=
ctx
->
priv
;
test
->
class
=
&
rgbtestsrc_class
;
test
->
fill_picture_fn
=
rgbtest_fill_picture
;
test
->
fill_picture_fn
=
rgbtest_fill_picture
;
return
init_common
(
ctx
,
args
);
return
init_common
(
ctx
);
}
}
static
int
rgbtest_query_formats
(
AVFilterContext
*
ctx
)
static
int
rgbtest_query_formats
(
AVFilterContext
*
ctx
)
...
@@ -499,6 +492,7 @@ AVFilter avfilter_vsrc_rgbtestsrc = {
...
@@ -499,6 +492,7 @@ AVFilter avfilter_vsrc_rgbtestsrc = {
.
name
=
"rgbtestsrc"
,
.
name
=
"rgbtestsrc"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Generate RGB test pattern."
),
.
description
=
NULL_IF_CONFIG_SMALL
(
"Generate RGB test pattern."
),
.
priv_size
=
sizeof
(
TestSourceContext
),
.
priv_size
=
sizeof
(
TestSourceContext
),
.
priv_class
=
&
rgbtestsrc_class
,
.
init
=
rgbtest_init
,
.
init
=
rgbtest_init
,
.
query_formats
=
rgbtest_query_formats
,
.
query_formats
=
rgbtest_query_formats
,
...
...
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