ffmpeg AVStream::codec被聲明為已否決
阿新 • • 發佈:2017-11-18
ffmpeg avstream::codec 被聲明為已否決
嚴重性 代碼 說明 項目 文件 行 禁止顯示狀態
錯誤 C4996 ‘AVStream::codec‘: 被聲明為已否決
雖然足夠的簡單,但是還是報了”被聲明為已否決”的error
在網上搜索到了解決方案:將VS的SDL檢查關閉
AVStream的codec成員不再推薦使用,而是要求使用codecpar。
從而我們知道FFmpeg中所謂的“被聲明為已否決”就是因為函數或者結構體屬性被標示為attribute_deprecated,很有可能在未來的版本中就刪除了。
所以我們最好的解決方案就是使用新的被推薦使用的函數、結構體等。
在後續中因為要解決avformat_find_stream_info探測流慢的問題,會針對codecpar進行相應的賦值
之前的版本
pCodecCtx = pFormatCtx->streams[videoIndex]->codec;
之後的版本
pCodecCtx = avcodec_alloc_context3(NULL);
if (pCodecCtx == NULL)
{
printf("Could not allocate AVCodecContext\n");
return -1;
}
avcodec_parameters_to_context(pCodecCtx, pFormatCtx->streams[videoIndex]->codecpar);
參考
http://blog.csdn.net/x_iya/article/details/52395990
ffmpeg AVStream::codec被聲明為已否決