【问题标题】:How Do I get list of audio/video and capture devices in C#?如何在 C# 中获取音频/视频和捕获设备列表?
【发布时间】:2012-07-26 03:39:24
【问题描述】:

在过去的两周里,我一直在到处寻找,甚至试图获得有关如何执行此操作的提示。这是我第一次询问,当我说我不喜欢寻求帮助时请相信我。

但我已经走到了尽头,我所能找到的只是如何在 C# 中使用别人的框架列出可用的音频和视频设备。我要做的就是列出从 C# 中连接到一台计算机的可用音频和视频设备,而无需任何额外的 3rd 方框架。

如果有人能提供帮助,我将不胜感激。就像我说的,我已经走到了尽头,想弄清楚如何做到这一点。

谢谢!

【问题讨论】:

    标签: c# audio video webcam capture


    【解决方案1】:

    试试 aForge.net http://www.aforgenet.com/ 这样做非常简单,或者如果对你来说足够的话,你可以使用他们现成的对话框。

    【讨论】:

      【解决方案2】:

      在搜索"C# get video capture devices" 之后。我最终阅读了这两篇 CodeProject 文章:

      您会看到其中涉及很多 COM 互操作。从它的声音来看,我不确定你是否准备好直接投入其中,因为这可能是很多乏味的工作。我会考虑使用现有的东西,而不是重新发明轮子。毕竟他们都在public domain

      此外,StackOverflow 上有这篇文章,其中有一些有趣的链接:

      【讨论】:

        【解决方案3】:
                /// <summary>
                /// The DirectSoundEnumerate function enumerates the DirectSound Odrivers installed in the system.
                /// </summary>
                /// <param name="lpDSEnumCallback">callback function</param>
                /// <param name="lpContext">User context</param>
                [DllImport("dsound.dll", EntryPoint = "DirectSoundEnumerateA", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
                static extern void DirectSoundEnumerate(DevicesEnumCallback lpDSEnumCallback, IntPtr lpContext);
        
        
                /// <summary>
                /// The DirectSoundEnumerate function enumerates the DirectSound Input drivers installed in the system.
                /// </summary>
                /// <param name="lpDSEnumCallback">callback function</param>
                /// <param name="lpContext">User context</param>
                [DllImport("dsound.dll", EntryPoint = "DirectSoundCaptureEnumerateA", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)]
                static extern void DirectSoundCaptureEnumerate(DevicesEnumCallback lpDSEnumCallback, IntPtr lpContext);
        

        【讨论】:

        • @jam:这里没什么好解释的。这些是过时的纯音频 API 的 P/Invoke 声明。它并没有真正回答原始问题。
        猜你喜欢
        • 1970-01-01
        • 2011-09-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-02-09
        • 2011-05-16
        • 2011-05-16
        • 2015-12-26
        相关资源
        最近更新 更多