private async Task <IList <CaptureProfile> > getCaptureProfiles(VideoDevice mediaDevice) { var videoDevice = this.media .GetVideoCaptureDevices() .Where(dev => dev.Id == mediaDevice.Id && dev.Name == mediaDevice.Name) .Single(); var capabilities = await videoDevice.GetVideoCaptureCapabilities(); return(capabilities .Select(cap => new CaptureProfile() { Width = cap.Width, Height = cap.Height, FrameRate = cap.FrameRate, MrcEnabled = cap.MrcEnabled }) .OrderBy(cap => cap.Width * cap.Height) .ThenBy(cap => cap.FrameRate) .ToList()); }
public Task <IList <CaptureProfile> > GetCaptureProfiles(VideoDevice device) { throw new NotImplementedException(); }
/// <summary> /// Set the desired video capture device. /// I.e., webcam, capture card, usb webcam /// </summary> /// <param name="mediaDevice"></param> public void SetSelectedMediaDevice(VideoDevice mediaDevice) { // video device is global for the source this.SelectedDevice = mediaDevice; }
public void SetSelectedMediaDevice(VideoDevice mediaDevice) { this.selectedDevice = mediaDevice; }
/// <summary> /// Returns all available capture profiles for the /// specified device /// </summary> /// <param name="device"></param> /// <returns></returns> public async Task <IList <WebRtcConductor.CaptureProfile> > GetCaptureProfiles(VideoDevice device) { var mediaCapture = new MediaCapture(); var mediaSettings = new MediaCaptureInitializationSettings() { VideoDeviceId = device.Id }; return(await mediaCapture .InitializeAsync(mediaSettings) .AsTask() .ContinueWith(initResult => { if (initResult.Exception != null) { return null; } return mediaCapture .VideoDeviceController .GetAvailableMediaStreamProperties(MediaStreamType.VideoRecord) .Cast <VideoEncodingProperties>() .Select(prop => new CaptureProfile() { Width = prop.Width, Height = prop.Height, FrameRate = prop.FrameRate.Numerator / prop.FrameRate.Denominator, MrcEnabled = true }) .GroupBy(profile => profile.ToString()) .Select(grp => grp.First()) .OrderBy(profile => profile.Width * profile.Height) .ThenBy(profile => profile.FrameRate) .ToList(); })); }