avformat_find_stream_info()函数体有 600 行左右的代码,我们拆开来看,一些不太重要的部分,这里就直接跳过了。 avformat_find_stream_info()函数源码解析 我们从这两个循环开始: for(i=0;i<ic->nb_streams;i++){constAVCodec*codec;AVDictionary*thread_opt=NULL;st=ic->streams[i];avctx=st->internal->...
这两个循环我们可以先跳过,原因是如果在avformat_open_input()之后第一次调用avformat_find_stream_info(),此时还没有 stream 的信息,所以ic->nb_streams为 0(nb_streams是 stream 的个数),进不去循环体,所以我们可以直接跳过,不影响理解。 接下来这个看着像’死循环’的 for-loop,就是我们重点的分析对象了,...