Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
dca055be
Commit
dca055be
authored
Aug 23, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AVOptions: add functions for evaluating option strings.
parent
059a037f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
opt.c
libavutil/opt.c
+15
-0
opt.h
libavutil/opt.h
+24
-0
No files found.
libavutil/opt.c
View file @
dca055be
...
@@ -239,6 +239,21 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
...
@@ -239,6 +239,21 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
#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)\
return AVERROR(EINVAL);\
return set_string_number(obj, o, val, name ## _out);\
}
OPT_EVAL_NUMBER
(
flags
,
FF_OPT_TYPE_FLAGS
,
int
)
OPT_EVAL_NUMBER
(
int
,
FF_OPT_TYPE_INT
,
int
)
OPT_EVAL_NUMBER
(
int64
,
FF_OPT_TYPE_INT64
,
int64_t
)
OPT_EVAL_NUMBER
(
float
,
FF_OPT_TYPE_FLOAT
,
float
)
OPT_EVAL_NUMBER
(
double
,
FF_OPT_TYPE_DOUBLE
,
double
)
OPT_EVAL_NUMBER
(
q
,
FF_OPT_TYPE_RATIONAL
,
AVRational
)
static
int
set_number
(
void
*
obj
,
const
char
*
name
,
double
num
,
int
den
,
int64_t
intnum
,
static
int
set_number
(
void
*
obj
,
const
char
*
name
,
double
num
,
int
den
,
int64_t
intnum
,
int
search_flags
)
int
search_flags
)
{
{
...
...
libavutil/opt.h
View file @
dca055be
...
@@ -226,6 +226,30 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
...
@@ -226,6 +226,30 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
*/
*/
int
av_opt_set_dict
(
void
*
obj
,
struct
AVDictionary
**
options
);
int
av_opt_set_dict
(
void
*
obj
,
struct
AVDictionary
**
options
);
/**
* @defgroup opt_eval_funcs Evaluating option strings
* @{
* This group of functions can be used to evaluate option strings
* and get numbers out of them. They do the same thing as av_opt_set(),
* except the result is written into the caller-supplied pointer.
*
* @param obj a struct whose first element is a pointer to AVClass.
* @param o an option for which the string is to be evaluated.
* @param val string to be evaluated.
* @param *_out value of the string will be written here.
*
* @return 0 on success, a negative number on failure.
*/
int
av_opt_eval_flags
(
void
*
obj
,
const
AVOption
*
o
,
const
char
*
val
,
int
*
flags_out
);
int
av_opt_eval_int
(
void
*
obj
,
const
AVOption
*
o
,
const
char
*
val
,
int
*
int_out
);
int
av_opt_eval_int64
(
void
*
obj
,
const
AVOption
*
o
,
const
char
*
val
,
int64_t
*
int64_out
);
int
av_opt_eval_float
(
void
*
obj
,
const
AVOption
*
o
,
const
char
*
val
,
float
*
float_out
);
int
av_opt_eval_double
(
void
*
obj
,
const
AVOption
*
o
,
const
char
*
val
,
double
*
double_out
);
int
av_opt_eval_q
(
void
*
obj
,
const
AVOption
*
o
,
const
char
*
val
,
AVRational
*
q_out
);
/**
* @}
*/
#define AV_OPT_SEARCH_CHILDREN 0x0001
/**< Search in possible children of the
#define AV_OPT_SEARCH_CHILDREN 0x0001
/**< Search in possible children of the
given object first. */
given object first. */
/**
/**
...
...
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