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
d5c66d9c
Commit
d5c66d9c
authored
Mar 18, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vf_setdar: make config_props work properly when called multiple times.
Do not overwrite the variable set through AVOptions.
parent
4c205f42
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
vf_aspect.c
libavfilter/vf_aspect.c
+15
-13
No files found.
libavfilter/vf_aspect.c
View file @
d5c66d9c
...
@@ -35,7 +35,8 @@
...
@@ -35,7 +35,8 @@
typedef
struct
{
typedef
struct
{
const
AVClass
*
class
;
const
AVClass
*
class
;
AVRational
aspect
;
AVRational
dar
;
AVRational
sar
;
#if FF_API_OLD_FILTER_OPTS
#if FF_API_OLD_FILTER_OPTS
float
aspect_num
,
aspect_den
;
float
aspect_num
,
aspect_den
;
#endif
#endif
...
@@ -49,7 +50,7 @@ static av_cold int init(AVFilterContext *ctx)
...
@@ -49,7 +50,7 @@ static av_cold int init(AVFilterContext *ctx)
if
(
s
->
aspect_num
>
0
&&
s
->
aspect_den
>
0
)
{
if
(
s
->
aspect_num
>
0
&&
s
->
aspect_den
>
0
)
{
av_log
(
ctx
,
AV_LOG_WARNING
,
"This syntax is deprecated, use "
av_log
(
ctx
,
AV_LOG_WARNING
,
"This syntax is deprecated, use "
"dar=<number> or dar=num/den.
\n
"
);
"dar=<number> or dar=num/den.
\n
"
);
s
->
aspect
=
av_d2q
(
s
->
aspect_num
/
s
->
aspect_den
,
INT_MAX
);
s
->
sar
=
s
->
dar
=
av_d2q
(
s
->
aspect_num
/
s
->
aspect_den
,
INT_MAX
);
}
}
return
0
;
return
0
;
...
@@ -60,7 +61,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
...
@@ -60,7 +61,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
{
{
AspectContext
*
s
=
link
->
dst
->
priv
;
AspectContext
*
s
=
link
->
dst
->
priv
;
frame
->
sample_aspect_ratio
=
s
->
aspect
;
frame
->
sample_aspect_ratio
=
s
->
sar
;
return
ff_filter_frame
(
link
->
dst
->
outputs
[
0
],
frame
);
return
ff_filter_frame
(
link
->
dst
->
outputs
[
0
],
frame
);
}
}
...
@@ -72,13 +73,14 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
...
@@ -72,13 +73,14 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
static
int
setdar_config_props
(
AVFilterLink
*
inlink
)
static
int
setdar_config_props
(
AVFilterLink
*
inlink
)
{
{
AspectContext
*
s
=
inlink
->
dst
->
priv
;
AspectContext
*
s
=
inlink
->
dst
->
priv
;
AVRational
dar
=
s
->
aspect
;
AVRational
dar
;
if
(
s
->
aspect
.
num
&&
s
->
aspect
.
den
)
{
if
(
s
->
dar
.
num
&&
s
->
dar
.
den
)
{
av_reduce
(
&
s
->
aspect
.
num
,
&
s
->
aspect
.
den
,
av_reduce
(
&
s
->
sar
.
num
,
&
s
->
sar
.
den
,
s
->
aspect
.
num
*
inlink
->
h
,
s
->
dar
.
num
*
inlink
->
h
,
s
->
aspect
.
den
*
inlink
->
w
,
100
);
s
->
dar
.
den
*
inlink
->
w
,
100
);
inlink
->
sample_aspect_ratio
=
s
->
aspect
;
inlink
->
sample_aspect_ratio
=
s
->
sar
;
dar
=
s
->
dar
;
}
else
{
}
else
{
inlink
->
sample_aspect_ratio
=
(
AVRational
){
1
,
1
};
inlink
->
sample_aspect_ratio
=
(
AVRational
){
1
,
1
};
dar
=
(
AVRational
){
inlink
->
w
,
inlink
->
h
};
dar
=
(
AVRational
){
inlink
->
w
,
inlink
->
h
};
...
@@ -96,7 +98,7 @@ static const AVOption setdar_options[] = {
...
@@ -96,7 +98,7 @@ static const AVOption setdar_options[] = {
{
"dar_num"
,
NULL
,
OFFSET
(
aspect_num
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"dar_num"
,
NULL
,
OFFSET
(
aspect_num
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"dar_den"
,
NULL
,
OFFSET
(
aspect_den
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"dar_den"
,
NULL
,
OFFSET
(
aspect_den
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
#endif
#endif
{
"dar"
,
"display aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{
.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"dar"
,
"display aspect ratio"
,
OFFSET
(
dar
),
AV_OPT_TYPE_RATIONAL
,
{
.
dbl
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
NULL
},
{
NULL
},
};
};
...
@@ -149,7 +151,7 @@ static int setsar_config_props(AVFilterLink *inlink)
...
@@ -149,7 +151,7 @@ static int setsar_config_props(AVFilterLink *inlink)
{
{
AspectContext
*
s
=
inlink
->
dst
->
priv
;
AspectContext
*
s
=
inlink
->
dst
->
priv
;
inlink
->
sample_aspect_ratio
=
s
->
aspect
;
inlink
->
sample_aspect_ratio
=
s
->
sar
;
return
0
;
return
0
;
}
}
...
@@ -159,7 +161,7 @@ static const AVOption setsar_options[] = {
...
@@ -159,7 +161,7 @@ static const AVOption setsar_options[] = {
{
"sar_num"
,
NULL
,
OFFSET
(
aspect_num
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"sar_num"
,
NULL
,
OFFSET
(
aspect_num
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"sar_den"
,
NULL
,
OFFSET
(
aspect_den
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
{
"sar_den"
,
NULL
,
OFFSET
(
aspect_den
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
},
0
,
FLT_MAX
,
FLAGS
},
#endif
#endif
{
"sar"
,
"sample (pixel) aspect ratio"
,
OFFSET
(
aspect
),
AV_OPT_TYPE_RATIONAL
,
{
.
dbl
=
1
},
0
,
INT_MAX
,
FLAGS
},
{
"sar"
,
"sample (pixel) aspect ratio"
,
OFFSET
(
sar
),
AV_OPT_TYPE_RATIONAL
,
{
.
dbl
=
1
},
0
,
INT_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