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
9371467d
Commit
9371467d
authored
Mar 26, 2013
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/perms: add seed option.
parent
e600d062
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
filters.texi
doc/filters.texi
+6
-0
f_perms.c
libavfilter/f_perms.c
+11
-3
version.h
libavfilter/version.h
+1
-1
No files found.
doc/filters.texi
View file @
9371467d
...
@@ -6249,6 +6249,12 @@ Make the frame read-only if writable, and writable if read-only.
...
@@ -6249,6 +6249,12 @@ Make the frame read-only if writable, and writable if read-only.
@item random
@item random
Set each output frame read-only or writable randomly.
Set each output frame read-only or writable randomly.
@end table
@end table
@item seed
Set the seed for the @var{random} mode, must be an integer included between
@code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
@code{-1}, the filter will try to use a good random seed on a best effort
basis.
@end table
@end table
Note: in case of auto-inserted filter between the permission filter and the
Note: in case of auto-inserted filter between the permission filter and the
...
...
libavfilter/f_perms.c
View file @
9371467d
...
@@ -34,6 +34,7 @@ enum mode {
...
@@ -34,6 +34,7 @@ enum mode {
typedef
struct
{
typedef
struct
{
const
AVClass
*
class
;
const
AVClass
*
class
;
AVLFG
lfg
;
AVLFG
lfg
;
int64_t
random_seed
;
enum
mode
mode
;
enum
mode
mode
;
}
PermsContext
;
}
PermsContext
;
...
@@ -47,6 +48,7 @@ static const AVOption options[] = {
...
@@ -47,6 +48,7 @@ static const AVOption options[] = {
{
"rw"
,
"set all output frames writable"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_RW
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"rw"
,
"set all output frames writable"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_RW
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"toggle"
,
"switch permissions"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_TOGGLE
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"toggle"
,
"switch permissions"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_TOGGLE
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"random"
,
"set permissions randomly"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_RANDOM
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"random"
,
"set permissions randomly"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
MODE_RANDOM
},
INT_MIN
,
INT_MAX
,
FLAGS
,
"mode"
},
{
"seed"
,
"set the seed for the random mode"
,
OFFSET
(
random_seed
),
AV_OPT_TYPE_INT64
,
{.
i64
=
-
1
},
-
1
,
UINT32_MAX
,
FLAGS
},
{
NULL
}
{
NULL
}
};
};
...
@@ -54,9 +56,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
...
@@ -54,9 +56,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
{
{
PermsContext
*
perms
=
ctx
->
priv
;
PermsContext
*
perms
=
ctx
->
priv
;
// TODO: add a seed option
if
(
perms
->
mode
==
MODE_RANDOM
)
{
if
(
perms
->
mode
==
MODE_RANDOM
)
uint32_t
seed
;
av_lfg_init
(
&
perms
->
lfg
,
av_get_random_seed
());
if
(
perms
->
random_seed
==
-
1
)
perms
->
random_seed
=
av_get_random_seed
();
seed
=
perms
->
random_seed
;
av_log
(
ctx
,
AV_LOG_INFO
,
"random seed: 0x%08x
\n
"
,
seed
);
av_lfg_init
(
&
perms
->
lfg
,
seed
);
}
return
0
;
return
0
;
}
}
...
...
libavfilter/version.h
View file @
9371467d
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 48
#define LIBAVFILTER_VERSION_MINOR 48
#define LIBAVFILTER_VERSION_MICRO 10
4
#define LIBAVFILTER_VERSION_MICRO 10
5
#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, \
...
...
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