Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
f6608f47
Commit
f6608f47
authored
7 years ago
by
Paul B Mahol
Browse files
Options
Downloads
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
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavfilter/vf_aspect.c
+17
-13
17 additions, 13 deletions
libavfilter/vf_aspect.c
with
17 additions
and
13 deletions
libavfilter/vf_aspect.c
+
17
−
13
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
,
in
link
->
sample_aspect_ratio
.
num
,
in
link
->
sample_aspect_ratio
.
den
);
dar
.
num
,
dar
.
den
,
out
link
->
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
,
in
link
->
sample_aspect_ratio
.
num
,
in
link
->
sample_aspect_ratio
.
den
,
dar
.
num
,
dar
.
den
);
out
link
->
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
}
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment