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
db36ea5b
Commit
db36ea5b
authored
Mar 15, 2013
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/settb: add support for named options
parent
0407a79e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
14 deletions
+58
-14
filters.texi
doc/filters.texi
+8
-6
f_settb.c
libavfilter/f_settb.c
+49
-7
version.h
libavfilter/version.h
+1
-1
No files found.
doc/filters.texi
View file @
db36ea5b
...
...
@@ -6618,12 +6618,14 @@ ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
Set the timebase to use for the output frames timestamps.
It is mainly useful for testing timebase configuration.
It accepts in input an arithmetic expression representing a rational.
The expression can contain the constants "AVTB" (the
default timebase), "intb" (the input timebase) and "sr" (the sample rate,
audio only).
The default value for the input is "intb".
This filter accepts a single option @option{tb}, which can be
specified either by setting @option{tb}=@var{VALUE} or setting the
value alone.
The value for @option{tb} is an arithmetic expression representing a
rational. The expression can contain the constants "AVTB" (the default
timebase), "intb" (the input timebase) and "sr" (the sample rate,
audio only). Default value is "intb".
@subsection Examples
...
...
libavfilter/f_settb.c
View file @
db36ea5b
...
...
@@ -30,6 +30,7 @@
#include "libavutil/eval.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/rational.h"
#include "avfilter.h"
#include "internal.h"
...
...
@@ -51,21 +52,40 @@ enum var_name {
};
typedef
struct
{
char
tb_expr
[
256
];
const
AVClass
*
class
;
char
*
tb_expr
;
double
var_values
[
VAR_VARS_NB
];
}
SetTBContext
;
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
#define OFFSET(x) offsetof(SetTBContext, x)
#define DEFINE_OPTIONS(filt_name, filt_type) \
static const AVOption filt_name##_options[] = { \
{ "tb", "set timebase expression", OFFSET(tb_expr), AV_OPT_TYPE_STRING, {.str="intb"}, \
.flags=AV_OPT_FLAG_##filt_type##_PARAM|AV_OPT_FLAG_FILTERING_PARAM }, \
{ NULL } \
}
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
,
const
AVClass
*
class
)
{
SetTBContext
*
settb
=
ctx
->
priv
;
av_strlcpy
(
settb
->
tb_expr
,
"intb"
,
sizeof
(
settb
->
tb_expr
));
static
const
char
*
shorthand
[]
=
{
"tb"
,
NULL
};
int
ret
;
if
(
args
)
sscanf
(
args
,
"%255[^:]"
,
settb
->
tb_expr
);
settb
->
class
=
class
;
av_opt_set_defaults
(
settb
);
if
((
ret
=
av_opt_set_from_string
(
settb
,
args
,
shorthand
,
"="
,
":"
))
<
0
)
return
ret
;
return
0
;
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
SetTBContext
*
settb
=
ctx
->
priv
;
av_opt_free
(
settb
);
}
static
int
config_output_props
(
AVFilterLink
*
outlink
)
{
AVFilterContext
*
ctx
=
outlink
->
src
;
...
...
@@ -120,6 +140,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
}
#if CONFIG_SETTB_FILTER
DEFINE_OPTIONS
(
settb
,
VIDEO
);
AVFILTER_DEFINE_CLASS
(
settb
);
static
av_cold
int
settb_init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
return
init
(
ctx
,
args
,
&
settb_class
);
}
static
const
AVFilterPad
avfilter_vf_settb_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -142,16 +171,27 @@ static const AVFilterPad avfilter_vf_settb_outputs[] = {
AVFilter
avfilter_vf_settb
=
{
.
name
=
"settb"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Set timebase for the video output link."
),
.
init
=
init
,
.
init
=
settb_init
,
.
uninit
=
uninit
,
.
priv_size
=
sizeof
(
SetTBContext
),
.
inputs
=
avfilter_vf_settb_inputs
,
.
outputs
=
avfilter_vf_settb_outputs
,
.
priv_class
=
&
settb_class
,
};
#endif
#if CONFIG_ASETTB_FILTER
DEFINE_OPTIONS
(
asettb
,
AUDIO
);
AVFILTER_DEFINE_CLASS
(
asettb
);
static
av_cold
int
asettb_init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
return
init
(
ctx
,
args
,
&
asettb_class
);
}
static
const
AVFilterPad
avfilter_af_asettb_inputs
[]
=
{
{
.
name
=
"default"
,
...
...
@@ -174,10 +214,12 @@ static const AVFilterPad avfilter_af_asettb_outputs[] = {
AVFilter
avfilter_af_asettb
=
{
.
name
=
"asettb"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Set timebase for the audio output link."
),
.
init
=
init
,
.
init
=
asettb_init
,
.
uninit
=
uninit
,
.
priv_size
=
sizeof
(
SetTBContext
),
.
inputs
=
avfilter_af_asettb_inputs
,
.
outputs
=
avfilter_af_asettb_outputs
,
.
priv_class
=
&
asettb_class
,
};
#endif
libavfilter/version.h
View file @
db36ea5b
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 47
#define LIBAVFILTER_VERSION_MICRO 10
1
#define LIBAVFILTER_VERSION_MICRO 10
2
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
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