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
e8ac905d
Commit
e8ac905d
authored
Dec 07, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/opt: Implement av_opt_set_defaults* in O(N) instead of O(N²) time
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
0aedf90e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
opt.c
libavutil/opt.c
+13
-6
No files found.
libavutil/opt.c
View file @
e8ac905d
...
...
@@ -1101,6 +1101,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
const
AVClass
*
class
=
*
(
AVClass
**
)
s
;
const
AVOption
*
opt
=
NULL
;
while
((
opt
=
av_opt_next
(
s
,
opt
))
!=
NULL
)
{
void
*
dst
=
((
uint8_t
*
)
s
)
+
opt
->
offset
;
#if FF_API_OLD_AVOPTIONS
if
((
opt
->
flags
&
mask
)
!=
flags
)
continue
;
...
...
@@ -1114,26 +1115,32 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
case
AV_OPT_TYPE_INT64
:
case
AV_OPT_TYPE_DURATION
:
case
AV_OPT_TYPE_CHANNEL_LAYOUT
:
av_opt_set_int
(
s
,
opt
->
name
,
opt
->
default_val
.
i64
,
0
);
write_number
(
s
,
opt
,
dst
,
1
,
1
,
opt
->
default_val
.
i64
);
break
;
case
AV_OPT_TYPE_DOUBLE
:
case
AV_OPT_TYPE_FLOAT
:
{
double
val
;
val
=
opt
->
default_val
.
dbl
;
av_opt_set_double
(
s
,
opt
->
name
,
val
,
0
);
write_number
(
s
,
opt
,
dst
,
val
,
1
,
1
);
}
break
;
case
AV_OPT_TYPE_RATIONAL
:
{
AVRational
val
;
val
=
av_d2q
(
opt
->
default_val
.
dbl
,
INT_MAX
);
av_opt_set_q
(
s
,
opt
->
name
,
val
,
0
);
write_number
(
s
,
opt
,
dst
,
1
,
val
.
den
,
val
.
num
);
}
break
;
case
AV_OPT_TYPE_COLOR
:
set_string_color
(
s
,
opt
,
opt
->
default_val
.
str
,
dst
);
break
;
case
AV_OPT_TYPE_STRING
:
set_string
(
s
,
opt
,
opt
->
default_val
.
str
,
dst
);
break
;
case
AV_OPT_TYPE_IMAGE_SIZE
:
set_string_image_size
(
s
,
opt
,
opt
->
default_val
.
str
,
dst
);
break
;
case
AV_OPT_TYPE_VIDEO_RATE
:
av_opt_set
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
0
);
set_string_video_rate
(
s
,
opt
,
opt
->
default_val
.
str
,
dst
);
break
;
case
AV_OPT_TYPE_PIXEL_FMT
:
#if LIBAVUTIL_VERSION_MAJOR < 53
...
...
@@ -1141,7 +1148,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
av_opt_set
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
0
);
else
#endif
av_opt_set_pixel_fmt
(
s
,
opt
->
name
,
opt
->
default_val
.
i64
,
0
);
write_number
(
s
,
opt
,
dst
,
1
,
1
,
opt
->
default_val
.
i64
);
break
;
case
AV_OPT_TYPE_SAMPLE_FMT
:
#if LIBAVUTIL_VERSION_MAJOR < 53
...
...
@@ -1149,7 +1156,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
av_opt_set
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
0
);
else
#endif
av_opt_set_sample_fmt
(
s
,
opt
->
name
,
opt
->
default_val
.
i64
,
0
);
write_number
(
s
,
opt
,
dst
,
1
,
1
,
opt
->
default_val
.
i64
);
break
;
case
AV_OPT_TYPE_BINARY
:
/* Cannot set default for binary */
...
...
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