/// <summary> /// 获取所有DeckLink设备信息 /// </summary> /// <returns></returns> public IEnumerable <InDeviceInfo> GetDeckLinkDevices() { var results = new List <InDeviceInfo>(); var deviceInfos = new _InDeviceInfo[5]; try { var deviceInfosPtr = Marshal.UnsafeAddrOfPinnedArrayElement(deviceInfos, 0); for (int i = 0; i < deviceInfos.Length; i++) { deviceInfos[i].Initialize(); } var num = deviceInfos.Length; if (Api.GetDeckLinkDeviceList(deviceInfosPtr, ref num) == FuncResult.Ok) { for (int i = 0; i < num; i++) { results.Add((InDeviceInfo)deviceInfos[i]); } } } finally { for (var i = 0; i < deviceInfos.Length; i++) { deviceInfos[i].Dispose(); } } return(results); }
/// <summary> /// 获取可用多媒体设备列表名称,暂时只支持DShow采集音视频 /// </summary> /// <param name="videoDeviceInfos">视频采集设备信息</param> /// <param name="audioDeviceInfos">音频采集设备信息</param> public void GetFreeDeviceInfos(out IEnumerable <InDeviceInfo> videoDeviceInfos, out IEnumerable <InDeviceInfo> audioDeviceInfos) { var videoDevices = new List <InDeviceInfo>(); var audioDevices = new List <InDeviceInfo>(); videoDeviceInfos = videoDevices; audioDeviceInfos = audioDevices; var videoDeviceNum = 0; var audioDeviceNum = 0; if (Api.GetFreeDevicesNum(out videoDeviceNum, out audioDeviceNum) == FuncResult.Error) { return; } if (videoDeviceNum == 0 && audioDeviceNum == 0) { return; } var videoInfos = new _InDeviceInfo[videoDeviceNum]; var audioInfos = new _InDeviceInfo[audioDeviceNum]; try { var videoInfosPtr = Marshal.UnsafeAddrOfPinnedArrayElement(videoInfos, 0); var audioInfosPtr = Marshal.UnsafeAddrOfPinnedArrayElement(audioInfos, 0); for (var i = 0; i < videoInfos.Length; i++) { videoInfos[i].Initialize(); } for (var i = 0; i < audioInfos.Length; i++) { audioInfos[i].Initialize(); } if (Api.GetFreeDeviceInfos(videoInfosPtr, videoDeviceNum, audioInfosPtr, audioDeviceNum) == FuncResult.Ok) { for (var i = 0; i < videoInfos.Length; i++) { videoDevices.Add((InDeviceInfo)videoInfos[i]); } for (var i = 0; i < audioInfos.Length; i++) { audioDevices.Add((InDeviceInfo)audioInfos[i]); } } } finally { for (var i = 0; i < videoInfos.Length; i++) { videoInfos[i].Dispose(); } for (var i = 0; i < audioInfos.Length; i++) { audioInfos[i].Dispose(); } } }
internal static extern FuncResult GetCamereCaptureInfo(ref _InDeviceInfo camera, [Out] IntPtr captureParams, ref int num);