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
2ec3e576
Commit
2ec3e576
authored
May 20, 2012
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt: add AV_OPT_TYPE_IMAGE_SIZE.
parent
f7985f34
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
opt.c
libavutil/opt.c
+14
-0
opt.h
libavutil/opt.h
+1
-0
No files found.
libavutil/opt.c
View file @
2ec3e576
...
...
@@ -31,6 +31,7 @@
#include "eval.h"
#include "dict.h"
#include "log.h"
#include "parseutils.h"
#if FF_API_FIND_OPT
//FIXME order them and do a bin search
...
...
@@ -224,6 +225,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
int
av_opt_set
(
void
*
obj
,
const
char
*
name
,
const
char
*
val
,
int
search_flags
)
{
int
ret
;
void
*
dst
,
*
target_obj
;
const
AVOption
*
o
=
av_opt_find2
(
obj
,
name
,
NULL
,
0
,
search_flags
,
&
target_obj
);
if
(
!
o
||
!
target_obj
)
...
...
@@ -241,6 +243,11 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
case
AV_OPT_TYPE_FLOAT
:
case
AV_OPT_TYPE_DOUBLE
:
case
AV_OPT_TYPE_RATIONAL
:
return
set_string_number
(
obj
,
o
,
val
,
dst
);
case
AV_OPT_TYPE_IMAGE_SIZE
:
ret
=
av_parse_video_size
(
dst
,
((
int
*
)
dst
)
+
1
,
val
);
if
(
ret
<
0
)
av_log
(
obj
,
AV_LOG_ERROR
,
"Unable to parse option value
\"
%s
\"
as image size
\n
"
,
val
);
return
ret
;
}
av_log
(
obj
,
AV_LOG_ERROR
,
"Invalid option type.
\n
"
);
...
...
@@ -394,6 +401,9 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
for
(
i
=
0
;
i
<
len
;
i
++
)
snprintf
(
*
out_val
+
i
*
2
,
3
,
"%02X"
,
bin
[
i
]);
return
0
;
case
AV_OPT_TYPE_IMAGE_SIZE
:
ret
=
snprintf
(
buf
,
sizeof
(
buf
),
"%dx%d"
,
((
int
*
)
dst
)[
0
],
((
int
*
)
dst
)[
1
]);
break
;
default
:
return
AVERROR
(
EINVAL
);
}
...
...
@@ -563,6 +573,9 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
case
AV_OPT_TYPE_BINARY
:
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
"<binary>"
);
break
;
case
AV_OPT_TYPE_IMAGE_SIZE
:
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
"<image_size>"
);
break
;
case
AV_OPT_TYPE_CONST
:
default
:
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%-7s "
,
""
);
...
...
@@ -640,6 +653,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags)
}
break
;
case
AV_OPT_TYPE_STRING
:
case
AV_OPT_TYPE_IMAGE_SIZE
:
av_opt_set
(
s
,
opt
->
name
,
opt
->
default_val
.
str
,
0
);
break
;
case
AV_OPT_TYPE_BINARY
:
...
...
libavutil/opt.h
View file @
2ec3e576
...
...
@@ -225,6 +225,7 @@ enum AVOptionType{
AV_OPT_TYPE_RATIONAL
,
AV_OPT_TYPE_BINARY
,
///< offset must point to a pointer immediately followed by an int for the length
AV_OPT_TYPE_CONST
=
128
,
AV_OPT_TYPE_IMAGE_SIZE
=
MKBETAG
(
'S'
,
'I'
,
'Z'
,
'E'
),
///< offset must point to two consecutive integers
#if FF_API_OLD_AVOPTIONS
FF_OPT_TYPE_FLAGS
=
0
,
FF_OPT_TYPE_INT
,
...
...
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