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
95f1f56a
Commit
95f1f56a
authored
Feb 25, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_select: switch to an AVOptions-based system.
parent
40c885c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
8 deletions
+34
-8
filters.texi
doc/filters.texi
+13
-6
vf_select.c
libavfilter/vf_select.c
+21
-2
No files found.
doc/filters.texi
View file @
95f1f56a
...
@@ -1742,9 +1742,16 @@ scale=w='min(500\, iw*3/2):h=-1'
...
@@ -1742,9 +1742,16 @@ scale=w='min(500\, iw*3/2):h=-1'
@section select
@section select
Select frames to pass in output.
Select frames to pass in output.
It accepts in input an expression, which is evaluated for each input
This filter accepts the following options:
frame. If the expression is evaluated to a non-zero value, the frame
is selected and passed to the output, otherwise it is discarded.
@table @option
@item expr
An expression, which is evaluated for each input frame. If the expression is
evaluated to a non-zero value, the frame is selected and passed to the output,
otherwise it is discarded.
@end table
The expression can contain the following constants:
The expression can contain the following constants:
...
@@ -1831,13 +1838,13 @@ Some examples follow:
...
@@ -1831,13 +1838,13 @@ Some examples follow:
select
select
# the above is the same as:
# the above is the same as:
select=1
select=
expr=
1
# skip all frames:
# skip all frames:
select=0
select=
expr=
0
# select only I-frames
# select only I-frames
select='eq(pict_type\,I)'
select='e
xpr=e
q(pict_type\,I)'
# select one frame every 100
# select one frame every 100
select='not(mod(n\,100))'
select='not(mod(n\,100))'
...
...
libavfilter/vf_select.c
View file @
95f1f56a
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "libavutil/fifo.h"
#include "libavutil/fifo.h"
#include "libavutil/internal.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "avfilter.h"
#include "internal.h"
#include "internal.h"
#include "video.h"
#include "video.h"
...
@@ -115,6 +116,8 @@ enum var_name {
...
@@ -115,6 +116,8 @@ enum var_name {
#define FIFO_SIZE 8
#define FIFO_SIZE 8
typedef
struct
{
typedef
struct
{
const
AVClass
*
class
;
char
*
expr_str
;
AVExpr
*
expr
;
AVExpr
*
expr
;
double
var_values
[
VAR_VARS_NB
];
double
var_values
[
VAR_VARS_NB
];
double
select
;
double
select
;
...
@@ -127,9 +130,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
...
@@ -127,9 +130,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
SelectContext
*
select
=
ctx
->
priv
;
SelectContext
*
select
=
ctx
->
priv
;
int
ret
;
int
ret
;
if
((
ret
=
av_expr_parse
(
&
select
->
expr
,
args
?
args
:
"1"
,
if
((
ret
=
av_expr_parse
(
&
select
->
expr
,
select
->
expr_str
,
var_names
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
ctx
))
<
0
)
{
var_names
,
NULL
,
NULL
,
NULL
,
NULL
,
0
,
ctx
))
<
0
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error while parsing expression '%s'
\n
"
,
args
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Error while parsing expression '%s'
\n
"
,
select
->
expr_str
);
return
ret
;
return
ret
;
}
}
...
@@ -309,6 +313,20 @@ static av_cold void uninit(AVFilterContext *ctx)
...
@@ -309,6 +313,20 @@ static av_cold void uninit(AVFilterContext *ctx)
select
->
pending_frames
=
NULL
;
select
->
pending_frames
=
NULL
;
}
}
#define OFFSET(x) offsetof(SelectContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
options
[]
=
{
{
"expr"
,
"An expression to use for selecting frames"
,
OFFSET
(
expr_str
),
AV_OPT_TYPE_STRING
,
{
.
str
=
"1"
},
.
flags
=
FLAGS
},
{
NULL
},
};
static
const
AVClass
select_class
=
{
.
class_name
=
"select"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_select_inputs
[]
=
{
static
const
AVFilterPad
avfilter_vf_select_inputs
[]
=
{
{
{
.
name
=
"default"
,
.
name
=
"default"
,
...
@@ -337,6 +355,7 @@ AVFilter avfilter_vf_select = {
...
@@ -337,6 +355,7 @@ AVFilter avfilter_vf_select = {
.
uninit
=
uninit
,
.
uninit
=
uninit
,
.
priv_size
=
sizeof
(
SelectContext
),
.
priv_size
=
sizeof
(
SelectContext
),
.
priv_class
=
&
select_class
,
.
inputs
=
avfilter_vf_select_inputs
,
.
inputs
=
avfilter_vf_select_inputs
,
.
outputs
=
avfilter_vf_select_outputs
,
.
outputs
=
avfilter_vf_select_outputs
,
...
...
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