我正在尝试使用 c++ 中的 gstreamer 1.0 在 Windows 上查询可用视频捕获设备(网络摄像头)的列表。
我使用 ksvideosrc 作为源,我能够捕获视频输入,但我无法查询可用设备(及其上限)的列表。
在 gstreamer 0.10 上,它可以通过 GstPropertyProbe 实现,它在 gstreamer 1.0 中被移除。该文档建议使用 GstDeviceMonitor。但我也没有运气使用它。
有没有人成功获取到设备名称列表?或者您能否建议另一种检索可用设备名称及其上限的方法?
最佳答案
您可以使用 GstDeviceMonitor
和 gst_device_monitor_get_devices ()
函数。
首先通过gst_device_monitor_new()
初始化GstDeviceMonitor
。
第二次通过 gst_device_monitor_start(pMonitor)
启动监视器。
第三,通过gst_device_monitor_get_devices(pMonitor)
获取设备列表。
代码是这样的:
GstDeviceMonitor* monitor= gst_device_monitor_new();
if(!gst_device_monitor_start(monitor)){
printf("WARNING: Monitor couldn't started!!\n");
}
GList* devices = gst_device_monitor_get_devices(monitor);
关于c++ - 列出可用于 gstreamer 1.0 中的 ksvideosrc 视频捕获的设备名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30440134/