0
我一直在檢測音頻和視頻設備,並構建捕獲圖,但在最後一個過濾器中,我無法渲染它們兩個。如何在C#中使用DirectShowNet呈現視頻和音頻文件?
DsDevice dev = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)[0];
hr = m_FilterGraph.AddSourceFilterForMoniker(dev.Mon, null, dev.Name, out capFilter);
Marshal.ThrowExceptionForHR(hr);
DsDevice audioDv = DsDevice.GetDevicesOfCat(FilterCategory.AudioInputDevice)[0];
hr = m_FilterGraph.AddSourceFilterForMoniker(audioDv.Mon, null, audioDv.Name, out audioFilter);
Marshal.ThrowExceptionForHR(hr);
asfWriter = ConfigAsf(capGraph, szOutputFileName);
hr = capGraph.RenderStream(null, MediaType.Audio, audioFilter, null, asfWriter);
Marshal.ThrowExceptionForHR(hr);
hr = capGraph.RenderStream(null, MediaType.Video, capFilter, null, asfWriter);
Marshal.ThrowExceptionForHR(hr);
這是我嘗試的一段代碼,我應該選擇其他的MediaType嗎?