通过ffmpeg 读取摄像头数据, 当设备移除后, 读取数据不阻塞设置:
infmtCtx->flags |= AVFMT_FLAG_NONBLOCK; // 加上既可.
if (avformat_open_input(&infmtCtx, dshow_name, fmt, &options) != 0) {
avformat_free_context(infmtCtx);
return -1;
}
通过ffmpeg 读取摄像头数据, 当设备移除后, 读取数据不阻塞设置:
infmtCtx->flags |= AVFMT_FLAG_NONBLOCK; // 加上既可.
if (avformat_open_input(&infmtCtx, dshow_name, fmt, &options) != 0) {
avformat_free_context(infmtCtx);
return -1;
}