问题描述
我抬头看望文件,发现一个非常方便的AVInputFormat
的功能get_device_list
。但是问题是我不能使用它。
这是我的简短代码段
#include <QDebug>
extern "C"
{
#include <libavformat/avformat.h>
#include <libavdevice/avdevice.h>
}
int main(int argc,char *argv[])
{
avdevice_register_all();
AVFormatContext *formatContext = avformat_alloc_context();
AVInputFormat *inputFormat = av_find_input_format("dshow");
AVDeviceInfoList devices;
inputFormat->get_device_list(formatContext,&devices);
qDebug() << devices.nb_devices;
avformat_free_context(formatContext);
return 0;
}
当我尝试打印devices
时,该代码 CRASHES 。如何正确使用该功能?官方的用法没有使用该功能的示例。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)