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
c3ecd968
Commit
c3ecd968
authored
Feb 15, 2014
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AVOptions: add flags for read/read-only options
parent
6bb8720f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
5 deletions
+26
-5
APIchanges
doc/APIchanges
+4
-0
opt.c
libavutil/opt.c
+11
-3
opt.h
libavutil/opt.h
+9
-0
version.h
libavutil/version.h
+2
-2
No files found.
doc/APIchanges
View file @
c3ecd968
...
...
@@ -13,6 +13,10 @@ libavutil: 2013-12-xx
API changes, most recent first:
2014-xx-xx - xxxxxxx - lavu 53.04.0 - opt.h
Add AV_OPT_FLAG_EXPORT and AV_OPT_FLAG_READONLY to mark options meant (only)
for reading.
2014-xx-xx - xxxxxxx - lavu 53.03.01 - opt.h
Deprecate unused AV_OPT_FLAG_METADATA.
...
...
libavutil/opt.c
View file @
c3ecd968
...
...
@@ -213,7 +213,7 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
const
AVOption
*
o
=
av_opt_find2
(
obj
,
name
,
NULL
,
0
,
search_flags
,
&
target_obj
);
if
(
!
o
||
!
target_obj
)
return
AVERROR_OPTION_NOT_FOUND
;
if
(
!
val
)
if
(
!
val
||
o
->
flags
&
AV_OPT_FLAG_READONLY
)
return
AVERROR
(
EINVAL
);
dst
=
((
uint8_t
*
)
target_obj
)
+
o
->
offset
;
...
...
@@ -235,7 +235,7 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
#define OPT_EVAL_NUMBER(name, opttype, vartype)\
int av_opt_eval_ ## name(void *obj, const AVOption *o, const char *val, vartype *name ## _out)\
{\
if (!o || o->type != opttype)\
if (!o || o->type != opttype
|| o->flags & AV_OPT_FLAG_READONLY
)\
return AVERROR(EINVAL);\
return set_string_number(obj, obj, o, val, name ## _out);\
}
...
...
@@ -256,6 +256,9 @@ static int set_number(void *obj, const char *name, double num, int den, int64_t
if
(
!
o
||
!
target_obj
)
return
AVERROR_OPTION_NOT_FOUND
;
if
(
o
->
flags
&
AV_OPT_FLAG_READONLY
)
return
AVERROR
(
EINVAL
);
dst
=
((
uint8_t
*
)
target_obj
)
+
o
->
offset
;
return
write_number
(
obj
,
o
,
dst
,
num
,
den
,
intnum
);
}
...
...
@@ -286,7 +289,7 @@ int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int
if
(
!
o
||
!
target_obj
)
return
AVERROR_OPTION_NOT_FOUND
;
if
(
o
->
type
!=
AV_OPT_TYPE_BINARY
)
if
(
o
->
type
!=
AV_OPT_TYPE_BINARY
||
o
->
flags
&
AV_OPT_FLAG_READONLY
)
return
AVERROR
(
EINVAL
);
ptr
=
av_malloc
(
len
);
...
...
@@ -479,6 +482,8 @@ static void opt_list(void *obj, void *av_log_obj, const char *unit,
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%c"
,
(
opt
->
flags
&
AV_OPT_FLAG_VIDEO_PARAM
)
?
'V'
:
'.'
);
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%c"
,
(
opt
->
flags
&
AV_OPT_FLAG_AUDIO_PARAM
)
?
'A'
:
'.'
);
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%c"
,
(
opt
->
flags
&
AV_OPT_FLAG_SUBTITLE_PARAM
)
?
'S'
:
'.'
);
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%c"
,
(
opt
->
flags
&
AV_OPT_FLAG_EXPORT
)
?
'X'
:
'.'
);
av_log
(
av_log_obj
,
AV_LOG_INFO
,
"%c"
,
(
opt
->
flags
&
AV_OPT_FLAG_READONLY
)
?
'R'
:
'.'
);
if
(
opt
->
help
)
av_log
(
av_log_obj
,
AV_LOG_INFO
,
" %s"
,
opt
->
help
);
...
...
@@ -505,6 +510,9 @@ void av_opt_set_defaults(void *s)
{
const
AVOption
*
opt
=
NULL
;
while
((
opt
=
av_opt_next
(
s
,
opt
))
!=
NULL
)
{
if
(
opt
->
flags
&
AV_OPT_FLAG_READONLY
)
continue
;
switch
(
opt
->
type
)
{
case
AV_OPT_TYPE_CONST
:
/* Nothing to be done here */
...
...
libavutil/opt.h
View file @
c3ecd968
...
...
@@ -268,6 +268,15 @@ typedef struct AVOption {
#define AV_OPT_FLAG_AUDIO_PARAM 8
#define AV_OPT_FLAG_VIDEO_PARAM 16
#define AV_OPT_FLAG_SUBTITLE_PARAM 32
/**
* The option is inteded for exporting values to the caller.
*/
#define AV_OPT_FLAG_EXPORT 64
/**
* The option may not be set through the AVOptions API, only read.
* This flag only makes sense when AV_OPT_FLAG_EXPORT is also set.
*/
#define AV_OPT_FLAG_READONLY 128
//FIXME think about enc-audio, ... style flags
/**
...
...
libavutil/version.h
View file @
c3ecd968
...
...
@@ -54,8 +54,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 53
#define LIBAVUTIL_VERSION_MINOR
3
#define LIBAVUTIL_VERSION_MICRO
1
#define LIBAVUTIL_VERSION_MINOR
4
#define LIBAVUTIL_VERSION_MICRO
0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
...
...
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