如何解决LibAV FFMPEG如何获取设备列表?
我抬头看望文件,发现一个非常方便的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 举报,一经查实,本站将立刻删除。