Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
7e83e1c5
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7e83e1c5
编写于
5月 22, 2011
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
AVOptions: add av_opt_set_dict() mapping a dictionary struct to a context.
This way the caller can pass all the options in one nice package.
上级
0b7ccad6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
39 addition
and
0 deletion
+39
-0
libavutil/opt.c
libavutil/opt.c
+22
-0
libavutil/opt.h
libavutil/opt.h
+17
-0
未找到文件。
libavutil/opt.c
浏览文件 @
7e83e1c5
...
...
@@ -29,6 +29,7 @@
#include "avstring.h"
#include "opt.h"
#include "eval.h"
#include "dict.h"
//FIXME order them and do a bin search
const
AVOption
*
av_find_opt
(
void
*
v
,
const
char
*
name
,
const
char
*
unit
,
int
mask
,
int
flags
)
...
...
@@ -538,6 +539,27 @@ void av_opt_free(void *obj)
av_freep
((
uint8_t
*
)
obj
+
o
->
offset
);
}
int
av_opt_set_dict
(
void
*
obj
,
AVDictionary
**
options
)
{
AVDictionaryEntry
*
t
=
NULL
;
AVDictionary
*
tmp
=
NULL
;
int
ret
=
0
;
while
((
t
=
av_dict_get
(
*
options
,
""
,
t
,
AV_DICT_IGNORE_SUFFIX
)))
{
ret
=
av_set_string3
(
obj
,
t
->
key
,
t
->
value
,
1
,
NULL
);
if
(
ret
==
AVERROR_OPTION_NOT_FOUND
)
av_dict_set
(
&
tmp
,
t
->
key
,
t
->
value
,
0
);
else
if
(
ret
<
0
)
{
av_log
(
obj
,
AV_LOG_ERROR
,
"Error setting option %s to value %s.
\n
"
,
t
->
key
,
t
->
value
);
break
;
}
ret
=
0
;
}
av_dict_free
(
options
);
*
options
=
tmp
;
return
ret
;
}
#ifdef TEST
#undef printf
...
...
libavutil/opt.h
浏览文件 @
7e83e1c5
...
...
@@ -29,6 +29,7 @@
#include "rational.h"
#include "avutil.h"
#include "dict.h"
enum
AVOptionType
{
FF_OPT_TYPE_FLAGS
,
...
...
@@ -191,4 +192,20 @@ void av_opt_free(void *obj);
*/
int
av_opt_flag_is_set
(
void
*
obj
,
const
char
*
field_name
,
const
char
*
flag_name
);
/*
* Set all the options from a given dictionary on an object.
*
* @param obj a struct whose first element is a pointer to AVClass
* @param options options to process. This dictionary will be freed and replaced
* by a new one containing all options not found in obj.
* Of course this new dictionary needs to be freed by caller
* with av_dict_free().
*
* @return 0 on success, a negative AVERROR if some option was found in obj,
* but could not be set.
*
* @see av_dict_copy()
*/
int
av_opt_set_dict
(
void
*
obj
,
struct
AVDictionary
**
options
);
#endif
/* AVUTIL_OPT_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录