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
7e59393d
Commit
7e59393d
authored
Apr 02, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_pad: add aspect option
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
a434657d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
filters.texi
doc/filters.texi
+3
-0
vf_pad.c
libavfilter/vf_pad.c
+14
-0
No files found.
doc/filters.texi
View file @
7e59393d
...
@@ -10453,6 +10453,9 @@ Evaluate expressions for each incoming frame.
...
@@ -10453,6 +10453,9 @@ Evaluate expressions for each incoming frame.
Default value is @samp{init}.
Default value is @samp{init}.
@item aspect
Pad to aspect instead to a resolution.
@end table
@end table
The value for the @var{width}, @var{height}, @var{x}, and @var{y}
The value for the @var{width}, @var{height}, @var{x}, and @var{y}
...
...
libavfilter/vf_pad.c
View file @
7e59393d
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
* video padding filter
* video padding filter
*/
*/
#include <float.h>
/* DBL_MAX */
#include "avfilter.h"
#include "avfilter.h"
#include "formats.h"
#include "formats.h"
#include "internal.h"
#include "internal.h"
...
@@ -87,6 +89,7 @@ typedef struct PadContext {
...
@@ -87,6 +89,7 @@ typedef struct PadContext {
int
x
,
y
;
///< offsets of the input area with respect to the padded area
int
x
,
y
;
///< offsets of the input area with respect to the padded area
int
in_w
,
in_h
;
///< width and height for the padded input video, which has to be aligned to the chroma values in order to avoid chroma issues
int
in_w
,
in_h
;
///< width and height for the padded input video, which has to be aligned to the chroma values in order to avoid chroma issues
int
inlink_w
,
inlink_h
;
int
inlink_w
,
inlink_h
;
AVRational
aspect
;
char
*
w_expr
;
///< width expression string
char
*
w_expr
;
///< width expression string
char
*
h_expr
;
///< height expression string
char
*
h_expr
;
///< height expression string
...
@@ -103,6 +106,7 @@ static int config_input(AVFilterLink *inlink)
...
@@ -103,6 +106,7 @@ static int config_input(AVFilterLink *inlink)
{
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
AVFilterContext
*
ctx
=
inlink
->
dst
;
PadContext
*
s
=
ctx
->
priv
;
PadContext
*
s
=
ctx
->
priv
;
AVRational
adjusted_aspect
=
s
->
aspect
;
int
ret
;
int
ret
;
double
var_values
[
VARS_NB
],
res
;
double
var_values
[
VARS_NB
],
res
;
char
*
expr
;
char
*
expr
;
...
@@ -143,6 +147,15 @@ static int config_input(AVFilterLink *inlink)
...
@@ -143,6 +147,15 @@ static int config_input(AVFilterLink *inlink)
if
(
!
s
->
w
)
if
(
!
s
->
w
)
var_values
[
VAR_OUT_W
]
=
var_values
[
VAR_OW
]
=
s
->
w
=
inlink
->
w
;
var_values
[
VAR_OUT_W
]
=
var_values
[
VAR_OW
]
=
s
->
w
=
inlink
->
w
;
if
(
adjusted_aspect
.
num
&&
adjusted_aspect
.
den
)
{
adjusted_aspect
=
av_div_q
(
adjusted_aspect
,
inlink
->
sample_aspect_ratio
);
if
(
s
->
h
<
av_rescale
(
s
->
w
,
adjusted_aspect
.
den
,
adjusted_aspect
.
num
))
{
s
->
h
=
var_values
[
VAR_OUT_H
]
=
var_values
[
VAR_OH
]
=
av_rescale
(
s
->
w
,
adjusted_aspect
.
den
,
adjusted_aspect
.
num
);
}
else
{
s
->
w
=
var_values
[
VAR_OUT_W
]
=
var_values
[
VAR_OW
]
=
av_rescale
(
s
->
h
,
adjusted_aspect
.
num
,
adjusted_aspect
.
den
);
}
}
/* evaluate x and y */
/* evaluate x and y */
av_expr_parse_and_eval
(
&
res
,
(
expr
=
s
->
x_expr
),
av_expr_parse_and_eval
(
&
res
,
(
expr
=
s
->
x_expr
),
var_names
,
var_values
,
var_names
,
var_values
,
...
@@ -409,6 +422,7 @@ static const AVOption pad_options[] = {
...
@@ -409,6 +422,7 @@ static const AVOption pad_options[] = {
{
"eval"
,
"specify when to evaluate expressions"
,
OFFSET
(
eval_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
EVAL_MODE_INIT
},
0
,
EVAL_MODE_NB
-
1
,
FLAGS
,
"eval"
},
{
"eval"
,
"specify when to evaluate expressions"
,
OFFSET
(
eval_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
EVAL_MODE_INIT
},
0
,
EVAL_MODE_NB
-
1
,
FLAGS
,
"eval"
},
{
"init"
,
"eval expressions once during initialization"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EVAL_MODE_INIT
},
.
flags
=
FLAGS
,
.
unit
=
"eval"
},
{
"init"
,
"eval expressions once during initialization"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EVAL_MODE_INIT
},
.
flags
=
FLAGS
,
.
unit
=
"eval"
},
{
"frame"
,
"eval expressions during initialization and per-frame"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EVAL_MODE_FRAME
},
.
flags
=
FLAGS
,
.
unit
=
"eval"
},
{
"frame"
,
"eval expressions during initialization and per-frame"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
EVAL_MODE_FRAME
},
.
flags
=
FLAGS
,
.
unit
=
"eval"
},
{
"aspect"
,
"pad to fit an aspect instead of a resolution"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{.
dbl
=
0
},
0
,
DBL_MAX
,
FLAGS
},
{
NULL
}
{
NULL
}
};
};
...
...
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