int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags) { AVDictionaryEntry *t = NULL; AVDictionary *tmp = NULL; int ret = 0; if (!options) return 0; while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { ret = av_opt_set(obj, t->key, t->value, search_flags); if (ret == AVERROR_OPTION_NOT_FOUND) ret = av_dict_set(&tmp, t->key, t->value, 0); if (ret < 0) { av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value); av_dict_free(&tmp); return ret; } ret = 0; } av_dict_free(options); *options = tmp; return ret; }
时间: 2024-04-02 22:34:22 浏览: 59
这是一个函数定义,它的作用是将 AVDictionary 类型的 options 中的所有键值对设置到 obj 对象中。函数内部通过 av_dict_get 函数遍历 options 中的所有键值对,然后通过 av_opt_set 函数将键值对设置到 obj 对象中。如果 av_opt_set 函数返回 AVERROR_OPTION_NOT_FOUND,则说明 obj 对象中不存在该选项,此时将该键值对添加到临时的 AVDictionary 对象 tmp 中。如果 av_opt_set 函数返回其他错误,则说明设置选项失败,函数返回错误码。最后,函数释放 options 对象并将 tmp 对象赋值给 options 对象。函数返回 0 表示设置选项成功。
阅读全文
相关推荐
















