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
f6608f47
Commit
f6608f47
authored
Dec 10, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_aspect: change outlink sample aspect ratio instead of inlink
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
4754d70a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
vf_aspect.c
libavfilter/vf_aspect.c
+17
-13
No files found.
libavfilter/vf_aspect.c
View file @
f6608f47
...
...
@@ -125,9 +125,11 @@ static int get_aspect_ratio(AVFilterLink *inlink, AVRational *aspect_ratio)
#if CONFIG_SETDAR_FILTER
static
int
setdar_config_props
(
AVFilterLink
*
in
link
)
static
int
setdar_config_props
(
AVFilterLink
*
out
link
)
{
AspectContext
*
s
=
inlink
->
dst
->
priv
;
AVFilterContext
*
ctx
=
outlink
->
src
;
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AspectContext
*
s
=
ctx
->
priv
;
AVRational
dar
;
AVRational
old_dar
;
AVRational
old_sar
=
inlink
->
sample_aspect_ratio
;
...
...
@@ -140,17 +142,17 @@ static int setdar_config_props(AVFilterLink *inlink)
av_reduce
(
&
s
->
sar
.
num
,
&
s
->
sar
.
den
,
s
->
dar
.
num
*
inlink
->
h
,
s
->
dar
.
den
*
inlink
->
w
,
INT_MAX
);
in
link
->
sample_aspect_ratio
=
s
->
sar
;
out
link
->
sample_aspect_ratio
=
s
->
sar
;
dar
=
s
->
dar
;
}
else
{
in
link
->
sample_aspect_ratio
=
(
AVRational
){
1
,
1
};
out
link
->
sample_aspect_ratio
=
(
AVRational
){
1
,
1
};
dar
=
(
AVRational
){
inlink
->
w
,
inlink
->
h
};
}
compute_dar
(
&
old_dar
,
old_sar
,
inlink
->
w
,
inlink
->
h
);
av_log
(
inlink
->
dst
,
AV_LOG_VERBOSE
,
"w:%d h:%d dar:%d/%d sar:%d/%d -> dar:%d/%d sar:%d/%d
\n
"
,
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"w:%d h:%d dar:%d/%d sar:%d/%d -> dar:%d/%d sar:%d/%d
\n
"
,
inlink
->
w
,
inlink
->
h
,
old_dar
.
num
,
old_dar
.
den
,
old_sar
.
num
,
old_sar
.
den
,
dar
.
num
,
dar
.
den
,
inlink
->
sample_aspect_ratio
.
num
,
in
link
->
sample_aspect_ratio
.
den
);
dar
.
num
,
dar
.
den
,
outlink
->
sample_aspect_ratio
.
num
,
out
link
->
sample_aspect_ratio
.
den
);
return
0
;
}
...
...
@@ -169,7 +171,6 @@ static const AVFilterPad avfilter_vf_setdar_inputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
setdar_config_props
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
...
...
@@ -179,6 +180,7 @@ static const AVFilterPad avfilter_vf_setdar_outputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
setdar_config_props
,
},
{
NULL
}
};
...
...
@@ -196,9 +198,11 @@ AVFilter ff_vf_setdar = {
#if CONFIG_SETSAR_FILTER
static
int
setsar_config_props
(
AVFilterLink
*
in
link
)
static
int
setsar_config_props
(
AVFilterLink
*
out
link
)
{
AspectContext
*
s
=
inlink
->
dst
->
priv
;
AVFilterContext
*
ctx
=
outlink
->
src
;
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
AspectContext
*
s
=
ctx
->
priv
;
AVRational
old_sar
=
inlink
->
sample_aspect_ratio
;
AVRational
old_dar
,
dar
;
int
ret
;
...
...
@@ -206,13 +210,13 @@ static int setsar_config_props(AVFilterLink *inlink)
if
((
ret
=
get_aspect_ratio
(
inlink
,
&
s
->
sar
)))
return
ret
;
in
link
->
sample_aspect_ratio
=
s
->
sar
;
out
link
->
sample_aspect_ratio
=
s
->
sar
;
compute_dar
(
&
old_dar
,
old_sar
,
inlink
->
w
,
inlink
->
h
);
compute_dar
(
&
dar
,
s
->
sar
,
inlink
->
w
,
inlink
->
h
);
av_log
(
inlink
->
dst
,
AV_LOG_VERBOSE
,
"w:%d h:%d sar:%d/%d dar:%d/%d -> sar:%d/%d dar:%d/%d
\n
"
,
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"w:%d h:%d sar:%d/%d dar:%d/%d -> sar:%d/%d dar:%d/%d
\n
"
,
inlink
->
w
,
inlink
->
h
,
old_sar
.
num
,
old_sar
.
den
,
old_dar
.
num
,
old_dar
.
den
,
inlink
->
sample_aspect_ratio
.
num
,
in
link
->
sample_aspect_ratio
.
den
,
dar
.
num
,
dar
.
den
);
outlink
->
sample_aspect_ratio
.
num
,
out
link
->
sample_aspect_ratio
.
den
,
dar
.
num
,
dar
.
den
);
return
0
;
}
...
...
@@ -231,7 +235,6 @@ static const AVFilterPad avfilter_vf_setsar_inputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
setsar_config_props
,
.
filter_frame
=
filter_frame
,
},
{
NULL
}
...
...
@@ -241,6 +244,7 @@ static const AVFilterPad avfilter_vf_setsar_outputs[] = {
{
.
name
=
"default"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
config_props
=
setsar_config_props
,
},
{
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