通过DirectX / C#访问视频捕获卡

编程入门 行业动态 更新时间:2024-10-13 16:15:50
本文介绍了通过DirectX / C#访问视频捕获卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好,

我一直在使用DirectX从我们的视频 Capture卡中流式传输视频一段时间没有问题。 我们使用的卡片带有4个单独的芯片,因此设备管理器中存在4个单独的实例,每个实例代表一个摄像头。

I have been using DirectX to stream video from our VideoCapturecards for a while now with no issue. The cards we have been using come with 4separatechips, so 4separateinstances existing in the device manager, each instance representing a single camera.

我们最近切换到新卡,在设备管理器中有一个芯片和一个实例(Conexant,如果重要的话)。 我只能从连接到卡上的第一台相机进行流式传输(我需要能够同时传输所有四个相机)。 我附上我的代码用于连接到卡并访问第一台摄像机,任何帮助都会非常值得赞赏。 传入的SystemID是卡片的Monicker字符串,在这种情况下,它是:"@ device:pnp:\\?\\\ pci#ven_14f1& dev_8200& subsys_001014f1& rev_00#4& 1b89d1f& ; 0& 00e0#{65e8773d-8f56-11d0-a3b9-00a0c9223196} \ {9b365890-165f-11d0-a195-0020afd156e4}"

We have recently switched to new cards, with one chip and one instance in the device manager (Conexant if it matters). I am only able to stream from the first camera attached to the card (i need to be able to stream all four at once). I've attached my code for connecting to the card and accessing the first camera, any help would be GREATLYappreciated. The SystemID that is being passed in is the Monicker string of the card, in the case, it's: "@device:pnp:\\?\pci#ven_14f1&dev_8200&subsys_001014f1&rev_00#4&1b89d1f&0&00e0#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{9b365890-165f-11d0-a195-0020afd156e4}"

public void OpenCamera(string SystemID) { CloseCamera(); Guid cat; Guid med; int hr; const int WS_CHILD = 0x40000000; const int WS_CLIPCHILDREN = 0x02000000; const int WS_CLIPSIBLINGS = 0x04000000; graphBuilder = (IGraphBuilder)Activator.CreateInstance(Type.GetTypeFromCLSID(Clsid.FilterGraph, true)); Guid clsid = Clsid.CaptureGraphBuilder2; Guid riid = typeof(ICaptureGraphBuilder2).GUID; captureGraphBuilder = (ICaptureGraphBuilder2)DsBugWO.CreateDsInstance(ref clsid, ref riid); if (captureGraphBuilder.SetFiltergraph(graphBuilder) == 0) { videoDeviceFilter = (IBaseFilter)Marshal.BindToMoniker(SystemID); if (graphBuilder.AddFilter(videoDeviceFilter, "Video Capture Device") == 0) { object o; cat = PinCategory.Preview; med = MediaType.Interleaved; Guid iid = typeof(IAMStreamConfig).GUID; hr = captureGraphBuilder.FindInterface(ref cat, ref med, videoDeviceFilter, ref iid, out o); if (hr != 0) { cat = PinCategory.Preview; med = MediaType.Video; hr = captureGraphBuilder.FindInterface(ref cat, ref med, videoDeviceFilter, ref iid, out o); if (hr != 0) o = null; } videoStreamConfig = o as IAMStreamConfig; mediaControl = (IMediaControl)graphBuilder; cat = PinCategory.Preview; med = MediaType.Video; if (captureGraphBuilder.RenderStream(ref cat, ref med, videoDeviceFilter, null, null) >= 0) { videoWindow = (IVideoWindow)graphBuilder; if (videoWindow.put_Owner(pnlCamWindow.Handle) >= 0) { if (videoWindow.put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS) >= 0) { OnResize(null); if (videoWindow.put_Visible(DsHlp.OATRUE) >= 0) { mediaControl.Run(); btnCardProperties.Enabled = true; } } } } } } }

我很乐意澄清一下是否有任何意义。 提前致谢。

I'll be happy to clarify if anything doesn't quite make sense. Thanks in advance.

推荐答案

Hi Malevento ,

感谢您的帖子。

根据对于你的问题,我认为DirectX论坛对你更好,因为在这个领域有更多经验丰富的专家。请尝试使用DirectX论坛: forums.create.msdn/forums/?GroupID = 7

很抱歉给您带来不便。

有美好的一天。

更多推荐

通过DirectX / C#访问视频捕获卡

本文发布于:2023-11-07 23:36:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567737.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视频   DirectX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!