AVDictionary
Simple key:value store.
Detailed Description
Dictionaries are used for storing key:value pairs. To create an AVDictionary, simply pass an address of a NULL pointer to av_dict_set(). NULL can be used as an empty dictionary wherever a pointer to an AVDictionary is required. Use av_dict_get() to retrieve an entry or iterate over all entries and finally av_dict_free() to free the dictionary and all its contents.
AVDictionary *d = NULL; // "create" an empty dictionary
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);
AVDictionaryEntry *t = NULL;
while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
<....> // iterate over all entries in d
}
av_dict_free(&d);
Example
RTSP TCP
ffmpeg -rtsp_transport tcp
명령행 옵션과 동일한 효과를 주기 위해 아래와 같이 적용하면 된다.
AVDictionary *opts = 0;
int ret = av_dict_set(&opts, "rtsp_transport", "tcp", 0);
err = avformat_open_input(&avfContext, filename, NULL, &opts);
av_dict_free(&opts);