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
a798c20a
Commit
a798c20a
authored
Jan 10, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/testsrc: add "decimals" option to the testsrc filter
parent
9f7144b4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
filters.texi
doc/filters.texi
+8
-0
version.h
libavfilter/version.h
+1
-1
vsrc_testsrc.c
libavfilter/vsrc_testsrc.c
+14
-1
No files found.
doc/filters.texi
View file @
a798c20a
...
@@ -3237,6 +3237,14 @@ See also the function @code{av_parse_time()}.
...
@@ -3237,6 +3237,14 @@ See also the function @code{av_parse_time()}.
If not specified, or the expressed duration is negative, the video is
If not specified, or the expressed duration is negative, the video is
supposed to be generated forever.
supposed to be generated forever.
@item decimals, n
Set the number of decimals to show in the timestamp, only used in the
@code{testsrc} source.
The displayed timestamp value will correspond to the original
timestamp value multiplied by the power of 10 of the specified
value. Default value is 0.
@end table
@end table
For example the following:
For example the following:
...
...
libavfilter/version.h
View file @
a798c20a
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 59
#define LIBAVFILTER_VERSION_MINOR 59
#define LIBAVFILTER_VERSION_MICRO 10
0
#define LIBAVFILTER_VERSION_MICRO 10
1
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
libavfilter/vsrc_testsrc.c
View file @
a798c20a
...
@@ -47,6 +47,7 @@ typedef struct {
...
@@ -47,6 +47,7 @@ typedef struct {
char
*
rate
;
///< video frame rate
char
*
rate
;
///< video frame rate
char
*
duration
;
///< total duration of the generated video
char
*
duration
;
///< total duration of the generated video
AVRational
sar
;
///< sample aspect ratio
AVRational
sar
;
///< sample aspect ratio
int
nb_decimals
;
void
(
*
fill_picture_fn
)(
AVFilterContext
*
ctx
,
AVFilterBufferRef
*
picref
);
void
(
*
fill_picture_fn
)(
AVFilterContext
*
ctx
,
AVFilterBufferRef
*
picref
);
...
@@ -64,6 +65,8 @@ static const AVOption testsrc_options[]= {
...
@@ -64,6 +65,8 @@ static const AVOption testsrc_options[]= {
{
"duration"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
"duration"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
"d"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
"d"
,
"set video duration"
,
OFFSET
(
duration
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
},
{
"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
},
{
"decimals"
,
"set number of decimals to show"
,
OFFSET
(
nb_decimals
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
},
{
"n"
,
"set number of decimals to show"
,
OFFSET
(
nb_decimals
),
AV_OPT_TYPE_INT
,
{.
dbl
=
0
},
INT_MIN
,
INT_MAX
},
{
NULL
},
{
NULL
},
};
};
...
@@ -97,6 +100,12 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
...
@@ -97,6 +100,12 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
return
ret
;
return
ret
;
}
}
if
(
test
->
nb_decimals
&&
strcmp
(
ctx
->
filter
->
name
,
"testsrc"
))
{
av_log
(
ctx
,
AV_LOG_WARNING
,
"Option 'decimals' is ignored with source '%s'
\n
"
,
ctx
->
filter
->
name
);
}
test
->
time_base
.
num
=
frame_rate_q
.
den
;
test
->
time_base
.
num
=
frame_rate_q
.
den
;
test
->
time_base
.
den
=
frame_rate_q
.
num
;
test
->
time_base
.
den
=
frame_rate_q
.
num
;
test
->
max_pts
=
duration
>=
0
?
test
->
max_pts
=
duration
>=
0
?
...
@@ -361,7 +370,11 @@ static void test_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref)
...
@@ -361,7 +370,11 @@ static void test_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref)
/* draw digits */
/* draw digits */
seg_size
=
width
/
80
;
seg_size
=
width
/
80
;
if
(
seg_size
>=
1
&&
height
>=
13
*
seg_size
)
{
if
(
seg_size
>=
1
&&
height
>=
13
*
seg_size
)
{
second
=
test
->
nb_frame
*
test
->
time_base
.
num
/
test
->
time_base
.
den
;
double
time
=
av_q2d
(
test
->
time_base
)
*
test
->
nb_frame
*
pow
(
10
,
test
->
nb_decimals
);
if
(
time
>
INT_MAX
)
return
;
second
=
(
int
)
time
;
x
=
width
-
(
width
-
seg_size
*
64
)
/
2
;
x
=
width
-
(
width
-
seg_size
*
64
)
/
2
;
y
=
(
height
-
seg_size
*
13
)
/
2
;
y
=
(
height
-
seg_size
*
13
)
/
2
;
p
=
data
+
(
x
*
3
+
y
*
picref
->
linesize
[
0
]);
p
=
data
+
(
x
*
3
+
y
*
picref
->
linesize
[
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