您的位置:首页 > 理论基础 > 数据结构算法

ffmpeg数据结构之AVDictionary

2014-10-16 11:10 106 查看
一:AVDictionary的定义:

struct AVDictionary {
int count;
AVDictionaryEntry *elems;
};


AVDictionaryEntry的定义:
typedef struct AVDictionaryEntry {
char *key;
char *value;
} AVDictionaryEntry;


作用:简单的键值对存储。
AVDictionary *d = NULL; // "create" an empty dictionary
AVDictionaryEntry *t = NULL;
av_dict_set(&d, "foo", "bar", 0); // add an entry
char *k = av_strdup("key"); // if your strings are already allocated,
char *v = av_strdup("value"); // you can avoid copying them like this
av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
<....> // iterate over all entries in d
}
av_dict_free(&d);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ffmpeg