美文网首页
FFmpeg-iOS

FFmpeg-iOS

作者: 万年老参 | 来源:发表于2024-04-07 13:49 被阅读0次

AVDictionary参数配置,初始化和使用:

//av_opt_set可以直接给AVFormatContext设置参数:av_opt_set(oc‐>priv_data, "movflags", "faststart", 0); /* 直接设置容器对象的参数 */
int a = AV_DICT_MATCH_CASE
  AVFormatContext  *formatContext = NULL;
  AVDictionary     *opts          = NULL;
  av_dict_set(&opts, "timeout", "2000000", a);//设置超时2秒
  formatContext = avformat_alloc_context();
  avformat_open_input(&formatContext, fileChar, NULL, &opts)
...
...
//检索:
  AVDictionaryEntry *t = NULL
  t = av_dict_get(opts, "timeout", NULL, 0)
  av_log(NULL, AV_LOG_DEBUG, "timeOut:%s",t->Value)


  av_dict_free(&opts); //释放

av_dict_get()和av_dict_set()函数都有一个flags参数(最后一个参数),可选值:

AV_DICT_MATCH_CASE:匹配大小写
AV_DICT_IGNORE_SUFFIX:匹配时忽略后缀)
AV_DICT_DONT_STRDUP_KEY:不对key进行拷贝
AV_DICT_DONT_STRDUP_VAL:不对value进行拷贝
AV_DICT_DONT_OVERWRITE:不覆盖现有条目
AV_DICT_APPEND:如果目已经存在,则value值直接拼接到之前的值的后面。
AV_DICT_MULTIKEY:允许在字典中存储相等的key。

相关文章

网友评论

      本文标题:FFmpeg-iOS

      本文链接:https://www.haomeiwen.com/subject/gcjmwdtx.html